[go: up one dir, main page]

CN111367915B - Method and device for operating block chain data - Google Patents

Method and device for operating block chain data Download PDF

Info

Publication number
CN111367915B
CN111367915B CN202010144327.1A CN202010144327A CN111367915B CN 111367915 B CN111367915 B CN 111367915B CN 202010144327 A CN202010144327 A CN 202010144327A CN 111367915 B CN111367915 B CN 111367915B
Authority
CN
China
Prior art keywords
page
index
data record
data
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010144327.1A
Other languages
Chinese (zh)
Other versions
CN111367915A (en
Inventor
尹强文
莫楠
石翔
贺双洪
李辉忠
张开翔
范瑞彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN202010144327.1A priority Critical patent/CN111367915B/en
Publication of CN111367915A publication Critical patent/CN111367915A/en
Application granted granted Critical
Publication of CN111367915B publication Critical patent/CN111367915B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/03Credit; Loans; Processing thereof

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Development Economics (AREA)
  • General Business, Economics & Management (AREA)
  • Technology Law (AREA)
  • Computing Systems (AREA)
  • Strategic Management (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明公开了一种区块链数据的操作方法及装置,其中方法为:区块链节点获取数据操作指令;所述数据操作指令包括具有目标主键的第一数据记录;所述区块链节点以多数据页面方式存储键值对形式的数据记录;每个主键对应至少一个键值;所述区块链节点确定所述第一数据记录的待操作页面;所述区块链节点读取所述待操作页面中具有所述目标主键的已有数据记录;所述区块链节点按照所述数据操作指令,对所述已有数据记录进行数据操作。上述方法应用于金融科技(Fintech)时,能极大地增加数据记录的读写性能。

The present invention discloses a method and device for operating blockchain data, wherein the method is as follows: a blockchain node obtains a data operation instruction; the data operation instruction includes a first data record with a target primary key; the blockchain node stores data records in the form of key-value pairs in a multi-data page manner; each primary key corresponds to at least one key value; the blockchain node determines the page to be operated for the first data record; the blockchain node reads an existing data record with the target primary key in the page to be operated; the blockchain node performs data operations on the existing data record according to the data operation instruction. When the above method is applied to Fintech, it can greatly increase the read and write performance of data records.

Description

Method and device for operating block chain data
Technical Field
The present invention relates to the field of blockchain (blockchain) in the field of financial science and technology (Fintech), and more particularly to a method and apparatus for operating blockchain data.
Background
With the development of computer technology, more and more technologies are applied in the financial field, and the traditional financial industry is gradually changed to the financial technology (Fintech), but due to the requirements of safety and real-time performance of the financial industry, the requirements of the technology are also higher. Data in the financial industry is extremely security-critical and is often stored by a blockchain (blockchain).
In the current method, business data of the financial industry is stored in a memory table in the form of key value pairs in a blockchain. One main key of the memory table corresponds to one or more data records, and the key value operation of the main key is performed in an integral mode during reading and writing. When a primary key corresponds to more data records, the read-write efficiency is very low, which is a problem to be solved.
Disclosure of Invention
The invention provides a method and a device for operating blockchain data, which solve the problem of low read-write efficiency when a main key corresponds to more data records in the prior art.
The invention provides an operation method of blockchain data, which comprises the steps that a blockchain link point obtains a data operation instruction, the data operation instruction comprises a first data record with a target main key, the blockchain node stores the data record in a key value pair form in a multi-data page mode, each main key corresponds to at least one key value, the blockchain node determines a page to be operated of the first data record, the blockchain link point reads an existing data record with the target main key in the page to be operated, and the blockchain node performs data operation on the existing data record according to the data operation instruction.
According to the method, the blockchain node stores data records in the form of key value pairs in a multi-data page mode, each primary key corresponds to at least one key value, after the blockchain node acquires a data operation instruction, the data operation instruction comprises a first data record with a target primary key, all key values of the primary key stored in the multi-data page do not need to be acquired, a page to be operated of the first data record is determined firstly, then the existing data record with the target primary key in the page to be operated is read, and data operation is carried out on the existing data record according to the data operation instruction, so that all key values of the primary key do not need to be acquired, and the read-write performance of the data record can be greatly improved.
In an optional implementation manner, the data operation instruction is a new instruction, the method further comprises the steps that the blockchain node generates target index information of the first data record according to the corresponding relation between a value of a preset object in the first data record and the page to be operated, the blockchain node determines a first index page in an index library, which is reserved for storing the target index information in the index library, according to the value of the preset object in the first data record, and the blockchain node stores the target index information to the index library according to the first index page.
In the method, the blockchain node generates the target index information of the first data record according to the corresponding relation between the value of the preset object in the first data record and the page to be operated, determines the first index page according to the value of the preset object in the first data record, and stores the target index information into the index library, so that the target index information of the first data record is recorded after the first data record is newly added, and the subsequent searching of the first data record can be facilitated.
In an alternative implementation mode, the index information in the index pages is arranged according to the preset sequence according to the value of the preset object, the blockchain node stores the target index information in the index library according to the first index page, the blockchain node determines the page position ready to store the first index page according to the value of the preset object, if the page position ready to store the first index page is the middle part of the first index page and the first index page is full, the blockchain node splits the first index page into a second index page and a third index page from the middle part of the first index page, the blockchain node stores the index information before the middle part of the first index page and the target index information in the second index page, and the blockchain node stores the index information after the middle part of the first index page in the third index page.
In the above method, after determining the page position of the first index page to be stored according to the value of the preset object, if the page position of the first index page to be stored is the middle of the first index page and the first index page is full, the blockchain node may be split into the second index page and the third index page without affecting the preset sequence between the index information, so as to open up a space capable of storing the index information again and reconstruct the index page, thereby providing a method for adding the index information without changing the preset sequence between the index information.
In an alternative implementation manner, the index information in the index pages is arranged according to the preset sequence according to the value of the preset object, the blockchain node stores the target index information into the index library according to the first index page, the method comprises the steps that the blockchain node determines the page position ready to store the first index page according to the value of the preset object, and if the page position ready to store the first index page is the head part or the tail part of the first index page and the first index page is full, the blockchain node creates a fourth index page and stores the target index information into the fourth index page.
In the above manner, after determining the page position of the first index page to be stored according to the value of the preset object, if the page position of the first index page to be stored is the head or the tail of the first index page and the first index page is full, the fourth index page can be created under the condition that the preset sequence between the index information is not affected, so that a new space for storing the index information is opened up, and the index page is reconstructed, thereby providing a method for adding the index information in the preset sequence between the index information without changing.
In an alternative implementation manner, the data operation instruction is a new instruction, and the blockchain node performs data operation on the existing data record according to the data operation instruction, and the method comprises the step that the blockchain node adds the first data record to the existing data record according to the existing data record and the first data record, so that the data record of the target main key in the page to be operated is updated.
In the above manner, when the data operation instruction is a new instruction, the blockchain node can add the first data record to the existing data record only by the existing data record and the first data record of the page to be operated without acquiring all key values according to the target main key, so that a method for updating the data record of the target main key in the page to be operated with higher performance is provided.
In an optional implementation manner, the data operation instruction is a modification instruction or a query instruction, the blockchain node determines a page to be operated of the first data record, the method comprises the steps that the blockchain node determines a first index page corresponding to the first data record according to a value of a preset object in the first data record, a plurality of pieces of index information are recorded in the first index page, a corresponding relation between the value of the preset object and the data page is recorded in each piece of index information, the blockchain node determines target index information corresponding to the first data record from the first index page, and the blockchain node determines the page to be operated according to the target index information.
In the above manner, since a plurality of pieces of index information are recorded in the first index page, wherein the corresponding relation between the value of the preset object and the data page is recorded in each piece of index information, and the blockchain node can determine the first index page corresponding to the first data record according to the value of the preset object in the first data record, the blockchain node can quickly find the target index information and the page to be operated, so that all the data pages do not need to be traversed, and the query performance of the data is improved.
In an alternative implementation mode, the data operation instruction is a modification instruction, the modification instruction further comprises a second data record with a target main key, the modification instruction is used for modifying the first data record into the second data record, the existing data record comprises the first data record, the blockchain node performs data operation on the existing data record according to the data operation instruction, and the blockchain node modifies the first data record in the existing data record into the second data record according to the existing data record and the second data record, so that the existing data record of the target main key in the page to be operated is updated.
In the above manner, when the data operation instruction is a modification instruction, the modification instruction further includes a second data record having a target main key, and the modification instruction is used for modifying the first data record into the second data record, and since the existing data record includes the first data record, the first data record in the existing data record can be modified into the second data record only by reading a page to be operated, thereby improving the modification performance of data.
In a second aspect, the invention provides an operating device of blockchain data, which comprises an acquisition module, a processing module and a data operation module, wherein the acquisition module is used for acquiring a data operation instruction, the data operation instruction comprises a first data record with a target main key, the blockchain node stores the data record in a key value pair form in a multi-data page mode, each main key corresponds to at least one key value, the processing module is used for determining a page to be operated of the first data record, and is used for reading an existing data record with the target main key in the page to be operated and performing data operation on the existing data record according to the data operation instruction.
In an alternative implementation manner, the processing module is further configured to generate target index information of the first data record according to a corresponding relationship between a value of a preset object in the first data record and the page to be operated, determine a first index page in an index library, in which the target index information is prepared to be stored, according to the value of the preset object in the first data record, and store the target index information to the index library according to the first index page.
In an alternative implementation manner, the index information in the index pages is arranged according to a preset sequence according to the value of the preset object, the processing module is specifically configured to determine a page position to be stored in the first index page according to the value of the preset object, split the first index page into a second index page and a third index page from the middle of the first index page if the page position to be stored in the first index page is the middle of the first index page and the first index page is full, store index information before the middle of the first index page and the target index information to the second index page, and store index information after the middle of the first index page to the third index page.
In an optional implementation manner, the index information in the index pages is arranged according to the preset sequence according to the value of the preset object, the processing module is specifically configured to determine a page position to be stored in the first index page according to the value of the preset object, and if the page position to be stored in the first index page is the head or the tail of the first index page and the first index page is full, create a fourth index page and store the target index information to the fourth index page.
In an optional implementation manner, the data operation instruction is a new instruction, and the processing module is specifically configured to add the first data record to the existing data record according to the existing data record and the first data record, so as to update the data record of the target main key in the page to be operated.
In an optional implementation manner, the data operation instruction is a modification instruction or a query instruction, and the processing module is specifically configured to determine a first index page corresponding to the first data record according to a value of a preset object in the first data record, record a plurality of pieces of index information in the first index page, record a corresponding relation between the value of the preset object and the data page in each piece of index information, determine target index information corresponding to the first data record from the first index page, and determine the page to be operated according to the target index information.
In an alternative implementation mode, the data operation instruction is a modification instruction, the modification instruction further comprises a second data record with a target main key, the modification instruction is used for modifying the first data record into the second data record, the existing data record comprises the first data record, and the processing module is specifically used for modifying the first data record in the existing data record into the second data record according to the existing data record and the second data record, so that the existing data record of the target main key in the page to be operated is updated.
The advantages of the second aspect and the second aspect may be referred to the advantages of the first aspect and the first aspect, and will not be described here again.
In a third aspect, the present invention provides a computer device comprising a program or instructions which, when executed, is operable to perform the above-described first aspect and the respective alternative methods of the first aspect.
In a fourth aspect, the present invention provides a storage medium comprising a program or instructions which, when executed, is adapted to carry out the above-described first aspect and the respective alternative methods of the first aspect.
Drawings
FIG. 1 is a flowchart illustrating a method of operating blockchain data according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an index library according to an embodiment of the present application;
Fig. 3 is a schematic structural diagram of an operating device for blockchain data according to an embodiment of the present application.
Detailed Description
In order to better understand the above technical solutions, the following detailed description will be made with reference to the accompanying drawings and specific embodiments of the present application, and it should be understood that specific features in the embodiments and examples of the present application are detailed descriptions of the technical solutions of the present application, and not limiting the technical solutions of the present application, and the technical features in the embodiments and examples of the present application may be combined with each other without conflict.
And the mapping from the main key of the distributed storage (ADVANCED MASS Database, AMDB) to the corresponding entry in the storage table can be added, deleted and checked based on the main key of the AMDB, and the condition screening is supported.
And the data record corresponds to one row in the storage table, each row takes a column name as a key, and the corresponding value is taken as a key value to form a key value pair (KV) structure. Each data record has its own AMDB key, and different data records are allowed to have the same AMDB key.
And the data record group is used for storing the data records with the same main key. The primary key of the ambb is different from the primary key in the conventional database, and the ambb primary key is used for indicating which primary key the data record belongs to, and the data records of the same primary key are stored in the same data record group.
Screening conditions, namely, a censoring and checking interface in a storage table supports the incoming screening conditions, and the three interfaces return the result after screening according to the conditions. If the screening conditions are empty, no screening is performed.
As shown in Table 1, the above-mentioned terms are explained by taking a material registry taken by a staff of a certain company as an example.
Name (Main key) Data record number Data record name
Alice (Alice) 1001001 Notebook computer
Alice (Alice) 1001002 Display device
Bob (Bob) 1002001 Notebook computer
Cris (Kerisi) 1003001 Desk computer
TABLE 1
Specifically, the name is a primary key of the distributed storage. One data record for each behavior in table 1. There are a total of 4 data records, each storing data in key-value pairs. The 4 data were recorded as follows:
data record 1 { name: alice, data record number: 1001001, data record name: notebook };
data record 2 { name: alice, data record number: 1001002, data record name: display };
data record 3 { name: bob, data record number: 1002001, data record name: notebook };
data record 4 { name: kris, data record number: 1003001, data record name: desktop }.
The storage table stores 3 data record group objects by taking names as main keys. Alice's 2 records are stored in the 1 st data record group, bob's 1 record is stored in the 2 nd data record group, and kris's one record is stored in the 3 rd data record group. When the query interface of the storage list class is called, the query interface needs to specify a main key and a screening condition in the distributed storage, the main key of the queried distributed storage is set as alice, and the screening condition is that the condition number=1001001, and the data record 1 can be queried.
During operation of a financial institution (banking, insurance or securities institution) in performing a business (e.g., loan, deposit, etc. of a bank), data is often stored at blockchain nodes by storing tables. The memory table is read and written in a whole mode to operate the key value of the main key. When the data record corresponding to one main key is more, the reading and writing efficiency is very low. This situation does not meet the requirements of financial institutions such as banks, and cannot guarantee efficient operation of various businesses of the financial institutions.
To this end, as shown in fig. 1, the present application provides a method of operating blockchain data.
And step 101, obtaining a data operation instruction by the block link point, wherein the data operation instruction comprises a first data record with a target main key.
Step 102, the blockchain node determines a page to be operated of the first data record.
And 103, reading the existing data record with the target main key in the page to be operated by the block chain link point.
And 104, the blockchain node performs data operation on the existing data record according to the data operation instruction.
It should be noted that in the steps 101 to 104, the blockchain node stores the data record in the form of key value pairs in a multi-data page manner, and each primary key corresponds to at least one key value. The space for storing the data records for each data page may be set to be the same, e.g., 5 rows per page, and 5 data records can be stored.
For example, as shown in tables 2-1 and 2-2, the data records with the same primary key (Ming) are stored in pages of 9 data records with the primary key Ming, and each data page stores 5 rows of data records. Wherein, table 2-1 shows data page one of the small names, and table 2-2 shows data page two of the small names.
Name of name Asset numbering Asset type Price of
Xiaoming (Ming) 1 Watch with a watch body 100k
Xiaoming (Ming) 2 Sports car 1000k
Xiaoming (Ming) 3 Sea Jing Fang 60m
Xiaoming (Ming) 4 High-rise building 80m
Xiaoming (Ming) 5 Shop(s) 200m
TABLE 2-1
Name of name Asset numbering Asset type Price of
Xiaoming (Ming) 6 Apartment house 100m
Xiaoming (Ming) 7 Securities 600m
Xiaoming (Ming) 8 Safety device 100k
Xiaoming (Ming) 9 Yacht 200m
TABLE 2-2
When the instruction to be operated is a new instruction, the page to be operated can be a randomly designated data page, or the last page of the data page can be directly defaulted as the page to be operated. The append rule of the data record may be: ordering the data pages with small brightness according to the first data page with small brightness and the second data page with small brightness. Append at the end of the data page of the last page of the small, for example, increment the data record with the asset number 10, there is directly the last two rows of the data page of the small. In addition, the total number of pages of the small data pages can be recorded in the first page, for example, the total number of pages is recorded as 2 in the first page. If the data records with the asset numbers of 10 and 11 are added, a new data page of less bright data page three can be created, and the total number of pages of 3 recorded in the less bright data page one is updated. Therefore, in the best case, the write operation only needs to update the data page where the data record is located, and needs to write 1 page, and in the worst case, the write operation needs to create a new page, needs to write 2 data pages, the newly created data page and the first data page. It can be seen that when the page is only stored as the data record of one main key, the total page number of the first page record can be rapidly positioned to the data page to be operated.
In an alternative embodiment, the blockchain in steps 101 to 104 may add index information of the data record when the data record is newly added, so that the page to be operated may be quickly and conveniently located when the data record is modified, queried and deleted later. The method can be concretely as follows:
The method comprises the steps that a block chain node generates target index information of a first data record according to a corresponding relation between a value of a preset object in the first data record and a page to be operated, the block chain node determines a first index page in an index library, in which the target index information is reserved, according to the value of the preset object in the first data record, and the block chain node stores the target index information to the index library according to the first index page.
For example, the preset object is a preset column name, such as the prices in tables 2-1 and 2-2, and the corresponding relationship between the value of the preset object in the first data record and the page to be operated is that the price is 40K, the data page 10, i.e. the data record with the price of 40K is stored in the data page 10. It should be noted that there may be a plurality of data records of price 40K, or may be stored in a plurality of data pages, and there may be a correspondence between one price and a plurality of data pages, for example, price 40K, data page 10, price 40K, and data page 11.
The index information is uniformly stored in an index library, the index library is provided with a plurality of index pages for storing the index information, and the index page where each piece of index information is stored can also be determined according to the value of a preset object. The storage rule of the specific index information can be flexibly set according to the scene, for example, the specific index information can be sequentially stored according to the value sequence of the preset object, the index information with the storage price of 0-80K is set in the first index page, and the index information with the storage price of 80-100K is set in the second index page. Then the first index page into which the generated target index information is prepared is index page one when the price of the first data record is 40K. Then, when the page to be operated of the first data record needs to be queried, the price 40K knows that the first index information is queried to the index page, and the page to be operated of the first data record is found.
It should be noted that the data structure of the index library may be various, for example, the index library may use a b+ tree to store the index information. The leaf nodes of the b+ tree are index pages for storing index information, and the non-leaf nodes (root pages in two layers) are used for indexing the stored index pages, and the specific structure can be shown in fig. 2. It should be noted that the structure of the 2-layer b+ tree shown in fig. 2 is merely illustrative, and the b+ tree may be any layer in practice.
The root node stores the index of the index page, as shown in Table 3-1, for example.
TABLE 3-1
And the index information stored in the index page may be as shown in table 3-2.
Price of Data page number
10K 4
20K 1
30K 3
42K 3
60K 2
TABLE 3-2
It should be noted that the value size of the preset object and the size of the data page number are not necessarily positively correlated, which is related to the storage mechanism of the data page, and if the mechanism is added according to the tail, the data record which is added first is stored first, and the more front the stored data page is.
In the above alternative embodiment, the index information in the index page may be arranged in a preset order according to the value of the preset object. The above blockchain node determines the page position to be stored in the first index page according to the value of the preset object, and the following steps can be specifically divided into the following cases:
First, write to the first index page, and the first index page is not full.
The first index page is directly updated and 1 page is written.
Second, write to the middle of the first index page, and the first index page is full.
If the page position of the first index page to be stored is the middle part of the first index page and the first index page is full, the blockchain node splits the first index page into a second index page and a third index page from the middle part of the first index page.
The block link point stores the index information before the middle part of the first index page and the target index information to the second index page, and the block link point stores the index information after the middle part of the first index page to the third index page. For example, taking the index page as 1000 rows, the first index page is 1000 rows, and the row number of the target index information to be stored is 751 th row. Then the front 750 rows of the second index page just after splitting stores the front 750 rows of index information of the original first index page, the back 250 rows are empty, the target index information is stored in the 751 th row of the second index page, the front 250 rows of the third index page stores index information, and the back 750 rows are empty. The target index information may be stored in the 1 st line of the third index page, and the 2 nd line to 251 nd line of the third index page stores the 1 st line to 250 nd line of the original first index page. And updating the root page simultaneously, and writing 3 pages in total.
More specifically, as shown in table 4-1, the range of the index information stored in the first index page is the index information with the preset object value between 0k and 100k, and 1000 lines are already stored.
TABLE 4-1
For example, the value of the preset object of the newly added target index information is 80K, and obviously, 80K is between 0K and 100K, so that the 0K to 100K needs to be split into a second index page for storing 0K to 80K and a third index page for storing 80K to 100K. The index of the first index page in the root page is also divided into 2 parts. The root page is shown in Table 4-2.
Start value Termination value Index page
0 80K Second index page
80K 100K Third index page
TABLE 4-2
The divided second index page and third index page are shown in tables 4-3 and 4-4, respectively:
the second index page is shown in Table 4-3:
TABLE 4-3
The third index page is shown in tables 4-4:
Tables 4 to 4
Third, write to the head or tail of the first index page and the first index page is full.
The blockchain node creates a fourth index page and stores the target index information to the fourth index page. And updating the root page simultaneously, and writing 2 pages in total. The specific procedure can be deduced from the second case, and will not be described in detail here.
It should be noted that in step 101 to step 104, the data operation instruction may be a new instruction, a query instruction, or a modification instruction.
In an alternative embodiment of step 103, the data operation instruction is a modification instruction or a query instruction, and step 103 may be performed in the following manner:
the block chain node determines a first index page corresponding to the first data record according to a value of a preset object in the first data record, determines target index information corresponding to the first data record from the first index page, and determines the page to be operated according to the target index information.
For example, the value of the preset object in the first data record is 40K, and the index information stored in the first index page is 0K to 80K, so that it is known that the first data record corresponds to the first index page. Then, the target index information corresponding to 40K is found in the first index page, and at this time, the target index information may be one index information corresponding to one data page, the data page is a page to be operated, the target index information may also be a plurality of index information, and then, according to the first data record, the page to be operated where the first data record is located is found in the plurality of data pages.
And the first index page records a plurality of pieces of index information, wherein each piece of index information records the corresponding relation between the value of the preset object and the data page.
In an alternative embodiment of step 104, the data manipulation instruction is a new instruction, then step 104 may be performed as follows:
And the blockchain node adds the first data record to the existing data record according to the existing data record and the first data record, so as to update the data record of the target main key in the page to be operated.
The specific update operation may be similar to the operation in the index page, creating a new data page when the data page is full.
In another alternative embodiment of step 104, the data operation instruction is a modification instruction, the modification instruction further includes a second data record having a target primary key, the modification instruction is used to modify the first data record into the second data record, the existing data record includes the first data record, and step 104 may specifically be performed in the following manner:
and the blockchain node modifies the first data record in the existing data records into the second data record according to the existing data records and the second data record, so that the existing data records of the target main key in the page to be operated are updated.
As shown in FIG. 3, the invention provides an operating device for blockchain data, which comprises an acquisition module 301 for acquiring a data operation instruction, wherein the data operation instruction comprises a first data record with a target main key, the blockchain node stores the data record in the form of key value pairs in a multi-data page mode, each main key corresponds to at least one key value, a processing module 302 for determining a page to be operated of the first data record, reading an existing data record with the target main key in the page to be operated, and performing data operation on the existing data record according to the data operation instruction.
In an alternative implementation manner, the processing module 302 is further configured to generate target index information of the first data record according to a corresponding relationship between a value of a preset object in the first data record and the page to be operated, determine a first index page in an index library, where the target index information is prepared to be stored, according to the value of the preset object in the first data record, and store the target index information to the index library according to the first index page.
In an alternative implementation manner, the index information in the index pages is arranged according to a preset sequence according to the value of the preset object, the processing module 302 is specifically configured to determine a page position to be stored in the first index page according to the value of the preset object, split the first index page into a second index page and a third index page from the middle of the first index page if the page position to be stored in the first index page is the middle of the first index page and the first index page is full, store index information before the middle of the first index page and the target index information to the second index page, and store index information after the middle of the first index page to the third index page.
In an alternative implementation manner, the index information in the index pages is arranged according to the preset sequence according to the value of the preset object, the processing module 302 is specifically configured to determine a page position to be stored in the first index page according to the value of the preset object, and if the page position to be stored in the first index page is the head or the tail of the first index page and the first index page is full, create a fourth index page and store the target index information to the fourth index page.
In an alternative implementation manner, the data operation instruction is a new instruction, and the processing module 302 is specifically configured to add the first data record to the existing data record according to the existing data record and the first data record, so as to update the data record of the target primary key in the page to be operated.
In an optional implementation manner, the data operation instruction is a modification instruction or a query instruction, and the processing module 302 is specifically configured to determine a first index page corresponding to the first data record according to a value of a preset object in the first data record, record a plurality of pieces of index information in the first index page, record a corresponding relationship between the value of the preset object and the data page in each piece of index information, determine target index information corresponding to the first data record from the first index page, and determine the page to be operated according to the target index information.
In an alternative implementation manner, the data operation instruction is a modification instruction, the modification instruction further comprises a second data record with a target main key, the modification instruction is used for modifying the first data record into the second data record, the existing data record comprises the first data record, and the processing module 302 is specifically used for modifying the first data record in the existing data record into the second data record according to the existing data record and the second data record, so that the existing data record of the target main key in the page to be operated is updated.
The embodiment of the application provides a computer device, which comprises a program or an instruction, and the program or the instruction are used for executing the operation method and any optional method of the blockchain data provided by the embodiment of the application when being executed.
The embodiment of the application provides a storage medium, which comprises a program or an instruction, and when the program or the instruction is executed, the program or the instruction is used for executing the operation method and any optional method of the blockchain data provided by the embodiment of the application.
Finally, it should be noted that those skilled in the art will appreciate that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (9)

1. A method of operating blockchain data, comprising:
the method comprises the steps of obtaining a data operation instruction by a block chain node, wherein the data operation instruction comprises a first data record with a target main key, and storing the data record in a key value pair form by the block chain node in a multi-data page mode;
The blockchain node determines a page to be operated of the first data record;
The block link point reads the existing data record with the target main key in the page to be operated;
the blockchain node performs data operation on the existing data record according to the data operation instruction;
The data operation instruction is a new instruction, and the method further comprises the following steps:
The blockchain node generates target index information of the first data record according to the corresponding relation between the value of a preset object in the first data record and the page to be operated, wherein the preset object is a preset column name;
The blockchain node determines a first index page which is reserved in an index library by the target index information according to the value of the preset object in the first data record;
And the blockchain node stores the target index information to the index library according to the first index page.
2. The method of claim 1, wherein the index information in the index pages is arranged in a predetermined order according to the value of the predetermined object, wherein the blockchain node storing the target index information to the index library according to the first index page comprises:
The blockchain node determines the page position of the first index page to be stored according to the value of the preset object;
If the page position of the first index page to be stored is the middle part of the first index page and the first index page is full, splitting the first index page into a second index page and a third index page by the block chain node from the middle part of the first index page;
The block link point stores the index information before the middle part of the first index page and the target index information to the second index page, and the block link point stores the index information after the middle part of the first index page to the third index page.
3. The method of claim 1, wherein the index information in the index pages is arranged in a predetermined order according to the value of the predetermined object, wherein the blockchain node storing the target index information to the index library according to the first index page comprises:
The blockchain node determines the page position of the first index page to be stored according to the value of the preset object;
if the page position ready to be stored in the first index page is the head or the tail of the first index page and the first index page is full, the blockchain node creates a fourth index page and stores the target index information into the fourth index page.
4. The method of any of claims 1-3, wherein the data manipulation instruction is a new instruction, wherein the blockchain node performs a data manipulation on the existing data record according to the data manipulation instruction, comprising:
And the blockchain node adds the first data record to the existing data record according to the existing data record and the first data record, so as to update the data record of the target main key in the page to be operated.
5. The method of any of claims 1-3, wherein the data manipulation instruction is a modify instruction or a query instruction, wherein the blockchain node determines a page to be manipulated of the first data record, comprising:
The block chain node determines a first index page corresponding to the first data record according to the value of a preset object in the first data record, wherein a plurality of pieces of index information are recorded in the first index page, and the corresponding relation between the value of the preset object and the data page is recorded in each piece of index information;
The blockchain node determines target index information corresponding to the first data record from the first index page;
And the blockchain node determines the page to be operated according to the target index information.
6. The method of any of claims 1-3, wherein the data manipulation instruction is a modification instruction, wherein the modification instruction further comprises a second data record having a target primary key, wherein the modification instruction is to modify the first data record to the second data record, wherein the existing data record comprises the first data record, and wherein the blockchain node performs a data manipulation on the existing data record in accordance with the data manipulation instruction, comprising:
and the blockchain node modifies the first data record in the existing data records into the second data record according to the existing data records and the second data record, so that the existing data records of the target main key in the page to be operated are updated.
7. An apparatus for manipulating blockchain data, comprising:
The system comprises an acquisition module, a block chain node, a data processing module and a data processing module, wherein the acquisition module is used for acquiring a data operation instruction, the data operation instruction comprises a first data record with a target main key, and the block chain node stores the data record in a key value pair form in a multi-data page mode;
The processing module is used for determining a page to be operated of the first data record, reading an existing data record with the target main key in the page to be operated, and carrying out data operation on the existing data record according to the data operation instruction;
the processing module is also used for generating target index information of the first data record according to the corresponding relation between the value of a preset object in the first data record and the page to be operated, wherein the preset object is a preset column name;
Determining a first index page of the target index information, which is reserved in an index library, according to the value of the preset object in the first data record;
and storing the target index information to the index library according to the first index page.
8. A computer device comprising a program or instructions which, when executed, performs the method of any of claims 1 to 6.
9. A storage medium comprising a program or instructions which, when executed, perform the method of any one of claims 1 to 6.
CN202010144327.1A 2020-03-04 2020-03-04 Method and device for operating block chain data Active CN111367915B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010144327.1A CN111367915B (en) 2020-03-04 2020-03-04 Method and device for operating block chain data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010144327.1A CN111367915B (en) 2020-03-04 2020-03-04 Method and device for operating block chain data

Publications (2)

Publication Number Publication Date
CN111367915A CN111367915A (en) 2020-07-03
CN111367915B true CN111367915B (en) 2025-01-17

Family

ID=71208439

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010144327.1A Active CN111367915B (en) 2020-03-04 2020-03-04 Method and device for operating block chain data

Country Status (1)

Country Link
CN (1) CN111367915B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110162540A (en) * 2019-04-17 2019-08-23 平安科技(深圳)有限公司 Querying method, electronic device and the storage medium of block chain account book data

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7941451B1 (en) * 2006-08-18 2011-05-10 Unisys Corporation Dynamic preconditioning of a B+ tree
KR101549220B1 (en) * 2013-10-15 2015-09-03 네이버 주식회사 Method and System for Managing Database, and Tree Structure for Database
US11269839B2 (en) * 2018-06-05 2022-03-08 Oracle International Corporation Authenticated key-value stores supporting partial state
CN110275884B (en) * 2019-05-31 2020-08-04 阿里巴巴集团控股有限公司 Data storage method and node

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110162540A (en) * 2019-04-17 2019-08-23 平安科技(深圳)有限公司 Querying method, electronic device and the storage medium of block chain account book data

Also Published As

Publication number Publication date
CN111367915A (en) 2020-07-03

Similar Documents

Publication Publication Date Title
US20220342875A1 (en) Data preparation context navigation
US11169978B2 (en) Distributed pipeline optimization for data preparation
US10255108B2 (en) Parallel execution of blockchain transactions
US11461304B2 (en) Signature-based cache optimization for data preparation
CN105956166A (en) Database reading-writing method and database reading-writing apparatus
CN110704438B (en) Method and device for generating bloom filter in blockchain
US10642815B2 (en) Step editor for data preparation
EP3362808B1 (en) Cache optimization for data preparation
CN107391544A (en) Processing method, device, equipment and the computer storage media of column data storage
CN104461384B (en) A kind of method for writing data and storage device
CN105260139B (en) A kind of disk management method and system
CN107609011A (en) The maintaining method and device of a kind of data-base recording
WO2021027612A1 (en) Method and apparatus for executing transaction in blockchain
CN107402982A (en) Data write-in, data matching method, device and computing device
US20200278980A1 (en) Database processing apparatus, group map file generating method, and recording medium
CN111367915B (en) Method and device for operating block chain data
US9128823B1 (en) Synthetic data generation for backups of block-based storage
US10725877B2 (en) System, method and computer program product for performing a data protection operation
CN105447043B (en) Database and its data access method
WO2015129109A1 (en) Index management device
US20140351298A1 (en) Method and apparatus for distributed processing of file
US20230409235A1 (en) File system improvements for zoned storage device operations
US20210056090A1 (en) Cache optimization for data preparation
CN105302495B (en) Date storage method and device
CN114265781B (en) Method for Performance Verification of Cockroach Database System Storage Engine

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant