CN110597852A - Data processing method, device, terminal and storage medium - Google Patents

Data processing method, device, terminal and storage medium Download PDF

Info

Publication number
CN110597852A
CN110597852A CN201910931214.3A CN201910931214A CN110597852A CN 110597852 A CN110597852 A CN 110597852A CN 201910931214 A CN201910931214 A CN 201910931214A CN 110597852 A CN110597852 A CN 110597852A
Authority
CN
China
Prior art keywords
target
key value
record data
record
data
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.)
Pending
Application number
CN201910931214.3A
Other languages
Chinese (zh)
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910931214.3A priority Critical patent/CN110597852A/en
Publication of CN110597852A publication Critical patent/CN110597852A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • 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

Landscapes

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

Abstract

The embodiment of the application discloses a data processing method, a device, a terminal and a storage medium, comprising the following steps: when target record data to be stored are acquired, determining a plurality of preset indexes for persistently storing the record data generated by the block chain network in a database; determining a key value set corresponding to the target record data according to the indexes, and storing the target record data in a record table corresponding to the indexes in a database according to the key value set, wherein the database is a database of an external storage device associated with the common node; and when the search operation aiming at the target record data is detected, determining a target index according to a key value input by the search operation, and searching in a record table corresponding to the target index to obtain the target record data. The embodiment of the application is beneficial to improving the data searching efficiency in a multi-index mode.

Description

Data processing method, device, terminal and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to the field of block chains, and in particular, to a data processing method, a data processing apparatus, a terminal, and a storage medium.
Background
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm, and is essentially a decentralized database. The size of each block of the block chain terminal is generally only several megabytes, and the size of the block can represent the size of a stored data packet, but as data transmission on the block chain is increased, the number of the blocks is increased rapidly, and all nodes in the block chain system need to store data in the whole block chain, so that a huge storage space is needed for storing the data of the whole block. In the existing blockchain system, data generated by a blockchain intelligent contract is generally stored in a local node of a blockchain, and because the local storage space of the node is limited, large-scale data cannot be stored, how to enable the node to store massive blockchain data, and enable the stored massive blockchain data to be read more quickly and efficiently is a hot problem which needs to be researched at present.
Disclosure of Invention
The embodiment of the application provides a data processing method, a data processing device, a terminal and a storage medium, and the data searching efficiency can be improved in a multi-index mode.
In a first aspect, an embodiment of the present application provides a data processing method, where the method is applied to a consensus node in a blockchain network, and the method includes:
when target record data to be stored are acquired, determining a plurality of preset indexes for persistently storing the record data generated by the block chain network in a database;
determining a key value set corresponding to the target record data according to the indexes, and storing the target record data in a record table corresponding to the indexes in a database according to the key value set, wherein the database is a database of an external storage device associated with the common node;
and when the search operation aiming at the target record data is detected, determining a target index according to a key value input by the search operation, and searching in a record table corresponding to the target index to obtain the target record data.
In a second aspect, an embodiment of the present application provides a data processing apparatus, including:
the device comprises an acquisition unit, a storage unit and a processing unit, wherein the acquisition unit is used for acquiring record data to be stored and detecting a currently set storage mode, and the storage mode is used for indicating a storage mode of the record data generated by the block chain network;
the acquisition unit is used for determining a plurality of preset indexes for persistently storing the record data generated by the block chain network in a database when the target record data to be stored is acquired;
the storage unit is used for determining a key value set corresponding to the target record data according to the indexes and storing the target record data in a record table corresponding to the indexes in a database according to the key value set, wherein the database is a database of an external storage device associated with the common identification node;
and the searching unit is used for determining a target index according to a key value input by the searching operation when the searching operation aiming at the target record data is detected, and searching in a record table corresponding to the target index to obtain the target record data.
In a third aspect, an embodiment of the present application provides a terminal, where the terminal includes an input device and an output device, and the terminal further includes:
a processor adapted to implement one or more instructions; and the number of the first and second groups,
a computer storage medium storing one or more instructions adapted to be loaded by the processor and to perform the steps of:
when target record data to be stored are acquired, determining a plurality of preset indexes for persistently storing the record data generated by the block chain network in a database;
determining a key value set corresponding to the target record data according to the indexes, and storing the target record data in a record table corresponding to the indexes in a database according to the key value set, wherein the database is a database of an external storage device associated with the common node;
and when the search operation aiming at the target record data is detected, determining a target index according to a key value input by the search operation, and searching in a record table corresponding to the target index to obtain the target record data.
In a fourth aspect, embodiments of the present application provide a computer storage medium storing one or more instructions adapted to be loaded by a processor and perform the steps of:
when target record data to be stored are acquired, determining a plurality of preset indexes for persistently storing the record data generated by the block chain network in a database;
determining a key value set corresponding to the target record data according to the indexes, and storing the target record data in a record table corresponding to the indexes in a database according to the key value set, wherein the database is a database of an external storage device associated with the common node;
and when the search operation aiming at the target record data is detected, determining a target index according to a key value input by the search operation, and searching in a record table corresponding to the target index to obtain the target record data.
When acquiring target record data to be stored, a common identification node of a blockchain network provided in an embodiment of the present application first determines a plurality of preset indexes used for persistently storing record data generated by the blockchain network in a database, and then determines a key value set corresponding to the target record data according to the plurality of indexes, and stores the target record data in a record table corresponding to the plurality of indexes in the database according to the key value set, where the database is a database of an external storage device associated with the common identification node, so that when a search operation for the target record data is detected, a target index is determined according to a key value input by the search operation, and the target record data is obtained after the search is performed in the record table corresponding to the target index. By adopting the mode, on one hand, the storage space of the consensus node is enlarged through the key external storage equipment, more block chain data can be stored, meanwhile, data generated by a block chain network is stored in a database of the external storage equipment in a table mode, and a multi-index storage mode is introduced, so that the searching conditions of the recorded data are enriched, the follow-up data searching is facilitated, and the searching efficiency of the data is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a block chain data sharing system according to an embodiment of the present invention;
FIG. 2 is a block diagram of an embodiment of the present invention;
FIG. 3 is a flow chart of a data processing method according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a record data generation according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a single index query in accordance with an embodiment of the present invention;
FIG. 6 is a diagram of a multi-index query, in accordance with an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a terminal according to an embodiment of the present application.
Detailed Description
The index is a structure for sequencing one or more columns of values in a database table, specific information in the database table can be quickly accessed by using the index, and in the prior blockchain system, the storage of blockchain data is only limited to local storage, and a primary key index is used. Generally, an index is established on columns which need to be searched frequently to accelerate the searching speed, a primary key index is composed of one or more columns and is used for uniquely identifying a certain record data in a data table, a table can have no primary key but only one primary key at most, and a primary key value cannot be null, the primary key is defined for the table in a database relational graph, the primary key index is automatically established, the primary key index is a specific type of the unique index, for example, a plurality of record data exist, and if a certain attribute group can uniquely identify a record data, the attribute group can become a primary key. For example, a student table (school number, name, gender, class) in which the number of each student is unique, a primary key, a course table (course number, course name, score) in which the course number is unique, a primary key, which requires that each value in the primary key be unique, when the primary key index is used in a query, quick access to data is allowed.
The Key-value distributed storage system is high in query speed, large in stored data volume, high in concurrency support, and very suitable for query through a main Key, but cannot perform query of complex conditions, wherein Key is a keyword, value is a value, the Key-value database is a database for storing data by Key value pairs, the whole database can be understood as a large map similar to the map in java, and each Key corresponds to a unique value. The Key-value distributed storage system has high query speed, large data storage quantity and high concurrency support, is very suitable for query through a main Key, cannot perform complex condition query due to the uniqueness of the main Key, and therefore, the embodiment of the application provides a data processing method which is applied to a consensus node in a block chain network, a plurality of consensus nodes in the block chain network form a block chain system, the consensus node can be any type of computing equipment accessed into the block chain network, such as a server, a user terminal and the like, the plurality of consensus nodes are connected in a network communication form and form a distributed block chain system, in the application, since the consensus node is associated with an external storage device with large capacity, target record data can be stored in a sub-table manner, that is, the target data can be stored in a plurality of corresponding recording tables with different indexes, the searching efficiency of the recorded data can be improved through a multi-index searching mode.
Referring to the blockchain data sharing system shown in fig. 1, the blockchain data sharing system 100 is a system for sharing data between a common node and a common node, and the data sharing system may include a plurality of common nodes, such as the common node 101, the common node 102, the common node 103, and the common node N, where the plurality of common nodes may refer to respective clients in the blockchain data sharing system. Each consensus node can receive input information during normal operation, and maintain shared data in the blockchain data sharing system based on the received input information. In order to ensure information intercommunication in the blockchain data sharing system, information connection can exist between each consensus node in the blockchain data sharing system, and information transmission can be carried out between the consensus nodes through the information connection. For example, when an arbitrary consensus node in the blockchain data sharing system receives input information, other consensus nodes in the blockchain data sharing system acquire the input information according to a consensus algorithm, and store the input information as data in shared data, so that the data stored in all the consensus nodes in the data sharing system are consistent, and therefore, the amount of recorded data required to be stored by the consensus nodes is large, and the consensus nodes need to have a very large storage space.
Each common node in the blockchain data sharing system can store node identifiers of other common nodes in the blockchain data sharing system, so that the generated blocks can be broadcast to other common nodes in the blockchain data sharing system according to the node identifiers of other common nodes. Each consensus node can maintain a node identification list shown in the following table, and the consensus node name and the node identification are correspondingly stored in the consensus node identification list. The node identifier may be an IP (internet protocol) address and any other information that can be used to identify the node, and table 1 only illustrates the IP address as an example.
Node name Node identification
Node 1 117.114.151.174
Node 2 117.116.189.145
Node N 119.123.789.258
Each consensus node in the blockchain data sharing system stores one identical blockchain. The block chain is composed of a plurality of blocks, referring to fig. 2, the block chain is composed of a plurality of blocks, the starting block includes a block header and a block main body, the block header stores an input information characteristic value, a version number, a timestamp and a difficulty value, and the block main body stores input information; the next block of the starting block takes the starting block as a parent block, the next block also comprises a block head and a block main body, the block head stores the input information characteristic value of the current block, the block head characteristic value of the parent block, the version number, the timestamp and the difficulty value, and the like, so that the block data stored in each block in the block chain is associated with the block data stored in the parent block, and the safety of the input information in the block is ensured.
The method for realizing multi-index of block chain intelligent contract data comprises the steps of inquiring a plurality of pieces of record data generated by an intelligent contract through different indexes, wherein the index of a table used for object persistent storage can be pre-specified during initialization of the intelligent contract, and a multi-index inquiry interface can be used by a consensus node after the block chain data is stored, so that the target record data can be searched from an external storage device of the consensus node through any index in the plurality of indexes, and the inquiry efficiency is improved. Firstly, when acquiring target record data to be stored, a common identification node needs to determine a plurality of preset indexes for record data generated by a persistent storage block chain in a database, each index in the plurality of indexes corresponds to one record table in the database, the database can store the record data generated by a block chain network in a table-by-table manner, and each record table corresponds to different indexes, so that a key value set corresponding to the target record data can be determined according to the plurality of indexes, which record tables the target record data is stored in the database can be determined according to the key value set of the target record data, when a search operation for the target record data is detected, a user can input any key word in the key word set, after the target index is determined according to the key word input by the user, the target record data can be searched through the target index and the key word input by the user, by introducing a multi-index mode, the searching conditions of the target record data are enriched, and the target record data which are searched by a user more efficiently and flexibly are facilitated.
Referring to the flowchart of fig. 3, the data processing method is applied to a consensus node in a blockchain network, where a plurality of consensus nodes maintain a blockchain, and the consensus node may be any type of computing device in an access blockchain network, such as a server, a user terminal, and the like. The method of an embodiment of the present application includes the following steps.
S301, when target record data to be stored is acquired, determining a plurality of preset indexes for persistently storing the record data generated by the block chain network in a database.
The blockchain system is also a data sharing system, data sharing can be performed among a plurality of common nodes in the data sharing system, each common node receives input information when performing normal work, and shared data in the data sharing system is maintained based on the received input information. For example, when any other consensus node in the data sharing system receives the input information, the other nodes in the data sharing system acquire the input information according to the consensus algorithm, and store the input information as data in shared data, so that the data stored in all the nodes in the data sharing system are consistent, and the target record data to be stored may be shared data.
When the consensus node realizes a specific service according to actual service requirements, recording data related to the service function and forming recorded data, wherein the recorded data carries a data signature to represent a source of the recorded data, the consensus node sends the recorded data to other consensus nodes in the block chain system, when the other consensus nodes verify the source of the recorded data and the integrity is successful, namely consensus is achieved, the recorded data is added to a temporary block chain, and the consensus node needs to store an updated block chain, namely the block chain of the recorded data is added. In the prior art, data generated by an intelligent contract is generally stored in a local computer, and in the application, a storage device for storing record data generated by the intelligent contract is additionally configured for a consensus node, so that mass storage is realized.
As shown in fig. 4, when a certain consensus node in the blockchain system, for example, the consensus node 1, receives information input by a client to the blockchain system through a blockchain interface, other consensus nodes in the blockchain system obtain the input information according to a consensus algorithm, a virtual machine of each consensus node executes logic enabling, checks through an account book, returns the input information to the client through the blockchain interface after the check is successful, synchronizes data to other nodes through the blockchain network, that is, sends the check data to other consensus nodes, and when all the consensus nodes are successfully checked, the shared data can be stored in the shared account book as record data to be stored. When target record data to be stored is acquired, the consensus node determines a plurality of preset indexes for storing record data generated by a block chain network in a database in a persistent manner, an external storage device of the consensus node is equivalent to a hard disk server, and the external storage device enables the consensus node to have a larger storage space, so that the record data generated by the block chain network can be stored in a form of a sub-table, wherein each record table is pre-established with a main key index, and the main key indexes of each table are different, for example, a name column is set as the main key index in a record table 1, an identity number column is set as the main key index in a record table 2, a home address column is set as the main key index in a record table 3, and it can be seen that each record table corresponds to a different index.
In a possible implementation, the database includes a plurality of record tables for storing record data generated by a plurality of block chains in a sub-table; the determining a plurality of preset indexes for persistently storing record data generated by the block chain network in a database comprises the following steps: determining a record table in which a plurality of record data generated by a target block chain are stored, wherein the target block chain is a block chain corresponding to the target record data; and determining a plurality of pre-established indexes according to the record table. The method comprises the steps that a plurality of record tables are included in a database, as a common identification node can be added into more than one block chain network, record data generated by a plurality of block chains can be stored in the plurality of record tables, when a plurality of indexes are determined, firstly, the record table which stores all record data of a target block chain in the plurality of record tables in the database is determined, the target record data is block chain data which needs to be added into the target block chain, therefore, the target record data needs to be stored in the record table which stores the target block chain, and therefore, a main key index corresponding to each record table in the database is not determined, but the plurality of indexes corresponding to the record table which stores the target block chain in the database are determined.
S302, determining a key value set corresponding to the target record data according to the indexes, and storing the target record data in a record table corresponding to the indexes in a database according to the key value set, wherein the database is a database of an external storage device associated with the common identification node.
The key value set corresponding to the target record data is determined according to a plurality of pre-established indexes, for example, according to a name index table, the key value of the target record data can be determined to be Zhang III, according to an identity card index, the key value of 500113200001019129 of the target record data can be determined, according to a home address index table, the key value of Shenzhen city Nanshan Guangdong sea street number 111 can be determined, and Zhang III, 500113200001019129 and Shenzhen city Nanshan city Guangdong sea street number 111 can form the key value set of the target record data, so that when the target record data is searched, the target record data can be searched by inputting any key value in the key value set.
In a possible implementation manner, the storing the target record data in a record table corresponding to the plurality of indexes in a database according to the key value set includes: determining an index corresponding to each key value in the key value set; and storing the target record data in a plurality of record tables of a database, wherein the record tables store a plurality of record data generated by the target block chain, according to the index corresponding to each key value. Each key in the target record data key value set corresponds to an index and a record table comprising the index, that is, each index corresponds to a record table, so that the target record data needs to be stored in the index record table corresponding to each key in the database, that is, the target record data needs to be simultaneously stored in a plurality of record tables, and the record data generated by the target block chain is stored in the plurality of record tables.
And S303, when the search operation aiming at the target record data is detected, determining a target index according to a key value input by the search operation, and searching in a record table corresponding to the target index to obtain the target record data.
When the search operation aiming at the target record data is detected, the target index is firstly determined according to the key value input by the user, for example, if the user inputs key value Zhang III, the name index and the record table corresponding to the name index can be determined, so that the target record data can be searched under the condition of Zhang III in the record table corresponding to the name index, in addition, the user can also input 500113200001019129, the record table corresponding to the identity card number index and the identity card number index can be determined, so that the target record data can be searched under the condition of 500113200001019129 in the record table corresponding to the identity card number index, and the target record data can be searched through different indexes. As shown in fig. 5, in the prior art, data generated by an intelligent contract is stored in a local consensus node, and when data is queried, data is queried through a K/V operation, that is, one piece of recorded data only corresponds to one key value, and the recorded data can be found only by inputting the key value, but in the present application, as shown in fig. 6, not only data generated by the intelligent contract can be stored through an external storage device, but also one piece of recorded data can correspond to multiple key values through a multi-index manner, and the recorded data can be found by inputting any key value, so that the data finding efficiency is improved.
In a possible implementation manner, the determining a target index according to a key value input by the search operation, and obtaining the target record data after performing search in a record table corresponding to the target index includes: when the input key value is detected to be a key value in a key value set corresponding to the target record data, determining a target index corresponding to the input key value; and acquiring a record table corresponding to the target index, and searching record data comprising the input key value in the record table corresponding to the target index by taking the input key value as a searching condition. When a user needs to search target record data, any key value in a key value set corresponding to input target data can be selected, when the key input by the user is detected, whether the key value is a certain key value in the key value set is determined, if yes, searching operation is executed, and if not, searching is failed. If so, firstly, determining a target index corresponding to a key value input by a user, determining a record table of target record data searched by the user according to the target index, searching a plurality of pieces of record data stored in the record table by taking the input key value as a searching condition, wherein the plurality of pieces of record data comprise the key value, and determining the record data as the target record data to be searched.
In a possible implementation, the determining a target index according to the key value input by the lookup operation includes: determining priorities of a first key value and a second key value when detecting that the input key values include the first key value and the second key value; when detecting that the priority of the first key value is higher than that of the second key value, determining that a first index corresponding to the first key value is the target index. When the user is uncertain about the key value included in the target record data, two key values can be input simultaneously, if only one of the two key values is the key value in the key value set of the target record data, the target record data can be searched, when the first key value and the second key value input by the user are both key values in the key value set, only one search may be performed, so that one key value is selected from two key values input by the user as a search condition, but priorities of the first key value and the second key value are determined, when it is detected that the priority of the first key value is higher than the priority of the second key value, the first key value may be used as a search condition, a first index corresponding to the first key value is determined as a target index, and target record data is searched in a record table corresponding to the first index. In addition, when only the first key value is a key value in the key value set in the first key value and the second key value, the first index corresponding to the first key value is the target index.
In one possible embodiment, the method further comprises: after the target record data is found, establishing a search record table; and saving a search record of the target record data in the search record table, wherein the search record comprises the target record data and a key value set used for searching the target record data, and the priority of the input key value is greater than the priority of other key values in the key value set. After the target record data is found, a search record table can be newly established in the database, the search record table stores a plurality of pieces of searched record data and search records of the record data, the search records of the target record data are stored in the search record table, the search records can comprise the target record data, a key value set of the target record data and a key value input by a user when the target record data is searched, the input key value is higher than other key values in the key value set, because the storage device stores the record data generated by a massive block chain network, the search process needs a certain processing time, how to help the user to improve the search efficiency is the problem which needs to be solved by the data processing method provided by the application, besides introducing multiple indexes and enriching the search conditions, the search records of the user can be stored and the search record table can be generated, after a certain record data is searched, the probability that the record data is searched and used again is considered to be very high, and the record data may be data which is frequently used by a user, therefore, after a search record table is established, when a certain record data is searched next time, the target record data can be searched simultaneously through a multi-table query mode corresponding to a multi-index and a single-table query mode corresponding to a query search record table, so as to improve the search efficiency, in addition, after a certain key value in a key value set is input by the user and the target record data is searched through the key value, the priority of the key value is improved, because when the user inputs a certain key value for many times, the user memorizes the key value more deeply, the probability of searching the record data through inputting the key value subsequently is high, therefore, the number of times of inputting a certain key value determines the priority of the key value, the larger the number of times of being input, the higher the priority.
In a possible implementation manner, in the record tables corresponding to the plurality of indexes, the record table with the searched times larger than a preset threshold is determined according to the search record table; and loading the data in the record table with the searched times larger than a preset threshold value into the memory of the external storage device. The search record table stores a plurality of searched record data, the index corresponding to the key value input by each record data may be different, for example, 100 record data are stored, it is found that 70 record data are searched by name index, 20 record data are searched by home address index, 10 record data are searched by identity number index, it can be seen that when a user searches a record data, the user prefers to input name to actually search the record data because name is also convenient for the user to remember, therefore, the record table corresponding to the name index is the most frequently used record table for searching record data, and when it is detected that the number of search times of a record table is greater than the preset threshold, the storage device may load the data in the record table whose number of search times is greater than the preset threshold into the memory in advance, the data in other recording tables can be stored in the external or the magnetic disk, and the data in the recording tables are loaded in advance, so that the data in the recording tables can be read quickly when the record number is searched subsequently, which is equivalent to improving the priority and the data reading speed of the recording table corresponding to the name index.
In the embodiment of the application, when acquiring target record data to be stored, a consensus node of a block chain network firstly determines a plurality of preset indexes used for persistently storing the record data generated by the block chain network in a database, secondly determines a key value set corresponding to the target record data according to the indexes, stores the target record data in a record table corresponding to the indexes in the database according to the key value set, and the database is a database of an external storage device associated with the consensus node, so that when a search operation aiming at the target record data is detected, a target index is determined according to a key value input by the search operation, and the target record data is obtained after the search is performed in the record table corresponding to the target index. By adopting the mode, on one hand, the storage space of the consensus node is enlarged through the key external storage equipment, more block chain data can be stored, meanwhile, data generated by a block chain network is stored in a database of the external storage equipment in a table mode, and a multi-index storage mode is introduced, so that the searching conditions of the recorded data are enriched, the follow-up data searching is facilitated, and the searching efficiency of the data is improved.
Based on the description of the above data processing method embodiment, the embodiment of the present application also discloses a data processing apparatus, which may be a computer program (including a program code) running in a terminal. The data processing apparatus may perform the method illustrated in fig. 3. Referring to fig. 7, the data processing apparatus may operate the following units:
an obtaining unit 701, configured to determine, when target record data to be stored is obtained, a plurality of preset indexes used for persistently storing, in a database, record data generated by the block chain network;
a storage unit 702, configured to determine a key value set corresponding to the target record data according to the multiple indexes, and store the target record data in a record table corresponding to the multiple indexes in a database according to the key value set, where the database is a database of an external storage device associated with the consensus node;
the searching unit 703 is configured to, when a search operation for the target record data is detected, determine a target index according to a key value input by the search operation, and perform a search in a record table corresponding to the target index to obtain the target record data.
In one embodiment, the database comprises a plurality of record tables for storing record data generated by a plurality of block chains in a sub-table; the obtaining unit 701, when determining a plurality of preset indexes for persistently storing the record data generated by the blockchain network in the database, is specifically configured to: determining a record table in which a plurality of record data generated by a target block chain are stored, wherein the target block chain is a block chain corresponding to the target record data; and determining a plurality of pre-established indexes according to the record table.
In an embodiment, when the target record data is stored in the record table corresponding to the plurality of indexes in the database according to the key value set, the storage unit 702 is specifically configured to: determining an index corresponding to each key value in the key value set; and storing the target record data in a plurality of record tables of a database, wherein the record tables store a plurality of record data generated by the target block chain, according to the index corresponding to each key value.
In an embodiment, when the searching unit 703 determines a target index according to the key value input by the search operation, and performs searching in a record table corresponding to the target index to obtain the target record data, the searching unit is specifically configured to: when the input key value is detected to be a key value in a key value set corresponding to the target record data, determining a target index corresponding to the input key value; and acquiring a record table corresponding to the target index, and searching record data comprising the input key value in the record table corresponding to the target index by taking the input key value as a searching condition.
In an embodiment, when determining the target index according to the key value input by the lookup operation, the lookup unit 703 is specifically configured to: determining priorities of a first key value and a second key value when detecting that the input key values include the first key value and the second key value; when detecting that the priority of the first key value is higher than that of the second key value, determining that a first index corresponding to the first key value is the target index.
In an embodiment, the search unit 703 is specifically configured to: after the target record data is found, establishing a search record table; and saving a search record of the target record data in the search record table, wherein the search record comprises the target record data and a key value set used for searching the target record data, and the priority of the input key value is greater than the priority of other key values in the key value set.
In an embodiment, the search unit 703 is specifically configured to: determining a record table with the searched times larger than a preset threshold value in the record tables corresponding to the plurality of indexes according to the search record table; and loading the data in the record table with the searched times larger than a preset threshold value into the memory of the external storage device.
According to an embodiment of the present application, the steps involved in the method shown in fig. 3 may be performed by units in the data processing apparatus shown in fig. 7. For example, step S301 shown in fig. 3 may be performed by the acquisition unit 701 shown in fig. 7, step S302 may be performed by the storage unit 702 shown in fig. 7, and step S303 may be performed by the lookup unit 703 shown in fig. 7.
According to another embodiment of the present application, the units in the data processing apparatus shown in fig. 7 may be respectively or entirely combined into one or several other units to form one or several other units, or some unit(s) therein may be further split into multiple functionally smaller units to form one or several other units, which may achieve the same operation without affecting the achievement of the technical effect of the embodiment of the present application. The units are divided based on logic functions, and in practical application, the functions of one unit can be realized by a plurality of units, or the functions of a plurality of units can be realized by one unit. In other embodiments of the present application, the data processing apparatus may also include other units, and in practical applications, these functions may also be implemented by being assisted by other units, and may be implemented by cooperation of a plurality of units.
According to another embodiment of the present application, the data processing apparatus device as shown in fig. 7 may be constructed by running a computer program (including program codes) capable of executing the steps involved in the corresponding method as shown in fig. 3 on a general-purpose computing device such as a computer including a processing element such as a Central Processing Unit (CPU), a random access storage medium (RAM), a read-only storage medium (ROM), and a storage element, and implementing the data processing method of the embodiment of the present application. The computer program may be recorded on a computer-readable recording medium, for example, and loaded and executed in the above-described computing apparatus via the computer-readable recording medium.
When acquiring target record data to be stored, a common identification node of a blockchain network provided in an embodiment of the present application first determines a plurality of preset indexes used for persistently storing record data generated by the blockchain network in a database, and then determines a key value set corresponding to the target record data according to the plurality of indexes, and stores the target record data in a record table corresponding to the plurality of indexes in the database according to the key value set, where the database is a database of an external storage device associated with the common identification node, so that when a search operation for the target record data is detected, a target index is determined according to a key value input by the search operation, and the target record data is obtained after the search is performed in the record table corresponding to the target index. By adopting the mode, on one hand, the storage space of the consensus node is enlarged through the key external storage equipment, more block chain data can be stored, meanwhile, data generated by a block chain network is stored in a database of the external storage equipment in a table mode, and a multi-index storage mode is introduced, so that the searching conditions of the recorded data are enriched, the follow-up data searching is facilitated, and the searching efficiency of the data is improved.
Based on the description of the method embodiment and the device embodiment, the embodiment of the application also provides a user terminal. Referring to fig. 8, the terminal includes at least a processor 801, an input device 802, an output device 803, and a computer storage medium 804. The processor 801, the input device 802, the output device 803, and the computer storage medium 804 within the terminal may be connected by a bus or other means.
A computer storage medium 804 may be stored in the memory of the user terminal, the computer storage medium 804 being for storing a computer program comprising program instructions, the processor 801 being for executing the program instructions stored by the computer storage medium 804. The processor 801 (or CPU) is a computing core and a control core of the terminal, and is adapted to implement one or more instructions, and in particular, is adapted to load and execute the one or more instructions so as to implement a corresponding method flow or a corresponding function; in one embodiment, the processor 801 according to the embodiment of the present application may be configured to perform a series of data processing, including: when target record data to be stored are acquired, determining a plurality of preset indexes for persistently storing the record data generated by the block chain network in a database; determining a key value set corresponding to the target record data according to the indexes, and storing the target record data in a record table corresponding to the indexes in a database according to the key value set, wherein the database is a database of an external storage device associated with the common node; and when the search operation aiming at the target record data is detected, determining a target index according to a key value input by the search operation, searching in a record table corresponding to the target index to obtain the target record data, and the like.
An embodiment of the present application further provides a computer storage medium (Memory), which is a Memory device in the terminal and is used for storing programs and data. It is understood that the computer storage medium herein may include a built-in storage medium in the terminal, and may also include an extended storage medium supported by the user terminal. The computer storage medium provides a storage space that stores an operating system of the user terminal. Also stored in this memory space are one or more instructions, which may be one or more computer programs (including program code), suitable for loading and execution by processor 801. The computer storage medium may be a high-speed RAM memory, or may be a non-volatile memory (non-volatile memory), such as at least one disk memory; and optionally at least one computer storage medium located remotely from the processor.
In one embodiment, one or more instructions stored in a computer storage medium may be loaded and executed by processor 801 to perform the corresponding steps of the methods described above in connection with the data processing embodiments; in particular implementations, one or more instructions in the computer storage medium are loaded and executed by the processor 801 to perform the steps of:
when target record data to be stored are acquired, determining a plurality of preset indexes for persistently storing the record data generated by the block chain network in a database;
determining a key value set corresponding to the target record data according to the indexes, and storing the target record data in a record table corresponding to the indexes in a database according to the key value set, wherein the database is a database of an external storage device associated with the common node;
and when the search operation aiming at the target record data is detected, determining a target index according to a key value input by the search operation, and searching in a record table corresponding to the target index to obtain the target record data.
In yet another embodiment, the database comprises a plurality of record tables for storing record data generated by a plurality of block chains in a sub-table; in the determining the preset indexes for persistently storing the record data generated by the blockchain network in the database, the one or more instructions may be further loaded and specifically executed by the processor 801: determining a record table in which a plurality of record data generated by a target block chain are stored, wherein the target block chain is a block chain corresponding to the target record data; and determining a plurality of pre-established indexes according to the record table.
In another embodiment, when the target record data is stored in the record table corresponding to the plurality of indexes in the database according to the key value set, the one or more instructions may be further loaded and specifically executed by the processor 801: determining an index corresponding to each key value in the key value set; and storing the target record data in a plurality of record tables of a database, wherein the record tables store a plurality of record data generated by the target block chain, according to the index corresponding to each key value.
In another embodiment, when the target index is determined according to the key value input by the search operation, and the target record data is obtained after the target index is searched in the record table corresponding to the target index, the one or more instructions may be loaded and specifically executed by the processor 801: when the input key value is detected to be a key value in a key value set corresponding to the target record data, determining a target index corresponding to the input key value; and acquiring a record table corresponding to the target index, and searching record data comprising the input key value in the record table corresponding to the target index by taking the input key value as a searching condition.
In yet another embodiment, when determining the target index according to the key value input by the lookup operation, the one or more instructions may be further loaded and specifically executed by the processor 801: determining priorities of a first key value and a second key value when detecting that the input key values include the first key value and the second key value; when detecting that the priority of the first key value is higher than that of the second key value, determining that a first index corresponding to the first key value is the target index.
In yet another embodiment, the one or more instructions may be further loaded and specifically executed by the processor 801: after the target record data is found, establishing a search record table; and saving a search record of the target record data in the search record table, wherein the search record comprises the target record data and a key value set used for searching the target record data, and the priority of the input key value is greater than the priority of other key values in the key value set.
In yet another embodiment, the one or more instructions may be further loaded and specifically executed by the processor 801: determining a record table with the searched times larger than a preset threshold value in the record tables corresponding to the plurality of indexes according to the search record table; and loading the data in the record table with the searched times larger than a preset threshold value into the memory of the external storage device.
When acquiring target record data to be stored, a common identification node of a blockchain network provided in an embodiment of the present application first determines a plurality of preset indexes used for persistently storing record data generated by the blockchain network in a database, and then determines a key value set corresponding to the target record data according to the plurality of indexes, and stores the target record data in a record table corresponding to the plurality of indexes in the database according to the key value set, where the database is a database of an external storage device associated with the common identification node, so that when a search operation for the target record data is detected, a target index is determined according to a key value input by the search operation, and the target record data is obtained after the search is performed in the record table corresponding to the target index. By adopting the mode, on one hand, the storage space of the consensus node is enlarged through the key external storage equipment, more block chain data can be stored, meanwhile, data generated by a block chain network is stored in a database of the external storage equipment in a table mode, and a multi-index storage mode is introduced, so that the searching conditions of the recorded data are enriched, the follow-up data searching is facilitated, and the searching efficiency of the data is improved.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present application and is not to be construed as limiting the scope of the present application, so that the present application is not limited thereto, and all equivalent variations and modifications can be made to the present application.

Claims (10)

1. A data processing method is applied to a consensus node in a block chain network, and comprises the following steps:
when target record data to be stored are acquired, determining a plurality of preset indexes for persistently storing the record data generated by the block chain network in a database;
determining a key value set corresponding to the target record data according to the indexes, and storing the target record data in a record table corresponding to the indexes in a database according to the key value set, wherein the database is a database of an external storage device associated with the common node;
and when the search operation aiming at the target record data is detected, determining a target index according to a key value input by the search operation, and searching in a record table corresponding to the target index to obtain the target record data.
2. The method of claim 1, wherein the database comprises a plurality of record tables for storing record data generated by a plurality of block chains in a table; the determining a plurality of preset indexes for persistently storing record data generated by the block chain network in a database comprises the following steps:
determining a record table in which a plurality of record data generated by a target block chain are stored, wherein the target block chain is a block chain corresponding to the target record data;
and determining a plurality of pre-established indexes according to the record table.
3. The method of claim 1 or 2, wherein the storing the target record data in a record table corresponding to the plurality of indexes in a database according to the key value set comprises:
determining an index corresponding to each key value in the key value set;
and storing the target record data in a plurality of record tables of a database, wherein the record tables store a plurality of record data generated by the target block chain, according to the index corresponding to each key value.
4. The method according to claim 1 or 2, wherein the determining a target index according to the key value input by the search operation, and obtaining the target record data after searching in a record table corresponding to the target index comprises:
when the input key value is detected to be a key value in a key value set corresponding to the target record data, determining a target index corresponding to the input key value;
and acquiring a record table corresponding to the target index, and searching record data comprising the input key value in the record table corresponding to the target index by taking the input key value as a searching condition.
5. The method of claim 1 or 2, wherein determining a target index based on a key value input by the lookup operation comprises:
determining priorities of a first key value and a second key value when detecting that the input key values include the first key value and the second key value;
when detecting that the priority of the first key value is higher than that of the second key value, determining that a first index corresponding to the first key value is the target index.
6. The method of claim 1, wherein the method further comprises:
after the target record data is found, establishing a search record table;
and saving a search record of the target record data in the search record table, wherein the search record comprises the target record data and a key value set used for searching the target record data, and the priority of the input key value is greater than the priority of other key values in the key value set.
7. The method of claim 6, wherein the method further comprises:
determining a record table with the searched times larger than a preset threshold value in the record tables corresponding to the plurality of indexes according to the search record table;
and loading the data in the record table with the searched times larger than a preset threshold value into the memory of the external storage device.
8. A data processing apparatus, comprising:
the acquisition unit is used for determining a plurality of preset indexes for persistently storing the record data generated by the block chain network in a database when the target record data to be stored is acquired;
the storage unit is used for determining a key value set corresponding to the target record data according to the indexes and storing the target record data in a record table corresponding to the indexes in a database according to the key value set, wherein the database is a database of an external storage device associated with the common identification node;
and the searching unit is used for determining a target index according to a key value input by the searching operation when the searching operation aiming at the target record data is detected, and searching in a record table corresponding to the target index to obtain the target record data.
9. A terminal, characterized in that it comprises a processor, an input device, an output device and a memory, said processor, input device, output device and memory being interconnected, wherein said memory is used to store a computer program, said computer program comprising program instructions, said processor being configured to invoke said program instructions to execute the multimedia playback method according to any of claims 1-7.
10. A computer storage medium storing computer program instructions adapted to be loaded by a processor and to perform a multimedia playback method as claimed in any one of claims 1 to 7.
CN201910931214.3A 2019-09-27 2019-09-27 Data processing method, device, terminal and storage medium Pending CN110597852A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910931214.3A CN110597852A (en) 2019-09-27 2019-09-27 Data processing method, device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910931214.3A CN110597852A (en) 2019-09-27 2019-09-27 Data processing method, device, terminal and storage medium

Publications (1)

Publication Number Publication Date
CN110597852A true CN110597852A (en) 2019-12-20

Family

ID=68864677

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910931214.3A Pending CN110597852A (en) 2019-09-27 2019-09-27 Data processing method, device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN110597852A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111310137A (en) * 2020-03-23 2020-06-19 杭州溪塔科技有限公司 Block chain associated data evidence storing method and device and electronic equipment
CN111782707A (en) * 2020-06-19 2020-10-16 北京海益同展信息科技有限公司 Data query method and system
CN112817980A (en) * 2021-02-05 2021-05-18 腾讯科技(深圳)有限公司 Data index processing method, device, equipment and storage medium
CN113177224A (en) * 2021-03-16 2021-07-27 深圳市名竹科技有限公司 Block chain based data sealing method, device, equipment and storage medium
CN113407811A (en) * 2021-07-06 2021-09-17 广州汇思信息科技股份有限公司 Table dividing method and device for learning platform, computer equipment and storage medium
CN115563103A (en) * 2022-09-15 2023-01-03 河南星环众志信息科技有限公司 Multi-dimensional aggregation method, system, electronic device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107464118A (en) * 2017-08-16 2017-12-12 济南浪潮高新科技投资发展有限公司 A kind of data trade method based on block chain intelligence contract
CN108197947A (en) * 2017-12-27 2018-06-22 深圳市轱辘车联数据技术有限公司 A kind of vehicle accessory data processing method and device for block chain
CN109408551A (en) * 2018-08-06 2019-03-01 杭州复杂美科技有限公司 Data query method and system, common recognition method and system, equipment and storage medium
CN109766707A (en) * 2019-01-17 2019-05-17 南方科技大学 Data processing method, device, equipment and medium based on block chain
US20190227999A1 (en) * 2018-01-23 2019-07-25 Swoop Inc. High-accuracy data processing and machine learning techniques for sensitive data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107464118A (en) * 2017-08-16 2017-12-12 济南浪潮高新科技投资发展有限公司 A kind of data trade method based on block chain intelligence contract
CN108197947A (en) * 2017-12-27 2018-06-22 深圳市轱辘车联数据技术有限公司 A kind of vehicle accessory data processing method and device for block chain
US20190227999A1 (en) * 2018-01-23 2019-07-25 Swoop Inc. High-accuracy data processing and machine learning techniques for sensitive data
CN109408551A (en) * 2018-08-06 2019-03-01 杭州复杂美科技有限公司 Data query method and system, common recognition method and system, equipment and storage medium
CN109766707A (en) * 2019-01-17 2019-05-17 南方科技大学 Data processing method, device, equipment and medium based on block chain

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111310137A (en) * 2020-03-23 2020-06-19 杭州溪塔科技有限公司 Block chain associated data evidence storing method and device and electronic equipment
CN111782707A (en) * 2020-06-19 2020-10-16 北京海益同展信息科技有限公司 Data query method and system
CN111782707B (en) * 2020-06-19 2024-04-16 京东科技信息技术有限公司 Data query method and system
CN112817980A (en) * 2021-02-05 2021-05-18 腾讯科技(深圳)有限公司 Data index processing method, device, equipment and storage medium
CN113177224A (en) * 2021-03-16 2021-07-27 深圳市名竹科技有限公司 Block chain based data sealing method, device, equipment and storage medium
CN113407811A (en) * 2021-07-06 2021-09-17 广州汇思信息科技股份有限公司 Table dividing method and device for learning platform, computer equipment and storage medium
CN115563103A (en) * 2022-09-15 2023-01-03 河南星环众志信息科技有限公司 Multi-dimensional aggregation method, system, electronic device and storage medium
CN115563103B (en) * 2022-09-15 2023-12-08 河南星环众志信息科技有限公司 Multi-dimensional aggregation method, system, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110597852A (en) Data processing method, device, terminal and storage medium
US11347787B2 (en) Image retrieval method and apparatus, system, server, and storage medium
WO2015106711A1 (en) Method and device for constructing nosql database index for semi-structured data
CN107783980B (en) Index data generation and data query method and device, and storage and query system
CN107015985B (en) Data storage and acquisition method and device
CN107368527B (en) Multi-attribute index method based on data stream
CN111008521B (en) Method, device and computer storage medium for generating wide table
CN108228799B (en) Object index information storage method and device
CN109299101B (en) Data retrieval method, device, server and storage medium
CN103077208A (en) Uniform resource locator matching processing method and device
CN112214468B (en) Small file acceleration method, device, equipment and medium for distributed storage system
CN108154024B (en) Data retrieval method and device and electronic equipment
CN111026709B (en) Data processing method and device based on cluster access
CN111427931A (en) Distributed query engine and method for querying relational database by using same
CN114491199A (en) Data retrieval method, device and system
CN111125216B (en) Method and device for importing data into Phoenix
CN116561382A (en) Data processing method, device, equipment and storage medium of graph database
CN108345699B (en) Method, device and storage medium for acquiring multimedia data
CN116450607A (en) Data processing method, device and storage medium
US10042957B2 (en) Devices and methods for implementing dynamic collaborative workflow systems
CN112181994B (en) Method, device and medium for refreshing distributed memory database of operation and maintenance big data
CN115658680A (en) Data storage method, data query method and related device
CN114398373A (en) File data storage and reading method and device applied to database storage
JP7133037B2 (en) Message processing method, device and system
CN115543993A (en) Data processing method and device, electronic equipment and 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