System and method for co-optimization of index update and query processing based on multi-granularity locks
By using a collaborative optimization system for index update and query processing based on multi-granularity locks, the problem of poor performance in verifiable index updates and queries in blockchains is solved. This system achieves efficient concurrent processing and scalability, meets the high-concurrency operation requirements of graph blockchains, and ensures the credibility and integrity of query results.
Patent Information
- Application Number
- CN202310225485.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-02
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2043-03-02
AI Technical Summary
In existing technologies, the update and query performance of blockchain verifiable indexes is poor, and their applicability is limited, making it difficult to meet the needs of efficient index processing in graph blockchains.
A collaborative optimization system for index update and query processing based on multi-granularity locks is adopted. The system achieves concurrent control of the index through the multi-granularity lock mechanism, optimizes the index update and query process, and includes a client, a verifiable index auxiliary system, and a graph blockchain system. Multi-granularity locks are used to reduce conflicts and achieve efficient parallel processing.
It achieves efficient index updates and queries, supports the asynchronous features of graph blockchain, improves the index's concurrent processing capabilities and scalability, meets the needs of high-concurrency operations, and ensures the correctness and completeness of query results.
Smart Images

Figure CN116383241B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the design of a collaborative optimization method for index update and query processing based on a multi-granularity locking mechanism, belonging to the technical field of blockchain index application research. Background Technology
[0002] Blockchain is essentially a distributed data ledger maintained by multiple, mutually distrustful nodes, characterized by decentralization, immutability, and traceability. Specifically, blockchain achieves redundant data storage across multiple nodes based on mechanisms such as hash chain consistency and distributed consensus, thus mitigating some of the security issues inherent in centralized storage models. While blockchain alleviates the shortcomings of traditional data storage methods like databases and improves the security and trustworthiness of stored data through relatively stringent security models, verifiable querying remains a necessary means to ensure data security in scenarios with high security requirements and vulnerable environments.
[0003] Verifiable querying of blockchain data is fundamental to ensuring data trustworthiness. Trustworthiness is determined by verifying query results, which must simultaneously satisfy both correctness and completeness. To meet the verification requirements of query results, building a verifiable query index based on the relationships between data is an excellent solution. A verifiable index generates verifiable information simultaneously with the query results and ensures data correctness based on this information. However, verifiable indexes are highly correlated with the data and need to be updated in real time as the data updates. As the scale of blockchain data continues to expand, the size of the verifiable index also grows positively correlated, leading to a rapid increase in the overhead of updating and querying the index. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention proposes a collaborative optimization system and method for index update and query processing based on multi-granularity locks, thereby alleviating the problems of poor index query and update performance and limited applicability. It better suits the asynchronous characteristics of graph blockchains. The efficient index processing method optimizes the update and query processes, playing a decisive role in the widespread application of verifiable indexes in graph blockchains. By reducing conflicts between index queries and updates in graph blockchains, it achieves efficient parallel processing of indexes, meeting the needs of efficient index updates and dynamic query processing.
[0005] The technical solution of this invention is:
[0006] A collaborative optimization system for index update and query processing based on multi-granularity locks is proposed. This collaborative optimization system includes a client, a verifiable index auxiliary system, and a graph blockchain system. The client includes a transaction processing module, an index verification module, an index query module, and a key management module. The verifiable index auxiliary system includes a transaction acquisition module and an index concurrency processing module. The graph blockchain system includes a routing module and a graph blockchain module.
[0007] The key management module is mainly responsible for managing user accounts and the public and private keys used by users when communicating with the verifiable index auxiliary system and the graph blockchain system. To ensure the trustworthiness of information transmission, the communication messages are encrypted in an asymmetric encryption manner during the communication process, ensuring that all messages transmitted in the communication channel are encrypted information and avoiding security risks. In addition, when initiating a transaction in the graph blockchain system, the user's certificate, key, address and other information are required. This information is also stored through the key management module to meet the needs of multiple users.
[0008] The transaction processing module is mainly responsible for processing blockchain transactions and communicating with the graph blockchain system. To support more user needs, the transaction processing module supports parsing user requests, generating corresponding blockchain transaction formats according to user needs, calling smart contract requests and sending them to the graph blockchain system. In addition, the transaction processing module also supports processing blockchain transaction results. By parsing the blockchain transaction results, it sends back parameters such as transaction status and transaction cost to the user.
[0009] The index query module is mainly used to communicate with the verifiable index auxiliary system, obtain verifiable index information by generating a formatted request based on blockchain data, and verify the correctness and integrity of the data through the index verification module.
[0010] The index verification module is mainly used to verify the blockchain data query results using verifiable indexes, verifying their credibility and completeness. The index verification module reconstructs the index using the data query results returned by the graph blockchain system and the verification structure returned by the verifiable index auxiliary system, and compares the hash of the reconstructed index with the hash value obtained from the blockchain query to determine the credibility and completeness of the results.
[0011] The transaction acquisition module is mainly responsible for communication functions with other modules, including receiving index query requests from the client, sending query results and verification structures back to the client, and receiving index update requests from the graph blockchain system. The transaction acquisition module stores its own and each user's public and private keys for encrypting and decrypting communication data. In addition, when there is a high confidentiality requirement, the transaction acquisition module can perform access control on users based on user certificates to prevent unauthorized users from accessing the index or causing damage to the system.
[0012] The index concurrency processing module is primarily responsible for the concurrent control of read and update operations on the verifiable index. By implementing a control mechanism based on multi-granularity locks, it improves the concurrent processing capability and scalability of the verifiable index. Specifically, when the index concurrency processing module receives a new verifiable index update request, it determines which nodes of the verifiable index are involved and whether these nodes are being accessed or updated. Based on the determination result, the index concurrency processing module generates corresponding processing logic, such as locking with coarse-grained locks, generating fine-grained locks, and sorting and waiting for unlocking. The index concurrency processing module processes the corresponding area of the verifiable index according to the processing logic, thereby achieving efficient updates and queries of the verifiable index.
[0013] The routing module is mainly responsible for connecting users and blockchains. Different blockchains have significant differences in the information required to initiate transactions, transaction deconstruction, and smart contract invocation methods. Furthermore, blockchains may exist inside some hard-to-reach networks. Therefore, by designing a standard interface, the significant differences between blockchains and various problems in network communication can be shielded from users. The routing module, as a standardized interface, is used to reduce the coupling between modules in the system and improve the scalability of the system.
[0014] The graph blockchain module is mainly responsible for storing data information, storing verification information such as verifiable index root hash values, and supporting other smart contract needs of users. The graph blockchain module provides users with the ability to query and update data, as well as the ability to process and calculate data according to smart contracts.
[0015] A collaborative optimization method for index update and query processing based on multi-granularity locks, which includes an index update part and an index verification part;
[0016] The steps in the index update section include:
[0017] Step S11: The user initiates a blockchain transaction request through the client. When initiating the request, the user first provides information such as the CA certificate, blockchain account address, smart contract address, and transaction parameters. The client then generates the request according to a standardized format. Furthermore, the client uses its locally stored public and private keys to encrypt the request, protecting its confidentiality during transmission.
[0018] Step S12: After receiving the encryption request, the routing module of the graph blockchain system decrypts it using the corresponding private key to obtain the request information. The routing module then initiates a transaction request to the corresponding blockchain based on the request information.
[0019] Step S13: The graph blockchain module executes the request and updates the blockchain ledger data. Simultaneously, the graph blockchain system initiates an index update request to the verifiable index auxiliary system through the routing module, thereby ensuring the consistency between the verifiable index and the ledger data in the blockchain.
[0020] Step S14: The verifiable index auxiliary system receives the index update request, decrypts the request to obtain information such as the key value to be updated and the corresponding transaction block number, and determines all index nodes affected by the key value to be updated and whether these nodes are being accessed or updated, i.e., the locking status of these nodes, based on this information and the current status of the verifiable index.
[0021] Step S15: Based on the locking status, if the node to be updated is not affected or locked by other update transactions, meaning the current update can be processed in parallel with other updates, the index concurrency processing module generates the smallest granularity lock based on the scope of influence of the current update, that is, only locking the nodes that need to be modified due to the current update. The index concurrency processing module minimizes the possibility of potential lock conflicts through fine-grained locking.
[0022] Based on the locking status, if the node to be updated is already locked by another transaction, it means that there is an intersection between the current update and the ongoing update. In this case, the index concurrency processing module first determines the intersection between transactions and applies coarse-grained locks to the intersection node and its related nodes to prevent the concurrent modifications of the index by multiple transactions from affecting the unlocked nodes.
[0023] Step S16: After locking is completed, the index concurrency processing module updates the verifiable index according to the index update request. Index update operations typically involve multiple nodes; therefore, the index system prioritizes updating the nodes locked by coarse-grained locks involved in the current request. The purpose is to reduce the locking time of coarse-grained locks through high-priority operations, thereby reducing the overall impact of the current update request on index concurrency updates. If the current request does not have a coarse-grained lock, the update starts from the highest-level node involved.
[0024] Step S17: After all nodes corresponding to the coarse-grained lock have been updated, the index concurrency processing module will first unlock the coarse-grained lock to reduce the impact on concurrent updates. Once all index updates are complete, the index concurrency processing module will unlock the remaining locked nodes and return a success message to the client.
[0025] The steps in the index verification section include:
[0026] Step S21: The user initiates a blockchain transaction request through the client to obtain the required data and verifiable index root hash from the blockchain. When initiating the request, the user first provides information such as CA certificate, blockchain account address, smart contract address, and transaction parameters, and the client generates the request according to a standardized format.
[0027] Step S22: The graph blockchain system verifies the user certificate, blockchain account address, etc. After successful verification, it returns encrypted ledger data and a verifiable index root hash to the client.
[0028] Step S23: The user generates a verification request based on the blockchain return result, initiates a trustworthiness verification request to the verifiable index auxiliary system through the client index query module, and obtains the query result and verifiable information.
[0029] Step S24: The verifiable index auxiliary system receives the user request through the transaction acquisition module and decrypts the request. Based on the user request information, it accesses the verifiable index, generates query results and verifiable information, and submits them to the user.
[0030] Step S25: The user uses the client index verification module to reconstruct the index tree based on the query results received from the index auxiliary system and the verifiable index. The reconstructed root hash is compared with the root hash obtained from the blockchain system in step S22. If the two are the same, it proves the correctness and integrity of the query result data. Otherwise, the query result data has been tampered with or contaminated.
[0031] Beneficial effects
[0032] (1) The index update and query processing collaborative optimization method based on multi-granularity lock described in this invention has the ability to handle asynchronous consensus of index transactions that depend on multiple old transactions; it can monitor data changes in the graph blockchain in real time and generate verifiable indexes, and at the same time, it can realize multi-granularity locks on the index to achieve efficient concurrent updates and access collaboration.
[0033] (2) The multi-granularity lock-based index update and query processing collaborative optimization method described in this invention supports the use of various graph blockchains that meet the security model of general graph blockchains. It can provide security, liveness and validity for the data stored therein according to the security model. It can support asynchronous consensus and has high scalability, thereby achieving high real-time performance and fast confirmation speed, thus meeting the concurrent operation needs of a large number of users for index initiation.
[0034] (3) In the graph blockchain system described in this invention, a graph blockchain is used that is different from the traditional chain blockchain. Its transaction composition is a directed acyclic graph topology structure rather than a single chain structure. Therefore, there may be multiple new transactions that do not affect each other, enabling concurrent updates or access to verifiable indexes.
[0035] (4) In the graph blockchain system described in this invention, the routing module can authenticate the user who uses the index, thereby ensuring the user's permissions and reliability.
[0036] (5) The index update and query processing collaborative optimization method based on multi-granularity lock described in this invention, wherein the verifiable index auxiliary system can support and store various verifiable index structures, and can realize efficient locking, unlocking and read / write operations on the index.
[0037] (6) The verifiable index auxiliary system of the present invention includes a transaction acquisition module that includes an encrypted communication function. When the system or user connects, the communication data is encrypted by using public and private keys during the communication process to ensure the reliability of the data transmission process and avoid data tampering and leakage.
[0038] (7) The multi-granularity lock-based index update and query processing collaborative optimization method of the present invention generates a corresponding verifiable index based on the data stored in the graph blockchain module, providing credibility and integrity verification capabilities for blockchain data query.
[0039] (8) The multi-granularity lock-based index update and query processing collaborative optimization method of the present invention uses coarse and fine multi-granularity locks to handle conflicting transactions, supports concurrent update and read processing of verifiable indexes, and realizes collaborative optimization of dynamic update and query processing of verifiable indexes. Attached Figure Description
[0040] Figure 1 This is a schematic diagram of the system composition of the present invention;
[0041] Figure 2 This is a schematic diagram of the verifiable index update process of the present invention;
[0042] Figure 3 This is a flowchart of the data and verifiable index update process of the present invention;
[0043] Figure 4 This is a flowchart of the verifiable index verification process of the present invention. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the invention.
[0045] Indexes need to be updated in real-time as blockchain ledger data is updated, and their size grows proportionally with the data. They also need to meet both read and write requirements simultaneously. However, current index processing systems suffer from low efficiency and significant overhead in updating and querying indexes. These issues make it difficult for current verifiable index systems to support high-concurrency updates and queries, resulting in low scalability. In the emerging field of graph blockchains, due to their ability to perform asynchronous consensus, the data on these blockchains is characterized by high-frequency updates and queries. This poses a challenge to the application of verifiable indexes in blockchain technology and is a significant obstacle limiting their widespread adoption.
[0046] Therefore, this invention proposes a collaborative optimization method for index update and query processing based on multi-granularity locks. This technology helps verifiable index systems handle concurrent update and query operations. It merges conflicting transactions through locking mechanisms of different granularities and ensures the scalability of the verifiable index by supporting a combination of local and global transaction sorting, thus meeting the requirements for its application in blockchain technology, especially graph blockchain technology. The proposed multi-granularity lock-based collaborative optimization method for index update and query processing supports the generation of verifiable indexes for blockchain data, especially graph blockchain data, and allows users to query the verifiable indexes through the system. Based on the verifiable indexes, the on-chain data obtained from the query is verified, thereby verifying the correctness and completeness of the query results.
[0047] This invention proposes a collaborative optimization method for index update and query processing based on multi-granularity locks. In this method, the blockchain system is used to store data, and smart contracts are used to process user data update and query requests. The verifiable index is stored in an off-chain space, such as a distributed database, after being digitally signed. This provides a trustworthiness verification service for the data on the blockchain and does not affect the data on the blockchain.
[0048] A collaborative optimization method for index update and query processing based on multi-granularity locks includes: a graph blockchain system for storing data, processing smart contract transactions, and storing verifiable index hash roots; a collaborative optimization method that integrates conflicting transactions through locking mechanisms of different granularities, supports a combination of partial and overall transaction sorting, ensures the scalability of the verifiable index, and meets the needs of concurrent updates and queries of the verifiable index when applied to blockchain technology, especially graph blockchain technology; and a verifiable index auxiliary system that stores the verifiable index, deploys the collaborative optimization method, and can monitor data changes in the blockchain to efficiently update the trusted index.
[0049] Unlike traditional chained blockchains, graph-based blockchains consist of transactions in a directed acyclic graph topology rather than a single-chain structure. Therefore, multiple new transactions may exist that do not affect each other, resulting in concurrent updates or accesses to verifiable indexes.
[0050] Graph blockchains satisfy the security model of general graph blockchains and provide security, liveness, and validity for the data stored within them according to the security model. They also support asynchronous consensus and have good scalability.
[0051] The graph blockchain system includes: a routing module, which supports identity verification via the graph blockchain to ensure the permissions and reliability of the initiating user; and a graph blockchain module, which supports data processing, data storage and updates based on smart contracts, and stores verifiable index hash roots, etc.
[0052] The verifiable index auxiliary system supports and stores various verifiable index structures and enables efficient locking, unlocking, and read / write operations on the indexes. The data verifiable index auxiliary system includes: a transaction acquisition module, which communicates encrypted with the routing module of the graph blockchain and parses pending operations on the index, and communicates encrypted with the user to exchange verification information and verification results; and an index concurrency processing module, which specifies processing schemes based on the current verifiable index status and concurrent read / write transactions on the index, and performs corresponding locking, unlocking, and read / write operations according to the schemes, achieving multi-granularity processing.
[0053] The transaction acquisition module includes encrypted communication functionality. When the system or user connects, a public-private key exchange must be performed first, and the public-private key is used to encrypt the communication data during subsequent communication processes to ensure the reliability of the data transmission process and prevent data tampering and leakage.
[0054] Example
[0055] Figure 1 This is a schematic diagram illustrating the components of the blockchain verifiable index system of the present invention. (See diagram below.) Figure 1 As shown, the blockchain verifiable index system architecture of this invention consists of three parts: a client, a verifiable index auxiliary system, and a graph blockchain. The client manages the user's keys and information; it also provides an interface for the user to communicate with the other two systems, thereby initiating blockchain transactions and obtaining verifiable indexes. The verifiable index auxiliary system stores the index, deploys the core multi-granularity lock-based index update and query processing collaborative optimization method of this invention, and supports efficient index processing. The graph blockchain system can be composed of various graph blockchains, each marked with a unique identifier, used to store ledger data and process user requests based on smart contracts.
[0056] Specifically, the overall architecture of the blockchain verifiable index system of the present invention includes:
[0057] 1. Client
[0058] The client mainly includes four modules: key management, transaction processing, index query, and index verification.
[0059] 1) The key management module is primarily responsible for managing user accounts and the public and private keys used by users when communicating with the verifiable auxiliary system and the blockchain system. To ensure the trustworthiness of the overall information transmission process, asymmetric encryption is used to encrypt all communication messages during communication between the three components, ensuring that all messages transmitted within the communication channel are encrypted and avoiding security risks. Furthermore, initiating transactions in the blockchain system may require the use of user certificates, keys, addresses, and other information; this information is also stored through the key management module to meet the needs of multiple users accessing the system.
[0060] 2) The transaction processing module is primarily responsible for handling blockchain transactions and communicating with the blockchain system. To support a wider range of user needs, the transaction processing module can parse user requests, generate corresponding blockchain transaction formats based on user requirements, call smart contract requests, and send them to the graph blockchain system. Furthermore, the data processing module also supports processing blockchain transaction results, parsing the results and sending back parameters such as transaction status and transaction costs to the user.
[0061] 3) The index query module is mainly used to communicate with the verifiable index auxiliary system. It obtains verifiable index information by generating formatted requests based on blockchain data, and verifies the correctness and integrity of the data through the index verification module.
[0062] 4) The index verification module is mainly used to verify the blockchain data query results using verifiable indexes, verifying their credibility and completeness. The index verification module reconstructs the index using the data query results returned by the blockchain system and the verification structure returned by the index auxiliary system, and compares the hash of the reconstructed index with the hash value obtained from the blockchain query to determine the credibility and completeness of the results.
[0063] 2. Verifiable indexing auxiliary system
[0064] The verifiable index auxiliary system mainly consists of two parts: a transaction acquisition module and an index concurrency processing module.
[0065] 1) The transaction acquisition module is primarily responsible for communication with other modules, including receiving index query requests from clients, sending query results and verification structures back to clients, and receiving index update requests from the graph blockchain system. This module also stores its own and each user's public and private keys for encrypting and decrypting communication data. Furthermore, when the system has high confidentiality requirements, the transaction acquisition module can also control user access based on user certificates to prevent unauthorized users from accessing the index or causing damage to the system.
[0066] 2) The index concurrency processing module is primarily responsible for the concurrent control of read and update operations on verifiable indexes. By implementing a multi-granularity lock-based control mechanism, it improves the concurrency processing capability and scalability of verifiable indexes. Specifically, when this module receives a new verifiable index update request, it determines which nodes in the verifiable index are involved and whether these nodes are currently being accessed or updated. Based on the determination, the module generates corresponding processing logic, such as locking with coarse-grained locks, generating fine-grained locks, and sorting for unlocking. Subsequently, this module processes the corresponding region of the verifiable index according to the processing logic, thereby achieving efficient updates and queries of the verifiable index.
[0067] 3. Graphical Blockchain System
[0068] The graph-based blockchain system mainly consists of two parts: a routing module and a graph-based blockchain module.
[0069] 1) The routing module is primarily responsible for connecting users and the blockchain. Different blockchains differ significantly in the information required to initiate transactions, transaction structure, and smart contract invocation methods. Furthermore, blockchains may reside within hard-to-reach networks. Therefore, by designing a standard interface, the system can shield users from the significant differences between blockchains and various problems in network communication. The routing module in the system acts as a receiver of this standardized interface, reducing coupling between modules and improving system scalability.
[0070] 2) The graph-based blockchain module is primarily responsible for storing data information, storing verifiable index root hash values and other verification information, and supporting other smart contract requirements of users. The blockchain module provides users with the ability to query and update data, as well as the ability to process and compute data according to smart contracts.
[0071] This section will introduce the processing flow of the index update and query processing collaborative optimization technology based on multi-granularity locks of the present invention. The invention will be further described in detail with reference to the accompanying drawings and embodiments. Figure 3 This is a flowchart illustrating the data and verifiable index update process of this invention. Figure 4 This is a flowchart of the verifiable index verification process of the present invention.
[0072] The data and verifiable index update business process includes:
[0073] Step S11: The user initiates a blockchain transaction request through the client. When initiating the request, the user first provides information such as the CA certificate, blockchain account address, smart contract address, and transaction parameters. The client then generates the request according to a standardized format. Furthermore, the client uses its locally stored public and private keys to encrypt the request, protecting its confidentiality during transmission.
[0074] Step S12: After receiving the encryption request, the routing module of the graph blockchain system decrypts it using the corresponding private key to obtain the request information. The routing module then initiates a transaction request to the corresponding blockchain based on the request information.
[0075] Step S13: Execute the request for the corresponding blockchain and update the blockchain ledger data. Simultaneously, the graph blockchain system also initiates an index update request to the index auxiliary system through the routing module, thereby ensuring the consistency between the verifiable index and the ledger data in the blockchain.
[0076] Step S14: The index system receives the index update request, decrypts the request to obtain information such as the key value to be updated and the corresponding transaction block number, and determines all index nodes affected by the key value to be updated and whether these nodes are being accessed or updated, i.e., the locking status of these nodes, based on this information and the verifiable current state of the index.
[0077] Step S15: Based on the judgment result, if the node to be updated is not affected or locked by other update transactions, meaning the current update can be processed in parallel with other updates, the index system generates the smallest granularity lock according to the scope of influence of the current update, that is, only locking the nodes that need to be modified due to the current update. The index system minimizes the possibility of potential lock conflicts through fine-grained locking. If, based on the judgment result, the node to be updated has been locked by other transactions, it means that there is an intersection between the current update and the ongoing update. In this case, the index system first determines the intersection between transactions and applies coarse-grained locks to the intersection nodes and their related nodes to avoid the impact of concurrent modifications to the index by multiple transactions on unlocked nodes.
[0078] Step S16: After locking is completed, the indexing system updates the verifiable index according to the index update request. Index update operations typically involve multiple nodes; therefore, the indexing system prioritizes updating the nodes locked by coarse-grained locks involved in the current request. The purpose is to reduce the locking time of coarse-grained locks through high-priority operations, thereby reducing the overall impact of the current update request on concurrent index updates. If the current request does not have a coarse-grained lock, the system starts updating from the highest-level node involved.
[0079] Step S17: After all nodes corresponding to the coarse-grained lock have been updated, the system will first unlock the coarse-grained lock to reduce the impact on concurrent updates. Once all index updates are complete, the system will unlock the remaining locked nodes and return a success message to the client.
[0080] The verifiable index verification process includes:
[0081] Step S21: The user initiates a blockchain transaction request through the client to obtain the required data and verifiable index root hash from the blockchain. When initiating the request, the user first provides information such as CA certificate, blockchain account address, smart contract address, and transaction parameters, and the client generates the request according to a standardized format.
[0082] Step S22: The blockchain system verifies the user certificate, blockchain account address, etc. After successful verification, it returns encrypted ledger data and a verifiable index root hash to the client.
[0083] Step S23: The user generates a verification request based on the blockchain return result, initiates a trustworthiness verification request to the index auxiliary system through the client index query module, and obtains the query results and verifiable information.
[0084] Step S24: The index-assisted system receives the user request through the transaction acquisition module and decrypts the request. Based on the user request information, it accesses the verifiable index, generates query results and verifiable information, and submits them to the user.
[0085] Step S25: The user uses the client index verification module to reconstruct the index tree based on the query results received from the index auxiliary system and the verifiable index. The reconstructed root hash is compared with the root hash obtained from the blockchain system in step S22. If the two are the same, it proves the correctness and integrity of the query result data. Otherwise, the query result data has been tampered with or contaminated.
[0086] The above description of the data and verifiable index update business process and the verifiable index verification process explains in detail the support of this invention for the collaborative optimization of index update and query processing based on multi-granularity locks, proving that this invention proposes a practical and effective solution for optimizing the collaborative optimization of blockchain and verifiable indexes.
[0087] The above embodiments are for illustrative purposes only and are not intended to limit the invention. The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not 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
1. A collaborative optimization system for index update and query processing based on multi-granularity locks, characterized in that: This collaborative optimization system includes a client, a verifiable indexing auxiliary system, and a graph-based blockchain system; The client includes a transaction processing module, an index verification module, an index query module, and a key management module; The verifiable index assistance system includes a transaction acquisition module and an index concurrency processing module; The graph-based blockchain system includes a routing module and a graph-based blockchain module; The steps in the index update section include: Step S11: The user initiates a blockchain transaction request through the client. When initiating the request, the user first provides the CA certificate, blockchain account address, smart contract address, and transaction parameter information. The client generates the request according to a standardized format and uses its locally stored public and private keys to encrypt the request, protecting the confidentiality of the request during transmission. Step S12: After receiving the encryption request, the routing module of the graph blockchain system decrypts it according to the corresponding private key to obtain the request information. The routing module then initiates a transaction request to the corresponding blockchain based on the request information. Step S13: The graph blockchain module executes the request and updates the blockchain ledger data. The graph blockchain system initiates an index update request to the verifiable index auxiliary system through the routing module. Step S14: The verifiable index auxiliary system receives the index update request, decrypts the request to obtain the key value to be updated and the corresponding transaction block number information, and determines all index nodes affected by the key value to be updated and whether these nodes are being accessed or updated, i.e., the locking status of these nodes, based on this information and the current status of the verifiable index. Step S15: Based on the locking status, if the node to be updated is not affected or locked by other update transactions, that is, the current update is processed in parallel with other updates, the index concurrency processing module generates the smallest granular lock according to the scope of influence of the current update, that is, only locks the nodes that need to be modified due to the current update. The index concurrency processing module minimizes the possibility of potential lock conflicts by using fine-grained locks. Based on the locking status, if the node to be updated has been locked by other transactions, it means that there is an intersection between the current update and the ongoing update. In this case, the index concurrency processing module first determines the intersection between transactions and applies coarse-grained locks to the intersection node and its related nodes. Step S16: After locking is completed, the index concurrency processing module updates the verifiable index according to the index update request; the index system prioritizes updating the nodes locked by the coarse-grained lock involved in the current request. If the current request does not have a coarse-grained lock, the update starts from the highest level node involved. Step S17: After all nodes corresponding to the coarse-grained lock have been updated, the index concurrency processing module will first unlock the coarse-grained lock. After all index updates are completed, the index concurrency processing module will unlock the remaining locked nodes and return a success message to the client.
2. The index update and query processing collaborative optimization system based on multi-granularity locks according to claim 1, characterized in that: The key management module is mainly responsible for managing user accounts and the public and private keys used by users when communicating with the verifiable index auxiliary system and the graph blockchain system. During the communication process, the communication messages are encrypted as a whole using asymmetric encryption. When initiating a transaction in the graph blockchain system, the user's certificate, key, and address information are required, and this information is stored through the key management module.
3. The index update and query processing collaborative optimization system based on multi-granularity locks according to claim 2, characterized in that: The transaction processing module is mainly responsible for processing blockchain transactions and communicating with the graph blockchain system. The transaction processing module supports parsing user requests, generating corresponding blockchain transaction formats according to user needs, calling smart contract requests and sending them to the graph blockchain system. The transaction processing module supports processing blockchain transaction results, and by parsing the blockchain transaction results, it sends back the transaction status and transaction cost parameters to the user.
4. The index update and query processing collaborative optimization system based on multi-granularity locks according to claim 3, characterized in that: The index query module is mainly used to communicate with the verifiable index auxiliary system, obtain verifiable index information by generating a formatted request based on blockchain data, and verify the correctness and integrity of the data through the index verification module.
5. The index update and query processing collaborative optimization system based on multi-granularity locks according to claim 4, characterized in that: The index verification module is mainly used to verify the blockchain data query results using verifiable indexes, verifying their credibility and completeness. The index verification module reconstructs the index using the data query results returned by the graph blockchain system and the verification structure returned by the verifiable index auxiliary system, and compares the hash of the reconstructed index with the hash value obtained from the blockchain query to determine the credibility and completeness of the results.
6. The index update and query processing collaborative optimization system based on multi-granularity locks according to claim 5, characterized in that: The transaction acquisition module is mainly responsible for communication functions with other modules, including receiving index query requests from the client, sending query results and verification structures back to the client, and receiving index update requests from the graph blockchain system. The transaction acquisition module stores its own and each user's public and private keys for encrypting and decrypting communication data. When confidentiality is required, the transaction acquisition module can control user access based on user certificates to prevent unauthorized users from accessing the index or causing damage to the system.
7. The index update and query processing collaborative optimization system based on multi-granularity locks according to claim 6, characterized in that: The index concurrency processing module is primarily responsible for the concurrent control of read and update operations on the verifiable index. By implementing a control mechanism based on multi-granularity locks, it improves the concurrent processing capability and scalability of the verifiable index. When the index concurrency processing module receives a new verifiable index update request, it determines which nodes of the verifiable index are involved and whether these nodes are being accessed or updated. Based on the determination result, the index concurrency processing module generates corresponding processing logic, namely, locking with coarse-grained locks, generating fine-grained locks, and sorting and waiting for unlocking. The index concurrency processing module processes the corresponding area of the verifiable index according to the processing logic, thereby achieving efficient updates and queries of the verifiable index.
8. The index update and query processing collaborative optimization system based on multi-granularity locks according to claim 7, characterized in that: The routing module is primarily responsible for connecting users and the blockchain; The graph blockchain module is mainly responsible for storing data information, storing verifiable index root hash value verification information, and supporting other smart contract needs of users. The graph blockchain module provides users with the ability to query and update data, as well as the ability to process and calculate data according to smart contracts.
9. A collaborative optimization method for index update and query processing based on multi-granularity locks, characterized in that... This method includes an index update part and an index verification part; The steps in the index update section include: Step S11: The user initiates a blockchain transaction request through the client. When initiating the request, the user first provides the CA certificate, blockchain account address, smart contract address, and transaction parameter information. The client generates the request according to a standardized format and uses its locally stored public and private keys to encrypt the request, protecting the confidentiality of the request during transmission. Step S12: After receiving the encryption request, the routing module of the graph blockchain system decrypts it according to the corresponding private key to obtain the request information. The routing module then initiates a transaction request to the corresponding blockchain based on the request information. Step S13: The graph blockchain module executes the request and updates the blockchain ledger data. The graph blockchain system initiates an index update request to the verifiable index auxiliary system through the routing module. Step S14: The verifiable index auxiliary system receives the index update request, decrypts the request to obtain the key value to be updated and the corresponding transaction block number information, and determines all index nodes affected by the key value to be updated and whether these nodes are being accessed or updated, i.e., the locking status of these nodes, based on this information and the current status of the verifiable index. Step S15: Based on the locking status, if the node to be updated is not affected or locked by other update transactions, that is, the current update is processed in parallel with other updates, the index concurrency processing module generates the smallest granular lock according to the scope of influence of the current update, that is, only locks the nodes that need to be modified due to the current update. The index concurrency processing module minimizes the possibility of potential lock conflicts by using fine-grained locks. Based on the locking status, if the node to be updated has been locked by other transactions, it means that there is an intersection between the current update and the ongoing update. In this case, the index concurrency processing module first determines the intersection between transactions and applies coarse-grained locks to the intersection node and its related nodes. Step S16: After locking is completed, the index concurrency processing module updates the verifiable index according to the index update request; the index system prioritizes updating the nodes locked by the coarse-grained lock involved in the current request. If the current request does not have a coarse-grained lock, the update starts from the highest level node involved. Step S17: After all nodes corresponding to the coarse-grained lock have been updated, the index concurrency processing module will first unlock the coarse-grained lock. After all index updates are completed, the index concurrency processing module will unlock the remaining locked nodes and return a success message to the client.
10. The collaborative optimization method for index update and query processing based on multi-granularity locks as described in claim 9, Its features are: The steps in the index verification section include: Step S21: The user initiates a blockchain transaction request through the client to obtain the required data and verifiable index root hash from the blockchain. When initiating the request, the user first provides the CA certificate, blockchain account address, smart contract address, and transaction parameter information, and the client generates the request according to the standardized format. Step S22: The graph blockchain system verifies the user certificate and blockchain account address; after successful verification, it returns encrypted ledger data and verifiable index root hash to the client; Step S23: The user generates a verification request based on the blockchain return result, initiates a trustworthiness verification request to the verifiable index auxiliary system through the client index query module, and obtains the query result and verifiable information; Step S24: The verifiable index auxiliary system receives the user request through the transaction acquisition module and decrypts the request; it accesses the verifiable index according to the user request information, generates query results and verifiable information, and submits them to the user; Step S25: The user uses the client index verification module to reconstruct the index tree based on the query results received from the index auxiliary system and the verifiable index. The reconstructed root hash is compared with the root hash obtained from the blockchain system in step S22. If the two are the same, it proves the correctness and integrity of the query result data. Otherwise, the query result data has been tampered with or contaminated.
Citation Information
Patent Citations
Transaction conflict decision method of dynamic multi-granularity lock in database
CN101667211A
An R tree index optimization method of a multi-granularity distributed read-write lock based on leaf nodes
CN109582678A