CN112487010A - Block chain user data table updating method, equipment and storage medium - Google Patents

Block chain user data table updating method, equipment and storage medium Download PDF

Info

Publication number
CN112487010A
CN112487010A CN202011474747.2A CN202011474747A CN112487010A CN 112487010 A CN112487010 A CN 112487010A CN 202011474747 A CN202011474747 A CN 202011474747A CN 112487010 A CN112487010 A CN 112487010A
Authority
CN
China
Prior art keywords
data table
user data
processed
transaction
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011474747.2A
Other languages
Chinese (zh)
Other versions
CN112487010B (en
Inventor
黎宁
刘明臻
何硕彦
周禄
张开翔
范瑞彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN202011474747.2A priority Critical patent/CN112487010B/en
Publication of CN112487010A publication Critical patent/CN112487010A/en
Application granted granted Critical
Publication of CN112487010B publication Critical patent/CN112487010B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The embodiment of the application discloses a block chain user data table updating method, which comprises the following steps: determining a user data table to be processed; if the user data table to be processed is detected to be identified to be in a locked state, acquiring target configuration parameters aiming at the user data table to be processed; wherein, the locked state is used for indicating that the user data table to be processed is locked; processing the user data table to be processed based on the target configuration parameters to obtain a reference user data table; unlocking the reference user data table to obtain a target user data table; wherein the target user data table does not have the locked status. The embodiment of the application also discloses a block chain user data table updating device and a storage medium.

Description

Block chain user data table updating method, equipment and storage medium
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a method, a device, and a storage medium for updating a blockchain user data table.
Background
With the rapid development of computer technology, more and more technologies are applied in the financial field, and the traditional financial industry is gradually changing to financial technology (Fintech), but higher requirements are also put forward on the technologies due to the requirements of the financial industry on safety and real-time performance. The block chain has the characteristics of decentralization, openness, autonomy, information non-tampering and the like, and is widely applied to the field of financial science and technology. In the operation process of the block chain, when the table structure of the user data table in the database needs to be updated, an operation and maintenance manager with certain authority needs to perform corresponding operation on corresponding nodes in the block chain network, manually close the corresponding nodes, manually update the table structures of the user data table one by one, and restart the corresponding nodes, so that the process of updating the table structure of the user data table in the corresponding nodes is realized.
At present, in the process of updating the user data table in the blockchain network, a user needs to close the corresponding node so as to manually update the table structure of the user data table in the corresponding node one by one, so that the updating process is complicated, operation errors are easy to occur, the blockchain network cannot normally operate, the intelligent degree of updating the user data table is low, and the efficiency of updating the user data table is low.
Content of application
In order to solve the above technical problem, embodiments of the present application desirably provide a method, a device, and a storage medium for updating a user data table of a block chain, which solve the problem that a user needs to close a corresponding block chain node and manually update a table structure of a user data table in the corresponding block chain node at present, implement a scheme for directly and automatically updating a user data table in the corresponding block chain node without closing the corresponding block chain node, ensure that a block chain network can operate normally and effectively, improve an intelligent degree of updating the user data table, and effectively improve an efficiency of updating the user data table.
The technical scheme of the application is realized as follows:
in a first aspect, a method for updating a blockchain user data table includes:
determining a user data table to be processed;
if the user data table to be processed is detected to be identified to be in a locked state, acquiring target configuration parameters aiming at the user data table to be processed; wherein, the locked state is used for indicating that the user data table to be processed is locked;
processing the user data table to be processed based on the target configuration parameters to obtain a reference user data table;
unlocking the reference user data table to obtain a target user data table; wherein the target user data table does not have the locked status.
In a second aspect, an apparatus for updating a blockchain user data table includes: a memory, a processor, and a communication bus; wherein:
the memory to store executable instructions;
the communication bus is used for realizing communication connection between the processor and the memory;
the processor is configured to execute the program for updating the blockchain user data table stored in the memory, so as to implement the steps of the method for updating the blockchain user data table according to any one of the above items.
In a third aspect, a storage medium has stored thereon a blockchain user data table update program, which when executed by a processor implements the steps of the blockchain user data table update method according to any one of the above.
In the embodiment of the application, the block chain user data table updating device determines the user data table to be processed, if the fact that the user data table to be processed is identified to be in a locked state is detected, the target configuration parameters for the user data table to be processed are obtained, the user data table to be processed is processed based on the target configuration parameters to obtain a reference user data table, and finally the reference user data table is unlocked to obtain the target user data table. Therefore, under the condition that the user data table to be processed is locked, the user data table to be processed is processed to obtain the reference user data table, the reference user data table is unlocked to obtain the target user data table, the problem that the user needs to close the corresponding block chain node and manually update the table structure of the user data table in the corresponding block chain node at present is solved, the scheme that the user data table in the corresponding block chain node is directly and automatically updated without closing the corresponding block chain node is realized, the block chain network can effectively and normally operate, the intelligent degree of updating the user data table is improved, and the efficiency of updating the user data table is effectively improved.
Drawings
Fig. 1 is a schematic flowchart illustrating a method for updating a block chain user data table according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of another method for updating a block chain user data table according to an embodiment of the present application;
fig. 3 is a schematic flowchart illustrating a further method for updating a user data table of a block chain according to an embodiment of the present application;
fig. 4 is a flowchart illustrating a method for updating a block chain user data table according to another embodiment of the present application;
fig. 5 is a schematic flowchart of another method for updating a block chain user data table according to another embodiment of the present application;
fig. 6 is a schematic structural diagram of a device for updating a block chain user data table according to an embodiment of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
An embodiment of the present application provides a method for updating a block chain user data table, which is applied to a device for updating a block chain user data table, as shown in fig. 1, and the method includes the following steps:
step 101, determining a user data table to be processed.
In the embodiment of the application, the blockchain user data table updating device has a calculation analysis capability and can be used as a device of a blockchain operation node, and the blockchain user data table updating device can operate at least one blockchain node, and can be an entity device such as a server, a desktop computer, a notebook computer, a tablet computer, a smart phone and even a vehicle-mounted computer in various forms; or may be a virtual device, corresponding to a virtual Machine (EVM) executing an intelligent contract in the etherhouse block chain. The user data table to be processed is a user data table in which a user wants to modify a table structure, such as capacity expansion, capacity reduction and the like, in the block chain. When determining the user data table to be processed, the block chain user data table updating device may be implemented by using the identification information of the user data table to be processed, which is input by the user.
And 102, if the user data table to be processed is detected to be identified to be in a locked state, acquiring target configuration parameters aiming at the user data table to be processed.
The locked state is used for indicating that the user data table to be processed is locked.
In the embodiment of the present application, Locking (LOCK) refers to setting a control variable, controlling shared resources not to be accessed by other processes, and when a corresponding user data table to be processed is identified as a locked state, other transactions cannot access the user data table to be processed, and four types of operations, namely creating (Create), retrieving (Retrieve), updating (Update), and removing (Delete), are performed on the content of the user data table to be processed. The target configuration parameters for the user data table to be processed refer to parameters that the user wishes to change for the structure of the user data table to be processed, such as change mode, change position, change number, change type, and corresponding naming parameters.
And 103, processing the user data table to be processed based on the target configuration parameters to obtain a reference user data table.
In the embodiment of the application, the updating device of the block chain user data table correspondingly changes the structure of the user data table to be processed according to the received target configuration parameters to obtain the reference user data table. The reference user data table may be obtained by changing the to-be-processed user data table based on the target configuration parameter, or may be obtained by recovering the history cache data based on the to-be-processed user data table, which has a fault when the to-be-processed user data table is processed based on the target configuration parameter.
And 104, unlocking the reference user data table to obtain a target user data table.
Wherein the target user data table does not have a locked status.
In the embodiment of the application, after the reference user data table is obtained, in order to not affect the subsequent use of the user data table to be processed, the block chain user data table updating device needs to unlock the locked reference user data table corresponding to the user data table to be processed to obtain the target user data table, so that other transactions can use the target user data table.
In the embodiment of the application, the block chain user data table updating device determines the user data table to be processed, if the fact that the user data table to be processed is identified to be in a locked state is detected, the target configuration parameters for the user data table to be processed are obtained, the user data table to be processed is processed based on the target configuration parameters to obtain a reference user data table, and finally the reference user data table is unlocked to obtain the target user data table. Therefore, under the condition that the user data table to be processed is locked, the user data table to be processed is processed to obtain the reference user data table, the reference user data table is unlocked to obtain the target user data table, the problem that the user needs to close the corresponding block chain node and manually update the table structure of the user data table in the corresponding block chain node at present is solved, the scheme that the user data table in the corresponding block chain node is directly and automatically updated without closing the corresponding block chain node is realized, the block chain network can effectively and normally operate, the intelligent degree of updating the user data table is improved, and the efficiency of updating the user data table is effectively improved.
Based on the foregoing embodiments, an embodiment of the present application provides a method for updating a block chain user data table, and as shown in fig. 2, the method is applied to a device for updating a block chain user data table, and the method includes the following steps:
step 201, determining a user data table to be processed.
In the embodiment of the present application, by taking an example that the blockchain user data table updating device is implemented by receiving the identification information of the to-be-processed user data table sent by the user as an example, after receiving the identification information of the to-be-processed user data table sent by the user, the blockchain user data table updating device determines the to-be-processed user data table according to the received identification information of the to-be-processed user data table. The identification information of the user data table to be processed may be an identity for uniquely identifying the user data table to be processed, and may be, for example, name information of the user data table to be processed.
Step 202, if it is detected that the user data table to be processed is identified as a locked state, detecting whether a parallel transaction for calling the content of the user data table to be processed exists.
The locked state is used for indicating that the user data table to be processed is locked.
In the embodiment of the present application, the block chain user data table updating device detects the state of the determined user data table to be processed, and specifically, may determine the state by detecting an identification bit set for the state of the user data table to be processed. Correspondingly, when the user data table to be processed is locked, the block amount user data table updating device modifies the identification bit of the user data table to be processed, modifies the content of the identification bit of the user data table to be processed to be in a locked state, and when the user data table to be processed is in an unlocked state, the corresponding content of the identification bit can be set to be in an unlocked state or set to be empty. The parallel transaction refers to other transaction processes called by the user data table to be processed in the block chain when the user data table to be processed is in a locked state.
And step 203, if the parallel transaction exists, suspending the parallel transaction.
In the embodiment of the application, because the user data table to be processed is currently in a locked state, the parallel transaction cannot access the user data table to be processed, the parallel transaction can be controlled to suspend processing so as to prevent the parallel transaction from having a transaction failure, and after the subsequent user data table to be processed is unlocked, the parallel transaction is rolled back to execute the parallel transaction, so that the success rate of the parallel transaction is effectively improved.
And step 204, acquiring target configuration parameters aiming at the user data table to be processed.
In this embodiment of the present application, the target configuration parameter may include at least one parameter, and correspondingly, all or part of the parameters of the target configuration parameter may be input by the user to the device for updating the user data table of the block chain.
And step 205, processing the user data table to be processed based on the target configuration parameters to obtain a reference user data table.
Wherein the target configuration parameters at least comprise the following parameters: the expansion column number, the type of the expansion column and the naming information of the expansion column, or the target configuration parameters at least comprise the following parameters: the number of expansion lines, the type of the expansion lines and the naming information of the expansion lines.
In the embodiment of the present application, in the application process of the to-be-processed user data table, there is usually a case that the to-be-processed user data table needs to be expanded, and therefore, the corresponding target configuration parameter may be a parameter for expanding the to-be-processed user data table. For example, when the user data table to be processed is a horizontal list, the corresponding target configuration parameters may be at least the following parameters: the number of expansion lines, the type of the expansion lines and the naming information of the expansion lines. When the user data table to be processed is a vertical list, the corresponding target configuration parameters may be at least the following parameters: the number of expansion columns, the types of the expansion columns and the naming information of the expansion columns.
And step 206, unlocking the reference user data table to obtain a target user data table.
Wherein the target user data table does not have a locked status.
In the embodiment of the application, the reference user data table is unlocked by the block chain user data table, the locked state of the identification bit content corresponding to the reference user data table can be removed, and the reference user data table is modified, so that other processes can access the reference user data table, and the unlocking processing is realized.
Step 207, based on the target user data table, executing the parallel transaction.
In the embodiment of the application, since other processes can access the target user data table, the rolling back is realized on the parallel transaction, and the parallel transaction is executed.
Based on the foregoing embodiments, in other embodiments of the present application, the step 202 may be implemented by the steps a 11-a 13:
step a11, under the condition that the user data table to be processed is identified to be in the locked state, determining the transaction sequence of the transactions included in the block chain and the occupation relationship of the transaction exclusive resource.
In the embodiment of the present application, the transactions included in the blockchain have explicit records in the blockchain, so statistics can be performed from the blockchain to obtain the transaction sequence of the transactions included in the blockchain and the occupation relationship of the transaction exclusive resources when the transactions are executed.
Step a12, determining transaction dependency relationship based on transaction sequence of transaction and occupation relationship of transaction exclusive resource.
In this embodiment of the present application, the transaction sequence of the transactions may specifically indicate the sequence of the transactions through the identification information of the transactions. For example, the transactions include A, B and C, and transaction A is executed after transaction C is executed, transaction A and transaction B can be executed simultaneously, i.e. transaction A and transaction B can be executed in parallel, and the corresponding transaction sequence can be marked as { (C, A); (0, B) }, where 0 means no other transactions before transaction B. The occupation relationship of the transaction exclusive resource can also adopt the identification information of the transaction exclusive resource to represent the resource occupation relationship, for example, in the transaction process, the resources required to be used are a1 and a2 when transaction a is executed, and the resources required to be used are a2, B1 and B2 when transaction B is executed, so that the transaction a and the transaction B share the resource a1, and the correspondence can be marked as a1(a, B), a2(a), B1(B) and B2 (B). The transaction dependency relationship can also be represented by visual representation forms such as a graph and a table.
Step a13, based on the transaction dependencies, determines whether there is a parallel transaction.
In the embodiment of the application, whether at least two transactions for calling the user data table to be processed exist at the same time or not is determined from the transaction dependency relationship, and if at least two transactions exist, the parallel transactions for calling the user data table to be processed are determined.
In some application scenarios, the transaction dependency relationship may also be predetermined, that is, the transaction dependency relationship is executed before determining whether the user data table to be processed is locked, so that after the user data table to be processed is locked and the locking is successful, the identification information of the user data table to be processed in the predetermined transaction dependency relationship may be identified as the locked state. Correspondingly, after the reference user data table corresponding to the user data table to be processed is unlocked, the locked state of the identification information identification of the user data table to be processed in the transaction dependency relationship is removed, so that the transaction calling the user data table to be processed can be defined as parallel transaction in the time period when the identification information identification of the user data table to be processed is in the locked state. It should be noted that, in the time period when the identification information of the user data table to be processed is identified as the locked state, if there are multiple parallel transactions, after the reference user data table corresponding to the user data table to be processed is subjected to the unlocking processing, and the target user data table is obtained, the target user data table is sequentially rolled back according to the execution sequence of the multiple parallel transactions, and is sequentially re-executed.
Based on the foregoing embodiments, in other embodiments of the present application, referring to fig. 3, after the step 201 is executed by the device for updating a block chain user data table, the device is further configured to execute steps 208 to 210:
and step 208, if the user data table to be processed is detected to exist, caching the current content of the user data table to be processed to a target storage area to obtain target cache data.
In the embodiment of the application, after the user data table to be processed is determined, whether the user data table to be processed exists in the block chain needs to be detected, and if the user data table to be processed does not exist, error throwing processing is directly performed; if the user data table to be processed is detected to exist, caching the current content of the user data table to be processed, wherein the caching mode can be realized by adopting a snapshot mode. The corresponding target storage area may be a memory storage area of the blockchain user data table updating device. It should be noted that, the target cache region may sequentially store snapshot cache contents for the user data table to be processed in different time periods according to a time sequence, or may only store a current snapshot cache for the user data table to be processed in the target cache region, that is, when a new snapshot cache of the user data table to be processed is stored in the target storage region, the history snapshot cache of the user data table to be processed, which is stored before, is directly covered, so as to delete the history snapshot cache of the user data table to be processed.
And step 209, locking the user data table to be processed.
And step 210, if the locking of the user data table to be processed is detected to be successful, marking the user data table to be processed as a locked state.
Correspondingly, in other embodiments of the present application, step 205 may be implemented by steps b 11-b 14:
and b11, processing the user data table to be processed based on the target configuration parameters.
In the embodiment of the present application, after the blockchain user data table updating apparatus performs step b11, it may select to perform step b12 or steps b 13-b 14. And c, if the user data table to be processed is successfully processed, selecting to execute the step b12, and if the user data table to be processed is abnormal, selecting to execute the steps b 13-b 14.
And b12, if the user data table to be processed is successfully processed, obtaining a reference user data table including the content matched with the target configuration parameters.
In the embodiment of the present application, the successful processing of the user data table to be processed indicates that: and adopting the target configuration parameters to carry out corresponding change operation on the structure of the user data table to be processed successfully.
Step b13, if the user data table to be processed is abnormal, obtaining the history cache data corresponding to the user data table to be processed closest to the current time from the target storage area.
In the embodiment of the present application, what is indicated by an exception occurring when a user data table to be processed is: the corresponding change operation of the structure of the user data table to be processed by adopting the target configuration parameters is not successful, errors may occur in the operation process, and the expected data table is not obtained after the operation.
And b14, recovering the user data table to be processed based on the historical cache data to obtain a reference user data table.
In the embodiment of the application, when the user data table to be processed is abnormal, the backup data of the user data table to be processed of the latest version is adopted to restore the user data table to be processed, so that the user data table to be processed can be quickly restored, and the influence of the user data table to be processed on other transactions in a block chain is reduced.
Based on the foregoing embodiments, in other embodiments of the present application, after the step b13 is executed by the device for updating a blockchain user data table, the device is further configured to execute the steps b15 to b 16:
and b15, generating the first log information.
The first log information is used for recording information of abnormality when the user data table to be processed is processed based on the target configuration information.
And b16, storing the first log information.
In the embodiment of the application, the first log information is recorded so as to analyze the situation of processing abnormality of the user data table to be processed in the following process, and obtain the reason of the abnormality.
Based on the foregoing embodiments, in other embodiments of the present application, after the step b12 is executed by the device for updating a blockchain user data table, the device is further configured to execute the steps b17 to b 18:
and b17, generating second log information if the reference user data table comprises the content matched with the target configuration parameters.
And the second log information is used for recording information of detecting that the content included in the reference user data table is matched with the content corresponding to the target configuration parameter.
And b18, storing the second log information.
Based on the foregoing embodiments, the present application provides a block chain user data table updating method, wherein locking, modifying and releasing LOCKs for a user data table can be implemented by one-to-one correspondence between three basic operations, LOCK, UNLOCK and ALTER. Correspondingly, database objects including libraries, tables, columns, etc. are defined by the data definition language. The data definition language includes common operations such as CREATE, modify, delete (ALTER), and DROP, which are used to CREATE new tables, modify table structures, or delete tables in a database, and index tables, etc. Wherein, referring to fig. 4, the block link points may be used to implement the following steps:
step 31, verifying whether the user identity information is matched with the preset identity information, and executing step 32 if the user identity information is matched with the preset identity information; if the user identification information does not match the predetermined identification information, go to step 314.
The preset identity information may be preset account information of a blockchain administrator, account information of an operation and maintenance administrator, or a user address of a modifiable table structure specified in an intelligent contract capable of calling a data table.
And 32, detecting whether the user data table to be expanded exists, if so, executing step 33, and if not, executing step 314.
When detecting whether the user data table to be expanded exists, the method can be realized through the following specific steps: firstly, the user data table to be expanded is called by the block chain link points, then the user data table to be expanded is detected, and whether the user data table to be expanded exists is determined. And the user data table to be expanded corresponds to the user data table to be processed.
And step 33, performing snapshot caching on the current state of the user data table to be processed.
And caching the snapshot of the current state of the acquired user data table to be processed for quickly returning to the snapshot state after the modification fails. The cached snapshot cache content comprises a structure of a user data table to be processed, and the snapshot cache content can be subjected to persistent processing in a snapshot cache table of a Database (Database, DB), so that the snapshot cache content is saved in a specific backup cache data table, and a Database operation log and an operation command of each step of operation are recorded.
And step 34, locking the user data table to be expanded.
The LOCK operation can be used to LOCK the user data table to be expanded, so that the user cannot access and modify the user data table to be expanded.
And step 35, detecting whether parallel transaction for calling the user data table to be expanded exists, if so, executing step 36, and if not, executing step 37.
Wherein, the step 34 and the step 35 can be executed simultaneously.
When detecting whether parallel transaction for calling the user data table to be expanded exists, determining to obtain a transaction dependency relationship related to the user data table to be expanded according to a transaction sequence of the transaction and an occupation relationship of mutually exclusive resources of the transaction. After the step 34 of executing the user data table to be expanded is to adopt LOCK locking, if a parallel transaction for calling the content in the user data table to be expanded is executed, there may be a problem that the parallel transaction fails and results in deadlock or inconsistent data because the user data table to be expanded is locked.
And step 36, suspending execution of the parallel transaction.
Step 37, detecting whether the user data table to be expanded is marked as a locked state, if so, executing step 38, and if not, executing step 311.
The method includes detecting whether a user data table to be expanded is marked as a locked state to judge whether locking operation of the user data table to be expanded is successful, namely, a locking state bit is set in the user data table to be expanded, after the user data table to be expanded is locked, the locking state bit can be set as an identifier of the locked state, for example, set as 1, and when the user data table to be expanded is not locked, the corresponding locking state bit is set as an identifier of an unlocked state, for example, set as 0.
And step 38, carrying out capacity expansion operation on the user data table to be subjected to capacity expansion.
The method comprises the steps of carrying out table structure capacity expansion operation on a user data table to be subjected to capacity expansion in a current node account book through an ALTER operation, only expanding one column at a time, and setting default values of the columns to be null. When carrying out capacity expansion operation on a user data table to be expanded, firstly determining a parameter of the user data table to be expanded, for example, a table name of the user data table to be expanded of a column to be expanded, a column type of the column to be expanded and a column name of the column to be expanded; and then, inserting columns corresponding to the parameter of the user data table to be expanded through ALTER operation.
And 39, detecting whether the capacity of the user data table to be expanded is successfully expanded, if so, executing the step 310, and if not, executing the step 311.
Wherein, the condition of capacity expansion failure comprises at least one of the following conditions: error prompt, namely error throwing condition, occurs in the capacity expansion process; abnormal conditions occur in the capacity expansion process; there is no problem in the expansion process, but the desired data table is not obtained finally.
And 310, generating log information of successful capacity expansion of the user data table to be subjected to capacity expansion, storing the log information of successful capacity expansion, and executing unlocking operation to release the lock.
The unlocking operation can be adopted to release the lock so as to remove the identification of the locked state of the user data table to be expanded, and the user data table to be expanded after the expansion operation is changed into the unlocked state, so that the parallel transaction can run normally, and the influence of the expansion operation of the user data table to be expanded on the running of the block chain is reduced. The log information may be in binary format, and the recorded content includes each operation step.
In some application scenarios, after the user data table to be expanded is successfully expanded, the snapshot cache content corresponding to the user data table to be expanded may be deleted, or after the user data table to be expanded is successfully expanded, the snapshot cache content corresponding to the user data table to be expanded may also be deleted after a certain number of blocks or transactions, so that the corresponding storage area may be the release of the snapshot cache table, and the storage pressure of the storage area is reduced.
Step 311, obtaining the latest historical snapshot cache content corresponding to the user data table to be expanded from the cache table, restoring the user data table to be expanded to the original table structure based on the obtained historical snapshot cache content, and generating log information of expansion failure.
When the capacity expansion operation is performed on the user data table to be expanded, a binary log (BINLOG) of SQL is saved to record detailed operation in the capacity expansion process.
And step 312, executing an unlocking operation.
And 313, after the unlocking operation is executed, if the parallel transaction which is executed in a suspended mode exists, executing the parallel transaction.
And step 314, throwing mistakes.
It should be noted that, for the descriptions of the same steps and the same contents in this embodiment as those in other embodiments, reference may be made to the descriptions in other embodiments, which are not described herein again.
In the embodiment of the application, the block chain user data table updating device determines the user data table to be processed, if the fact that the user data table to be processed is identified to be in a locked state is detected, the target configuration parameters for the user data table to be processed are obtained, the user data table to be processed is processed based on the target configuration parameters to obtain a reference user data table, and finally the reference user data table is unlocked to obtain the target user data table. Therefore, under the condition that the user data table to be processed is locked, the user data table to be processed is processed to obtain the reference user data table, the reference user data table is unlocked to obtain the target user data table, the problem that the user needs to close the corresponding block chain node and manually update the table structure of the user data table in the corresponding block chain node at present is solved, the scheme that the user data table in the corresponding block chain node is directly and automatically updated without closing the corresponding block chain node is realized, the block chain network can effectively and normally operate, the intelligent degree of updating the user data table is improved, and the efficiency of updating the user data table is effectively improved.
Based on the foregoing embodiments, an embodiment of the present application provides a method for updating a block chain user data table, and as shown in fig. 5, the method is applied to a device for updating a block chain user data table, and the method includes the following steps:
step 401, determining a user data table to be processed.
Step 402, if the user data table to be processed is detected to exist, caching the current content of the user data table to be processed to a target storage area to obtain target cache data.
And step 403, locking the user data table to be processed.
And step 404, if the locking of the user data table to be processed is detected to be successful, marking the user data table to be processed as a locked state.
Step 405, if it is detected that the user data table to be processed is identified as the locked state, acquiring the target configuration parameters of the user data table to be processed.
The locked state is used for indicating that the user data table to be processed is locked; the target configuration parameters include at least the following parameters: the expansion column number, the type of the expansion column and the naming information of the expansion column, or the target configuration parameters at least comprise the following parameters: the number of expansion lines, the type of the expansion lines and the naming information of the expansion lines.
And 406, processing the user data table to be processed based on the target configuration parameters to obtain a reference user data table.
And 407, unlocking the reference user data table to obtain a target user data table.
Wherein the target user data table does not have a locked status.
Based on the foregoing embodiments, in other embodiments of the present application, step 406 may be implemented by steps c 11-c 14:
and c11, processing the user data table to be processed based on the target configuration parameters.
And c12, if the user data table to be processed is successfully processed, obtaining a reference user data table including the content matched with the target configuration parameters.
And c13, if the user data table to be processed is abnormal, acquiring historical cache data corresponding to the user data table to be processed closest to the current time from the target storage area.
And c14, recovering the user data table to be processed based on the historical cache data to obtain a reference user data table.
Based on the foregoing embodiments, in other embodiments of the present application, after the step c13 is executed by the device for updating the blockchain user data table, the device is further configured to execute the steps c15 to c 16.
And c15, generating the first log information.
The first log information is used for recording information of abnormality when the user data table to be processed is processed based on the target configuration information.
And c16, storing the first log information.
Based on the foregoing embodiments, in other embodiments of the present application, after the step c12 is executed by the device for updating the blockchain user data table, the device is further configured to execute the steps c17 to c 18.
And c17, generating second log information if the reference user data table comprises the content matched with the target configuration parameters.
And the second log information is used for recording information of detecting that the content included in the reference user data table is matched with the content corresponding to the target configuration parameter.
And step c18, storing the second log information.
It should be noted that, for the descriptions of the same steps and the same contents in this embodiment as those in other embodiments, reference may be made to the descriptions in other embodiments, which are not described herein again.
In the embodiment of the application, the block chain user data table updating device determines the user data table to be processed, if the fact that the user data table to be processed is identified to be in a locked state is detected, the target configuration parameters for the user data table to be processed are obtained, the user data table to be processed is processed based on the target configuration parameters to obtain a reference user data table, and finally the reference user data table is unlocked to obtain the target user data table. Therefore, under the condition that the user data table to be processed is locked, the user data table to be processed is processed to obtain the reference user data table, the reference user data table is unlocked to obtain the target user data table, the problem that the user needs to close the corresponding block chain node and manually update the table structure of the user data table in the corresponding block chain node at present is solved, the scheme that the user data table in the corresponding block chain node is directly and automatically updated without closing the corresponding block chain node is realized, the block chain network can effectively and normally operate, the intelligent degree of updating the user data table is improved, and the efficiency of updating the user data table is effectively improved.
Based on the foregoing embodiments, an embodiment of the present application provides a blockchain user data table updating apparatus, and referring to fig. 6, the blockchain user data table updating apparatus 5 may include: a processor 51, a memory 52, and a communication bus 53, wherein:
a memory 52 for storing executable instructions;
a communication bus 53 for implementing a communication connection between the processor 51 and the memory 52;
the processor 51 is configured to execute the block chain user data table updating program stored in the memory 52 to implement the following steps:
determining a user data table to be processed;
if the user data table to be processed is detected to be identified to be in a locked state, acquiring target configuration parameters aiming at the user data table to be processed; the locked state is used for indicating that the user data table to be processed is locked;
processing the user data table to be processed based on the target configuration parameters to obtain a reference user data table;
unlocking the reference user data table to obtain a target user data table; wherein the target user data table does not have a locked status.
In other embodiments of the present application, the processor executes the following steps if it is detected that the user data table to be processed is identified as the locked state:
detecting whether a parallel transaction for calling the content of a user data table to be processed exists or not;
if the parallel transaction exists, the parallel transaction is suspended.
In other embodiments of the present application, the processor executes the step of performing unlocking processing on the reference user data table, and after obtaining the target user data table, is further configured to execute the following step:
based on the target user data table, a parallel transaction is performed.
In other embodiments of the present application, the processor executes the step of detecting whether there is a parallel transaction invoking the content of the user data table to be processed when the user data table to be processed is identified as the locked state, and the step of:
under the condition that the user data table to be processed is identified to be in a locked state, determining the transaction sequence of transactions and the occupation relation of mutually exclusive resources of the transactions included in the block chain;
determining a transaction dependency relationship based on the transaction sequence of the transaction and the occupation relationship of the transaction exclusive resources;
based on the transaction dependencies, it is determined whether there is a parallel transaction.
In other embodiments of the present application, after the processor executes the step of determining the user data table to be processed, the processor is further configured to execute the following steps:
if the user data table to be processed exists, caching the current content of the user data table to be processed to a target storage area to obtain target cache data;
locking the user data table to be processed;
and if the locking of the user data table to be processed is detected to be successful, marking the user data table to be processed as a locked state.
In other embodiments of the present application, the processor executes the step of processing the user data table to be processed based on the target configuration parameter to obtain the reference user data table, and the step of processing the reference user data table may be implemented by:
processing the user data table to be processed based on the target configuration parameters;
if the user data table to be processed is successfully processed, obtaining a reference user data table comprising the content matched with the target configuration parameters;
if the user data table to be processed is abnormal, acquiring historical cache data corresponding to the user data table to be processed closest to the current moment from the target storage area;
and recovering the user data table to be processed based on the historical cache data to obtain a reference user data table.
In other embodiments of the present application, the processor executing step is further configured to, if an exception occurs in the processing of the user data table to be processed, execute the following step:
generating first log information; the first log information is used for recording information of abnormality when the user data table to be processed is processed based on the target configuration information;
the first log information is stored.
In other embodiments of the present application, the processor is further configured to perform the steps of:
if the reference user data table comprises the content matched with the target configuration parameters, generating second log information; the second log information is used for recording information of detecting that the content included in the reference user data table is matched with the content corresponding to the target configuration parameter;
the second log information is stored.
In other embodiments of the present application, the target configuration parameters stored in the memory include at least the following parameters: the expansion column number, the type of the expansion column and the naming information of the expansion column, or the target configuration parameters at least comprise the following parameters: the number of expansion lines, the type of the expansion lines and the naming information of the expansion lines.
It should be noted that, in this embodiment, a specific implementation process of information interaction between units in the device for updating a block chain user data table may refer to an implementation process in the method for updating a block chain user data table provided in the embodiments corresponding to fig. 1 to 5, and is not described herein again.
In the embodiment of the application, the block chain user data table updating device determines the user data table to be processed, if the fact that the user data table to be processed is identified to be in a locked state is detected, the target configuration parameters for the user data table to be processed are obtained, the user data table to be processed is processed based on the target configuration parameters to obtain a reference user data table, and finally the reference user data table is unlocked to obtain the target user data table. Therefore, under the condition that the user data table to be processed is locked, the user data table to be processed is processed to obtain the reference user data table, the reference user data table is unlocked to obtain the target user data table, the problem that the user needs to close the corresponding block chain node and manually update the table structure of the user data table in the corresponding block chain node at present is solved, the scheme that the user data table in the corresponding block chain node is directly and automatically updated without closing the corresponding block chain node is realized, the block chain network can effectively and normally operate, the intelligent degree of updating the user data table is improved, and the efficiency of updating the user data table is effectively improved.
Based on the foregoing embodiments, embodiments of the present application provide a computer-readable storage medium, referred to as a storage medium for short, where one or more programs are stored in the computer-readable storage medium, and the one or more programs can be executed by one or more processors to implement the implementation process of the block chain user data table updating method provided in the embodiments corresponding to fig. 1 to 5, which is not described herein again.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only a preferred embodiment of the present application, and is not intended to limit the scope of the present application.

Claims (11)

1. A method for updating a blockchain user data table, the method comprising:
determining a user data table to be processed;
if the user data table to be processed is detected to be identified to be in a locked state, acquiring target configuration parameters aiming at the user data table to be processed; wherein, the locked state is used for indicating that the user data table to be processed is locked;
processing the user data table to be processed based on the target configuration parameters to obtain a reference user data table;
unlocking the reference user data table to obtain a target user data table; wherein the target user data table does not have the locked status.
2. The method of claim 1, wherein after detecting that the pending user data table has been identified as being in a locked state, the method further comprises:
detecting whether a parallel transaction for calling the content of the user data table to be processed exists or not;
and if the parallel transaction exists, suspending the parallel transaction.
3. The method of claim 2, wherein after the unlocking the reference user data table to obtain the target user data table, the method further comprises:
and executing the parallel transaction based on the target user data table.
4. The method of claim 2, wherein detecting whether there is a parallel transaction invoking the contents of the pending user data table in the event that the pending user data table has been identified as in a locked state comprises:
determining the transaction sequence of the transaction and the occupation relation of the transaction exclusive resources included in the block chain under the condition that the user data table to be processed is identified to be in a locked state;
determining a transaction dependency relationship based on the transaction sequence and the occupation relationship of the mutually exclusive resources;
determining whether the parallel transaction exists based on the transaction dependency.
5. The method according to any of claims 1 to 4, wherein after determining the pending user data table, the method further comprises:
if the user data table to be processed is detected to exist, caching the current content of the user data table to be processed to a target storage area to obtain target cache data;
locking the user data table to be processed;
and if the locking of the user data table to be processed is detected to be successful, marking the user data table to be processed as a locked state.
6. The method according to any one of claims 1 to 4, wherein the processing the to-be-processed user data table based on the target configuration parameter to obtain a reference user data table comprises:
processing the user data table to be processed based on the target configuration parameters;
if the user data table to be processed is successfully processed, obtaining the reference user data table comprising the content matched with the target configuration parameters;
if the user data table to be processed is processed abnormally, acquiring historical cache data corresponding to the user data table to be processed closest to the current moment from the target storage area;
and recovering the user data table to be processed based on the historical cache data to obtain the reference user data table.
7. The method according to claim 6, wherein if an exception occurs in the processing of the to-be-processed user data table, the method further comprises:
generating first log information; the first log information is used for recording information of abnormity when the user data table to be processed is processed based on the target configuration information;
storing the first log information.
8. The method of claim 6, further comprising:
if the reference user data table comprises the content matched with the target configuration parameters, second log information is generated; the second log information is used for recording information that the detected content included in the reference user data table is matched with the content corresponding to the target configuration parameter;
and storing the second log information.
9. The method according to any of claims 1 to 4 and 6 to 8, wherein the target configuration parameters comprise at least the following parameters: the expansion column number, the type of the expansion column and the naming information of the expansion column, or the target configuration parameters at least comprise the following parameters: the number of expansion lines, the type of the expansion lines and the naming information of the expansion lines.
10. A device for updating a blockchain user data table, the device comprising: a memory, a processor, and a communication bus; wherein:
the memory to store executable instructions;
the communication bus is used for realizing communication connection between the processor and the memory;
the processor is configured to execute the blockchain user data table updating program stored in the memory, and implement the steps of the blockchain user data table updating method according to any one of claims 1 to 9.
11. A storage medium having stored thereon a blockchain user data table update program, the blockchain user data table update program when executed by a processor implementing the steps of the blockchain user data table update method according to any one of claims 1 to 9.
CN202011474747.2A 2020-12-14 2020-12-14 Block chain user data table updating method, equipment and storage medium Active CN112487010B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011474747.2A CN112487010B (en) 2020-12-14 2020-12-14 Block chain user data table updating method, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011474747.2A CN112487010B (en) 2020-12-14 2020-12-14 Block chain user data table updating method, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112487010A true CN112487010A (en) 2021-03-12
CN112487010B CN112487010B (en) 2024-02-23

Family

ID=74916897

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011474747.2A Active CN112487010B (en) 2020-12-14 2020-12-14 Block chain user data table updating method, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112487010B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113094754A (en) * 2021-05-08 2021-07-09 重庆银行股份有限公司 Big data platform data modification system and modification, response, cache and verification method

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070177740A1 (en) * 2004-10-08 2007-08-02 Keiichi Nakajima Encryption key distribution system, key distribution server, locking terminal, viewing terminal, encryption key distribution method, and computer-readable medium
CN107507001A (en) * 2017-08-11 2017-12-22 杭州秘猿科技有限公司 A kind of data revision method based on license chain
CN110175913A (en) * 2019-04-12 2019-08-27 阿里巴巴集团控股有限公司 Data processing system, method, calculating equipment and storage medium based on block chain
CN110363663A (en) * 2019-07-12 2019-10-22 深圳前海微众银行股份有限公司 Batch data processing method, device, equipment and storage medium based on block chain
CN110473104A (en) * 2019-08-20 2019-11-19 深圳市网心科技有限公司 A kind of transaction processing method and relevant device
CN111597077A (en) * 2020-05-13 2020-08-28 腾讯科技(深圳)有限公司 Data processing method, data processing device, computer equipment and storage medium
CN111694873A (en) * 2020-06-10 2020-09-22 腾讯科技(深圳)有限公司 Processing method and device of virtual resource packet and database server
CN111930788A (en) * 2020-09-04 2020-11-13 阿里云计算有限公司 Processing method, device and equipment of operation request, readable storage medium and system

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070177740A1 (en) * 2004-10-08 2007-08-02 Keiichi Nakajima Encryption key distribution system, key distribution server, locking terminal, viewing terminal, encryption key distribution method, and computer-readable medium
CN107507001A (en) * 2017-08-11 2017-12-22 杭州秘猿科技有限公司 A kind of data revision method based on license chain
CN110175913A (en) * 2019-04-12 2019-08-27 阿里巴巴集团控股有限公司 Data processing system, method, calculating equipment and storage medium based on block chain
CN110363663A (en) * 2019-07-12 2019-10-22 深圳前海微众银行股份有限公司 Batch data processing method, device, equipment and storage medium based on block chain
CN110473104A (en) * 2019-08-20 2019-11-19 深圳市网心科技有限公司 A kind of transaction processing method and relevant device
CN111597077A (en) * 2020-05-13 2020-08-28 腾讯科技(深圳)有限公司 Data processing method, data processing device, computer equipment and storage medium
CN111694873A (en) * 2020-06-10 2020-09-22 腾讯科技(深圳)有限公司 Processing method and device of virtual resource packet and database server
CN111930788A (en) * 2020-09-04 2020-11-13 阿里云计算有限公司 Processing method, device and equipment of operation request, readable storage medium and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
潘吉飞: "基于链上扩展的区块链性能优化方案研究", 《中国优秀硕士学位论文 信息科技辑》, 15 August 2020 (2020-08-15) *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113094754A (en) * 2021-05-08 2021-07-09 重庆银行股份有限公司 Big data platform data modification system and modification, response, cache and verification method
CN113094754B (en) * 2021-05-08 2022-11-01 重庆银行股份有限公司 Big data platform data modification system and modification, response, cache and verification method

Also Published As

Publication number Publication date
CN112487010B (en) 2024-02-23

Similar Documents

Publication Publication Date Title
CN107562513B (en) Intelligent contract life cycle management method based on JAVA
US8140483B2 (en) Transaction log management
JP2012508919A (en) Application restore point
CN110046029A (en) Data processing method and device applied to multi-level buffer in cluster
CN111752957A (en) Sale locking method and system based on caching
US11507566B2 (en) Managing objects in shared caches using multiple chains
CN111538519A (en) Version upgrading method and device
US8336053B2 (en) Transaction management
US8458511B2 (en) Fault isolation using code paths
CN112487010B (en) Block chain user data table updating method, equipment and storage medium
US11061889B2 (en) Systems and methods of managing manifest refresh in a database
CN112559496B (en) Method and device for realizing transaction atomicity of distributed database
US8621161B1 (en) Moving data between data stores
CN115934272A (en) Online batch task processing method and device
CN116070294A (en) Authority management method, system, device, server and storage medium
CN110888717A (en) Transaction control method and device for directory operation of HDFS (Hadoop distributed File System)
CN112286894A (en) Log generation method and device and readable storage medium
EP3991060B1 (en) Managing objects in shared caches using multiple chains
JP2021521570A (en) Managing shared resources in a distributed computing system
US10331503B2 (en) Patching system calls in data protection operations
CN114328746A (en) Data management method and device
CN115952029A (en) Data processing method, device, equipment and computer readable storage medium
CN118245282A (en) Snapshot backup method and device
US10235438B2 (en) Removal of invisible data packages in data warehouses
CN116089044A (en) Timing task scheduling method, device, 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
GR01 Patent grant
GR01 Patent grant