CN111782707B - Data query method and system - Google Patents

Data query method and system Download PDF

Info

Publication number
CN111782707B
CN111782707B CN202010565812.6A CN202010565812A CN111782707B CN 111782707 B CN111782707 B CN 111782707B CN 202010565812 A CN202010565812 A CN 202010565812A CN 111782707 B CN111782707 B CN 111782707B
Authority
CN
China
Prior art keywords
data
stored
storage area
value
index
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
CN202010565812.6A
Other languages
Chinese (zh)
Other versions
CN111782707A (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.)
Jingdong Technology Holding Co Ltd
Jingdong Technology Information Technology Co Ltd
Original Assignee
Jingdong Technology Holding Co Ltd
Jingdong Technology Information Technology 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 Jingdong Technology Holding Co Ltd, Jingdong Technology Information Technology Co Ltd filed Critical Jingdong Technology Holding Co Ltd
Priority to CN202010565812.6A priority Critical patent/CN111782707B/en
Publication of CN111782707A publication Critical patent/CN111782707A/en
Application granted granted Critical
Publication of CN111782707B publication Critical patent/CN111782707B/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/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2471Distributed queries
    • 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
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Probability & Statistics with Applications (AREA)
  • Mathematical Physics (AREA)
  • Fuzzy Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a data query method and a data query system, and belongs to the technical field of block chains. The method is applied to a data server in a blockchain, the data server comprises a temporary storage area, the temporary storage area stores index data in a persistent storage area and value data corresponding to at least part of the index data, and the method comprises the following steps: receiving a data query request of a block chain node, wherein the data query request carries target index data of data to be queried; searching the target index data in the temporary storage area; and if the target index data is found and the value data corresponding to the target index data is stored in the temporary storage area, acquiring the value data corresponding to the target index data from the temporary storage area, and sending the value data to the blockchain node. By adopting the technical scheme provided by the embodiment of the application, the problem of low data query efficiency can be solved.

Description

Data query method and system
Technical Field
The present disclosure relates to the field of blockchain technologies, and in particular, to a data query method and system.
Background
In a blockchain, blockchain data may be stored in a database based on a key (index) -value data structure. When the blockchain data needs to be queried, the blockchain node can send a data query request to a data server deployed with a database, wherein the data query request can carry target index data of the blockchain data to be queried. After receiving the data query request, the data server may search the database for value data matching the target index data. If the value data matching the target index data is found, the data server may send the found value data to the block link point.
However, in general, the data server stores the database based on a persistent storage area such as a hard disk, and each time the blockchain node queries blockchain data, the data server needs to query target index data in a large amount of index data contained in the database by accessing the hard disk, which results in low data query efficiency.
Disclosure of Invention
An object of the embodiments of the present application is to provide a data query method and system, so as to solve the problem of low data query efficiency. The specific technical scheme is as follows:
in a first aspect, a data query method is provided, where the method is applied to a data server in a blockchain, where the data server includes a temporary storage area, where the temporary storage area stores index data in a persistent storage area and value data corresponding to at least part of the index data, and the method includes:
Receiving a data query request of a block chain node, wherein the data query request carries target index data of data to be queried;
searching the target index data in the temporary storage area;
and if the target index data is found and the value data corresponding to the target index data is stored in the temporary storage area, acquiring the value data corresponding to the target index data from the temporary storage area, and sending the value data to the blockchain node.
Optionally, the method further comprises:
receiving a data storage request of a block chain node, wherein the data storage request carries index data and value data of data to be stored;
storing the data to be stored in the temporary storage area, and sending a successful storage message to the blockchain node;
and storing index data and value data of the data to be stored in the persistent storage area.
Optionally, the storing the data to be stored in the temporary storage area includes:
acquiring data classification of the data to be stored, wherein the data classification comprises hot spot data or non-hot spot data;
storing index data and value data of the data to be stored in the temporary storage area if the data of the data to be stored is classified as the hot spot data;
And if the data of the data to be stored is classified into the non-hot data, storing index data of the data to be stored in the temporary storage area.
Optionally, the method further comprises:
and if the target index data is found and the value data corresponding to the target index data is not stored in the temporary storage area, acquiring the value data corresponding to the target index data from the persistent storage area, and sending the value data to the blockchain node.
Optionally, the method further comprises:
when the data recovery is required to be carried out on the temporary storage area, a data log acquisition request is sent to the block link point;
receiving a data log sent by the block chain node, wherein index data and value data of stored data are recorded in the data log;
and carrying out data recovery based on the index data and the value data recorded in the data log.
In a second aspect, a data query method is provided, the method being applied to a blockchain node in a blockchain, the method comprising:
responding to data query operation, and acquiring target index data of data to be queried;
inquiring whether the target index data is stored in a data server or not;
And if the target index data is stored in the data server, generating a data query request and sending the data query request to the data server, wherein the data query request carries the target index data of the data to be queried.
Optionally, the querying whether the target index data is stored in the data server includes:
calculating element values corresponding to the target index data through a preset filter to obtain target element values;
searching the target element value in a preset element set, wherein the preset element set comprises a plurality of element values, and the element values are obtained by calculating index data stored in the temporary storage area through the preset filter;
if the target element value is found in the preset element set, determining that the target index data is stored in the data server;
and if the target element value is not found in the preset element set, determining that the target index data is not stored in the data server.
Optionally, the method further comprises:
acquiring index data and value data of data to be stored in response to a data storage operation;
Storing the data to be stored in the blockchain;
and generating a data storage request and sending the data storage request to the data server, wherein the data storage request carries index data and value data of the data to be stored.
Optionally, the storing the data to be stored in the blockchain includes:
acquiring data classification of the data to be stored, wherein the data classification comprises hot spot data or non-hot spot data;
if the data of the data to be stored is classified into the hot spot data, recording index data and value data of the data to be stored in a data log;
and if the data of the data to be stored is classified into the non-hot data, recording index data of the data to be stored in the data log.
Optionally, the method further comprises:
and carrying out de-duplication processing on the same index data contained in the data log to obtain an updated data log.
Optionally, the performing deduplication processing on the same index data contained in the data log to obtain an updated data log includes:
performing data copying on the data log to obtain a data log copy;
Traversing index data contained in the data log copy, and determining the same index data;
and recording the same index data and value data corresponding to the index data stored latest in the same index data in the new data log to obtain an updated data log.
In a third aspect, a data query system is provided, the system comprising a data server as described in any of the first aspects above, a blockchain node as described in any of the second aspects above.
In a fourth aspect, there is provided a data querying device for application to a data server in a blockchain, the data server including a temporary storage area storing index data in a persistent storage area and value data corresponding to at least part of the index data, the device comprising:
the first receiving module is used for receiving a data query request of a block chain node, wherein the data query request carries target index data of data to be queried;
the searching module is used for searching the target index data in the temporary storage area;
the first acquisition module is used for acquiring the value data corresponding to the target index data from the temporary storage area and sending the value data to the blockchain node when the target index data is searched and the value data corresponding to the target index data is stored in the temporary storage area.
Optionally, the apparatus further includes:
the second receiving module is used for receiving a data storage request of the block chain node, wherein the data storage request carries index data and value data of data to be stored;
the first storage module is used for storing the data to be stored in the temporary storage area and sending a successful storage message to the blockchain node;
and the second storage module is used for storing the index data and the value data of the data to be stored in the persistent storage area.
Optionally, the first storage module includes:
the acquisition sub-module is used for acquiring data classification of the data to be stored, wherein the data classification comprises hot spot data or non-hot spot data;
a storage sub-module for storing index data and value data of the data to be stored in the temporary storage area when the data of the data to be stored is classified as the hot spot data;
the storage sub-module is further configured to store index data of the data to be stored in the temporary storage area when the data of the data to be stored is classified as the non-hot spot data.
Optionally, the apparatus further includes:
and the second acquisition module is used for acquiring the value data corresponding to the target index data from the persistent storage area and sending the value data to the blockchain node when the target index data is searched and the value data corresponding to the target index data is not stored in the temporary storage area.
Optionally, the apparatus further includes:
the sending module is used for sending a data log obtaining request to the block link point when the data recovery is required to be carried out on the temporary storage area;
the third receiving module is used for receiving a data log sent by the block chain node, wherein index data and value data of stored data are recorded in the data log;
and the data recovery module is used for carrying out data recovery based on the index data and the value data recorded in the data log.
In a fifth aspect, a data querying device is provided, the device being applied to a blockchain node in a blockchain, the device comprising:
the first acquisition module is used for responding to the data query operation and acquiring target index data of the data to be queried;
the query module is used for querying whether the target index data is stored in the data server or not;
and the first sending module is used for generating a data query request and sending the data query request to the data server when the target index data is stored in the data server, wherein the data query request carries the target index data of the data to be queried.
Optionally, the query module includes:
The calculating sub-module is used for calculating the element value corresponding to the target index data through a preset filter to obtain a target element value;
the searching sub-module is used for searching the target element value in a preset element set, wherein the preset element set comprises a plurality of element values, and the element values are obtained by calculating index data stored in the temporary storage area through the preset filter;
a determining submodule, configured to determine that the target index data is stored in the data server when the target element value is found in the preset element set;
the determining submodule is further used for determining that the target index data is not stored in the data server when the target element value is not found in the preset element set.
Optionally, the apparatus further includes:
the second acquisition module is used for responding to the data storage operation and acquiring index data and value data of the data to be stored;
the storage module is used for storing the data to be stored in the block chain;
and the second sending module is used for generating a data storage request and sending the data storage request to the data server, wherein the data storage request carries index data and value data of the data to be stored.
Optionally, the storage module includes:
the acquisition sub-module is used for acquiring data classification of the data to be stored, wherein the data classification comprises hot spot data or non-hot spot data;
a recording sub-module, configured to record index data and value data of the data to be stored in a data log when the data of the data to be stored is classified as the hotspot data;
the recording sub-module is further configured to record index data of the data to be stored in the data log when the data of the data to be stored is classified as the non-hot spot data.
Optionally, the apparatus further includes:
and the deduplication module is used for performing deduplication processing on the same index data contained in the data log to obtain an updated data log.
Optionally, the deduplication module comprises:
the replication sub-module is used for carrying out data replication on the data log to obtain a data log replica;
the determining submodule is used for traversing the index data contained in the data log copy and determining the same index data;
and the recording sub-module is used for recording the same index data and the value data corresponding to the index data which is stored latest in the same index data in the new data log to obtain the updated data log.
In a sixth aspect, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor configured to implement any of the method steps of the first aspect, or any of the second aspect, when executing a program stored on a memory.
In a seventh aspect, a computer readable storage medium is provided, in which a computer program is stored, which computer program, when being executed by a processor, implements any of the first aspects, or any of the method steps of the second aspect.
In an eighth aspect, there is provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method steps of any of the first aspects, or any of the second aspects, described above.
The beneficial effects of the embodiment of the application are that:
the embodiment of the application provides a data query method and a data query system, wherein the method can be applied to a data server in a blockchain, and the data server comprises a temporary storage area which stores index data in a persistent storage area and value data corresponding to at least part of the index data.
The data server may search the temporary storage area for target index data of the data to be queried after receiving the data query request of the blockchain node. If the target index data is found and the value data corresponding to the target index data is stored in the temporary storage area, the data server can acquire the value data corresponding to the target index data from the temporary storage area and then send the value data to the blockchain node. Because the data server can directly acquire the value data from the temporary storage area when the value data corresponding to the target index data is stored in the temporary storage area, the time consumed for reading the data consumed by acquiring the value data from the persistent storage area can be avoided, and the data query efficiency can be improved.
Of course, not all of the above-described advantages need be achieved simultaneously in practicing any one of the products or methods of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the description of the embodiments or the prior art will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
Fig. 1 is a flowchart of a data query method provided in an embodiment of the present application;
FIG. 2 is a flowchart of a data storage method according to an embodiment of the present application;
FIG. 3 is a flowchart of another data storage method according to an embodiment of the present application;
FIG. 4 is a flowchart of another data query method according to an embodiment of the present application;
FIG. 5 is a flowchart of another data storage method according to an embodiment of the present application;
FIG. 6 is a flowchart of a method for updating a data log according to an embodiment of the present application;
FIG. 7 is an exemplary diagram of a data query process provided by an embodiment of the present application;
FIG. 8 is an exemplary diagram of a data storage process provided by an embodiment of the present application;
fig. 9 is a schematic structural diagram of a data query device according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of another data query device according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
The embodiment of the application provides a data query method which can be applied to a data server in a blockchain. The data server may have stored therein blockchain data of a blockchain, and blockchain nodes in the blockchain may obtain the blockchain data from the data server. The data server may store blockchain data based on a key (index) -value data structure, and may be a relational database, a NoSQL (Non-relational Structured Query Language, non-relational database language) database, or a document database.
The data server includes a temporary storage area and a persistent storage area, and the memory of the data server may be used as the temporary storage area, and the hard disk of the data server may be used as the persistent storage area. The persistent storage area stores index data of all the blockchain data and value data corresponding to each blockchain data, and the temporary storage area stores index data in the persistent storage area and value data corresponding to at least part of the index data.
Alternatively, the data stored in the temporary storage area may be varied, and in one possible implementation, all the index data in the persistent storage area may be stored in the temporary storage area, in which case the value data corresponding to a part of the index data may be stored in the temporary storage area. In another possible implementation, a part of the index data in the persistent storage area may be stored in the temporary storage area, in which case value data corresponding to each of the index data stored in the temporary storage area may be stored in the temporary storage area.
Based on the temporary storage area and the persistent storage area, the data server may read, store blockchain data in the blockchain.
The following will describe a data query method provided in the embodiment of the present application in detail with reference to a specific embodiment, as shown in fig. 1, and the specific steps are as follows:
step 101, receiving a data query request of a blockchain node.
The data query request carries target index data of data to be queried.
In implementation, when a blockchain node needs to query a certain data, the data is the data to be queried, and the blockchain node can determine the index data of the data to be queried to obtain the target index data. The blockchain node may then generate a data query request carrying the target index data, and send the data query request to the data server. Thus, the data server may receive a data query request.
Step 102, searching target index data in the temporary storage area.
In an implementation, the data server may store the index data in a temporary storage area in a manner of storing a Hash (Hash) value of the index data. The data server may calculate a Hash value of the target index data, and then the data server may search for the Hash value of the target index data among the Hash values of the index data stored in the temporary storage area.
In the embodiment of the application, the blockchain node can calculate the Hash value of the target index data, and generate the data query request carrying the Hash value of the target index data. Therefore, the data server can acquire the Hash value carried by the data query request, and searches the Hash value of the target index data in the Hash values of the index data stored in the temporary storage area.
Alternatively, the data server may calculate the Hash value of the target index data using any hashing algorithm, such as: sha (secure hash algorithm), secure hash algorithm) 256 algorithm, sha128 algorithm.
Step 103, if the target index data is found and the value data corresponding to the target index data is stored in the temporary storage area, the value data corresponding to the target index data is acquired from the temporary storage area, and the value data is sent to the blockchain node.
In an implementation, if the data server finds the target index data in the temporary storage area, the data server may further determine whether value data corresponding to the target index data is stored in the temporary storage area.
If the value data corresponding to the target index data is stored in the temporary storage area, the data server may acquire the value data corresponding to the target index data from the temporary storage area, and then the data server may transmit the value data to the blockchain node.
Alternatively, if the value data corresponding to the target index data is not stored in the temporary storage area, the value data corresponding to the target index data is indicated to be stored in the persistent storage area, and then the data server may acquire the value data corresponding to the target index data from the persistent storage area and send the value data to the blockchain node. Therefore, the value data corresponding to the target index data can be obtained under the condition that the value data corresponding to the target index data is not stored in the temporary storage area, so that the comprehensiveness of data query can be ensured.
For example, taking the value data of all index data and hot spot data stored in the persistent storage area as an example, if the value data corresponding to the target index data is not stored in the temporary storage area, the data to be queried is indicated to be non-hot spot data, the value data corresponding to the target index data is stored in the persistent storage area, and then the data server can acquire the value data corresponding to the target index data from the persistent storage area.
The processing of the data server will be described in more detail later if the data server does not find the target index data in the temporary storage area.
In this embodiment of the present application, after receiving a data query request of a blockchain node, the data server may search the temporary storage area for target index data of data to be queried. If the target index data is found and the value data corresponding to the target index data is stored in the temporary storage area, the data server can acquire the value data corresponding to the target index data from the temporary storage area and then send the value data to the blockchain node. Because the data server can directly acquire the value data from the temporary storage area when the value data corresponding to the target index data is stored in the temporary storage area, the time consumed for reading the data consumed by acquiring the value data from the persistent storage area can be avoided, and the data query efficiency can be improved.
Optionally, the processing procedure of the data server is different when the data server does not find the target index data in the temporary storage area according to the difference of the data storage conditions in the temporary storage area. The embodiment of the application provides the data storage conditions in two temporary storage areas, and describes the processing procedure of the data server under the corresponding conditions, and the processing procedure is as follows:
In the first case, the temporary storage area stores all index data and value data corresponding to part of the index data in the persistent storage area.
In this case, when the data server does not find the target index data in the temporary storage area, it indicates that the data to be queried is not stored in the data server, and then the data server may send a data absence message to the block link.
In the second case, the temporary storage area stores therein part of the index data in the persistent storage area and value data corresponding to each of the index data stored in the temporary storage area.
In this case, when the data server does not find the target index data in the temporary storage area, the data server may find the target index data in the persistent storage area. If the data server finds the target index data in the persistent storage area, the data server can acquire the value data corresponding to the target index data and then send the value data to the blockchain node. If the server does not find the target index data in the persistent storage area, it indicates that the data to be queried is not stored in the data server, and then the data server may send a data absence message to the block link.
For example, index data and value data of the hot spot data are stored in the temporary storage area. When the data server does not find the target index data in the temporary storage area, the data server may find the target index data in the persistent storage area. If the data server finds the target index data in the persistent storage area, the data server indicates that the data to be queried is non-hot data, and the data server can acquire the value data corresponding to the target index data and then send the value data to the blockchain node. If the server does not find the target index data in the persistent storage area, it indicates that the data to be queried is not stored in the data server, and then the data server may send a data absence message to the block link.
In the embodiment of the application, for the case of storing the value data of the hot spot data in the temporary storage area, the data query method provided by the embodiment of the application is adopted, and in the case that the data to be queried is the hot spot data stored in the data server, the value data of the data to be queried can be quickly obtained from the temporary storage area; in addition, under the condition that the data to be queried is non-hot data stored in the data server, the value data of the data to be queried can be obtained from the persistent storage area, so that the comprehensiveness of data query can be ensured.
Optionally, an embodiment of the present application further provides a storage process of the data server storing blockchain data, as shown in fig. 2, including:
step 201, a data storage request of a blockchain node is received.
Wherein the data storage request carries index data and value data of the data to be stored.
In an implementation, when a block link point needs to store certain data, the data is the data to be stored, and the block link node can determine index data and value data of the data to be stored. The blockchain node may then generate a data storage request carrying index data and value data of the data to be stored, and send the data storage request to the data server. Thus, the data server may receive the data storage request.
In this embodiment of the present application, the blockchain node may also directly send the data to be stored to the data server, and the data server may generate the index data and the value data based on the data to be stored.
Step 202, storing the data to be stored in the temporary storage area, and sending a successful storage message to the blockchain node.
In implementations, the data server may store the data to be stored in the temporary storage area and send a successful store message to the blockchain node after the storage of the data to be stored in the temporary storage area is completed.
The manner in which the data server stores the data to be stored in the temporary storage area may be varied, and in one possible implementation, the data server may store index data and value data of the data to be stored in the temporary storage area. In another possible implementation, the data server may store only index data of the data to be stored in the temporary storage area.
Step 203, storing index data and value data of the data to be stored in the persistent storage area.
In implementations, the data server may store index data and value data for data to be stored in the persistent storage when the storage condition is satisfied.
In this embodiment of the present application, the storage condition may be various, for example, the storage condition may be that a preset storage period is reached, and the storage condition may also be that a preset idle state is satisfied in a current running state of the data server.
In the embodiment of the application, the data server may receive a data storage request of the blockchain node, then store the data to be stored in the temporary storage area, and send a successful storage message to the blockchain node. Thereafter, the data server may store index data and value data of the data to be stored in the persistent storage area. Thus, by storing the index data and the value data of the data to be stored in the temporary storage area and the persistent storage area, respectively, asynchronous storage of the blockchain data can be realized.
In the related art, the block chain data is stored in a synchronous writing database mode, and the block chain link point can be disconnected from the communication connection between the block chain link point after waiting for the data server to store the data to be stored in the persistent storage area. Because of the long time it takes for the data server to store data in the persistent storage area, the processing resources of the blockchain node may be occupied for a long period of time during which the data server stores data. Furthermore, when the data server has abnormal operation and cannot normally store data, the blockchain node is also affected, so that the data processing efficiency of the blockchain system is reduced.
By adopting the block chain data asynchronous storage scheme provided by the embodiment of the application, on one hand, after the data to be stored is stored in the temporary storage area, the storage success message is sent to the block chain link point, and on the other hand, the time consumed for storing the data in the temporary storage area is very small, so that the occupation condition of processing resources of the block chain node during the data storage period of the data server can be effectively reduced. Furthermore, the influence of the running state of the data server on the block chain node can be reduced, and the overall data processing efficiency of the block chain system is improved.
Optionally, in order to facilitate distinguishing different blockchain data in the data server, the blockchain data may be classified to obtain a data classification to which the blockchain data belongs. The data classification may be hot spot data or non-hot spot data. The data classification may also be user data or system data, important data or non-important data, etc., which is not specifically limited in the embodiments of the present application.
The embodiment of the application also provides an implementation manner of storing data to be stored based on data classification in a temporary storage area by a data server, as shown in fig. 3, comprising the following steps:
step 301, obtaining data classification of data to be stored.
In implementation, the embodiment of the application provides two implementation manners of data classification of data to be stored obtained by a data server, which are respectively:
in the first mode, the data server can acquire the historical query record of the data to be stored, and the data server can determine the data classification of the data to be stored based on the historical query record of the data to be stored and preset screening conditions. Wherein, the preset screening conditions can be as follows: the data to be stored, of which the query times of the data in the preset query period reach the query times threshold value, belong to hot spot data, and the data to be stored, of which the query times do not reach the query times threshold value, belong to non-hot spot data.
For example, the threshold number of queries is 10, and the preset query period is 1 week. The data server can take the data to be stored, of which the query times exceed 10 times in a week, as hot spot data.
Alternatively, a hot spot data discrimination algorithm may be preset in the data server, and the hot spot data discrimination algorithm may be LRU (Least Recently Used, which has not been used recently, the longest), FIFO (First in First out, first-in first-out) and LFU (least frequently used, which has been used least frequently). The data server can determine the data classification of the data to be stored according to the historical query record and the hot spot data discrimination algorithm.
In the second mode, the data storage request can carry a data classification identifier of the data to be stored, and the data server can acquire the data classification identifier carried by the data storage request and take the data classification corresponding to the data classification identifier as the data classification of the data to be stored.
Step 302, determining whether the data classification of the data to be stored is hot spot data.
In practice, if the data of the data to be stored is classified as hot spot data, the data server may perform step 303; if the data of the data to be stored is classified as non-hotspot data, the data server may perform step 304.
Step 303, storing index data and value data of the data to be stored in the temporary storage area.
Step 304, storing index data of the data to be stored in the temporary storage area.
Alternatively, since the data to be stored in the blockchain is generated by a transaction, there is no duplicate data to be stored, and the data server may store index data of the data to be stored in the temporary storage area.
For non-hotspot data, the data server may not store the value data of the non-hotspot data in the temporary storage area, or the data server may set the value data of the non-hotspot data to a preset null value in the temporary storage area.
In this embodiment of the present invention, the data server may obtain a data classification of the data to be stored, and store index data and value data of the data to be stored in the temporary storage area when the data of the data to be stored is classified as hot spot data, and store index data of the data to be stored in the temporary storage area when the data of the data to be stored is classified as non-hot spot data. Therefore, when a data query request of the hot spot data is received later, the data server can quickly acquire the value data of the hot spot data from the temporary storage area, and the time consumption for data reading consumed when the value data is acquired from the persistent storage area can be avoided, so that the data query efficiency can be improved.
Alternatively, when the index data and the value data stored in the temporary storage area are lost, the data server needs to perform data recovery on the temporary storage. In one possible implementation, the data server may perform data recovery based on the index data and the value data stored in the persistent storage.
In another possible implementation, a blockchain node may have stored therein a data log having recorded therein index data and value data for data stored in the data server. The data server can restore the data of the temporary storage area based on the data log, and the specific processing procedures comprise:
and step 1, when the data recovery is required to be carried out on the temporary storage area, sending a data log acquisition request to the block link.
In implementations, situations where data recovery from the temporary storage area is required may include: the data server is restarted or the data server is operating abnormally. When data recovery is required for the temporary storage area, the data server may send a data log acquisition request to the block link point.
And step 2, receiving a data log sent by the block chain node.
And step 3, carrying out data recovery based on the index data and the value data recorded in the data log.
In an implementation, the data server may store index data and value data recorded in the data log based on a key-value data structure, thereby implementing data recovery.
Alternatively, the data server may store all index data and value data recorded in the data log. The data server may also store the index data and the value data in the temporary storage area based on the data classification, and the specific storage process may refer to the processing procedures from step 301 to step 304, which will not be described herein.
In this embodiment of the present application, the data server may send a data log obtaining request to the block link point when data recovery is required for the temporary storage area. Then, data recovery is performed based on the index data and the value data of the received data log record. Thereby, it is ensured that a quick and convenient data query can be achieved based on the temporary storage area.
Based on the same technical concept, the embodiment of the application also provides a data query method, which can be applied to a blockchain node in a blockchain, as shown in fig. 4, and the method can include:
step 401, obtaining target index data of data to be queried in response to a data query operation.
In practice, the blockchain traffic handled by the blockchain node may trigger a data query operation. The blockchain service may be to check the message during the message broadcast, calculate the transaction after the consensus is over, etc.
The blockchain node may obtain data to be queried in response to a data querying operation. The data to be queried can be data required for message verification, and the data to be queried can also be data required for transaction calculation. Then, the blockchain node may determine index data of the data to be queried, resulting in target index data.
Step 402, inquiring whether the target index data is stored in the data server.
In implementations, the blockchain node may query the data server for the target index data stored therein in a number of ways. In one possible implementation, a data log may be stored in a blockchain node, and blockchain data stored in a data server may be recorded in the data log. The blockchain node may determine whether the target index data is stored in the data server by querying the data log.
In another possible implementation, a preset filter may be set in the blockchain node, and the blockchain node may determine whether the target index data is stored in the data server through the preset filter, where a specific process will be described in detail later.
Step 403, if the target index data is stored in the data server, generating a data query request and sending the data query request to the data server.
The data query request carries target index data of data to be queried.
In implementations, if the target index data is stored in the data server, the blockchain node may generate a data query request that is sent to the data server. If the target index data is not stored in the data server, the blockchain node may not be subsequently processed.
In this embodiment of the present application, the blockchain node may send the data query request when the target index data is stored in the data server, and may not send the data query request when the target index data is not stored in the data server. On the one hand, the method can effectively filter the data query request for the non-stored data on the block chain node side, and reduce the time and processing resources consumed by the block chain node to send the data query request and wait for the query result of the data server. On the other hand, on the data server side, the data query load of the data server is reduced, and the data query efficiency is improved.
Optionally, the blockchain node may directly generate a data query request carrying the target index data after acquiring the target index data of the data to be queried, and send the data query request to the data server.
Optionally, a preset Filter may be disposed in the blockchain node, where the preset Filter may be a Bloom Filter or a cuckoo Filter. The embodiment of the application provides an implementation manner for determining whether target index data is stored in a data server or not by a blockchain node through a preset filter, comprising the following steps:
step one, calculating element values corresponding to target index data through a preset filter to obtain target element values.
In implementation, the blockchain node may calculate a Hash value of the target index data, and then, the blockchain node may calculate an element value corresponding to the Hash value through a preset filter to obtain the target element value.
Searching a target element value in a preset element set.
The preset element set comprises a plurality of element values, and each element value is obtained by calculating index data stored in the temporary storage area through a preset filter.
In implementations, the blockchain node may look up the target element value in the preset element set. If the target element value is not found in the set of preset elements, the blockchain node may determine that the target index data is not stored in the data server. If the target element value is found in the preset element set, the blockchain node may determine that target index data is stored in the data server.
It should be noted that, when a preset filter such as a bloom filter and a cuckoo filter searches for a target element value in a preset element set, there is a problem of erroneous judgment. That is, if the target element value is not found in the preset element set, it may be determined that the target index data is not stored in the temporary storage area; however, if the target element value is found in the preset element set, it cannot be determined whether the target index data is stored in the temporary storage area. The judging accuracy of whether the target index data is stored in the temporary storage area is related to the misjudging rate of a preset filter.
Optionally, because the bloom filter has the advantages of quickly judging whether a certain element belongs to a certain element set, high-efficiency data insertion efficiency and data query efficiency, saving storage space of the element set and the like, the bloom filter can be selected as a preset filter in the embodiment of the application.
In the embodiment of the application, whether the target index data is stored in the temporary storage area is judged by adopting the preset filter, so that preliminary filtering of data query can be realized quickly and conveniently.
Optionally, the embodiment of the present application further provides a storing process of the blockchain data stored in the blockchain node, including:
Step one, responding to data storage operation, and acquiring index data and value data of data to be stored.
In implementations, the blockchain traffic handled by the blockchain node may trigger data storage operations. The blockchain service may be to check the message during the message broadcast, calculate the transaction after the consensus is over, etc.
The blockchain node may obtain data to be stored in response to a data query operation. The data to be stored can be data checked through the message, and can also be data obtained by carrying out transaction calculation. The blockchain node may then determine index data and value data for the data to be stored.
And step two, storing the data to be stored in the block chain.
In practice, the manner in which the blockchain node stores the data to be stored in the blockchain may be varied, for example, a blockchain node may store a data log therein, and the blockchain node may record the data to be stored in the data log, and a detailed description of the recording process will be described later.
Or, the block link points can store the data to be stored through a preset filter and a preset element set. Specifically, the blockchain node may calculate a Hash value of index data of data to be stored, and then, the blockchain node may calculate an element value corresponding to the Hash value through a preset filter. Thereafter, the blockchain node may store the element value in a preset set of elements. Therefore, when data query is carried out later, the block chain link points can carry out preliminary filtration on the data to be queried through a preset filter and a preset element set, so that the data query efficiency is improved.
And thirdly, generating a data storage request and sending the data storage request to a data server.
Wherein the data storage request carries index data and value data of the data to be stored.
In this embodiment, the blockchain node may store the blockchain data not only to the data server, but also locally. Further, the blockchain node may send a data storage request to the data server after completing the local storage of the data to be stored, thereby implementing asynchronous storage of the blockchain data.
Alternatively, the blockchain node may record the data to be stored in the data log in a variety of ways, for example, the blockchain node may record the index data and the value data of the data to be stored directly in the data log. Alternatively, the blockchain node may record the data to be stored in a data log based on the data classification of the data to be stored.
Specifically, as shown in fig. 5, the process of recording the data to be stored in the data log may include:
step 501, obtaining data classification of data to be stored.
Wherein the data classification includes hot spot data or non-hot spot data.
In implementation, the processing procedure of this step may refer to the processing procedure of the data server for obtaining the data classification of the data to be stored in the first manner, which is not described herein.
Step 502, determining whether the data classification of the data to be stored is hot spot data.
In implementation, the blockchain node may determine whether the data classification of the data to be stored is hot spot data, and if the data classification of the data to be stored is hot spot data, the blockchain node may execute step three; if the data classification of the data to be stored is not hot spot data, the blockchain node may perform step four.
Step 503, index data and value data of data to be stored are recorded in a data log.
Step 504, the index data of the data to be stored is recorded in the data log.
It should be noted that, the blockchain node records only the index data and the value data of the data to be stored in the data log, and does not store the index data and the value data of the data to be stored based on the data structure. Therefore, a large amount of storage space is not required in the data log in which the data to be stored is recorded.
In the embodiment of the present application, the blockchain node may acquire data classification of the data to be stored, and record index data and value data of the data to be stored in the data log when the data classification of the data to be stored is hot spot data; and recording index data of the data to be stored in a data log under the condition that the data classification of the data to be stored is not hot spot data. Thereby, a reduction of the memory space occupied by the data log can be achieved. Furthermore, as the data to be stored is recorded in the data log stored at the blockchain node side, the blockchain node can provide a data recovery function for the data server based on the data log, and the situation of data loss in the asynchronous storage process of the blockchain data is effectively prevented.
Optionally, as the blockchain node continuously stores data in the running process, the data recorded by the data log is more and more, and the storage space occupied by the data log is more and more large, so that the blockchain node can update the data log to reduce the storage space occupied by the data log.
The embodiment of the application provides a process for updating a data log, which comprises the following steps: and carrying out de-duplication processing on the same index data contained in the data log to obtain an updated data log.
In implementations, a blockchain node may traverse index data contained in the data log to determine the same index data. And then, the blockchain node performs deduplication processing on the same index data to obtain an updated data log.
The embodiment of the application provides two implementations of performing deduplication processing on the same index data by using the blockchain nodes:
in the first mode, the blockchain node can determine the value data corresponding to each same index data according to the same index data to obtain at least two value data. Then, the blockchain node may select a preset number of value data among at least two value data, and record the selected value data and the same index data in a new data log.
And in the second mode, the blockchain node can determine the value data corresponding to each same index data according to the same index data to obtain at least two value data. Then, the blockchain node may select a preset number of value data from the at least two value data, and delete the determined value data from the current data log.
Optionally, the blockchain node may update the data log according to a preset update period, and the blockchain node may update the data log after receiving the data log update instruction.
In the embodiment of the application, the data log after updating is obtained by carrying out the de-duplication processing on the same index data contained in the data log, and the block chain node can reduce the storage space occupied by the data log, so that the processing performance of the block chain node can be improved. Furthermore, based on the updated data log, the data server can reconstruct the index data of the stored data in a shorter time when the data is recovered, so that the data recovery efficiency of the data server on the temporary storage area is improved.
Optionally, an embodiment of the present application provides an implementation manner of updating a data log based on the deduplication processing operation described in the first mode, as shown in fig. 6, including:
And 601, performing data replication on the data log to obtain a data log replica.
In implementation, the blockchain node may create a data log, copy the data recorded in the original data log in the blockchain node into the created data log, that is, use the created data log as the data log copy of the original data log.
For example, the original data log stored in the blockchain node is F1, and the blockchain node may create a data log F2. The blockchain node may copy the data in the original data log F1 into the data log F2, where the data log F2 is a data log copy of the original data log F1.
Step 602, traversing index data contained in the data log copy, and determining the same index data.
For example, the blockchain node may traverse the index data contained in the data log copy to determine the same index data, resulting in zhangsan, lisi.
Step 603, recording the same index data and the value data corresponding to the index data stored most recently in the same index data in the new data log, to obtain the updated data log.
In an implementation, the blockchain node may create a new data log, and for the same index data, the blockchain node may determine the index data stored most recently in the same index data and the value data corresponding to the index data, and then the blockchain node may record the same index data and the value data in the new data log to obtain the updated data log.
For example, the blockchain node may create a new data log F3. For the same index data zhangsan, the value data corresponding to the index data in the data log copy F2 is respectively 50 and 100, and the blockchain may record the value data 100 corresponding to the latest stored index data and the same index data zhangsan in the new data log F3.
In the embodiment of the application, the blockchain node can copy the data of the data log to obtain a data log copy, and then the blockchain node can traverse the index data contained in the data log copy to determine the same index data. And then, the blockchain node can record the value data corresponding to the latest stored index data in the same index data and the same index data in the new data log to obtain the updated data log.
In the data log merging scheme provided by the embodiment of the application, the blockchain node performs data log merging based on the data log copy obtained by copying the data log, so that the data integrity of the data recorded by the original data log can be maintained, and the situation that the data recorded by the original data log is lost due to abnormal operation in the process of performing data log merging by the blockchain node is avoided.
Optionally, in order to ensure that the blockchain node can still record data to be stored in the original data log in the data log merging process, the blockchain node can record the merging starting time of the data log merging, and keep the normal operation of a data writing process of writing data into the original data log in the data log merging process. After obtaining the updated new data log, the blockchain node may block the data writing process of the original data log, and then, the blockchain node may determine the time between the current time and the starting merging time, and write the data in the original data log. The blockchain node may then copy the determined data into a new data log.
Or, the blockchain node may block the data writing process of the original data log when starting to merge the data logs, and after obtaining the updated new data log, the blockchain node may start the data writing process of writing data into the new data log.
In this embodiment of the present application, the data server may perform steps of generating a data log, updating the data log, and the like, and a specific processing procedure may refer to a processing procedure of generating the data log by the above blockchain node, updating the data log, and the like, which will not be described herein.
Based on the same technical concept, the embodiment of the application also provides a data query system, which comprises the data server for executing a data query method and the blockchain node for executing the data query method.
Taking the value data of all index data and hot spot data stored in the temporary storage area as an example, the embodiment of the application provides an example diagram of a data query process, as shown in fig. 7, including the following steps:
step 701, the block link point responds to the data query operation to obtain the target index data of the data to be queried.
Step 702, the block link point queries whether the target index data is stored in the data server.
Step 703, if the target index data is stored in the data server, the block link point generates a data query request and sends the data query request to the data server.
The data query request carries target index data of data to be queried.
Step 704, the data server receives the data query request of the blockchain node, and searches the temporary storage area for the target index data.
Step 705, if the target index data is found and the value data corresponding to the target index data is stored in the temporary storage area, the data server acquires the value data corresponding to the target index data from the temporary storage area and sends the value data to the blockchain node.
Step 706, if the target index data is found and the value data corresponding to the target index data is not stored in the temporary storage area, the data server acquires the value data corresponding to the target index data from the persistent storage area and sends the value data to the blockchain node.
Step 707, if the target index data is not found, the data server sends a data absence message to the block link point.
Taking the value data of all index data and hot spot data stored in the temporary storage area as examples, the embodiment of the application provides an example diagram of a data storage process, as shown in fig. 8, including the following steps:
step 801, the block link point responds to a data storage operation to acquire index data and value data of data to be stored.
Step 802, obtaining data classification of data to be stored by the block link points.
Wherein the data classification includes hot spot data or non-hot spot data.
Step 803, if the data of the data to be stored is classified as hot spot data, the index data and the value data of the data to be stored are recorded in the data log.
Step 804, if the data of the data to be stored is classified as non-hot data, the index data of the data to be stored is recorded in the data log.
Step 805, the block link point generates a data storage request and sends the data storage request to a data server.
Wherein the data storage request carries index data and value data of the data to be stored.
Step 806, the data server stores the data to be stored in the temporary storage area and sends a successful store message to the blockchain node.
Step 807, the data server stores index data and value data of the data to be stored in the persistent storage area.
Based on the same technical concept, the embodiment of the application further provides a data query device, where the device is applied to a data server in a blockchain, the data server includes a temporary storage area, the temporary storage area stores index data in a persistent storage area and value data corresponding to at least part of the index data, as shown in fig. 9, and the device includes:
a first receiving module 910, configured to receive a data query request of a blockchain node, where the data query request carries target index data of data to be queried;
a searching module 920, configured to search the temporary storage area for the target index data;
the first obtaining module 930 is configured to obtain, when the target index data is found and the value data corresponding to the target index data is stored in the temporary storage area, value data corresponding to the target index data from the temporary storage area, and send the value data to the blockchain node.
The beneficial effects of the embodiment of the application are that: the target index data of the data to be queried can be searched in the temporary storage area after the data query request of the blockchain node is received. If the target index data is found and the value data corresponding to the target index data is stored in the temporary storage area, the value data corresponding to the target index data can be acquired from the temporary storage area and then sent to the blockchain node. Because the value data corresponding to the target index data is stored in the temporary storage area, the value data can be directly obtained from the temporary storage area, the time consumed for reading the data consumed by obtaining the value data from the persistent storage area can be avoided, and the data query efficiency can be improved.
Based on the same technical concept, the embodiment of the application further provides a data query device, which is applied to a blockchain node in a blockchain, as shown in fig. 10, and includes:
a first obtaining module 1010, configured to obtain target index data of data to be queried in response to a data query operation;
a query module 1020, configured to query a data server for whether the target index data is stored in the data server;
The first sending module 1030 is configured to generate a data query request when the target index data is stored in the data server, and send the data query request to the data server, where the data query request carries the target index data of the data to be queried.
The beneficial effects of the embodiment of the application are that: the data query request may be transmitted when the target index data is stored in the data server, and not transmitted when the target index data is not stored in the data server. On the one hand, the method can effectively filter the data query request for the non-stored data on the block chain node side, and reduce the time and processing resources consumed by the block chain node to send the data query request and wait for the query result of the data server. On the other hand, on the data server side, the data query load of the data server is reduced, and the data query efficiency is improved.
Based on the same technical conception, the embodiment of the application also provides electronic equipment which can be used as a data server or a blockchain node. As shown in fig. 11, the electronic device may include a processor 1101, a communication interface 1102, a memory 1103 and a communication bus 1104, wherein the processor 1101, the communication interface 1102, the memory 1103 complete communication with each other via the communication bus 1104,
A memory 1103 for storing a computer program;
the processor 1101 is configured to implement a data query method step performed by the data server or implement a data query method step performed by the block link point when executing the program stored in the memory 1103.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processing, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In yet another embodiment provided herein, there is also provided a computer readable storage medium having stored therein a computer program which when executed by a processor implements the steps of any of the data querying methods described above.
In yet another embodiment provided herein, there is also provided a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the data query methods of the above embodiments.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), etc.
It should be noted that in this document, relational terms such as "first" and "second" and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing is merely a specific embodiment of the application to enable one skilled in the art to understand or practice the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (14)

1. A data query method, the method being applied to a data server in a blockchain, the data server including a temporary storage area storing index data in a persistent storage area and value data corresponding to at least a portion of the index data, the method comprising:
receiving a data query request of a block chain node, wherein the data query request carries target index data of data to be queried;
searching the target index data in the temporary storage area;
if the target index data is found and the value data corresponding to the target index data is stored in the temporary storage area, acquiring the value data corresponding to the target index data from the temporary storage area, and sending the value data to the blockchain node;
wherein the method further comprises: receiving a data storage request of a block chain node, wherein the data storage request carries index data and value data of data to be stored; storing the data to be stored in the temporary storage area, and sending a successful storage message to the blockchain node, wherein the method specifically comprises the steps of obtaining data classification of the data to be stored, wherein the data classification comprises hot spot data or non-hot spot data; storing index data and value data of the data to be stored in the temporary storage area if the data of the data to be stored is classified as the hot spot data; and if the data of the data to be stored is classified into the non-hot data, storing index data of the data to be stored in the temporary storage area.
2. The method according to claim 1, wherein the method further comprises:
and storing index data and value data of the data to be stored in the persistent storage area.
3. The method according to claim 1, wherein the method further comprises:
and if the target index data is found and the value data corresponding to the target index data is not stored in the temporary storage area, acquiring the value data corresponding to the target index data from the persistent storage area, and sending the value data to the blockchain node.
4. The method according to claim 1, wherein the method further comprises:
when the data recovery is required to be carried out on the temporary storage area, a data log acquisition request is sent to the block link point;
receiving a data log sent by the block chain node, wherein index data and value data of stored data are recorded in the data log;
and carrying out data recovery based on the index data and the value data recorded in the data log.
5. A method of data querying, the method being applied to a blockchain node in a blockchain, the method comprising:
Responding to data query operation, and acquiring target index data of data to be queried;
inquiring whether the target index data is stored in a data server or not;
if the target index data is stored in the data server, generating a data query request and sending the data query request to the data server, wherein the data query request carries the target index data of the data to be queried;
wherein the method further comprises: acquiring index data and value data of data to be stored in response to a data storage operation; storing the data to be stored in the block chain, wherein the data classification comprises hot spot data or non-hot spot data; if the data of the data to be stored is classified into the hot spot data, recording index data and value data of the data to be stored in a data log; and if the data of the data to be stored is classified into the non-hot data, recording index data of the data to be stored in the data log.
6. The method of claim 5, wherein querying whether the target index data is stored in the data server comprises:
Calculating element values corresponding to the target index data through a preset filter to obtain target element values;
searching the target element value in a preset element set, wherein the preset element set comprises a plurality of element values, and the element values are obtained by calculating index data stored in a temporary storage area of the data server through the preset filter;
if the target element value is found in the preset element set, determining that the target index data is stored in the data server;
and if the target element value is not found in the preset element set, determining that the target index data is not stored in the data server.
7. The method of claim 5, wherein the method further comprises:
and generating a data storage request and sending the data storage request to the data server, wherein the data storage request carries index data and value data of the data to be stored.
8. The method of claim 7, wherein the method further comprises:
and carrying out de-duplication processing on the same index data contained in the data log to obtain an updated data log.
9. The method of claim 8, wherein performing deduplication processing on the same index data contained in the data log to obtain an updated data log comprises:
performing data copying on the data log to obtain a data log copy;
traversing index data contained in the data log copy, and determining the same index data;
and recording the same index data and value data corresponding to the index data stored latest in the same index data in the new data log to obtain an updated data log.
10. A data query system comprising a data server as claimed in any one of claims 1 to 4, a blockchain node as claimed in any one of claims 5 to 9.
11. A data querying device, the device being applied to a data server in a blockchain, the data server including a temporary storage area storing index data in a persistent storage area and value data corresponding to at least a portion of the index data, the device comprising:
the first receiving module is used for receiving a data query request of a block chain node, wherein the data query request carries target index data of data to be queried;
The searching module is used for searching the target index data in the temporary storage area;
the first acquisition module is used for acquiring the value data corresponding to the target index data from the temporary storage area and sending the value data to the blockchain node when the target index data is searched and the value data corresponding to the target index data is stored in the temporary storage area;
the second receiving module is used for receiving a data storage request of the block chain node, wherein the data storage request carries index data and value data of data to be stored; the first storage module is used for storing the data to be stored in the temporary storage area and sending a successful storage message to the blockchain node; the first storage module comprises an acquisition sub-module, wherein the acquisition sub-module is used for acquiring data classification of the data to be stored, and the data classification comprises hot spot data or non-hot spot data; a storage sub-module for storing index data and value data of the data to be stored in the temporary storage area when the data of the data to be stored is classified as the hot spot data; the storage sub-module is further configured to store index data of the data to be stored in the temporary storage area when the data of the data to be stored is classified as the non-hot spot data.
12. A data querying device for application to a blockchain node in a blockchain, the device comprising:
the first acquisition module is used for responding to the data query operation and acquiring target index data of the data to be queried;
the query module is used for querying whether the target index data is stored in the data server or not;
the first sending module is used for generating a data query request and sending the data query request to the data server when the target index data is stored in the data server, wherein the data query request carries the target index data of the data to be queried;
the second acquisition module is used for responding to the data storage operation and acquiring index data and value data of the data to be stored; the storage module is used for storing the data to be stored in the block chain; the memory module includes: the acquisition sub-module is used for acquiring data classification of the data to be stored, wherein the data classification comprises hot spot data or non-hot spot data; a recording sub-module, configured to record index data and value data of the data to be stored in a data log when the data of the data to be stored is classified as the hotspot data; the recording sub-module is further configured to record index data of the data to be stored in the data log when the data of the data to be stored is classified as the non-hot spot data.
13. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 4 or any one of claims 5 to 9 when executing a program stored on a memory.
14. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program which, when executed by a processor, implements the method steps of any of claims 1-4, or any of claims 5-9.
CN202010565812.6A 2020-06-19 2020-06-19 Data query method and system Active CN111782707B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010565812.6A CN111782707B (en) 2020-06-19 2020-06-19 Data query method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010565812.6A CN111782707B (en) 2020-06-19 2020-06-19 Data query method and system

Publications (2)

Publication Number Publication Date
CN111782707A CN111782707A (en) 2020-10-16
CN111782707B true CN111782707B (en) 2024-04-16

Family

ID=72757378

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010565812.6A Active CN111782707B (en) 2020-06-19 2020-06-19 Data query method and system

Country Status (1)

Country Link
CN (1) CN111782707B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113177224B (en) * 2021-03-16 2022-01-04 深圳市名竹科技有限公司 Block chain based data sealing method, device, equipment and storage medium
CN113177048A (en) * 2021-04-28 2021-07-27 中国工商银行股份有限公司 Data processing method, terminal, node, system, electronic device and storage medium
CN113239078B (en) * 2021-05-17 2022-09-20 国网河南省电力公司信息通信公司 Data rapid query method based on alliance chain
CN113328920B (en) * 2021-08-04 2021-10-29 成都飞机工业(集团)有限责任公司 Method for collecting and storing equipment data
CN113656501B (en) * 2021-08-18 2024-01-12 北京百度网讯科技有限公司 Data reading method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8370315B1 (en) * 2010-05-28 2013-02-05 Symantec Corporation System and method for high performance deduplication indexing
CN108848119A (en) * 2018-04-03 2018-11-20 阿里巴巴集团控股有限公司 The exchange method and device, system, electronic equipment of transregional piece of chain
CN109614823A (en) * 2018-10-26 2019-04-12 阿里巴巴集团控股有限公司 Data processing method, device and equipment
CN110532228A (en) * 2019-09-02 2019-12-03 深圳市网心科技有限公司 A kind of method, system, equipment and the readable storage medium storing program for executing of block chain reading data
CN110597852A (en) * 2019-09-27 2019-12-20 腾讯科技(深圳)有限公司 Data processing method, device, terminal and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105988899B (en) * 2015-03-05 2019-04-02 广州市动景计算机科技有限公司 The method and apparatus for realizing data buffer storage

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8370315B1 (en) * 2010-05-28 2013-02-05 Symantec Corporation System and method for high performance deduplication indexing
CN108848119A (en) * 2018-04-03 2018-11-20 阿里巴巴集团控股有限公司 The exchange method and device, system, electronic equipment of transregional piece of chain
CN109614823A (en) * 2018-10-26 2019-04-12 阿里巴巴集团控股有限公司 Data processing method, device and equipment
CN110532228A (en) * 2019-09-02 2019-12-03 深圳市网心科技有限公司 A kind of method, system, equipment and the readable storage medium storing program for executing of block chain reading data
CN110597852A (en) * 2019-09-27 2019-12-20 腾讯科技(深圳)有限公司 Data processing method, device, terminal and storage medium

Also Published As

Publication number Publication date
CN111782707A (en) 2020-10-16

Similar Documents

Publication Publication Date Title
CN111782707B (en) Data query method and system
CN109284073B (en) Data storage method, device, system, server, control node and medium
CN111858520B (en) Method and device for separately storing block chain node data
CN110958300B (en) Data uploading method, system, device, electronic equipment and computer readable medium
US20190332701A1 (en) System and Method for Efficiently Updating a Secondary Index Associated with a Log-Structured Merge-Tree Database
CN104584524A (en) Aggregating data in a mediation system
US11455117B2 (en) Data reading method, apparatus, and system, avoiding version rollback issues in distributed system
CN110716924B (en) Method and device for deleting expired data
CN114528231A (en) Data dynamic storage method and device, electronic equipment and storage medium
WO2022048475A1 (en) Data deduplication method, node, and computer readable storage medium
CN112883065A (en) Data storage method and device and computer equipment
CN112307069A (en) Data query method, system, device and storage medium
CN109992708B (en) Method, device, equipment and storage medium for metadata query
CN111382180A (en) Data clearing method and device for local cache
CN109213972B (en) Method, device, equipment and computer storage medium for determining document similarity
CN115442439A (en) Distributed cache cluster management method, system, terminal and storage medium
CN112488708B (en) Block chain account relevance query method and false transaction screening method
CN109408496A (en) A kind of method and device reducing data redundancy
CN116820323A (en) Data storage method, device, electronic equipment and computer readable storage medium
CN111367992B (en) Data processing method and device, computer storage medium and electronic equipment
CN113342813A (en) Key value data processing method and device, computer equipment and readable storage medium
CN114816219A (en) Data writing and reading method and device and data reading and writing system
CN110678854B (en) Data query method and device
TWI441035B (en) Processing method for duplicate data
WO2023078130A1 (en) Index creation method and apparatus, and computer-readable storage medium

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
CB02 Change of applicant information

Address after: 601, 6 / F, building 2, No. 18, Kechuang 11th Street, Daxing District, Beijing, 100176

Applicant after: Jingdong Technology Information Technology Co.,Ltd.

Applicant after: Jingdong Technology Holding Co.,Ltd.

Address before: 601, 6 / F, building 2, No. 18, Kechuang 11th Street, Daxing District, Beijing, 100176

Applicant before: Jingdong Shuke Haiyi Information Technology Co.,Ltd.

Applicant before: Jingdong Digital Technology Holding Co.,Ltd.

Address after: 601, 6 / F, building 2, No. 18, Kechuang 11th Street, Daxing District, Beijing, 100176

Applicant after: Jingdong Shuke Haiyi Information Technology Co.,Ltd.

Applicant after: Jingdong Digital Technology Holding Co.,Ltd.

Address before: 601, 6 / F, building 2, No. 18, Kechuang 11th Street, Beijing Economic and Technological Development Zone, Beijing 100176

Applicant before: BEIJING HAIYI TONGZHAN INFORMATION TECHNOLOGY Co.,Ltd.

Applicant before: JINGDONG DIGITAL TECHNOLOGY HOLDINGS Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant