WO2019076102A1 - Procédé et dispositif de restauration de données et support d'informations lisible par ordinateur - Google Patents

Procédé et dispositif de restauration de données et support d'informations lisible par ordinateur Download PDF

Info

Publication number
WO2019076102A1
WO2019076102A1 PCT/CN2018/099322 CN2018099322W WO2019076102A1 WO 2019076102 A1 WO2019076102 A1 WO 2019076102A1 CN 2018099322 W CN2018099322 W CN 2018099322W WO 2019076102 A1 WO2019076102 A1 WO 2019076102A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
data
rollback
information
commit
Prior art date
Application number
PCT/CN2018/099322
Other languages
English (en)
Chinese (zh)
Inventor
干荣亮
张鹏
郭龙波
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2019076102A1 publication Critical patent/WO2019076102A1/fr

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/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/1734Details of monitoring file system events, e.g. by the use of hooks, filter drivers, logs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/176Support for shared access to files; File sharing support
    • G06F16/1767Concurrency control, e.g. optimistic or pessimistic approaches
    • 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

Definitions

  • the present invention relates to the field of database technologies, and in particular, to a data rollback method, system, device, and computer readable storage medium.
  • the existing distributed transaction processing mainly includes the following two methods: a rollback method based on the XA protocol (a protocol for distributed transaction processing) and a distributed rollback method based on a transaction log;
  • the XA protocol is an interface standard between the resource manager and the transaction manager.
  • the XA protocol includes: an application (AP, Application Program), a transaction manager (TM, Transaction Manager), and a resource manager (RM). , Resource Manager).
  • the application can communicate with the transaction manager and the resource manager, and the transaction manager and the resource manager communicate bidirectionally through the XA interface.
  • the XA interface specification uses a two-phase commit protocol to complete a global transaction, thereby ensuring that all databases in the same transaction are successfully submitted or rolled back at the same time, including: the first phase is the preparation phase, and the transaction manager sends a request for executing transactions to all databases.
  • the second phase is the commit phase, if all the responses received by the transaction manager are successful, the transaction manager sends a message request to all databases; if the transaction manager receives a response to any message request In the case of a failure, the transaction manager sends a rollback message request to all databases.
  • the transaction log-based distributed rollback method uses a two-phase commit protocol to complete a global transaction.
  • the direct commit method is used, that is, the transaction manager directly initiates a transaction commit request to the relevant resource manager. If the transaction manager receives a message that all resource managers have submitted successfully, it determines that the entire transaction was successfully submitted; if any resource manager's submission failure response is received, then the transaction manager will manage the resources that are being submitted or submitted successfully.
  • the device initiates a rollback request for the branch transaction.
  • the rollback process is mainly based on the provided global transaction ID (identity, identification), by analyzing the transaction log, generating the reverse execution statement in units of the original transaction, and executing in reverse order, thereby completing the rollback of the local resources.
  • the transaction manager collects the rollback results of each resource manager node, and summarizes them and feeds them back to the user.
  • the transaction log based distributed rollback method has improved performance compared to the XA protocol based rollback method.
  • the parsing transaction log process is a serial process, and also scans some transaction log files that are not related to the transaction ID to be rolled back, it wastes a lot of time. This is especially the case when some large transactions are rolled back, a large number of rollback requests are processed during the same time period, or the business is frequently refreshing the transaction log files when rolling back. Not only that, but the longer the rollback process, the longer the system resources will be occupied, and the performance of other services will be greatly affected.
  • the embodiments of the present invention provide a data rollback method, system, device, and computer readable storage medium, which overcome the problem of low performance of database rollback performance based on distributed transactions in the prior art.
  • the embodiment of the invention provides a data rollback method, including:
  • the rollback operation is performed concurrently on the commit data of all the databases corresponding to the transaction according to all the transaction logs corresponding to the transaction.
  • the commit data of all the databases corresponding to the transaction is concurrently performed to perform a rollback operation.
  • the method includes:
  • the data rollback information is stored as a first data file.
  • the data rollback information includes: a set of reverse operation program statements corresponding to the program statement set included in the transaction;
  • the reverse operation program statement set in the shared memory is executed in reverse order, and the rollback operation is concurrently performed on the commit data of all the databases corresponding to the transaction.
  • the performing the rollback operation on the commit data of all the databases corresponding to the transaction according to the data rollback information further includes:
  • the data rollback information in the first data file that is sequentially cached is read based on the cached preset data capacity
  • the reverse operation program statement set in the data rollback information of each read is executed in reverse order, and the rollback operation is concurrently performed on the commit data of all the databases corresponding to the transaction.
  • the number of the transactions is multiple
  • the data rollback information corresponding to each of the transactions is performed, and the rollback operation is performed on the commit data of all the databases corresponding to each of the transactions in a set order, including:
  • the data rollback information in the second data file is sequentially read by the cache, and a rollback operation is performed on the commit data of all the databases corresponding to each transaction.
  • the data rollback information includes: a set of reverse operation program statements corresponding to the program statement set included in the transaction;
  • the reverse operation program statement set in the data rollback information of each read is executed in reverse order, and the rollback operation is performed on the commit data of all the databases corresponding to each of the transactions.
  • the reverse sequence performs a reverse operation program statement set corresponding to the data rollback information of each read, including:
  • the reverse operation program statement set corresponding to the data rollback information of each read is executed in reverse order.
  • the embodiment of the invention further provides a data rollback system, including:
  • a transaction manager configured to send a data rollback request to the resource manager if any database data operation corresponding to the transaction fails
  • a resource manager configured to: when receiving a data rollback request sent by the transaction manager, acquire, according to the transaction log index information corresponding to the transaction that is generated in advance, all transaction logs corresponding to the transaction; All transaction logs perform concurrent rollback operations on the commit data of all databases corresponding to the transaction.
  • the commit data of all the databases corresponding to the transaction concurrently performs a rollback operation.
  • the resource manager is further configured to: after the generating the data rollback information, determining whether the data capacity of the data rollback information is less than a set threshold;
  • the data rollback information is stored as a first data file.
  • the data rollback information includes: a set of reverse operation program statements corresponding to the program statement set included in the transaction;
  • the reverse operation program statement set in the shared memory is executed in reverse order, and the rollback operation is concurrently performed on the commit data of all the databases corresponding to the transaction.
  • the performing the rollback operation on the commit data of all the databases corresponding to the transaction according to the data rollback information further includes:
  • the data rollback information in the first data file that is sequentially cached is read based on the cached preset data capacity
  • the reverse operation program statement set in the data rollback information of each read is executed in reverse order, and the rollback operation is concurrently performed on the commit data of all the databases corresponding to the transaction.
  • the number of the transactions is multiple
  • the data rollback information corresponding to each of the transactions is performed, and the rollback operation is performed on the commit data of all the databases corresponding to each of the transactions in a set order, including:
  • the data rollback information in the second data file is sequentially read by the cache, and a rollback operation is performed on the commit data of all the databases corresponding to each transaction.
  • the data rollback information includes: a set of reverse operation program statements corresponding to the program statement set included in the transaction;
  • the reverse operation program statement set in the data rollback information of each read is executed in reverse order, and the rollback operation is performed on the commit data of all the databases corresponding to each of the transactions.
  • the reverse sequence performs a reverse operation program statement set corresponding to the data rollback information of each read, including:
  • the reverse operation program statement set corresponding to the data rollback information of each read is executed in reverse order.
  • An embodiment of the present invention further provides a data rollback device, where the data rollback device includes a processor and a memory;
  • the processor is configured to execute a program for data rollback stored in the memory to implement the steps of the data rollback method described above.
  • An embodiment of the present invention further provides a computer readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement the foregoing The steps of the data rollback method.
  • the embodiment of the present invention has at least the following advantages:
  • FIG. 1 is a flowchart of a data rollback method according to first to second embodiments of the present invention
  • FIG. 2 is a schematic structural diagram of a data rollback system according to third to fourth embodiments of the present invention.
  • FIG. 3 is a schematic structural diagram of a data rollback device according to a fifth embodiment of the present invention.
  • a data rollback method is provided, as shown in FIG. 1, including the following specific steps:
  • step S101 if any database data operation corresponding to the transaction fails, all transaction logs corresponding to the transaction are obtained according to the transaction log index information corresponding to the transaction generated in advance.
  • Transaction is a program execution unit that manipulates various data in the database; the transaction is usually through a high-level database manipulation language or programming language (for example: SQL (Structured Query Language), C++ or Java) a set of program statements; a transaction consists of a set of all program statements executed between a begin transaction and an end transaction.
  • a high-level database manipulation language or programming language for example: SQL (Structured Query Language), C++ or Java
  • the data operations include at least one of the following: data access, data update, data deletion, and data write operations.
  • the transaction log includes, but is not limited to, a data manipulation record for all databases corresponding to the transaction for the transaction.
  • the pre-generated transaction log index information corresponding to the transaction is corresponding to all transaction logs corresponding to the transaction;
  • the transaction log index information includes but is not limited to: identifier information corresponding to the transaction log, and corresponding transaction The start time of each transaction in the log, corresponding to the start position of each transaction in the transaction log, the end time of each transaction in the corresponding transaction log, the end position of each transaction in the corresponding transaction log, and each transaction in the corresponding transaction log Identification information, etc.
  • the transaction log corresponding to the transaction with abnormal data operation can be quickly and effectively located.
  • step S101 includes:
  • Step S102 Perform a rollback operation concurrently on the commit data of all the databases corresponding to the transaction according to all the transaction logs corresponding to the transaction.
  • the data of the database corresponding to the multiple transactions can be effectively improved when the transaction is multiple. Rollback operation speed and operating efficiency.
  • a data rollback method according to the first embodiment of the present invention can effectively improve the data rollback speed and data rollback efficiency in the database.
  • a second embodiment of the present invention includes the following specific steps:
  • step S101 if any database data operation corresponding to the transaction fails, all transaction logs corresponding to the transaction are obtained according to the transaction log index information corresponding to the transaction generated in advance.
  • step S101 includes:
  • the manner of obtaining all transaction logs corresponding to the transaction according to the transaction log index information corresponding to the transaction generated in advance includes, but is not limited to:
  • the operation of all transaction logs corresponding to each transaction is queried according to the pre-generated transaction log index information corresponding to each transaction, and is set as a query operation thread, and the query operation thread is concurrently executed; Execute all the query operation threads to get all the transaction logs corresponding to each transaction.
  • a transaction is a program execution unit that manipulates various data in a database;
  • a transaction is usually a collection of program statements written by an advanced database manipulation language or a programming language (for example, SQL, C++, or Java); the transaction includes: a transaction start (begin transaction) It consists of a set of all program statements executed between the end transaction and the end transaction.
  • the data operations include at least one of the following: data access, data update, data deletion, and data write operations.
  • the transaction log includes, but is not limited to, a data manipulation record for all databases corresponding to the transaction for the transaction.
  • the pre-generated transaction log index information corresponding to the transaction is corresponding to all transaction logs corresponding to the transaction;
  • the transaction log index information includes but is not limited to: identifier information corresponding to the transaction log, and corresponding transaction The start time of each transaction in the log, corresponding to the start position of each transaction in the transaction log, the end time of each transaction in the corresponding transaction log, the end position of each transaction in the corresponding transaction log, and each transaction in the corresponding transaction log Identification information, etc.
  • the transaction log corresponding to the transaction with the data operation abnormality can be quickly and effectively located.
  • Step S102 Perform a rollback operation concurrently on the commit data of all the databases corresponding to the transaction according to all the transaction logs corresponding to the transaction.
  • step S102 includes:
  • the commit data of all the databases corresponding to the transaction is concurrently performed.
  • the data rollback information is stored as the first data file.
  • the set threshold is not specifically limited, and may be set according to the capacity of the shared memory, or may be set according to a user's operation instruction, or may be set by a limited experiment. It can be set by a limited number of simulations.
  • the manner of performing the rollback operation on the commit data of all the databases corresponding to the transaction including but not limited to:
  • the data rollback information includes: a set of reverse operation program statements corresponding to the program statement set included in the transaction;
  • the reverse operation program statement set in the shared memory is executed in reverse order, and the rollback operation is concurrently performed on the commit data of all the databases corresponding to the transaction.
  • the data rollback information includes: a set of reverse operation program statements corresponding to the program statement set included in the transaction;
  • the data rollback information in the first cached data file is sequentially read based on the cached preset data capacity
  • the reverse operation program statement set in the data rollback information of each read is executed in reverse order, and the rollback operation is performed concurrently on the commit data of all the databases corresponding to the transaction.
  • step S102 includes:
  • the operation of parsing all the transaction logs corresponding to each transaction is set as one parsing operation thread;
  • the rollback operation is performed on the commit data of all the databases corresponding to each transaction in the set order.
  • a manner of performing a rollback operation on the commit data of all databases corresponding to each transaction in a set order including but not limited to:
  • the data rollback information corresponding to each transaction is stored as a second data file
  • the data rollback information in the second data file is sequentially read through the cache, and the rollback operation is performed on the commit data of all the databases corresponding to each transaction.
  • the data rollback information corresponding to each transaction is stored as the second data file of the set name according to the preset storage name rule;
  • the data rollback information in the second data file is sequentially read through the cache, and the rollback operation is performed on the commit data of all the databases corresponding to each transaction.
  • the data rollback information corresponding to each transaction is stored as a second data file of the set name; wherein the storage name rule includes but is not limited to: the base file name + the transaction log identifier information + Current serial number;
  • the data rollback information in the second data file is sequentially read through the cache, and the rollback operation is performed on the commit data of all the databases corresponding to each transaction.
  • the data rollback information in the second data file is sequentially read by the cache, and the rollback operation is performed on the commit data of all the databases corresponding to each transaction, including but not limited to :
  • the data rollback information includes: a set of reverse operation program statements corresponding to the set of program statements included in the transaction;
  • the reverse operation program statement set in the data rollback information of each read is executed in reverse order, and the rollback operation is performed on the commit data of all the databases corresponding to each transaction.
  • the speed of reading the second data file can be effectively improved, thereby improving the speed of data rollback and the efficiency of data rollback.
  • the cached preset data capacity is not specifically limited, and the maximum value of a complete transaction may be read for the database.
  • the manner in which the set of reverse operator statements in the data rollback information for each read is performed in reverse order includes, but is not limited to:
  • the reverse operation program statement set corresponding to the data rollback information of each read is executed in reverse order.
  • the data of the database corresponding to the multiple transactions can be effectively improved when the transaction is multiple. Rollback operation speed and operating efficiency.
  • a data rollback method in which all the transaction logs corresponding to the transaction are concurrently executed by the commit data of all the databases corresponding to the transaction, and the transaction is performed in multiple
  • the rollback speed of the data in the database and the rollback efficiency of the data can be effectively improved.
  • by binding the variables, the data security, the data rollback speed, and the data rollback efficiency can be effectively improved.
  • a third embodiment of the present invention provides a data rollback system, as shown in FIG. 2, including the following components:
  • the transaction manager 100 is configured to send a data rollback request to the resource manager 200 if the data operation of any of the databases 300 corresponding to the transaction fails.
  • the transaction manager 100 is configured to send a data rollback request to the resource manager 200 if the data operation of any of the databases corresponding to the transaction fails, or the data rollback instruction corresponding to the transaction is received.
  • the resource manager 200 is configured to: when receiving the data rollback request sent by the transaction manager 100, acquire all transaction logs corresponding to the transaction according to the transaction log index information corresponding to the pre-generated transaction; according to all transaction logs corresponding to the transaction, The rollback operation is performed concurrently on the commit data of all the databases 300 corresponding to the transaction.
  • the transaction is a program execution unit that operates various data in the database 300; the transaction is typically a set of program statements written by the advanced database 300 manipulation language or programming language (eg, SQL, C++, or Java); the transaction includes: the transaction begins ( A combination of the entire set of program statements executed between begin transaction and end transaction.
  • the advanced database 300 manipulation language or programming language eg, SQL, C++, or Java
  • the data operations include at least one of the following: data access, data update, data deletion, and data write operations.
  • the transaction log includes, but is not limited to, a data manipulation record for all databases 300 corresponding to the transaction for the transaction.
  • the pre-generated transaction log index information corresponding to the transaction is corresponding to all transaction logs corresponding to the transaction;
  • the transaction log index information includes but is not limited to: identifier information corresponding to the transaction log, and corresponding transaction The start time of each transaction in the log, corresponding to the start position of each transaction in the transaction log, the end time of each transaction in the corresponding transaction log, the end position of each transaction in the corresponding transaction log, and each transaction in the corresponding transaction log Identification information, etc.
  • the transaction log corresponding to the transaction with the data operation abnormality can be quickly and effectively located.
  • the database 300 corresponding to the plurality of transactions can be effectively improved when the transaction is multiple. Data rollback operation speed and operational efficiency.
  • a data rollback system can effectively improve the data rollback speed and data rollback efficiency in the database.
  • a data rollback system as shown in FIG. 2, includes the following components:
  • the transaction manager 100 is configured to send a data rollback request to the resource manager 200 if the data operation of any of the databases 300 corresponding to the transaction fails.
  • the transaction manager 100 is configured to send a data rollback request to the resource manager 200 if the data operation of any of the databases corresponding to the transaction fails, or the data rollback instruction corresponding to the transaction is received.
  • the resource manager 200 is configured to: when receiving the data rollback request sent by the transaction manager 100, acquire all transaction logs corresponding to the transaction according to the transaction log index information corresponding to the pre-generated transaction; according to all transaction logs corresponding to the transaction, The rollback operation is performed concurrently on the commit data of all the databases 300 corresponding to the transaction.
  • the manner of obtaining all transaction logs corresponding to the transaction according to the transaction log index information corresponding to the transaction generated in advance includes, but is not limited to:
  • the operation of querying all transaction logs corresponding to each transaction is set according to the pre-generated transaction log index information corresponding to each transaction, and is set as a query operation thread, and all query operations are performed concurrently.
  • the resource manager 200 is configured to generate data rollback information according to the commit data of all the databases 300 corresponding to the transaction, according to all the transaction logs corresponding to the transaction, in the case that the number of transactions is one;
  • the commit data of all the databases 300 corresponding to the transaction is concurrently performed to perform a rollback operation.
  • the data rollback information is stored as the first data file.
  • the set threshold is not specifically limited, and may be set according to the capacity of the shared memory, or may be set according to a user's operation instruction, or may be set by a limited experiment. It can be set by a limited number of simulations.
  • the manner of performing the rollback operation concurrently on the commit data of all the databases 300 corresponding to the transaction includes, but is not limited to:
  • the data rollback information includes: a set of reverse operation program statements corresponding to the program statement set included in the transaction;
  • the reverse operation program statement set in the shared memory is executed in reverse order, and the rollback operation is concurrently performed on the commit data of all the databases 300 corresponding to the transaction.
  • the data rollback information includes: a set of reverse operation program statements corresponding to the program statement set included in the transaction;
  • the data rollback information in the first cached data file is sequentially read based on the cached preset data capacity
  • the reverse operation program statement set in the data rollback information of each read is executed in reverse order, and the rollback operation is concurrently performed on the commit data of all the databases 300 corresponding to the transaction.
  • the transaction log corresponding to the transaction with the data operation abnormality can be quickly and effectively located.
  • the resource manager 200 is configured to: when the number of transactions is multiple, set an operation of parsing all transaction logs corresponding to each transaction as a parsing operation thread;
  • a rollback operation is sequentially performed on the commit data of all the databases 300 corresponding to each transaction in the set order.
  • the manner of performing a rollback operation on the commit data of all the databases 300 corresponding to each transaction in a set order according to the data rollback information corresponding to each transaction includes, but is not limited to:
  • the data rollback information corresponding to each transaction is stored as a second data file
  • the data rollback information in the second data file is sequentially read by the cache, and the rollback operation is performed on the submitted data of all the databases 300 corresponding to each transaction.
  • the data rollback information corresponding to each transaction is stored as the second data file of the set name according to the preset storage name rule;
  • the data rollback information in the second data file is sequentially read by the cache, and the rollback operation is performed on the submitted data of all the databases 300 corresponding to each transaction.
  • the data rollback information corresponding to each transaction is stored as a second data file of the set name; wherein the storage name rule includes but is not limited to: the base file name + the transaction log identifier information + Current serial number;
  • the data rollback information in the second data file is sequentially read by the cache, and the rollback operation is performed on the submitted data of all the databases 300 corresponding to each transaction.
  • the data rollback information in the second data file is sequentially read by the cache, and the rollback operation is performed on the submitted data of all the databases 300 corresponding to each transaction, including but not Limited to:
  • the data rollback information includes: a set of reverse operation program statements corresponding to the set of program statements included in the transaction;
  • the reverse operation program statement set in the data rollback information of each read is executed in reverse order, and the rollback operation is performed on the commit data of all the databases 300 corresponding to each transaction.
  • the speed of reading the second data file can be effectively improved, thereby improving the speed of data rollback and the efficiency of data rollback.
  • the cached preset data capacity is not specifically limited, and the maximum value of a complete transaction may be read for the database 300.
  • the manner in which the set of reverse operator statements in the data rollback information for each read is performed in reverse order includes, but is not limited to:
  • the reverse operation program statement set corresponding to the data rollback information of each read is executed in reverse order.
  • the database 300 corresponding to the plurality of transactions can be effectively improved when the transaction is multiple. Data rollback operation speed and operational efficiency.
  • the database 300 corresponding to the plurality of transactions can be effectively improved when the transaction is multiple. Data rollback operation speed and operational efficiency.
  • a data rollback system can effectively improve the data rollback speed and data rollback efficiency in the database; and at the same time, the data security and data can be effectively improved by binding variables. Rollback speed and data rollback efficiency.
  • a data rollback device as shown in FIG. 3, includes the following components:
  • processor 501 and memory 502. may be connected by a bus or other means.
  • the processor 501 may be a general-purpose processor, such as a central processing unit (CPU), or may be a digital signal processor (DSP) or an application specific integrated circuit (ASIC). Or one or more integrated circuits configured to implement embodiments of the present invention.
  • the memory 502 is configured to store executable instructions of the processor 501;
  • the memory 502 is configured to store the program code and transmit the program code to the processor 501.
  • the memory 502 may include a volatile memory (Volatile Memory), such as a random access memory (RAM); the memory 502 may also include a non-volatile memory (Non-Volatile Memory), such as a read-only memory (Read- Only Memory, ROM), Flash Memory, Hard Disk Drive (HDD), or Solid-State Drive (SSD); the memory 502 may also include a combination of the above types of memories.
  • volatile memory such as a random access memory (RAM)
  • non-Volatile Memory such as a read-only memory (Read- Only Memory, ROM), Flash Memory, Hard Disk Drive (HDD), or Solid-State Drive (SSD)
  • the memory 502 may also include a combination of the above types of memories.
  • the processor 501 is configured to invoke the program code management code stored in the memory 502 to perform some or all of the steps from the first embodiment of the present invention to the second embodiment of the present invention.
  • a data rollback device can effectively improve the data rollback speed and data rollback efficiency in the database, and can effectively improve data security and data by binding variables. Rollback speed and data rollback efficiency.
  • a sixth embodiment of the present invention is a computer readable storage medium.
  • the computer storage medium can be RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, mobile hard disk, CD-ROM, or any other form of storage medium known in the art.
  • the computer readable storage medium stores one or more programs, which may be executed by one or more processors to implement any one of the first embodiment of the present invention to the second embodiment of the present invention. Some or all of the steps.
  • a computer readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors, which can effectively improve data in the database. Rollback speed and data rollback efficiency; at the same time, by binding variables, data security, data rollback speed and data rollback efficiency can be effectively improved.
  • the seventh embodiment of the present invention is based on the above embodiment, and takes a data rollback method as an example to introduce an application example of the present invention.
  • step S701 in the case that the database execution execution of the statement 2 in a distributed transaction fails, the transaction manager issues a rollback request to the resource manager where the statement 1 is located.
  • the distributed transaction (where the transaction ID value is 5) contains two SQL statements, which are respectively distributed in two different database nodes.
  • the SQL statement contained in the transaction is as follows:
  • Statement 1 execution commits successfully, but the database in which statement 2 is executed fails to submit (the commit failed database is automatically rolled back);
  • the rollback request contains the transaction ID value of 5, the start time (timestamp) of the transaction 1495673713, and the end time (timestamp) of the transaction 1947673373.
  • Step S702 the resource manager acquires a transaction log file corresponding to the distributed transaction according to the transaction log index information.
  • the transaction log index information in the resource manager is as follows:
  • the format of the transaction log index information is: transaction start time transaction log file name transaction start location transaction ID value;
  • Step S703 the resource manager throws the transaction in the rollback request into the processing transaction thread pool, and parses the transaction log file corresponding to the distributed transaction by using the rollback request and the transaction log index information.
  • the resource manager throws the transaction in the rollback request into the processing transaction thread pool, and through the rollback request and the transaction log index information, locates the transaction log file to be parsed as mysql-bin.000015, the starting position is 123, and then the The transaction log file is thrown into the parsed transaction log file thread for parsing.
  • the rollback SQL statement is generated and stored in the shared memory.
  • Step S704 executing the reverse statement.
  • the eighth embodiment of the present invention is based on the foregoing embodiment, and takes a data rollback method as an example to introduce an application example of the present invention.
  • Step S801 in the case that a distributed transaction has been successfully submitted, the transaction manager sends a rollback request to a set resource manager corresponding to the distributed transaction.
  • step S801 includes:
  • a distributed transaction (transaction ID value is 3, field a of db.tb table contains data 2, 3, 4), and the SQL statement of the distributed transaction includes:
  • the distributed transaction has been successfully submitted, and the transaction manager initiates a rollback request to the resource manager, the request message containing the transaction ID value of 3, the start time (time stamp) of the transaction 3, 1945563363, and the end time (time stamp) 1495653833.
  • Step S802 the resource manager acquires a transaction log file corresponding to the distributed transaction according to the transaction log index information.
  • the transaction log index information in the resource manager is as follows:
  • the format of the transaction log index information is: transaction start time transaction log file name transaction start location transaction ID value;
  • Step S803 the resource manager throws the transaction in the rollback request into the processing transaction thread pool, and parses the transaction log file corresponding to the distributed transaction by using the rollback request and the transaction log index information.
  • step S803 includes:
  • the resource manager throws the transaction in the rollback request into the processing transaction thread pool, and through the rollback request and the transaction log index information, locates the transaction log file to be parsed as mysql-bin.000001, the starting position is 1444, and the The transaction file is thrown into the parsing transaction log file thread for parsing;
  • the rollback SQL statement is generated and stored in the shared memory.
  • the generated rollback content is: insert into db.tb(a)values(?);2;3;4. Among them, 2, 3, 4 are the three values of the field a, which is equivalent to the generated reverse rollback statement:
  • Step S804 the reverse statement is executed by binding variables.
  • step S804 includes:
  • Executing SQL statements in reverse order by binding variables means that they are executed in the order of statements 6, 5, and 4. After the execution is successful, the entire rollback process is completed. For details about how to bind variables, refer to the related description. The specific implementation process is not described in detail. Executing a reverse statement by binding variables can be considered as executing the statements in a forward order, thereby ensuring consistency of the data (statements).
  • the ninth embodiment of the present invention is based on the above embodiment, and an application example of the present invention is introduced by taking a data rollback method as an example.
  • Step S901 in the case that two distributed transactions have been successfully submitted, the transaction manager sends a rollback request to the set resource manager corresponding to the two distributed transactions.
  • step S901 includes:
  • transaction ID values are 3 and 6 respectively.
  • the transaction manager After both transactions are successfully submitted, the transaction manager initiates a rollback request to the resource manager.
  • the request message contains the transaction ID value of 3.
  • the start time (time stamp) of the transaction 3 is 1495653723 and the end time (time stamp) 1495653923, the transaction ID value.
  • the start time (time stamp) of transaction 6 is 1495755967 and the end time (time stamp) is 1495756014.
  • Step S902 the resource manager acquires a transaction log file corresponding to the distributed transaction according to the transaction log index information.
  • the transaction log index information in the resource manager is as follows:
  • the format of the transaction log index information is: transaction start time transaction log file name transaction start location transaction ID value;
  • Step S903 the resource manager throws the transaction in the rollback request into the processing transaction thread pool, and parses the transaction log file corresponding to the two distributed transactions by using the rollback request and the transaction log index information.
  • step S903 includes:
  • the resource manager throws the transaction 3 and the transaction 6 into the processing transaction thread pool respectively, and locates the transaction log file to be parsed by the transaction 3 as mysql-bin.000017 through the rollback request and the transaction log index information.
  • the starting position is 467
  • the transaction log file to be parsed by transaction 6 is mysql-bin.000019
  • the starting position is 123.
  • the two transaction log files are thrown into the parsing transaction log file thread for parsing.
  • the generated file corresponding to transaction 3 is: rollback_mysql-bin.000017_000002, and the rollback content contained in the file is:
  • Step S904 executing the reverse statement by binding variables.
  • step S904 includes:
  • the tenth embodiment of the present invention is based on the above embodiment, and takes a data rollback method as an example to introduce an application example of the present invention.
  • Step S1101 In the case that three distributed transactions have been successfully submitted, the transaction manager sends a rollback request to the set resource manager corresponding to the three distributed transactions.
  • step S1101 includes:
  • Transaction 1 includes: 1.insert into db.tb(a)values(1);
  • the transaction manager initiates a rollback request to the resource manager, which includes:
  • Transaction ID value 1 transaction 1 start time (time stamp) 1495653723 and end time (time stamp) 1495653923;
  • Transaction ID value 2 transaction 2 start time (time stamp) 1945654403 and end time (time stamp) 1495654983;
  • Transaction ID value 3 transaction 3 start time (time stamp) 1947778793 and end time (time stamp) 149777901.
  • Step S1102 The resource manager acquires a transaction log file corresponding to the distributed transaction according to the transaction log index information.
  • the transaction log index information in the resource manager is as follows:
  • the format of the transaction log index information is: transaction start time transaction log file name transaction start location transaction ID value;
  • step S1103 the resource manager throws the transaction in the rollback request into the processing transaction thread pool, and parses the transaction log file corresponding to the three distributed transactions by using the rollback request and the transaction log index information.
  • step S1103 includes:
  • the resource manager throws the transactions 1, 2, and 3 in the rollback request into the processing transaction thread pool.
  • the transaction log files to be resolved by transaction 1 and transaction 2 are respectively located as mysql- Bin.000001, the starting position is 123, 467, the transaction log file to be parsed by transaction 3 is mysql-bin.000002, the starting position is 123, and the three transaction log files are thrown into the parsing transaction log file thread for parsing.
  • the generated file corresponding to transaction 1 is: rollback_mysql-bin.000001_000001, and the file contents include:
  • the generated file corresponding to transaction 2 is: rollback_mysql-bin.000001_000003, and the file contents include:
  • the generated file corresponding to transaction 3 is: rollback_mysql-bin.000002_000002, and the file contents include:
  • step S1104 the reverse statement is executed by binding variables.
  • step S1104 includes:
  • the files are executed in reverse order and the statements in each file are executed in reverse order. After the execution is successful, the entire rollback process is completed, thereby ensuring data consistency.
  • the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is better.
  • Implementation Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal (which may be a cell phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or a combination of software and hardware. Moreover, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) including computer usable program code.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

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

Abstract

Les modes de réalisation de la présente invention concernent un procédé de restauration de données comprenant les étapes suivantes : en cas d'échec d'une opération de données d'une quelconque base de données correspondant à une transaction, acquérir selon des informations d'index de journal de transactions prégénérées correspondant à la transaction, tous les journaux de transactions correspondant à cette transaction; et mettre en oeuvre simultanément, conformément à tous les journaux de transactions correspondant à la transaction, une opération de restauration sur les données soumises par toutes les bases de données correspondant à cette transaction. Les modes de réalisation de la présente invention se rapportent en outre à un système de restauration de données, à un dispositif et à un support de stockage lisible par ordinateur.
PCT/CN2018/099322 2017-10-19 2018-08-08 Procédé et dispositif de restauration de données et support d'informations lisible par ordinateur WO2019076102A1 (fr)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710977289.6A CN110019050A (zh) 2017-10-19 2017-10-19 一种数据回滚方法、系统、设备及计算机可读存储介质
CN201710977289.6 2017-10-19

Publications (1)

Publication Number Publication Date
WO2019076102A1 true WO2019076102A1 (fr) 2019-04-25

Family

ID=66173087

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/099322 WO2019076102A1 (fr) 2017-10-19 2018-08-08 Procédé et dispositif de restauration de données et support d'informations lisible par ordinateur

Country Status (2)

Country Link
CN (1) CN110019050A (fr)
WO (1) WO2019076102A1 (fr)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110473100A (zh) * 2019-08-15 2019-11-19 深圳前海微众银行股份有限公司 一种基于区块链系统的交易处理方法及装置
CN113486109A (zh) * 2021-06-01 2021-10-08 中国人民财产保险股份有限公司 异构数据库的数据同步方法、装置及电子设备
CN116775664A (zh) * 2023-08-17 2023-09-19 金篆信科有限责任公司 一种提高时间自由度的数据库回放方法、装置、系统及介质

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256656B (zh) * 2019-07-22 2023-04-18 金篆信科有限责任公司 事务回滚方法及装置、数据库、系统、计算机存储介质
CN111176907B (zh) * 2020-01-06 2021-03-05 中科驭数(北京)科技有限公司 硬件数据库回滚方法、软件数据库回滚方法及装置
CN111488367B (zh) * 2020-04-16 2024-07-02 深圳前海微众银行股份有限公司 数据一致性的实现方法、装置、设备及计算机存储介质
CN113254425B (zh) * 2021-06-24 2022-01-11 阿里云计算有限公司 数据库事务保持的方法、设备、系统、程序及存储介质
CN114302438B (zh) * 2021-12-29 2024-08-06 中国电信股份有限公司 网元的异常处理方法、装置、设备以及存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101089857A (zh) * 2007-07-24 2007-12-19 中兴通讯股份有限公司 一种内存数据库事务管理方法及系统
CN106557514A (zh) * 2015-09-29 2017-04-05 中兴通讯股份有限公司 一种分布式事务回滚方法及装置
CN107203560A (zh) * 2016-03-18 2017-09-26 中国移动通信集团宁夏有限公司 数据库、多数据库操作事务一致性保证方法及系统

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101127045B (zh) * 2007-09-25 2010-04-21 中兴通讯股份有限公司 数据库可重复读实现方法、装置及数据库管理系统
CN103677968B (zh) * 2012-09-07 2017-11-10 腾讯科技(深圳)有限公司 事务处理方法、事务协调器装置、事务参与者装置及系统
CN104636401B (zh) * 2013-11-15 2018-04-06 中国石油天然气股份有限公司 一种scada系统数据回滚的方法及装置
CN104793988B (zh) * 2014-01-20 2019-01-22 阿里巴巴集团控股有限公司 跨数据库分布式事务的实现方法和装置
GB2531537A (en) * 2014-10-21 2016-04-27 Ibm Database Management system and method of operation
CN105701190A (zh) * 2016-01-07 2016-06-22 深圳市金证科技股份有限公司 一种数据同步的方法和装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101089857A (zh) * 2007-07-24 2007-12-19 中兴通讯股份有限公司 一种内存数据库事务管理方法及系统
CN106557514A (zh) * 2015-09-29 2017-04-05 中兴通讯股份有限公司 一种分布式事务回滚方法及装置
CN107203560A (zh) * 2016-03-18 2017-09-26 中国移动通信集团宁夏有限公司 数据库、多数据库操作事务一致性保证方法及系统

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110473100A (zh) * 2019-08-15 2019-11-19 深圳前海微众银行股份有限公司 一种基于区块链系统的交易处理方法及装置
CN113486109A (zh) * 2021-06-01 2021-10-08 中国人民财产保险股份有限公司 异构数据库的数据同步方法、装置及电子设备
CN116775664A (zh) * 2023-08-17 2023-09-19 金篆信科有限责任公司 一种提高时间自由度的数据库回放方法、装置、系统及介质
CN116775664B (zh) * 2023-08-17 2023-11-14 金篆信科有限责任公司 一种提高时间自由度的数据库回放方法、装置、系统及介质

Also Published As

Publication number Publication date
CN110019050A (zh) 2019-07-16

Similar Documents

Publication Publication Date Title
WO2019076102A1 (fr) Procédé et dispositif de restauration de données et support d'informations lisible par ordinateur
US20180113771A1 (en) Transaction consistency query support for replicated data from recovery log to external data stores
CN107220142B (zh) 执行数据恢复操作的方法及装置
US8954408B2 (en) Allowing writes to complete without obtaining a write lock to a file
US10380103B2 (en) Object data updating method and apparatus in an object storage system
EP2863310B1 (fr) Procédé et appareil de traitement de données, ainsi que dispositif de stockage partagé
US8738964B2 (en) Disk-free recovery of XA transactions for in-memory data grids
US8719237B2 (en) Method and apparatus for deleting duplicate data
WO2017041654A1 (fr) Procédé et appareil pour écrire et acquérir des données dans un système de stockage réparti
US11232071B2 (en) Regressable differential data structures
WO2016050112A1 (fr) Procédé de stockage de données, appareil de stockage, et dispositif de stockage
US10013312B2 (en) Method and system for a safe archiving of data
CN107357920B (zh) 一种增量式的多副本数据同步方法及系统
CN109491834B (zh) 一种应用于数据库的数据恢复方法及装置
WO2022048358A1 (fr) Procédé et dispositif de traitement de données et support d'enregistrement
CN109086382A (zh) 一种数据同步方法、装置、设备及存储介质
US11853284B2 (en) In-place updates with concurrent reads in a decomposed state
CN106874343B (zh) 一种时序数据库的数据删除方法及系统
CN102760154A (zh) 一种在文本信息检索服务中支持分布式事务管理的方法
WO2019072088A1 (fr) Procédé de gestion de fichiers, dispositif de gestion de fichiers, équipement électronique et support d'enregistrement
US10922277B1 (en) Logging file system metadata changes using a single log hold per cached block of metadata
CN113268483A (zh) 请求处理方法和装置、电子设备和存储介质
CN107844491B (zh) 一种在分布式系统中实现强一致性读操作的方法与设备
CN112231105A (zh) 基于区块链的区块写入方法及系统
US10706012B2 (en) File creation

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 10/09/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18868535

Country of ref document: EP

Kind code of ref document: A1