CN111782707A - Data query method and system - Google Patents

Data query method and system Download PDF

Info

Publication number
CN111782707A
CN111782707A CN202010565812.6A CN202010565812A CN111782707A CN 111782707 A CN111782707 A CN 111782707A CN 202010565812 A CN202010565812 A CN 202010565812A CN 111782707 A CN111782707 A CN 111782707A
Authority
CN
China
Prior art keywords
data
stored
storage area
value
temporary storage
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.)
Granted
Application number
CN202010565812.6A
Other languages
Chinese (zh)
Other versions
CN111782707B (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.)
JD Digital Technology Holdings Co Ltd
Beijing Haiyi Tongzhan Information Technology Co Ltd
Original Assignee
JD Digital Technology Holdings Co Ltd
Beijing Haiyi Tongzhan 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 JD Digital Technology Holdings Co Ltd, Beijing Haiyi Tongzhan Information Technology Co Ltd filed Critical JD Digital Technology Holdings 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

Images

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)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (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, and 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 block chain 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 application relates to the field of block chain technology, 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 data of the block chain needs to be queried, the block chain link point may send a data query request to a data server deployed with a database, where the data query request may carry target index data of the block chain data to be queried. After receiving the data query request, the data server may look up the value data matched with the target index data in the database. If the value data matched with the target index data is found, the data server can send the found value data to the block chain nodes.
However, in general, a data server stores a database based on a persistent storage area such as a hard disk, and when a block chain link point queries block chain data each time, the data server needs to query target index data in a large amount of index data included in the database in a manner of accessing the hard disk, which results in low data query efficiency.
Disclosure of Invention
The embodiment of the application aims to provide a data query method and a data query 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, and 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 block chain node.
Optionally, the method further includes:
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 block chain node;
and storing the index data and the 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;
if the data of the data to be stored is classified into the hotspot data, storing index data and value data of the data to be stored in the temporary storage area;
and if the data of the data to be stored is classified into the non-hot data, storing the index data of the data to be stored in the temporary storage area.
Optionally, the method further includes:
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 block chain node.
Optionally, the method further includes:
when data recovery needs to be carried out on the temporary storage area, sending a data log acquisition request to the block chain nodes;
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 performing 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, where the method is applied to a blockchain node in a blockchain, and the method includes:
responding to data query operation, and acquiring target index data of data to be queried;
inquiring whether the target index data are 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 data server stores the target index data 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 includes:
responding to data storage operation, and acquiring index data and value data of data to be stored;
storing the data to be stored in the block chain;
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 block chain 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 hotspot data, recording index data and value data of the data to be stored in a data log;
if the data of the data to be stored is classified as the non-hotspot data, recording index data of the data to be stored in the data log.
Optionally, the method further includes:
and carrying out duplicate removal 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 included in the data log to obtain an updated data log includes:
performing data replication on the data log to obtain a data log replica;
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 which is newly stored 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 the data server described in any first aspect above and the block link point described in any second aspect above.
In a fourth aspect, a data query apparatus is provided, where the apparatus is applied to a data server in a blockchain, where the data server includes a temporary storage area, and 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 apparatus includes:
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;
and 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 block chain node when the target index data is found and the value data corresponding to the target index data is stored in the temporary storage area.
Optionally, the apparatus further comprises:
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 block chain 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 submodule 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;
the storage submodule is used for storing the index data and the value data of the data to be stored in the temporary storage area when the data of the data to be stored is classified into the hotspot data;
the storage submodule 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-hotspot data.
Optionally, the apparatus further comprises:
and the second obtaining module is used for obtaining the value data corresponding to the target index data from the persistent storage area and sending the value data to the block chain node when the target index data is found and the value data corresponding to the target index data is not stored in the temporary storage area.
Optionally, the apparatus further comprises:
the sending module is used for sending a data log obtaining request to the block chain nodes when data recovery needs to be carried out on the temporary storage area;
a third receiving module, configured to receive a data log sent by the blockchain node, where index data and value data of stored data are recorded in the data log;
and the data recovery module is used for performing data recovery based on the index data and the value data recorded in the data log.
In a fifth aspect, a data query apparatus is provided, where the apparatus is applied to a block chain node in a block chain, and the apparatus includes:
the first acquisition module is used for responding to data query operation and acquiring target index data of data to be queried;
the query module is used for querying whether the target index data is stored in the data server;
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 calculation submodule is used for calculating an element value corresponding to the target index data through a preset filter to obtain a target element value;
the searching submodule is used for searching the target element value in a preset element set, 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 sub-module is further configured to determine 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 comprises:
the second acquisition module is used for responding to 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 submodule 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;
the recording submodule is used for recording 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 into 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-hotspot data.
Optionally, the apparatus further comprises:
and the duplicate removal module is used for carrying out duplicate removal processing on the same index data contained in the data log to obtain the updated data log.
Optionally, the deduplication module includes:
the replication submodule is used for performing 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 submodule is used for recording the same index data and the value data corresponding to the latest stored index data 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, which includes a processor, a communication interface, a memory and a communication bus, wherein 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 adapted to perform the method steps of any of the first aspect or any of the second aspect when executing a program stored in the memory.
In a seventh aspect, a computer-readable storage medium is provided, in which a computer program is stored which, when being executed by a processor, carries out the method steps of any of the first aspects, or any of the second aspects.
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 as described above in relation to implementing any of the first aspects, or any of the second aspects.
The embodiment of the application has the following beneficial effects:
the embodiment of the application provides a data query method and a data query system, the method can be applied to a data server in a block chain, the data server comprises a temporary storage area, and the temporary storage area 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 target index data of the data to be queried in the temporary storage area 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 block chain nodes. When the value data corresponding to the target index data is stored in the temporary storage area, the data server can directly acquire the value data from the temporary storage area, so that the time consumed for reading the data consumed for acquiring the value data from the persistent storage area can be avoided, and the data query efficiency can be improved.
Of course, not all advantages described above need to be achieved at the same time in the practice of any one product or method 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 needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
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 flow chart of another data storage method provided by an embodiment of the present application;
FIG. 4 is a flow chart of another data query method provided in the embodiments of the present application;
FIG. 5 is a flow chart of another data storage method provided by an embodiment of the present application;
fig. 6 is a flowchart of a data log updating method 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 technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides a data query method, which can be applied to a data server in a block chain. The data server may store therein blockchain data of the blockchain, and the blockchain link point in the blockchain may obtain the blockchain data from the data server. The data server may store block chain data based on a key-value data structure, and may be a relational database, a NoSQL (Non-relational Structured query language) database, or a document-type database.
The data server comprises a temporary storage area and a persistent storage area, and the memory of the data server can be used as the temporary storage area, and the hard disk of the data server can 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 the index data in the persistent storage area and the value data corresponding to at least part of the index data.
Optionally, the data stored in the temporary storage area may be various, and in a feasible implementation manner, all the index data in the persistent storage area may be stored in the temporary storage area, and in this case, the value data corresponding to part of the index data may be stored in the temporary storage area. In another possible implementation manner, the temporary storage area may store a part of the index data in the persistent storage area, in which case, the temporary storage area may store value data corresponding to each index data stored in the temporary storage area.
Based on the temporary storage area and the persistent storage area, the data server can read and store the block chain data in the block chain.
A data query method provided in an embodiment of the present application will be described in detail below with reference to specific embodiments, as shown in fig. 1, the specific steps are as follows:
step 101, receiving a data query request of a block chain node.
The data query request carries target index data of the data to be queried.
In implementation, when a block link point needs to query a certain data, the data is the data to be queried, and the block link point can determine the index data of the data to be queried to obtain the target index data. Then, the block link point may 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.
And 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 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 block link point can calculate the Hash value of the target index data, and generate a data query request carrying the Hash value of the target index data. Therefore, the data server can obtain the Hash value carried by the data query request, and search 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 by using any Hash algorithm, for example: sha (secure hash algorithm) 256 algorithm, sha128 algorithm.
And 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, acquiring the value data corresponding to the target index data from the temporary storage area and sending the value data to the block chain nodes.
In implementation, if the data server finds the target index data in the temporary storage area, the data server may further determine whether the temporary storage area stores the value data corresponding to the target index data.
If the temporary storage area stores therein the value data corresponding to the target index data, 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 block link points.
Optionally, if the value data corresponding to the target index data is not stored in the temporary storage area, it indicates that the value data corresponding to the target index data is 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 block link point. Thus, when 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 can be acquired, and the comprehensiveness of the data query can be ensured.
For example, taking the case that the temporary storage area stores all index data and value data of hot spot data in the persistent storage area, if the temporary storage area does not store value data corresponding to the target index data, it indicates that the data to be queried is 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 may obtain the value data corresponding to the target index data from the persistent storage area.
If the data server does not find the target index data in the temporary storage area, the processing procedure of the data server will be described in detail later.
In the embodiment of the application, the data server may search the target index data of the data to be queried in the temporary storage area 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 block chain nodes. When the value data corresponding to the target index data is stored in the temporary storage area, the data server can directly acquire the value data from the temporary storage area, so that the time consumed for reading the data consumed for acquiring the value data from the persistent storage area can be avoided, and the data query efficiency can be improved.
Optionally, for different data storage conditions in the temporary storage area, when the data server does not find the target index data in the temporary storage area, the processing procedure of the data server is also different. The embodiment of the present application provides two data storage conditions in the temporary storage area, and explains a processing procedure of the data server under the corresponding conditions, specifically as follows:
in the first case, the temporary storage area stores the data corresponding to all index data and part of 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 point.
And in the second case, the temporary storage area stores partial index data in the persistent storage area and value data corresponding to each 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 block chain nodes. If the server does not find the target index data in the persistent storage area, the data server is indicated to not store the data to be inquired, and then the data server can send a data nonexistence message to the block link point.
For example, index data and value data of hotspot 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 inquired is non-hotspot data, and the data server can acquire the value data corresponding to the target index data and then send the value data to the block link points. If the server does not find the target index data in the persistent storage area, the data server is indicated to not store the data to be inquired, and then the data server can send a data nonexistence message to the block link point.
In the embodiment of the application, by adopting the data query method provided by the embodiment of the application, aiming at the condition that the value data of the hotspot data is stored in the temporary storage area, the value data of the data to be queried can be quickly acquired from the temporary storage area under the condition that the data to be queried is the hotspot data stored in the data server; and under the condition that the data to be queried is non-hotspot data stored in the data server, the value data of the data to be queried can be acquired 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 block chain data stored in the data server, as shown in fig. 2, including:
step 201, receiving a data storage request of a blockchain node.
The data storage request carries index data and value data of the data to be stored.
In implementation, when a block link point needs to store certain data, the data is the data to be stored, and the block link point can determine the index data and the value data of the data to be stored. Then, the block link point may 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 a data storage request.
In the embodiment of the application, the block link point may also directly send data to be stored to the data server, and the data server may generate index data and 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 block chain nodes.
In implementation, the data server may store the data to be stored in the temporary storage area, and send a successful storage message to the block link point after completing the storage of the data to be stored in the temporary storage area.
The way in which the data server stores the data to be stored in the temporary storage area may be various, and in a 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 only store index data of data in the temporary storage area.
And step 203, storing the index data and the value data of the data to be stored in the persistent storage area.
In implementation, the data server may store index data and value data of data to be stored in the persistent storage area 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, or the storage condition may be that a preset idle state is satisfied in a current operating state of the data server.
In the embodiment of the application, the data server can receive a data storage request of a block chain node, then store data to be stored in the temporary storage area, and send a successful storage message to the block chain node. The data server may then store the index data and value data for the data to be stored in the persistent storage area. Therefore, 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 block chain data can be realized.
In the related technology, block chain data are stored in a mode of synchronously writing in a database, and a block chain link point can be disconnected from communication with the block chain link point only after a data server stores data to be stored in a persistent storage area. Because the data server takes a long time to store data in the persistent storage area, the processing resources of the blockchain node may be occupied for a long time during the data server stores the data. Furthermore, when the data server runs abnormally and cannot store data normally, the block chain nodes are also affected, so that the data processing efficiency of the block chain system is reduced.
By adopting the asynchronous storage scheme of the block chain data 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 short, 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 link points can be reduced, and the overall data processing efficiency of the block chain system is improved.
Optionally, in order to distinguish 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 hotspot data or non-hotspot data. The data classification may also be user data or system data, important data or non-important data, and the like, which is not specifically limited in this embodiment of the application.
The embodiment of the present application further provides an implementation manner for storing data to be stored in a temporary storage area by a data server based on data classification, as shown in fig. 3, the implementation manner includes the following steps:
step 301, obtaining data classification of data to be stored.
In implementation, the embodiments of the present application provide two implementation manners for data classification of data to be stored acquired by a data server, which are respectively:
in the first mode, the data server can obtain the historical query records 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 records of the data to be stored and preset screening conditions. Wherein, the preset screening conditions can be as follows: data to be stored, of which the query times of the data in the preset query period reach the query time threshold value, belong to hotspot data, and data to be stored, of which the query times do not reach the query time threshold value, belong to non-hotspot data.
For example, the threshold of the number of queries is 10, and the preset query period is 1 week. The data server can use the data to be stored, which is queried for more than 10 times in a week, as the hot spot data.
Optionally, the data server may be preset with a hot spot data discrimination algorithm, where the hot spot data discrimination algorithm may be an LRU (Least Recently Used) algorithm, a FIFO (First in First out) algorithm, and an LFU (Least frequently Used page replacement) algorithm. 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.
And in the second mode, the data storage request can carry a data classification identifier of the data to be stored, the data server can acquire the data classification identifier carried by the data storage request, and the data classification corresponding to the data classification identifier is used as the data classification of the data to be stored.
Step 302, judging whether the data classification of the data to be stored is hot data.
In implementation, if the data of the data to be stored is classified as hot data, the data server may perform step 303; if the data of the data to be stored is classified as non-hot data, the data server may perform step 304.
And 303, storing the index data and the value data of the data to be stored in the temporary storage area.
Step 304, storing the index data of the data to be stored in the temporary storage area.
Optionally, since the data to be stored in the blockchain is generated by a transaction, there is no repeated data to be stored, and the data server may store the index data of the data to be stored in the temporary storage area.
For the 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 the embodiment of the application, the data server can acquire the data classification of the data to be stored, when the data classification of the data to be stored is the hotspot data, the index data and the value data of the data to be stored are stored in the temporary storage area, and when the data classification of the data to be stored is the non-hotspot data, the index data of the data to be stored is stored in the temporary storage area. Therefore, when a data query request of the hotspot data is received subsequently, the data server can quickly acquire the value data of the hotspot data from the temporary storage area, and the consumed data reading time when the value data is acquired from the persistent storage area can be avoided, so that the data query efficiency can be improved.
Optionally, 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 value data stored in the persistent storage.
In another possible implementation manner, a data log may be stored in the blockchain node, and index data and value data of data already stored in the data server are recorded in the data log. The data server can perform data recovery on the temporary storage area based on the data log, and the specific processing process comprises the following steps:
step 1, when data recovery needs to be carried out on the temporary storage area, a data log acquisition request is sent to the block chain nodes.
In implementation, the case where data recovery is required for the temporary storage area may include: and restarting the data server, or enabling the data server to run abnormally. When the temporary storage area needs to be subjected to data recovery, the data server can send a data log acquisition request to the block chain nodes.
And 2, receiving the data log sent by the blockchain node.
And 3, recovering data based on the index data and the value data recorded in the data log.
In 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 data classification, and the specific storage process may refer to the processing processes of step 301 to step 304, which are not described herein again.
In the embodiment of the application, the data server can send a data log acquisition request to the block link point when the data recovery needs to be performed on the temporary storage area. Data recovery is then performed based on the index data and value data of the received data log record. Therefore, the data can be quickly and conveniently inquired based on the temporary storage area.
Based on the same technical concept, embodiments of the present application further provide a data query method, which may be applied to a blockchain node in a blockchain, as shown in fig. 4, and the method may include:
step 401, in response to the data query operation, obtaining target index data of the data to be queried.
In implementation, the data query operation may be triggered by the block chain traffic handled by the block chain node. The blockchain service may be to check the message during the message broadcasting process, to calculate the transaction after the consensus ends, and the like.
The block link point can respond to the data query operation to acquire the data to be queried. The data to be queried may be data required for message verification, or data required for transaction calculation. Then, the block link point can determine the index data of the data to be queried to obtain the target index data.
Step 402, inquiring whether the data server stores the target index data.
In implementation, the block link point may query whether the data server stores the target index data in various ways. In a possible implementation manner, the blockchain node may store a data log, and the data log may record blockchain data stored in the data server. The block chain node can determine whether the data server stores the target index data by inquiring the data log.
In another possible implementation manner, a preset filter may be set in the block chain node, and the block chain node may determine whether the data server stores the target index data through the preset filter, where the specific processing procedure 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 the data to be queried.
In an implementation, if the data server stores the target index data, the chunk node may generate a data query request, and send the data query request to the data server. If the target index data is not stored in the data server, the block link point may not be processed subsequently.
In this embodiment, the block link point may send the data query request when the data server stores the target index data, and may not send the data query request when the data server does not store the target index data. Because the existence judgment of the data to be inquired is carried out on the block chain node side in advance, on one hand, the data inquiry request for the data which is not stored can be effectively filtered out on the block chain node side, and the time and the processing resources consumed by the block chain node for sending the data inquiry request and waiting for the inquiry result of the data server are reduced. 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 block link point 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 set in the blockchain node, and the preset Filter may be a Bloom Filter (Bloom Filter) or a cuckoo Filter. The embodiment of the application provides an implementation mode for determining whether a data server stores target index data or not through a preset filter by using a block link point, which comprises 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 block chain node may calculate a Hash value of the target index data, and then, the block chain node may calculate an element value corresponding to the Hash value through a preset filter to obtain a target element value.
And step two, 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 the index data stored in the temporary storage area through a preset filter.
In an implementation, a block chain node may look up a target element value in a preset set of elements. If the target element value is not found in the preset element set, the block link point 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 block link point may determine that the target index data is stored in the data server.
It should be noted that, when a preset filter such as a bloom filter or a cuckoo filter searches for a target element value in a preset element set, a problem of erroneous judgment exists. 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 judgment accuracy rate of whether the target index data is stored in the temporary storage area is related to the misjudgment rate of the preset filter.
Optionally, the bloom filter has the advantages of quickly determining whether a certain element belongs to a certain element set, efficiently determining data insertion efficiency and data query efficiency, saving storage space of the element set, and the like, and therefore the bloom filter can be selected as the preset filter in the embodiment of the present application.
In the embodiment of the application, whether the target index data are stored in the temporary storage area or not is judged by adopting the preset filter, so that the preliminary filtering of data query can be quickly and conveniently realized.
Optionally, an embodiment of the present application further provides a storage process of block chain data in a block chain link point storage area, including:
step one, responding to data storage operation, and acquiring index data and value data of data to be stored.
In implementation, the data storage operation may be triggered by the block chain traffic handled by the block chain link points. The blockchain service may be to check the message during the message broadcasting process, to calculate the transaction after the consensus ends, and the like.
The block link points may be responsive to a data query operation to retrieve data to be stored. The data to be stored may be data verified by the message, or data obtained by performing transaction calculation. The block link points 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 implementation, the way that the blockchain node stores the data to be stored in the blockchain may be various, for example, a data log may be stored in the blockchain node, and the blockchain node may record the data to be stored in the data log, where the detailed description will be described later in the specific recording process.
Or, the block link points may store the data to be stored through a preset filter and a preset element set. Specifically, the block chain node may calculate a Hash value of the index data of the data to be stored, and then, the block chain node may calculate an element value corresponding to the Hash value through a preset filter. The block link point may then store the element value in a preset set of elements. Therefore, when data query is subsequently carried out, the block chain link points can carry out preliminary filtering on the data to be queried through the preset filter and the preset element set, and therefore the data query efficiency is improved.
And step three, generating a data storage request and sending the data storage request to a data server.
The data storage request carries index data and value data of the data to be stored.
In the embodiment of the application, the block chain link point can store the block chain data to the data server and can also store the block chain data in a local area. Further, after the local storage of the data to be stored is completed, the block link point may send a data storage request to the data server, so that asynchronous storage of the block chain data may be implemented.
Alternatively, the block link point may record the data to be stored in the data log in various ways, for example, the block link point may directly record the index data and the value data of the data to be stored in the data log. Alternatively, the block link point may record the data to be stored in the 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 by the block link point based on the data classification of the data to be stored may include:
and step 501, acquiring data classification of data to be stored.
Wherein the data classification includes hot spot data or non-hot spot data.
In the implementation, the processing procedure of this step may refer to the processing procedure of obtaining the data classification of the data to be stored in the first data server, which is not described herein again.
Step 502, judging whether the data classification of the data to be stored is hot data.
In implementation, the block chain node may determine whether the data classification of the data to be stored is hot data, and if the data classification of the data to be stored is hot data, the block chain node may perform step three; if the data classification of the data to be stored is not the hot spot data, the block link point may perform step four.
Step 503, recording the index data and value data of the data to be stored in the data log.
Step 504, recording index data of the data to be stored in the data log.
It should be noted that the blockchain node only records 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 consumed in recording the data log of the data to be stored.
In the embodiment of the application, the block chain nodes can acquire the data classification of the data to be stored, and record the index data and the value data of the data to be stored in the data log under the condition that the data of the data to be stored is classified as the hotspot data; and recording index data of the data to be stored in the data log under the condition that the data classification of the data to be stored is not the hot spot data. Therefore, the storage space occupied by the data log can be reduced. Furthermore, the data to be stored is recorded in the data log stored at the node side of the block chain, so that the block chain node can provide a data recovery function for the data server based on the data log, and the condition of data loss in the asynchronous storage process of the block chain data is effectively prevented.
Optionally, as the block chain node continuously stores data in the operation process, the data recorded by the data log is more and more, and the storage space occupied by the data log is larger and larger, so that the block chain node can update the data log to reduce the storage space occupied by the data log.
An embodiment of the present application provides a process for updating a data log, including: and carrying out deduplication processing on the same index data contained in the data log to obtain an updated data log.
In an implementation, the chunk chain node may traverse the index data contained in the data log to determine the same index data. Then, the block chain link points perform deduplication processing on the same index data to obtain an updated data log.
The embodiment of the application provides two implementation modes for carrying out deduplication processing on the same index data by using block link points:
in the first mode, the block link point may determine, for the same index data, value data corresponding to each of the same index data to obtain at least two value data. Then, the block link point may select a preset number of value data among the at least two value data, and record the selected value data and the same index data in the new data log.
In a second mode, the block link points 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 block link point may select a preset number of value data among the at least two value data, and delete the determined value data in the current data log.
Optionally, the block link point may update the data log according to a preset update period, and the block link point may also update the data log after receiving the data log update instruction.
In the embodiment of the application, the updated data log is obtained by performing deduplication processing on the same index data contained in the data log, and the storage space occupied by the data log can be reduced by the block chain nodes, so that the processing performance of the block chain nodes can be improved. Furthermore, based on the updated data log, when the data server performs data recovery, the index data of the stored data can be reconstructed in a shorter time, and the efficiency of the data server performing data recovery on the temporary storage area is improved.
Optionally, an embodiment of the present application provides an implementation manner for updating a data log based on the deduplication processing operation described in the foregoing first manner, as shown in fig. 6, including:
step 601, data replication is carried out on the data log to obtain a data log replica.
In an implementation, a data log may be created by a tile link node, and data recorded by an original data log in the tile link node is copied to the created data log, that is, the created data log is used as a data log copy of the original data log.
For example, the original data log stored in the blockchain node is F1, and a data log F2 can be created at the blockchain node. The blockchain node may copy the data in the original data log F1 to a data log F2, where the data log F2 is a data log copy of the original data log F1.
Step 602, traversing the index data contained in the data log copy, and determining the same index data.
For example, the block chain node may traverse the index data included in the data log copy, determine the same index data, and obtain zhangsan and lisi.
Step 603, recording the same index data and the value data corresponding to the latest stored index data in the same index data in the new data log to obtain an updated data log.
In implementation, the block link point may create a new data log, and for the same index data, the block link point may determine the latest stored index data in the same index data and the value data corresponding to the index data, and then, the block link point may record the same index data and the value data in the new data log to obtain an updated data log.
For example, a chunk link point 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 are 50 and 100, respectively, and the blockchain may record the value data 100 corresponding to the newly stored index data and the same index data zhangsan in the new data log F3.
In the embodiment of the application, the block chain node can perform data replication on the data log to obtain a data log replica, and then the block chain node can traverse the index data contained in the data log replica to determine the same index data. Then, the block link point may record, in the new data log, value data corresponding to the index data that is newly stored in the same index data and the same index data, to obtain an updated data log.
In the data log merging scheme provided by the embodiment of the application, the block chain node merges the data logs based on the data log copy obtained by copying the data logs, so that the data integrity of the data recorded by the original data log can be maintained, and the condition that the data recorded by the original data log is lost due to abnormal operation in the process of merging the data logs by the block chain node is avoided.
Optionally, in order to ensure that the block link point can still record the data to be stored in the original data log during the merging of the data logs, the block link point may record the merging start time of the data log merging, and maintain the normal operation of the data writing process for writing the data into the original data log during the merging of the data logs. After the updated new data log is obtained, the block link point may block the data writing process of the original data log, and then the block link point may determine the time between the current time and the merging start time, and write the data in the original data log. The block chain node may then copy the determined data into a new data log.
Or, the block link point may block the data writing process of the original data log when the data log merging is started, and may start the data writing process of writing data into the new data log after the updated new data log is obtained.
In this embodiment of the application, the data server may perform the steps of generating the data log, updating the data log, and the like, and the specific processing process may refer to the processing processes of generating the data log by using the block chain node, updating the data log, and the like, which are not described herein again.
Based on the same technical concept, the embodiment of the application also provides a data query system, which comprises the data server executing the data query method and the block chain node executing the data query method.
The embodiment of the present application takes, as an example, value data of all index data and hotspot data in a persistent storage area stored in a temporary storage area, and provides an example diagram of a data query process, as shown in fig. 7, including the following steps:
step 701, the block chain nodes respond to the data query operation to obtain target index data of the data to be queried.
Step 702, the block chain nodes inquire whether the data server stores the target index data.
And 703, if the target index data is stored in the data server, generating a data query request by the block link node and sending the data query request to the data server.
The data query request carries target index data of the data to be queried.
Step 704, the data server receives the data query request of the blockchain node, and searches the target index data in the temporary storage area.
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 obtains the value data corresponding to the target index data from the temporary storage area and sends the value data to the block link point.
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 obtains the value data corresponding to the target index data from the persistent storage area and sends the value data to the block link point.
Step 707, if the target index data is not found, the data server sends a data nonexistence message to the block link point.
The embodiment of the present application takes, as an example, value data of all index data and hotspot data in a persistent storage area stored in a temporary storage area, and provides an example diagram of a data storage process, as shown in fig. 8, the method includes the following steps:
step 801, the block chain link points respond to data storage operation, and index data and value data of data to be stored are obtained.
And step 802, obtaining data classification of the data to be stored by the block chain nodes.
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 the hotspot data, recording the index data and the value data of the data to be stored in the data log.
Step 804, if the data of the data to be stored is classified as non-hot data, recording index data of the data to be stored in the data log.
Step 805, the block link node generates a data storage request and sends the data storage request to the data server.
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 storage message to the block link point.
Step 807, the data server stores the index data and value data of the data to be stored in the persistent storage area.
Based on the same technical concept, an embodiment of the present application further provides a data query apparatus, where the apparatus is applied to a data server in a block chain, where the data server includes a temporary storage area, and 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, the apparatus 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 target index data in the temporary storage area;
a first obtaining module 930, configured to, when the target index data is found and the value data corresponding to the target index data is stored in the temporary storage area, obtain the value data corresponding to the target index data from the temporary storage area, and send the value data to the blockchain node.
The embodiment of the application has the following beneficial effects: after receiving a data query request of a blockchain node, target index data of data to be queried can be searched 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, the value data corresponding to the target index data can be obtained from the temporary storage area, and then the value data is sent to the block chain nodes. When the value data corresponding to the target index data is stored in the temporary storage area, the value data can be directly acquired from the temporary storage area, so that the time consumed for reading the data consumed for acquiring 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 present application further provides a data query apparatus, where the apparatus is applied to a blockchain node in a blockchain, as shown in fig. 10, and the apparatus 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 whether the target index data is stored in the data server;
a first sending module 1030, configured to generate a data query request and send the data query request to the data server when the target index data is stored in the data server, where the data query request carries the target index data of the data to be queried.
The embodiment of the application has the following beneficial effects: the data query request may be transmitted when the target index data is stored in the data server, and the data query request may not be transmitted when the target index data is not stored in the data server. Because the existence judgment of the data to be inquired is carried out on the block chain node side in advance, on one hand, the data inquiry request for the data which is not stored can be effectively filtered out on the block chain node side, and the time and the processing resources consumed by the block chain node for sending the data inquiry request and waiting for the inquiry result of the data server are reduced. 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 concept, the embodiment of the application also provides the electronic equipment, and the electronic equipment can be used as a data server and also can be used as a block chain 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 communicate with each other through the communication bus 1104,
a memory 1103 for storing a computer program;
the processor 1101 is configured to implement the above-mentioned data query method steps executed by the data server or implement the above-mentioned data query method steps executed by the block link points when executing the program stored in the memory 1103.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a 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 processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
In another embodiment provided by the present application, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of any of the above data query methods.
In yet another embodiment provided by the present application, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the data query methods of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized 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, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the 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)), among others.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be 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. Also, 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 an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is merely exemplary of the present application and is presented to enable those skilled in the art to understand and practice the present 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 (16)

1. A data query method, which is applied to a data server in a blockchain, wherein the data server includes a temporary storage area, and 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 block chain node.
2. The method of claim 1, further comprising:
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 block chain node;
and storing the index data and the value data of the data to be stored in the persistent storage area.
3. The method according to claim 2, wherein the storing the data to be stored in the temporary storage area comprises:
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 hotspot data, storing index data and value data of the data to be stored in the temporary storage area;
and if the data of the data to be stored is classified into the non-hot data, storing the index data of the data to be stored in the temporary storage area.
4. The method of claim 1, further comprising:
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 block chain node.
5. The method of claim 1, further comprising:
when data recovery needs to be carried out on the temporary storage area, sending a data log acquisition request to the block chain nodes;
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 performing data recovery based on the index data and the value data recorded in the data log.
6. A data query method, 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 are 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.
7. The method of claim 6, wherein querying the data server as to whether the target index data is stored therein 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 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.
8. The method of claim 6, further comprising:
responding to data storage operation, and acquiring index data and value data of data to be stored;
storing the data to be stored in the block chain;
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.
9. The method according to claim 8, wherein the storing the data to be stored in the block chain comprises:
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 hotspot data, recording index data and value data of the data to be stored in a data log;
if the data of the data to be stored is classified as the non-hotspot data, recording index data of the data to be stored in the data log.
10. The method of claim 9, further comprising:
and carrying out duplicate removal processing on the same index data contained in the data log to obtain an updated data log.
11. The method of claim 10, wherein the performing deduplication processing on the same index data included in the data log to obtain an updated data log comprises:
performing data replication on the data log to obtain a data log replica;
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 which is newly stored in the same index data in the new data log to obtain an updated data log.
12. A data query system, characterized in that the system comprises a data server as described in claims 1-5 above, and a blockchain node as described in claims 6-11 above.
13. A data query apparatus, applied to a data server in a blockchain, the data server including a temporary storage area, the temporary storage area storing index data in a persistent storage area and value data corresponding to at least part of the index data, the apparatus 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;
and 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 block chain node when the target index data is found and the value data corresponding to the target index data is stored in the temporary storage area.
14. A data query apparatus, applied to a block chain node in a block chain, the apparatus comprising:
the first acquisition module is used for responding to data query operation and acquiring target index data of data to be queried;
the query module is used for querying whether the target index data is stored in the data server;
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.
15. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory 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 5, or claims 6 to 11, when executing a program stored in a memory.
16. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of claims 1-5 or any of claims 6-11.
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 true CN111782707A (en) 2020-10-16
CN111782707B 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)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113177224A (en) * 2021-03-16 2021-07-27 深圳市名竹科技有限公司 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
CN113239078A (en) * 2021-05-17 2021-08-10 国网河南省电力公司信息通信公司 Data rapid query method based on alliance chain
CN113328920A (en) * 2021-08-04 2021-08-31 成都飞机工业(集团)有限责任公司 Method for collecting and storing equipment data
CN113656501A (en) * 2021-08-18 2021-11-16 北京百度网讯科技有限公司 Data reading method, device, equipment and storage medium

Citations (6)

* 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
US20160259727A1 (en) * 2015-03-05 2016-09-08 Guangzhou Ucweb Computer Technology Co., Ltd. Method, apparatus, and system for data caching
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

Patent Citations (7)

* 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
US20160259727A1 (en) * 2015-03-05 2016-09-08 Guangzhou Ucweb Computer Technology Co., Ltd. Method, apparatus, and system for data caching
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
US20200133949A1 (en) * 2018-10-26 2020-04-30 Alibaba Group Holding Limited Data processing method, apparatus, and device
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

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113177224A (en) * 2021-03-16 2021-07-27 深圳市名竹科技有限公司 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
CN113239078A (en) * 2021-05-17 2021-08-10 国网河南省电力公司信息通信公司 Data rapid query method based on alliance chain
CN113328920A (en) * 2021-08-04 2021-08-31 成都飞机工业(集团)有限责任公司 Method for collecting and storing equipment data
CN113328920B (en) * 2021-08-04 2021-10-29 成都飞机工业(集团)有限责任公司 Method for collecting and storing equipment data
CN113656501A (en) * 2021-08-18 2021-11-16 北京百度网讯科技有限公司 Data reading method, device, equipment and storage medium
CN113656501B (en) * 2021-08-18 2024-01-12 北京百度网讯科技有限公司 Data reading method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN111782707B (en) 2024-04-16

Similar Documents

Publication Publication Date Title
CN111782707B (en) Data query method and system
KR20190067158A (en) METHOD, APPARATUS AND SEARCH METHOD FOR ARCHITECTING BLOCK CHAIN BLOCK DATA
CN102629247B (en) Method, device and system for data processing
CN109284073B (en) Data storage method, device, system, server, control node and medium
US10776345B2 (en) Efficiently updating a secondary index associated with a log-structured merge-tree database
CN110888837B (en) Object storage small file merging method and device
CN107301215B (en) Search result caching method and device and search method and device
CN110958300B (en) Data uploading method, system, device, electronic equipment and computer readable medium
CN111858520B (en) Method and device for separately storing block chain node data
CN109766318B (en) File reading method and device
CN111198885A (en) Data processing method and device
US11853229B2 (en) Method and apparatus for updating cached information, device, and medium
CN114528231A (en) Data dynamic storage method and device, electronic equipment and storage medium
CN111651443A (en) Data management method and device, electronic equipment and storage medium
CN115442439A (en) Distributed cache cluster management method, system, terminal and storage medium
CN114461762A (en) Archive change identification method, device, equipment and storage medium
CN114816219A (en) Data writing and reading method and device and data reading and writing system
CN112637293B (en) Data recovery system, method, device, electronic equipment and storage medium
CN110968267B (en) Data management method, device, server and system
CN113609123B (en) HBase-based mass user data deduplication storage method and device
US11797486B2 (en) File de-duplication for a distributed database
WO2022222665A1 (en) Request recognition method and apparatus, and device and storage medium
CN118035207A (en) Small file merging method and device based on HDFS (Hadoop distributed File System) framework and related medium
CN114553885A (en) DHT network-based storage method and device, electronic equipment and storage medium
WO2017014744A1 (en) Processing time-varying data using a graph data structure

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