A power grid model data caching system and method based on LeveDB technology

By using a LevelDB-based power grid model data caching system, the problem of high-concurrency read and write pressure in power grid dispatch automation systems by traditional relational databases has been solved, achieving efficient data access and querying, and improving the storage and query efficiency of power grid model data.

CN117992492BActive Publication Date: 2025-11-28NARI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311738229.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-18
Publication Date
2025-11-28
Estimated Expiration
2043-12-18

AI Technical Summary

Technical Problem

In the new generation of power grid dispatch automation system, the physical model data of primary power grid equipment is mainly stored in traditional relational databases, which leads to huge high-concurrency read and write pressure on single-machine databases and reduced efficiency.

Method used

The power grid model data caching system, based on LevelDB technology, realizes a C/S architecture-based power grid model data caching by creating and managing column family modules, data modeling modules, and data query modules for power grid model data. It expands the query capabilities of LevelDB, provides two-dimensional table row and column data querying, and realizes data storage and querying by dividing the data into index column family modules with indexed columns.

Benefits of technology

It improves the access efficiency of power grid model data, reduces the pressure on traditional single-machine databases, lowers disk I/O and CPU load, realizes data read-write separation, and improves overall data efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117992492B_ABST
    Figure CN117992492B_ABST
Patent Text Reader

Abstract

The application discloses a power grid model data caching system and method based on LeveDB technology and belongs to the technical field of NOSQL databases.The system comprises a column family creating module used for enabling a client to request a server to create a column family, a data modeling module used for enabling the client to model data table structure information and power grid model row and column data into K-V data through data modeling and then request the server to write the K-V data into the column family, and a data query module used for extending a query engine for the K-V data stored in the column family based on a LevelDB interface, thereby providing a query for two-dimensional table row and column data on the basis of supporting original K-V data query.The application enables the application layer to smoothly migrate based on the query service of the traditional relational database by extending the relational database query engine for the stored K-V data to realize the fast query for the power grid model data in the form of the two-dimensional table.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to a power grid model data caching system and method based on LevelDB technology, in particular to a power grid primary equipment physical model data storage system and method based on LevelDB in a power grid dispatching automation system, and belongs to the technical field of NOSQL databases. BACKGROUND

[0002] LevelDB is an embedded, persistent and efficient K-V database storage engine. LevelDB adopts a storage structure based on a log tree LSM (Log Structure Merge Tree), which stores data in multiple levels according to the order of keys, and each level is called a Level. When data is written into LevelDB, it is first written into an active memory table (Active MemTable) in the memory, and when the data size of the memory table reaches the set threshold, it is converted into an immutable memory table (Immutable Memtable). Subsequently, a background thread flushes the read-only memory table into a disk file SSTable (Sorted Strings Table) and adds it to the Level-0 layer in the disk. With the writing operation, the disk file SSTable in the Level-0 layer is reorganized into higher Level-1 to Level-n layers through a merge sorting algorithm, which maintains the order of data and compresses and combines data to release more storage space. The data query process of LevelDB is also very efficient. When a key value needs to be found, LevelDB first searches the memory table MemTable, and if it is found, it is directly returned. If it is not found, it is searched from the Level-0 layer in the disk layer by layer upwards until the corresponding key value is found or all layers are traversed without finding the corresponding key value.

[0003] At present, in a new generation of power grid dispatching automation system, power grid primary equipment physical model data (hereinafter referred to as power grid model data) is mainly stored in a traditional relational database, and various upper application scenarios (such as data synchronization, data maintenance, data management, state estimation, power grid transient analysis, power grid steady-state analysis, online security analysis, etc.) need to frequently read and write power grid model data, and a single machine database faces huge high-concurrency read-write pressure, thereby reducing efficiency. SUMMARY

[0004] The purpose of the application is to provide a power grid model data caching system and method based on LevelDB technology, which solves the problem of low efficiency caused by the huge high-concurrency read-write pressure faced by a single machine database.

[0005] Technical solution: The LevelDB-based power grid model data caching system has the characteristics that it comprises:

[0006] A column family creating module is configured to create a column family for a client.

[0007] A data modeling module is configured to model data table structure information and power grid model row and column data into K-V data through data modeling and then request a server to write the K-V data into a column family.

[0008] A data query module is configured to extend a query engine based on LevelDB interface for K-V data stored in a column family, and provide two-dimensional table row and column data query on the basis of original K-V data query.

[0009] The LevelDB-based power grid model data caching system is realized based on C / S architecture, comprising a client used as an adaptation layer to realize external data storage and query interface, a server used as a service layer to realize column family management and provide basic K-V data read-write function, and a public column family and model table column family encapsulating LevelDB used as a K-V data storage layer, wherein the model table column family internally comprises a primary index column family and a series of secondary index column families. A single LevelDB is extended into a column family, and the column family defines column family name, column family storage location, column family creation interface / destroying interface, column family opening / closing interface, column family iterator, etc. A column family stores a class of data, the K-V caching client realizes external data storage and query interface, the K-V caching server realizes column family management and provides basic K-V data read-write function, and the column family realizes K-V data storage.

[0010] Further, the column family creating module comprises a public column family unit, a primary index column family unit and a secondary index column family unit.

[0011] The public column family unit is configured to request the server to create a public column family, and the column family constructor of the server creates the public column family and registers the public column family with a column family management center after the creation. The primary index column family unit is configured to send a request for creating a model table column family to the server, and the column family constructor of the server creates the primary index column family according to the model table name through an OpenTable interface and registers the primary index column family with the column family management center after the creation. The secondary index column family unit is configured to request the server to create a secondary index column family for a power grid model table when a secondary index is needed, and register the secondary index column family with the column family management center after the creation. The column family management center is a column family resource pool, and controls registration, opening and automatic closing and resource recycling of the column family.

[0012] The column family builder creates a completed column family in an open state and registers a memory address to the column family management center. The column family reader requests the column family management center to open the column family corresponding to the table name. If the column family is in an open state, the column family management center directly returns the memory address of the column family. If the column family is in a closed state, the column family manager reopens the column family and registers the memory address, and then returns the memory address to the column family reader. The column family reader can read and write the K-V data stored in the column family.

[0013] Further, the data modeling module comprises a K-V metadata unit, a K-V primary index data unit and a K-V secondary index data unit.

[0014] The K-V metadata unit is that the client requests the server to write the K-V data of the data model table structure information into the public column family through the column family reader after modeling the data model table structure information into K-V data through metadata modeling.

[0015] When writing the metadata, the data model table structure information is modeled into column family structure K-V data, wherein K represents the data table name, and V represents the model table column family structure metadata, including the table name, the primary key, the owned column, the data type of the column, the storage structure for describing the primary index of the model table, and the storage structure for describing the secondary index of the model table. Subsequently, the client submits the modeled K-V data to the K-V server for writing. The column family reader first requests the memory address of the public column family from the column family management center, and writes the model table column family structure K-V data into the metadata column family.

[0016] When writing the primary index data, the row data of the power grid model table is encoded into K-V data through primary key index modeling, wherein K represents the keyword, and V is the content of the whole row. Subsequently, the client submits the K-V data to the server. The column family reader of the server first requests the memory address of the model table primary index column family from the column family management center, and writes the K-V data into the primary index column family.

[0017] When writing secondary index data, the columns used as indexes in the power grid model table are coded into K-V data through secondary index modeling, wherein K is a keyword representing the binding combination of the index column and the primary key, and V is empty. Subsequently, the client submits the K-V data to the server, and the column family reader of the server first requests the memory address of the secondary index of the model table from the column family management center and writes the K-V data into the secondary index column family. Because the primary key data is contained in K of the secondary index, each secondary index K-V can locate the primary index K-V associated therewith, and therefore, fast conditional query can be realized through the secondary index.

[0018] Through modeling the power grid model data stored in the traditional relational database into K-V data and writing the K-V data into the cache system, K is used as a unique identifier and is a unique keyword for finding the address of each piece of data, and V is the actual storage content of the data. The client calls the storage interface to create a column family corresponding to the power grid model table for storing the K-V data.

[0019] Further, the data query module comprises a metadata index query unit and a primary index data query unit.

[0020] The metadata index query unit queries the K-V data of the metadata modeling of the model table through the client requesting the server, the column family reader of the server first requests the column family management center to open the public column family, reads the K-V data of the metadata modeling of the model table from the public column family and returns the K-V data to the client, and the client parses the K-V data of the metadata modeling to obtain the model table structure. The primary index data query unit queries the K-V data of the primary index modeling of the model table through the client requesting the server, the column family reader of the server first requests the column family management center to open the primary index column family of the model table, reads the K-V data of the primary index modeling according to the range of K and returns the K-V data to the client, and the client parses the K-V data of the primary index modeling according to the model table structure to obtain a set of row-column two-dimensional data.

[0021] When expanding a new query interface, the input parameters can be SQL query statements or some parameter combinations, and the parameters include the table name, the column name required for this query, the keyword, the keyword range, the filtering condition, the number of returned rows, etc. The output parameter is a row-column two-dimensional data table. The client parses the K-V data of the data modeling to obtain the model table structure, such as the table name, the column name, the data type of the column, the primary key, the secondary index column, etc.

[0022] Further, the data query module can also accelerate the model table data query through a secondary index data query unit.

[0023] The secondary index data query unit queries the K-V data of the secondary index modeling through the client request service, the service receives the query request, the column family reader requests the column family management center to open the model table secondary index column family, reads the K-V data of the secondary index modeling according to the range of the secondary index column, parses the K-V data of the secondary index modeling to obtain a set of only containing the primary key K according to the model table structure, the client requests the service to query the K-V data of the primary index modeling according to the table name and the set of primary keys K, the service receives the query request, requests the column family management center to open the primary index column family, reads the K-V data of the primary index modeling according to the set of primary keys K and returns to the client, and the client parses the K-V data of the primary index modeling to obtain a set of row-column two-dimensional data similar to the traditional relational database form according to the model table structure.

[0024] The LevelDB-based power grid model data caching method has the characteristics that it comprises the following steps:

[0025] (1) The client requests the service to create a column family;

[0026] (2) The client models the data table structure information and the power grid model row and column data into K-V data through data modeling, and then requests the service to write the K-V data into the column family;

[0027] (3) The K-V data stored in the column family is extended with a query engine based on the LevelDB interface, and on the basis of supporting original K-V data query, two-dimensional table row-column data query is provided.

[0028] Further, the step (1) comprises the following specific steps:

[0029] (11) The client requests the service to create a public column family, the column family builder of the service creates the public column family, and registers the column family management center after the creation is completed; the column family management center is a column family resource pool, and simultaneously controls the registration, opening and automatic closing and recycling of the column family resources;

[0030] (12) The client sends a model table column family creation request to the service, and the column family builder of the service creates a primary index column family according to the model table name through an OpenTable interface, and registers the column family management center after the creation is completed;

[0031] (13) When a secondary index needs to be established, the client requests the service to create a secondary index column family for the power grid model table, and registers the column family management center after the creation is completed.

[0032] Further, the step (2) comprises the following specific steps:

[0033] (21) Client requests the server to write the K-V data of the data table structure information modeled by the metadata modeling into the common column family through the column family reader and writer after modeling the data table structure information into the K-V data of the metadata modeling; the column family reader and writer is to request the specified column family resource memory address from the column family management center, read the K-V data stored in the column family through the point reading or iterator mode when reading, and write the K-V data into the column family for storage when writing;

[0034] (22) After storing the metadata, the client requests the server to write the K-V data of the row data of the power grid model table into the primary index column family of the power grid model table through the column family reader and writer after encoding the row data of the power grid model table into the K-V data through the primary index modeling;

[0035] (23) After storing the primary index data, the client requests the server to write the K-V data of the column used as the index in the power grid model table into the secondary index column family of the power grid model table through the column family reader and writer after encoding the column used as the index in the power grid model table into the K-V data through the secondary index modeling.

[0036] Further, the step (3) comprises the following specific steps:

[0037] (31) The client requests the server to query the K-V data of the metadata modeling of the model table, and the column family reader and writer of the server first requests the column family management center to open the common column family, reads the K-V data of the metadata modeling of the model table from the common column family, and returns the K-V data to the client, and the client analyzes the K-V data of the metadata modeling to obtain the model table structure;

[0038] (32) The client requests the server to query the K-V data of the primary index modeling of the model table, and the column family reader and writer of the server first requests the column family management center to open the primary index column family of the model table, reads the K-V data of the primary index modeling according to the range of K, and returns the K-V data to the client, and the client analyzes the K-V data of the primary index modeling according to the model table structure to obtain a group of two-dimensional row and column data.

[0039] Further, the step (32) can also accelerate the model table data query through the secondary index;

[0040] The client requests the server to query K-V data of a secondary index modeling, the server receives the query request, the column family reader requests the column family management center to open a model table secondary index column family, reads K-V data of the secondary index modeling according to the range of the secondary index column, parses the K-V data of the secondary index modeling to obtain a set of only containing primary keys K according to the model table structure, the client requests the server to query K-V data of a primary index modeling according to the table name and the set of primary keys K, the server receives the query request, requests the column family management center to open the primary index column family, reads the K-V data of the primary index modeling according to the set of primary keys K and returns the K-V data to the client, and the client parses the K-V data of the primary index modeling to obtain a set of row-column two-dimensional data similar to a traditional relational database form according to the model table structure.

[0041] Advantages: Compared with the prior art, the application has the following remarkable advantages: 1. providing efficient power grid model data access capability, realizing large-scale power grid model data fast access application scenarios, reducing the pressure of traditional single machine databases, expanding the cache mechanism based on the K-V database, realizing data read-write separation, thereby greatly reducing the pressure of a single relational database and improving the overall data read-write efficiency; 2. maximizing the storage of power grid model structures, power grid model data itself and the relationship between power grid model data; 3. reducing the IO and CPU load of the disk, and providing more accurate and efficient data for computing business. BRIEF DESCRIPTION OF DRAWINGS

[0042] Figure 1 It is a power grid model table data storage architecture diagram of the application;

[0043] Figure 2 It is a power grid model table data query architecture diagram of the application;

[0044] Figure 3 It is a column family storage flowchart of the application;

[0045] Figure 4 It is a power grid model data K-V index format diagram of the application;

[0046] Figure 5 It is a power grid model table metadata K-V storage flowchart of the application;

[0047] Figure 6 It is a power grid model table primary index data K-V storage flowchart of the application;

[0048] Figure 7 It is a power grid model table secondary index data K-V storage flowchart of the application;

[0049] Figure 8 It is a power grid model table data query flowchart of the application;

[0050] Figure 9 The secondary index of the application accelerates the power grid model table data query flow chart. DETAILED DESCRIPTION

[0051] The technical solutions of the application are further described below with reference to the drawings.

[0052] Referring to Figure 1 As shown in the figure, the application proposes a power grid model data caching method based on LevelDB storage. After the client models the relational database inventory data into K-V data, it requests the server to write. The server column family builder first creates the corresponding column family, registers with the column family management center after the creation is completed, and then the column family read-write request column family management center obtains the memory address of the column family and writes the K-V data into the corresponding column family.

[0053] Referring to Figure 2 As shown in the figure, the application realizes an efficient row-column two-dimensional table data query method for K-V data stored in column family. The client query interface requests the server to query specific K-V data according to the input parameters. The input parameters include column family name, model table name, primary key range, secondary index range, etc. After receiving the request, the server requests the column family management center to open the corresponding column family according to the column family name, and then reads the K-V data according to the K access and returns it to the client. The client obtains the corresponding row-column two-dimensional table data by analyzing the K-V data.

[0054] Referring to Figure 3 As shown in the figure, first, create a column family to store the corresponding K-V data of the model table. The client requests the server to create a public column family to separately save the metadata of the model table structure. The server column family builder registers with the column family management center after creating the public column family. Then, the client sends a request to the cache server to create a model table column family. The server's column family builder creates a primary index column family according to the model table name through the OpenTable interface, and registers with the column family management center after the creation is completed. If secondary index needs to be established, the client requests the server to create a secondary index column family for the power grid model table, and registers with the column family management center after the creation is completed.

[0055] Referring to Figure 4 and Figure 5As shown, after the column family is created, the power grid model table metadata index K-V is stored. The client models through the metadata index, encodes the model table structure data into K-V data described in the metadata index format, and then sends it to the server for write operation. After the server receives the K-V data, the column family reader first requests the opening of the public column family from the column family management center. Then the column family management center sends the memory address of the opened public column family to the column family reader, and the column family reader writes the metadata index K-V data into the public column family. After the metadata is written, the client calls the OpenTable interface to request the server to create the model table column family. After the server column family builder receives the request, it will create the model table main index column family according to the table name. If the secondary index name is passed in, it will also create the secondary index column family in turn. After the column family is created, the column family management center is registered.

[0056] Referring to Figure 4 and Figure 6 As shown, after the power grid model table metadata is stored, the power grid model table main index K-V data is stored. The client models through the primary index, encodes the model table row data into K-V data described in the primary index format, and then sends it to the server for write operation. After the server receives the K-V data, the column family reader first requests the opening of the model table main index column family from the column family management center. Then the column family reader writes the primary index K-V data into the main index column family. The write process first writes the K-V data into the log file of the main index column family in an append write manner, and then writes the K-V data into the active memory table MemTable of the main index column family. When the data size of the MemTable reaches the set threshold, the active memory table MemTable is converted into a read-only memory table Immutable MemTable, and a background thread is started to flush the read-only memory table Immutable MemTable into a disk file SSTable, and add it to the Level-0 layer.

[0057] Referring to Figure 4 and Figure 7 As shown, after the power grid model table main index data is stored, the power grid model table secondary index K-V data is finally stored. The storage process is shown in the attached Figure 7 . The client models through the secondary index, encodes the model table single column data into the attached Figure 3The key-value (KV) data described in the secondary index format is sent to the server for writing. After receiving the KV data, the column family reader first requests to open the secondary index column family of the model table from the column family management center. Then, the column family reader writes the secondary index KV data into the secondary index column family of the model table. The writing process first appends the KV data to the log file of the secondary index column family. Then, the KV data is written to the active memory table MemTable in the secondary index column family. When the data size of MemTable reaches the set threshold, the active memory table MemTable is converted into a read-only memory table Immutable MemTable, and a background thread is started to flush the read-only memory table to the disk file SSTable and add it to the Level-0 layer.

[0058] See Figure 8 As shown, the client first requests the server to query the metadata key-value pairs (KV) of the model table based on the table name. The server's column family reader / writer first requests the column family management center to open the public column family, then reads the metadata KV of the model table from the public column family and returns it to the client. The client parses the metadata KV to obtain the model table structure, such as the table name, column names, column data types, primary key, secondary index columns, etc. Subsequently, the client requests the server to query the model table's primary index KV data based on the table name, the range of the primary key K, etc. After receiving the query request, the server's column family reader / writer first requests the column family management center to open the model table's primary index column family, then reads the primary index KV data according to the range of K and returns it to the client. The client parses the primary index KV data according to the model table structure to obtain a set of row and column two-dimensional data similar to that in a traditional relational database.

[0059] See Figure 9 As shown, the client first requests the server to query the metadata key-value pairs of the model table based on the table name. Then, it parses the metadata key-value pairs to obtain the model table structure. Subsequently, the client requests the server to query the secondary index key-value pairs based on the table name, secondary index column names, and the range of the secondary index columns. After receiving the query request, the server's column family reader requests the column family management center to open the model table's secondary index column family. It then reads the secondary index key-value pairs based on the range of the secondary index columns. Based on the model table structure, it parses the secondary index key-value pairs to obtain a set containing only the primary key (K). Next, the client requests the server to query the primary index key-value pairs based on the table name and the set of primary key (K). After receiving the query request, the server requests the primary index column family to be opened from the column family management center. It then reads the primary index key-value pairs based on the set of primary key (K) and returns the data to the client. The client then parses the primary index key-value pairs based on the model table structure to obtain a set of row-column two-dimensional data similar to that in a traditional relational database.

[0060] The principles and implementation manners of the present application are described in detail by using the above specific examples, and the examples are only used to help understand the core technical content of the present application. Based on the above specific examples of the present application, any improvement and modification of the present application made by the person skilled in the art without departing from the principles of the present application shall fall within the patent protection scope of the present application.

Claims

1. A power grid model data caching system based on LevelDB, characterized in that, include: The column family creation module is used by clients to request the server to create column families. The data modeling module is used by the client to model the data model table structure information and the row and column data of the power grid model into KV data and then request the server to write it into the column family. The data query module is used to extend the query engine for key-value data stored in column families based on the LevelDB interface. In addition to supporting the original key-value data query, it provides two-dimensional table row and column data query. The data query module accelerates model table data querying through a secondary index data query unit, including: Read the key-value data of the secondary index model based on the range of the secondary index column, where K is the key, representing the binding combination of the index column and the primary key, and V is empty; The set of primary keys K is obtained by parsing the key-value data modeled by the secondary index; Query the key-value data modeled by the primary index based on the table name and the primary key K, where K represents the key and V is the entire row of data content; Parse the key-value data modeled by the primary index to obtain two-dimensional data in rows and columns.

2. The power grid model data caching system based on LevelDB according to claim 1, characterized in that: The column family creation module includes a common column family unit, a primary index column family unit, and a secondary index column family unit; The common column family unit is created when a client requests the server to create a common column family. The server's column family builder creates the common column family and registers it with the column family management center after creation. The primary index column family is created when a client sends a request to create a model table column family to the server. The server's column family builder creates the primary index column family based on the model table name through the OpenTable interface and registers it with the column family management center after creation. The secondary index column family unit is created when a secondary index needs to be created. The client requests the server to create a secondary index column family for the power grid model table and registers it with the column family management center after creation. The column family management center is a column family resource pool that controls the registration, opening, and automatic closing and recycling of resources for column families.

3. The power grid model data caching system based on LevelDB according to claim 1, characterized in that: The data modeling module includes a KV metadata unit, a KV primary index data unit, and a KV secondary index data unit; The KV metadata unit is created by the client modeling the data model table structure information into KV data using metadata, and then requesting the server to write it into the common column family via a column family reader / writer. The KV primary index data unit is created by the client modeling the power grid model table into KV data using the primary index after storing the metadata, and then requesting the server to write it into the primary index column family of the power grid model table via a column family reader / writer. The KV secondary index data unit is created by the client modeling the power grid model table into KV data using the secondary index after storing the primary index data, and then requesting the server to write it into the secondary index column family of the power grid model table via a column family reader / writer. The column family reader / writer requests a specified column family resource memory address from the column family management center. During read requests, it reads the KV data stored in the column family using point read or iterator methods. During write requests, it writes the KV data into the column family for storage.

4. The power grid model data caching system based on LevelDB according to claim 1, characterized in that: The data query module includes a metadata index query unit and a main index data query unit; The metadata index query unit requests the server from the client to query the key-value data modeled by the metadata of the model table. The column family reader on the server first requests the column family management center to open the public column family, reads the key-value data modeled by the metadata of the model table from the public column family, and returns it to the client. The client parses the data to obtain the model table structure. The main index data query unit requests the server from the client to query the key-value data modeled by the main index of the model table. After receiving the query request, the column family reader on the server first requests the column family management center to open the main index column family of the model table, reads the key-value data modeled by the main index according to the range of K, and returns it to the client. The client parses the data according to the model table structure to obtain a set of row and column two-dimensional data.

5. The power grid model data caching system based on LevelDB according to claim 4, characterized in that: The data query module can also accelerate model table data query through the secondary index data query unit; The secondary index data query unit requests the server from the client to query the key-value data modeled by the secondary index. After receiving the query request, the column family reader requests the column family management center to open the secondary index column family of the model table, reads the key-value data modeled by the secondary index according to the range of the secondary index column, and parses the data according to the model table structure to obtain a set containing only the primary key K. The client requests the server to query the key-value data modeled by the primary index according to the table name and the set of primary key K. After receiving the query request, the server requests the primary index column family to be opened from the column family management center, reads the key-value data modeled by the primary index according to the set of primary key K, and returns it to the client. The client parses the key-value data modeled by the primary index according to the model table structure to obtain a set of row and column two-dimensional data.

6. A method for caching power grid model data based on LevelDB, characterized in that: Includes the following steps: (1) The client requests the server to create a column family; (2) The client models the data model table structure information and the power grid model row and column data into KV data through data modeling and then requests the server to write it into the column family; (3) Based on the LevelDB interface, extend the query engine for KV data stored in the column family, and provide two-dimensional table row and column data query on the basis of supporting the original KV data query; Step (3) includes the following specific steps: (31) The client requests the server to query the KV data of the metadata modeling of the model table. The server's column family reader first requests the column family management center to open the public column family, reads the KV data of the metadata modeling of the model table from the public column family and returns it to the client. The client parses the KV data of the metadata modeling to obtain the model table structure. (32) The client requests the server to query the KV data modeled by the main index of the model table. After the server receives the query request, the column family reader first requests the column family management center to open the column family of the main index of the model table, reads the KV data modeled by the main index according to the range of K and returns it to the client. The client parses the KV data modeled by the main index according to the structure of the model table and obtains a set of row and column two-dimensional data. Step (32) can also accelerate the query of model table data through secondary indexes; The client requests the server to query the key-value data modeled by the secondary index. After receiving the query request, the column family reader requests the column family management center to open the secondary index column family of the model table. Based on the range of the secondary index column, the server reads the key-value data modeled by the secondary index and parses it into a set containing only the primary key K according to the model table structure. The client then requests the server to query the key-value data modeled by the primary index based on the table name and the set of primary key K. After receiving the query request, the server requests the primary index column family to be opened from the column family management center, reads the key-value data modeled by the primary index according to the set of primary key K, and returns it to the client. The client then parses the key-value data modeled by the primary index according to the model table structure to obtain a set of row and column two-dimensional data.

7. The method for caching power grid model data based on LevelDB according to claim 6, characterized in that: Step (1) includes the following specific steps: (11) The client requests the server to create a public column family. The server's column family builder creates the public column family and registers it with the column family management center after creation. The column family management center is a column family resource pool, which controls the registration, opening, and automatic closing and recycling of resources of the column families. (12) The client sends the request to create a model table column family to the server. The server's column family builder creates the main index column family based on the model table name through the OpenTable interface. After creation, it registers with the column family management center. (13) When a secondary index needs to be created, the client requests the server to create a secondary index column family for the power grid model table, and registers it with the column family management center after creation.

8. The method for caching power grid model data based on LevelDB according to claim 6, characterized in that: Step (2) includes the following specific steps: (21) The client models the data model table structure information into metadata modeled KV data and then requests the server to write it into the public column family through the column family reader / writer. The column family reader / writer requests the memory address of the specified column family resource from the column family management center. When making a read request, it reads the KV data stored in the column family through point reading or iterator. When making a write request, it writes the KV data into the column family for storage. (22) After storing the metadata, the client models the power grid model table through the main index, encodes the row data of the power grid model table into KV data, and then requests the server to write the data into the main index column family of the power grid model table through the column family reader. (23) After storing the primary index data, the client models the secondary index, encodes the columns used as indexes in the power grid model table into KV data, and then requests the server to write the secondary index column family of the power grid model table through the column family reader.

Citation Information

Patent Citations

  • Method for realizing row and column mixed storage based on RocksDB

    CN113535729A