Method and device for rollback log generation and method and device for determining active data table in transaction rollback
By adding a storage area for positioning information in the rollback log record of the MySQL database, the problem of long database startup time caused by the large amount of Undo logs is solved, and the effect of quickly obtaining active transaction table information is achieved, and the database startup efficiency is optimized.
Patent Information
- Application Number
- CN202311476218.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-07
- Publication Date
- 2025-05-13
AI Technical Summary
When MySQL database restarts, the large amount of Undo logs makes it a long time to scan Undo logs to obtain table information, affecting the normal startup of the database.
By extending the format of rollback log records, adding a designated storage area to store location information, optimizing the scanning process of rollback logs, and quickly finding the table information of active transactions.
The process of scanning and rolling back logs to obtain table information is accelerated, the number of scans of Undo logs is reduced, the speed of recovery of table lock information is improved, and the database startup process is optimized.
Smart Images

Figure CN119988345A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and device for generating a rollback log and determining an active data table during a transaction rollback. Background Art
[0002] In database systems, especially relational database systems, in order to ensure the consistency of data update operations, two logs are introduced to protect data operations. Taking MySQL (My Structured Query Language, relational database management system) database as an example, the Undo log (rollback log) is used to protect the recovery of old data. When the MySQL database is restarted due to some abnormalities, it is necessary to restore it to the state before the restart through the Undo log. One of the important steps is to scan the Undo log to obtain the table information of the active transaction for rebuilding the table lock to ensure the safety of the active transaction when rolling back. When the amount of Undo log is relatively large, the process of scanning the Undo log to obtain the table information will take a lot of time, affecting the normal startup of the database. Summary of the invention
[0003] The method and device for generating a rollback log and determining an active data table in a transaction rollback provided by the embodiments of the present invention at least expand the record format of the rollback log, thereby speeding up the process of scanning the rollback log to obtain table information and speeding up the startup of the database.
[0004] According to one aspect of the present application, a rollback log generation method is also provided, comprising: in the operation of one or more data tables in the execution of a transaction, operating the current data table and generating a rollback log record corresponding to the current operation, wherein the rollback log record includes a designated storage area, and the designated storage area stores one of the following positioning information: when the current operation is the second operation in the transaction, the address of the rollback log record corresponding to the previous operation is used as the positioning information; when the data table corresponding to the previous operation is not a new table, the positioning information stored in the rollback log record corresponding to the previous operation is used as the positioning information; when the data table corresponding to the previous operation is a new table, the address of the rollback log record corresponding to the previous operation is used as the positioning information; and the rollback log records corresponding to each operation in the transaction are stored in the order of operations to obtain the rollback log of the transaction.
[0005] According to another aspect of the present application, a method for determining an active data table in a transaction rollback is also provided, comprising: determining a starting log record to be scanned in a rollback log; obtaining log records to be scanned after the starting log record based on positioning information stored in a designated storage area of the starting log record; wherein the rollback log is obtained according to the rollback log generation method described above; and taking the data table corresponding to the starting log record and the data tables corresponding to each of the log records to be scanned as the active data table.
[0006] According to another aspect of the present application, a rollback log generation device is also provided, including: a generation module, used to operate the current data table and generate a rollback log record corresponding to the current operation in the operation of one or more data tables in the execution of a transaction, wherein the rollback log record includes a designated storage area, and the designated storage area stores one of the following positioning information: when the current operation is the second operation in the transaction, the address of the rollback log record corresponding to the previous operation is used as the positioning information; when the data table corresponding to the previous operation is not a new table, the positioning information stored in the rollback log record corresponding to the previous operation is used as the positioning information; when the data table corresponding to the previous operation is a new table, the address of the rollback log record corresponding to the previous operation is used as the positioning information; a storage module, used to store the rollback log records corresponding to each operation in the transaction in the order of operations to obtain the rollback log of the transaction.
[0007] According to another aspect of the present application, a device for determining an active data table in a transaction rollback is also provided, comprising: a determination module for determining a starting log record to be scanned in a rollback log; a determination module for obtaining a log record to be scanned after the starting log record based on positioning information stored in a designated storage area of the starting log record; wherein the rollback log is obtained according to the above-mentioned rollback log generation method; and a data module for using a data table corresponding to the starting log record and a data table corresponding to each of the log records to be scanned as the active data table.
[0008] According to another aspect of the present application, a database management system is also provided, including: the above-mentioned rollback log generating device, and the above-mentioned device for determining the active data table in the transaction rollback.
[0009] According to another aspect of the present application, an electronic device is provided, comprising: a processor; and a memory storing a program, wherein the program comprises instructions, and when the instructions are executed by the processor, the processor executes the above method.
[0010] According to another aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is also provided, wherein the computer instructions are used to enable the computer to execute the steps of the above method.
[0011] According to another aspect of the present application, a computer program product is also provided. The computer program product includes a computer program. When the computer program is executed by a processor, the above method steps are implemented.
[0012] Beneficial effects of the embodiments of the present invention:
[0013] An embodiment of the present invention includes: in the operation of one or more data tables in the execution of a transaction, operating the current data table and generating a rollback log record corresponding to the current operation, wherein the rollback log record includes a designated storage area, and the designated storage area stores one of the following positioning information: when the current operation is the second operation in the transaction, the address of the rollback log record corresponding to the previous operation is used as the positioning information; when the data table corresponding to the previous operation is not a new table, the positioning information stored in the rollback log record corresponding to the previous operation is used as the positioning information; when the data table corresponding to the previous operation is a new table, the address of the rollback log record corresponding to the previous operation is used as the positioning information; and the rollback log records corresponding to each operation in the transaction are stored in the order of operations to obtain the rollback log of the transaction. When generating a rollback log record in a rollback log, the embodiment of the present invention expands the format of the rollback log record. The rollback log record of the embodiment of the present invention includes a specified storage area, and the specified storage area is used to store positioning information. Therefore, when the MySQL database is restarted, the rollback log record is scanned along the positioning information, and the table information of the active transaction can be quickly found in the rollback log record. Therefore, the present invention can speed up the process of scanning the rollback log to obtain table information, speed up the recovery of table locks, and optimize the startup of the database.
[0014] The details of one or more embodiments of the invention are set forth in the following drawings and description so that other features, objects, and advantages of the invention are more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other embodiments can be obtained based on these drawings without creative work.
[0016] Figure 1 is a flow chart of a rollback log generation method according to an embodiment of the present invention;
[0017] Figure 2 It is the organizational logic diagram of the rollback log in the existing MySQL database;
[0018] Figure 3 It is a pointer diagram of the existing rollback log record;
[0019] Figure 4 is a pointer schematic diagram of a rollback log record according to an embodiment of the present invention;
[0020] Figure 5 It is a schematic diagram of a transaction operation process of an embodiment of the present invention;
[0021] Figure 6 It is a schematic diagram of the process of scanning the rollback log according to an embodiment of the present invention;
[0022] Figure 7 Schematic diagram of the structure of the electronic device of this embodiment. DETAILED DESCRIPTION
[0023] Embodiments of the present embodiment will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present embodiment are shown in the accompanying drawings, it should be understood that the present embodiment can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein, which are instead provided for a more thorough and complete understanding of the present embodiment. It should be understood that the drawings and embodiments of the present embodiment are only for exemplary purposes and are not intended to limit the scope of protection of the present embodiment.
[0024] The terms involved are explained below.
[0025] MySQL: A popular relational database.
[0026] Undo log: A rollback log inside the MySQL database, used to restore data before it is modified. When data needs to be restored, the version before the modification can be obtained from the Undo log.
[0027] Transaction: In MySQL database, a transaction is a logical unit of a set of database operations, which are either all executed successfully or all rolled back (undone). Transactions can ensure the consistency and integrity of the database.
[0028] Active transaction: A transaction that has been opened but not yet committed, that is, a transaction that is being modified.
[0029] Transaction rollback: Undo all operations that have been executed in the transaction and restore to the state before the transaction was executed.
[0030] The organizational logic of the Undo log in the MySQL database is as follows: Figure 2As shown in the figure, for each transaction, an Undo log header is first assigned to record transaction-related information; for each subsequent data operation (inside the MySQL database, update operations and insert operations are handled separately, and for convenience, they are described together here), an Undo log record is generated to record the data before the data operation. In terms of the organization of the Undo log, all Undo logs are recorded in the data page, and the Undo log of a single transaction may span multiple data pages; in each data page, the Undo log records are written in order according to the order in which they are generated.
[0031] See also Figure 3 The pointer diagram of the existing rollback log record shown in FIG. 1 shows that in each Undo log record, there is a pointer information at the head and tail of the record, respectively. Figure 3 , where the head pointer points to the end of the record and the tail pointer points to the beginning of the record. These two pointers can be used to quickly locate the boundary of each Undo log record.
[0032] For the recovery of active transaction table locks during database restart, the existing methods are:
[0033] 1. First, find the Undo log header corresponding to the active transaction;
[0034] 2. Find the last Undo log record based on the Undo log header;
[0035] 3. Start from the last Undo log record and scan forward in sequence until all Undo log records are found;
[0036] During the scanning process, parse the information in the Undo log record. If a new table appears, record the table information. If it is a table that has been scanned before, directly scan the next record.
[0037] The existing method needs to scan the entire Undo log record to obtain the table information corresponding to the transaction. When the amount of Undo log corresponding to the transaction is large, the process of scanning the Undo log to obtain the table information will also consume a lot of time.
[0038] Based on this, the present invention provides a method and device for determining active data tables in rollback log generation and transaction rollback. The method expands the format of the current rollback log record, adds a designated storage area to the rollback log record, and uses the designated storage area to store positioning information. The positioning information is used to jump to the next rollback log record to be scanned when scanning the rollback log record, thereby determining the table information of the table that needs to be locked based on the scanned rollback log record, greatly reducing the scanning amount of the rollback log and accelerating the recovery of the table lock information.
[0039] A rollback log generation method is provided in an embodiment of the present invention. The method can be developed and implemented on a cloud database, and the method can be used when generating a rollback log of a MySQL database. Figure 1 is a flow chart of a rollback log generation method according to an embodiment of the present application. Figure 1 The method steps involved are described.
[0040] Step S101, in the operation on one or more data tables in the execution of the transaction, operate the current data table and generate a rollback log record corresponding to the current operation, wherein the rollback log record includes a designated storage area, and the designated storage area stores one of the following positioning information: when the current operation is the second operation in the transaction, the address of the rollback log record corresponding to the previous operation is used as the positioning information; when the data table corresponding to the previous operation is not a new table, the positioning information stored in the rollback log record corresponding to the previous operation is used as the positioning information; when the data table corresponding to the previous operation is a new table, the address of the rollback log record corresponding to the previous operation is used as the positioning information.
[0041] In this step, a transaction in the MySQL database may operate one or more tables. When a transaction operates on a table, a rollback log record is generated. In the operation of one or more data tables in the execution of the transaction, the current data table is operated and a rollback log record corresponding to the current operation is generated. In the rollback log record, a specified storage area is included, and the specified storage area stores positioning information. The positioning information is used to determine the next rollback log record to be scanned when scanning the rollback log record.
[0042] When the current operation is the second operation in the transaction, the address of the rollback log record corresponding to the previous operation is used as the positioning information. Based on this, the positioning information stored in the designated storage area of the rollback log record corresponding to the current operation can point to the first rollback log record in the rollback log. Therefore, when scanning the rollback log record corresponding to the current operation, it is possible to jump to the first rollback log record.
[0043] When the data table corresponding to the previous operation is not a new table, the positioning information stored in the rollback log record corresponding to the previous operation is used as the positioning information. Based on this, the positioning information stored in the designated storage area of the rollback log record corresponding to the current operation and the positioning information stored in the rollback log record corresponding to the previous operation can point to the same rollback log record. Therefore, when scanning the rollback log record corresponding to the current operation, it is possible to jump to the rollback log record generated when the transaction last operated on a new table.
[0044] When the data table corresponding to the previous operation is a new table, the address of the rollback log record corresponding to the previous operation is used as the positioning information. Based on this, the positioning information stored in the designated storage area of the rollback log record corresponding to the current operation can point to the rollback log record corresponding to the previous operation. Therefore, when scanning the rollback log record corresponding to the current operation, it is possible to jump to the rollback log record generated when the transaction last operated on the new table.
[0045] It should be noted that when the current operation is the first operation in the transaction, the rollback log record corresponding to the current operation may not include the specified storage area, or may include the specified storage area and store a given value in the specified storage area. For example, the given value may include but is not limited to a null value.
[0046] The designated storage area is a storage location or storage unit in a computer. The designated storage area is a physical location used to store positioning information in a rollback log record using a disk or a file. Compared to memory space, a disk is a permanent storage medium that uses magnetic materials to store data, and the data is retained after a power outage. The read and write speed of the disk is relatively slow, but the capacity is large. It should be noted that the size and allocation method of the storage space of the designated storage area in the rollback log record can be set according to actual needs, and the embodiments of the present invention do not specifically limit this.
[0047] In this step, a corresponding designated storage area is added to the rollback log record, thereby expanding the record format of the rollback log so that when the MySQL database is restarted, the positioning information stored in the designated storage area can be used to quickly obtain the table information of the data table that needs to be locked.
[0048] Step S102: storing the rollback log records corresponding to each operation in the transaction in the order of operations to obtain the rollback log of the transaction.
[0049] In this step, a rollback log is generated for a transaction. The rollback log includes multiple rollback log records. The storage order of the multiple rollback log records is determined according to the execution order of each operation in the transaction, that is, the rollback log records corresponding to each operation in the transaction are stored in the order of operations to obtain the rollback log of the transaction.
[0050] An embodiment of the present invention includes: in the operation of one or more data tables in the execution of a transaction, operating the current data table and generating a rollback log record corresponding to the current operation, wherein the rollback log record includes a designated storage area, and the designated storage area stores one of the following positioning information: when the current operation is the second operation in the transaction, the address of the rollback log record corresponding to the previous operation is used as the positioning information; when the data table corresponding to the previous operation is not a new table, the positioning information stored in the rollback log record corresponding to the previous operation is used as the positioning information; when the data table corresponding to the previous operation is a new table, the address of the rollback log record corresponding to the previous operation is used as the positioning information; and the rollback log records corresponding to each operation in the transaction are stored in the order of operations to obtain the rollback log of the transaction. When generating a rollback log record in a rollback log, the embodiment of the present invention expands the format of the rollback log record. The rollback log record of the embodiment of the present invention includes a specified storage area, and the specified storage area is used to store positioning information. Therefore, when the MySQL database is restarted, the rollback log record is scanned along the positioning information, and the table information of the active transaction can be quickly found in the rollback log record. Therefore, the present invention can speed up the process of scanning the rollback log to obtain table information, speed up the recovery of table locks, and optimize the startup of the database.
[0051] In one possible implementation, generating a rollback log record corresponding to the current operation may be performed according to the following steps: determining a head pointer storage area and a tail pointer storage area in the storage area of the rollback log record; wherein the head pointer storage area is used to store the end address of the rollback log record, and the tail pointer storage area is used to store the start address of the rollback log record; and determining the designated storage area in the storage area between the head pointer storage area and the tail pointer storage area.
[0052] In this possible implementation, the storage area of the rollback log record is used to store data related to the rollback log record, for example, data related to the data table corresponding to the rollback log record. A part of the storage area of the rollback log record is used as a head pointer storage area to store the end address of the rollback log record, and a part of the storage area of the rollback log record is used as a tail pointer storage area to store the start address of the rollback log record, so that the address range corresponding to the storage area of the rollback log record can be determined after scanning the head pointer storage area and the tail pointer storage area.
[0053] In the embodiment of the present invention, the designated storage area can be determined in the storage area between the head pointer storage area and the tail pointer storage area, without specifically limiting the location of the designated storage area, so that the user can select the location of the designated storage area according to actual needs.
[0054] In this possible implementation, the format of the rollback log record is optimized. In the rollback log record, a specified storage area, i.e., a dynamic pointer, is added based on the original head pointer storage area and tail pointer storage area. The dynamic pointer can point to the storage location of the rollback log record that operates the new table. Through the dynamic pointer, when scanning, it is possible to directly jump to the previous rollback log record that operates the new table without scanning forward in sequence.
[0055] In a possible implementation, determining a head pointer storage area and a tail pointer storage area in the storage area of the rollback log record can be performed according to the following steps: using the starting address as the starting position of the head pointer storage area, and determining the head pointer storage area in the rollback log record according to the starting position and a first specified length; using the ending address as the ending position of the tail pointer storage area, and determining the tail pointer storage area in the rollback log record according to the ending position and a second specified length.
[0056] In this possible implementation, the starting address is used as the starting position of the head pointer storage area, and the head pointer storage area is determined in the rollback log record according to the starting position and the first specified length, so that the head pointer storage area can be determined from the starting address of the storage area of the rollback log record, wherein the first specified length can be determined according to actual needs and is not specifically limited in the embodiment of the present invention.
[0057] The end address is used as the end position of the tail pointer storage area, and the tail pointer storage area is determined in the rollback log record according to the end position and the second specified length, so that the tail pointer storage area can be determined from the end position of the storage area of the rollback log record forward, wherein the second specified length can be determined according to actual needs and is not specifically limited in the embodiment of the present invention. The second specified length can be the same as or different from the first specified length, for example, the first specified length and the second specified length can both be 8 bytes in length.
[0058] See also Figure 4 The pointer diagram of the rollback log record of the embodiment of the present invention is shown. When the step is specifically implemented, in the rollback log, the rollback log record includes a head pointer storage area (shown as the head pointer in the figure) and a tail pointer storage area (shown as the tail pointer in the figure). The head pointer points to the tail pointer, and the tail pointer points to the head pointer. Through these two pointers, the boundary of a rollback log record can be quickly located.
[0059] In a possible implementation, determining the designated storage area in the storage area between the head pointer storage area and the tail pointer storage area can be performed according to the following steps: in the storage area between the head pointer storage area and the tail pointer storage area, taking a given position as the starting position and / or the ending position of the designated storage area; and determining the designated storage area according to the starting position and / or the ending position.
[0060] In this possible implementation, a fixed position can be used as a given position. For example, the storage area between the head pointer storage area and the tail pointer storage area includes 100 bytes, then the 50th byte can be used as the given position, and the 50th byte can be the starting position or the ending position of the specified storage area; or the 21st byte and the 30th byte can be used as the specified position, wherein the 21st byte is used as the starting position and the 30th byte is used as the ending position. When the 50th byte is used as the starting position and the specified length is 15 bytes, the position corresponding to the 50th byte to the 64th byte can be used as the specified storage area.
[0061] In this possible implementation, a randomly determined position may also be used as a given position, and the given position may be a starting position of the designated storage area, may be an ending position of the designated storage area, or may include both the starting position and the ending position of the designated storage area. Afterwards, the designated storage area is determined according to the starting position and / or the ending position.
[0062] It should be noted that after determining the designated storage area, the location of the designated storage area in the storage area of the rollback log record can be recorded so that the designated storage area can be quickly found when scanning the rollback log record. When scanning the rollback log record, for example, when a rollback log record is scanned, the designated storage area is found according to the specific location of the designated storage area in the log content storage area, so as to realize the rapid scanning of the location information stored in the designated storage area.
[0063] In a possible implementation, determining the designated storage area in a storage area between the head pointer storage area and the tail pointer storage area may be performed according to the following steps: randomly determining a starting position and / or an ending position of the designated storage area according to a third specified length of the designated storage area in the area between the head pointer storage area and the tail pointer storage area; and determining the designated storage area according to the starting position and / or the ending position.
[0064] In this possible implementation, the third specified length can be determined according to the amount of data in the positioning information, which is not specifically limited in the embodiment of the present invention. In the area between the head pointer storage area and the tail pointer storage area, the starting position and / or the ending position of the specified storage area are randomly determined according to the third specified length of the specified storage area; the specified storage area is determined according to the starting position and / or the ending position, so that the specified storage area can be set to the required length.
[0065] In a possible implementation, the following steps may also be performed: using a designated memory space to store table identification information of a data table that has been operated by the transaction; when the data table corresponding to the previous operation is not a new table, the following steps may be performed: if the table identification information of the data table corresponding to the previous operation has been stored in the designated memory space, then it is determined that the data table corresponding to the previous operation is not a new table; when the data table corresponding to the previous operation is a new table, the following steps may be performed: if the table identification information of the data table corresponding to the previous operation is not stored in the designated memory space, then it is determined that the data table corresponding to the previous operation is a new table.
[0066] In this possible implementation, the table identification information can be used to identify a data table in MySQL. For example, the table identification information can be the name of the data table (table name), the table serial number, and other information that can be used to uniquely identify the table. In MySQL, a data table is an object used to store and organize data.
[0067] The designated memory space is a storage location selected based on actual needs. This storage location is a memory space used to temporarily store data. Among them, the memory space is where the computer temporarily stores data and programs. It is a volatile storage medium, which means that when the computer loses power, the data in the memory will be lost. The memory uses electric current to store and read data, which is very fast, but the capacity is relatively small.
[0068] The data structure used to record the table identification information in the specified memory space can be set according to actual needs, for example, an array, a queue, a graph or a tree, etc. can be used, and the embodiment of the present invention does not specifically limit this. The table information of the rollback log record operation can be obtained through the rollback log record, and the table information can include table identification information. For example, the rollback log record records a certain operation on Table 3, where "Table 3" is the table name and can be used as table identification information.
[0069] If the table identification information of the data table corresponding to the previous operation has been recorded in the designated memory space, it is determined that the data table corresponding to the previous operation has been operated by the transaction, that is, the data table corresponding to the previous operation is not a new table.
[0070] If the table identification information of the data table corresponding to the previous operation has not been recorded in the designated memory space, it is determined that the data table corresponding to the previous operation has not been operated by the transaction, that is, the data table corresponding to the previous operation is a new table.
[0071] In this step, when scanning the rollback log, for example, when scanning to a certain rollback log record, it is possible to jump to the next rollback log record according to the positioning information stored in the designated storage area corresponding to the rollback log record, thereby skipping some log rollback log records and only scanning the rollback log records generated when the transaction operates the new table, thereby speeding up the search speed for the table that needs to recover the table lock information.
[0072] In a possible implementation manner, the positioning information includes page number data recorded in the rollback log and offset data based on recording the page number data.
[0073] In this possible implementation, a page number is a number or identifier used to identify a specific page in a file. Page numbers are typically used to manage and access different parts of a file. For example, in a database system, page numbers are typically used to identify data pages or index pages in a database file. Each page number corresponds to a specific page in the file, and the page number can be used to locate and access the content of the page. The specific representation of the page number depends on the implementation of the file system or database management system. In some systems, the page number is an integer value that increases from 0 and is used to represent the order of pages in a file. In other systems, the page number may be a unique identifier that identifies each page in the file.
[0074] The offset data based on the page number data can be used to determine a specific position or specific content in a file page, such as the number of pieces of information.
[0075] In this possible implementation manner, the positioning information includes page number data and offset data of the rollback log record, so that the required rollback log record can be accurately found in the rollback log.
[0076] The implementation of this method is described below with a specific embodiment. Regarding the generation of rollback log records:
[0077] 1. Add a dynamic pointer information based on the original information;
[0078] 2. Dynamic pointer records the rollback log record of [the last time a new table was operated]; to understand the meaning of [the last time a new table was operated], see Figure 5 The transaction operation process diagram of the embodiment of the present invention is shown below. Figure 5 , describes the rollback log recording method. Figure 5 The operation process of the transaction is shown:
[0079] 1. Undo log record 1, operate table 1 [operate new table];
[0080] 2. Undo log record 2, operate table 1, and the dynamic pointer points to record 1;
[0081] 3. Undo log record 3, operate table 2 [operate new table], and the dynamic pointer points to record 1;
[0082] 4. Undo log record 4, operate table 2, and the dynamic pointer points to record 3;
[0083] 5. Undo log record 5, operate table 3 [operate new table], and the dynamic pointer points to record 3;
[0084] 6. Undo log record 6, operate table 3, and the dynamic pointer points to record 5;
[0085] 7. Undo log record 7, operate table 3, and the dynamic pointer points to record 5;
[0086] 8. Undo log record 8, operate table 3, and the dynamic pointer points to record 5.
[0087] When performing operations on data table 1, data table 2, and data table 3 in the above transaction, the rollback log records in the rollback log corresponding to the above transaction can be generated according to the following steps:
[0088] First, the transaction operates table 1 and generates a rollback log record corresponding to operation table 1, that is, Undo log record 1;
[0089] Afterwards, the transaction operates table 1, and generates a rollback log record corresponding to operation table 1, namely, Undo log record 2. The current operation is the second operation in the transaction, so the address of the rollback log record corresponding to the previous operation is used as the positioning information, and the address of Undo log record 1 is used as the positioning information, namely, the dynamic pointer points to record 1.
[0090] Afterwards, the transaction operates on Table 2 and generates a rollback log record corresponding to the operation on Table 2, namely, Undo log record 3. The data table corresponding to the previous operation is Table 1, and Table 1 is not a new table. Therefore, the positioning information stored in the rollback log record corresponding to the previous operation is used as the positioning information, and the address of Undo log record 1 is used as the positioning information, that is, the dynamic pointer points to record 1.
[0091] After that, the transaction operates Table 2 and generates a rollback log record corresponding to Table 2, namely, Undo log record 4. The data table corresponding to the previous operation is Table 2, which is a new table. Therefore, the address of the rollback log record corresponding to the previous operation is used as the positioning information, and the address of Undo log record 3 is used as the positioning information, namely, the dynamic pointer points to record 3.
[0092] Afterwards, the transaction operates on Table 3 and generates a rollback log record corresponding to Table 3, namely, Undo log record 5. The data table corresponding to the previous operation is Table 2, which is not a new table. Therefore, the positioning information stored in the rollback log record corresponding to the previous operation is used as the positioning information, and the address of Undo log record 3 is used as the positioning information, that is, the dynamic pointer points to record 3.
[0093] After that, the transaction operates table 3 and generates a rollback log record corresponding to table 3, namely, Undo log record 6. The data table corresponding to the previous operation is table 3, which is a new table. Therefore, the address of the rollback log record corresponding to the previous operation is used as the positioning information, and the address of the Undo log record 5 is used as the positioning information, that is, the dynamic pointer points to record 5.
[0094] After that, the transaction operates table 3 and generates a rollback log record corresponding to table 3, namely, Undo log record 7. The data table corresponding to the previous operation is table 3, which is not a new table. Therefore, the positioning information stored in the rollback log record corresponding to the previous operation is used as the positioning information, and the address of Undo log record 5 is used as the positioning information, namely, the dynamic pointer points to record 5.
[0095] Afterwards, the transaction operates on Table 3 and generates a rollback log record corresponding to the operation on Table 3, namely, Undo log record 8. The data table corresponding to the previous operation is Table 3, and Table 3 is not a new table. Therefore, the positioning information stored in the rollback log record corresponding to the previous operation is used as the positioning information, and the address of Undo log record 5 is used as the positioning information, that is, the dynamic pointer points to record 5.
[0096] After completing the above rollback log record generation steps, the obtained rollback log is scanned. Figure 6 The schematic diagram of the process of scanning the rollback log shown in the figure illustrates the scanning process.
[0097] During scanning, starting from Undo log record 8, the dynamic pointer of log record 8 points to log record 5. First, Undo log record 8 can be used to directly jump to Undo log record 5, corresponding to step ① in the figure; then, the dynamic pointer of Undo log record 5 points to rollback log record 3. Therefore, Undo log record 5 can be used to directly jump to Undo log record 3, corresponding to step ② in the figure; finally, Undo log record 3 can be used to directly jump to Undo log record 1, corresponding to step ③ in the figure.
[0098] Based on the above implementation, in the process of recovering the table lock of an active transaction, you only need to scan forward along the dynamic pointer to directly obtain the information of all data tables that need to recover the table lock, avoiding scanning all rollback log records of the rollback log. Compared with the existing method of obtaining table information by scanning all rollback log records of active transactions, this solution expands the format of the current rollback log record, that is, adds a dynamic pointer for quickly finding the rollback log. Through this dynamic pointer, you can quickly find the rollback log record generated when a new table is operated in the rollback log. Based on these rollback log records generated when the new table is operated, you can obtain the table information of all tables that need to recover the table lock information, which greatly reduces the amount of scanning of the Undo log and accelerates the recovery of the table lock information.
[0099] The present invention provides a method and device for determining active data tables in rollback log generation and transaction rollback. The method is based on MySQL database, expands the original rollback log record format, and accelerates the scanning process of rollback log records by adding dynamic pointers in rollback log records, thereby accelerating the recovery of table locks; the modification involved in the method is compatible with the original logic of MySQL database, and there is no compatibility problem; in the large transaction rollback scenario, the method can directly reduce the table lock recovery time from several seconds to milliseconds. Based on the method, the efficiency problem of active transaction table lock information recovery during the startup process of relational database MySQL can be solved, and the speed of scanning rollback logs to obtain table information is greatly improved, thereby accelerating the startup process of the database.
[0100] Based on the above-mentioned rollback log recording method provided by an embodiment of the present invention, an embodiment of the present invention also provides a method for determining an active data table in a transaction rollback, the method comprising: determining a starting log record to be scanned in a rollback log; obtaining a log record to be scanned after the starting log record based on the positioning information stored in a designated storage area of the starting log record; wherein the rollback log is obtained according to the above-mentioned rollback log generation method; and taking the data table corresponding to the starting log record and the data table corresponding to each of the log records to be scanned as the active data table.
[0101] In the embodiment of the present invention, the log header of the rollback log records the identification information of the transaction, for example, the transaction name, and the rollback log corresponding to the active transaction can be determined through the log header of the rollback log. Then, a log record is selected from the rollback log of the active transaction as the starting log record for scanning.
[0102] Based on the positioning information stored in the designated storage area of the starting log record, the log records to be scanned after the starting log record are obtained, and after all the log records to be scanned are scanned one by one starting from the starting log record, and a data table of log record operations can be obtained after scanning. The data table corresponding to the starting log record and the data tables corresponding to the log records to be scanned are used as the active data table.
[0103] In an embodiment of the present invention, a starting log record to be scanned is determined in a rollback log; based on the positioning information stored in a designated storage area of the starting log record, the log record to be scanned after the starting log record is obtained; wherein the rollback log is obtained according to the rollback log generation method described above; the data table corresponding to the starting log record and the data table corresponding to each of the log records to be scanned are used as the active data table. When the MySQL database is restarted, a new data table for transaction operations can be quickly found from the rollback log record of the present invention, and the new data table for transaction operations can be used to determine the table that needs to be restored by table locks. Therefore, the present invention can accelerate the process of scanning the rollback log to obtain table information, accelerate the recovery of table locks, and optimize the startup of the database.
[0104] In a possible implementation, determining the starting log record to be scanned in the rollback log can be performed according to the following steps: searching the rollback log header to obtain the storage location of the tail log record; searching the tail log record according to the storage location of the tail log record, and using the tail log record as the starting log record to be scanned.
[0105] In this step, the rollback log header stores the last log record in the rollback log, that is, the storage location of the tail log record. The rollback log header is searched to obtain the storage location of the tail log record, so that the tail log record can be found according to the storage location, and the tail log record can be used as the starting log record to be scanned, so as to start scanning based on the tail log record to avoid missing scanning log records.
[0106] In a possible implementation, obtaining a log record to be scanned after the starting log record based on the positioning information stored in the designated storage area of the starting log record can be performed according to the following steps: scanning the positioning information stored in the designated storage area of the starting log record to obtain a second log record to be scanned; scanning the positioning information stored in the designated storage area of the second log record to be scanned to obtain a next log record to be scanned; scanning the positioning information stored in the designated storage area of the next log record to be scanned, until the obtained log record to be scanned is the first rollback log record in the transaction.
[0107] In a possible implementation, the following steps may also be performed: respectively recovering table lock information of each active data table according to the starting log record and each log record to be scanned; and restarting the MySQL database corresponding to the transaction according to the table lock information.
[0108] Based on the above-mentioned rollback log generation method provided by an embodiment of the present invention, an embodiment of the present invention further provides a rollback log generation device, including: a generation module, used to operate the current data table and generate a rollback log record corresponding to the current operation in the operation of one or more data tables in the execution of a transaction, wherein the rollback log record includes a designated storage area, and the designated storage area stores one of the following positioning information: when the current operation is the second operation in the transaction, the address of the rollback log record corresponding to the previous operation is used as the positioning information; when the data table corresponding to the previous operation is not a new table, the positioning information stored in the rollback log record corresponding to the previous operation is used as the positioning information; when the data table corresponding to the previous operation is a new table, the address of the rollback log record corresponding to the previous operation is used as the positioning information; a storage module, used to store the rollback log records corresponding to each operation in the transaction in the order of operations to obtain the rollback log of the transaction.
[0109] An embodiment of the present invention includes: in the operation of one or more data tables in the execution of a transaction, operating the current data table and generating a rollback log record corresponding to the current operation, wherein the rollback log record includes a designated storage area, and the designated storage area stores one of the following positioning information: when the current operation is the second operation in the transaction, the address of the rollback log record corresponding to the previous operation is used as the positioning information; when the data table corresponding to the previous operation is not a new table, the positioning information stored in the rollback log record corresponding to the previous operation is used as the positioning information; when the data table corresponding to the previous operation is a new table, the address of the rollback log record corresponding to the previous operation is used as the positioning information; and the rollback log records corresponding to each operation in the transaction are stored in the order of operations to obtain the rollback log of the transaction. When generating a rollback log record in a rollback log, the embodiment of the present invention expands the format of the rollback log record. The rollback log record of the embodiment of the present invention includes a specified storage area, and the specified storage area is used to store positioning information. Therefore, when the MySQL database is restarted, the rollback log record is scanned along the positioning information, and the table information of the active transaction can be quickly found in the rollback log record. Therefore, the present invention can speed up the process of scanning the rollback log to obtain table information, speed up the recovery of table locks, and optimize the startup of the database.
[0110] In one possible implementation, generating a rollback log record corresponding to a current operation includes: determining a head pointer storage area and a tail pointer storage area in a storage area of the rollback log record; wherein the head pointer storage area is used to store an end address of the rollback log record, and the tail pointer storage area is used to store a start address of the rollback log record; and determining the designated storage area in a storage area between the head pointer storage area and the tail pointer storage area.
[0111] In one possible implementation, a head pointer storage area and a tail pointer storage area are determined in the storage area of the rollback log record, including: using the starting address as the starting position of the head pointer storage area, and determining the head pointer storage area in the rollback log record according to the starting position and a first specified length; using the ending address as the ending position of the tail pointer storage area, and determining the tail pointer storage area in the rollback log record according to the ending position and a second specified length.
[0112] In a possible implementation, the designated storage area is determined in a storage area between the head pointer storage area and the tail pointer storage area, including: in the storage area between the head pointer storage area and the tail pointer storage area, taking a given position as the starting position and / or the ending position of the designated storage area; and determining the designated storage area according to the starting position and / or the ending position.
[0113] In a possible implementation, the designated storage area is determined in a storage area between the head pointer storage area and the tail pointer storage area, including: randomly determining a starting position and / or an ending position of the designated storage area according to a third specified length of the designated storage area in the area between the head pointer storage area and the tail pointer storage area; and determining the designated storage area according to the starting position and / or the ending position.
[0114] In a possible implementation, it further includes: using a designated memory space to store table identification information of a data table that has been operated by the transaction; when the data table corresponding to the previous operation is not a new table, including: if the table identification information of the data table corresponding to the previous operation has been stored in the designated memory space, then determining that the data table corresponding to the previous operation is not a new table; when the data table corresponding to the previous operation is a new table, including: if the table identification information of the data table corresponding to the previous operation is not stored in the designated memory space, then determining that the data table corresponding to the previous operation is a new table.
[0115] In a possible implementation manner, the positioning information includes page number data recorded in the rollback log and offset data based on recording the page number data.
[0116] Based on the method for determining the active data table in the transaction rollback provided by the embodiment of the present invention, the embodiment of the present invention also provides a device for determining the active data table in the transaction rollback, including: a determination module, used to determine the starting log record to be scanned in the rollback log; an acquisition module, used to acquire the log record to be scanned after the starting log record based on the positioning information stored in the designated storage area of the starting log record; wherein the rollback log is obtained according to the rollback log generation method mentioned above; a data module, used to use the data table corresponding to the starting log record and the data table corresponding to each of the log records to be scanned as the active data table.
[0117] In an embodiment of the present invention, a starting log record to be scanned is determined in a rollback log; based on the positioning information stored in a designated storage area of the starting log record, the log record to be scanned after the starting log record is obtained; wherein the rollback log is obtained according to the rollback log generation method described above; the data table corresponding to the starting log record and the data table corresponding to each of the log records to be scanned are used as the active data table. When the MySQL database is restarted, a new data table for transaction operations can be quickly found from the rollback log record of the present invention, and the new data table for transaction operations can be used to determine the table that needs to be restored by table locks. Therefore, the present invention can accelerate the process of scanning the rollback log to obtain table information, accelerate the recovery of table locks, and optimize the startup of the database.
[0118] In a possible implementation, determining the starting log record to be scanned in the rollback log includes: searching the log header of the rollback log to obtain the storage location of the tail log record; searching the tail log record according to the storage location of the tail log record, and using the tail log record as the starting log record to be scanned.
[0119] In a possible implementation, obtaining a log record to be scanned after the starting log record based on the positioning information stored in the designated storage area of the starting log record includes: scanning the positioning information stored in the designated storage area of the starting log record to obtain a second log record to be scanned; scanning the positioning information stored in the designated storage area of the second log record to be scanned to obtain a next log record to be scanned; scanning the positioning information stored in the designated storage area of the next log record to be scanned, until the obtained log record to be scanned is the first rollback log record in the transaction.
[0120] In a possible implementation, the method further includes: restoring table lock information of each of the active data tables according to the starting log record and each of the log records to be scanned; and restarting the MySQL database corresponding to the transaction according to the table lock information.
[0121] An embodiment of the present invention further provides a database management system, comprising: the above-mentioned rollback log generating device, and the above-mentioned device for determining active data tables in transaction rollback.
[0122] An embodiment of the present invention further provides an electronic device, comprising: at least one processor; and a memory in communication with the at least one processor. The memory stores a computer program executable by the at least one processor, and when the computer program is executed by the at least one processor, the electronic device executes the method of the embodiment of the present invention.
[0123] An embodiment of the present invention further provides a non-transitory machine-readable medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to execute the method of the embodiment of the present invention.
[0124] An embodiment of the present invention further provides a computer program product, including a computer program, wherein the computer program, when executed by a processor of a computer, is used to enable the computer to execute the method of the embodiment of the present invention.
[0125] refer to Figure 7, a block diagram of an electronic device that can be used as a server or client of an embodiment of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. Electronic devices are intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0126] like Figure 7 As shown, the electronic device includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0127] Multiple components in the electronic device are connected to the I / O interface 705, including: an input unit 706, an output unit 707, a storage unit 708, and a communication unit 709. The input unit 706 can be any type of device that can input information to the electronic device, and the input unit 706 can receive input digital or character information, and generate key signal input related to user settings and / or function control of the electronic device. The output unit 707 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 708 can include but is not limited to a disk, an optical disk. The communication unit 709 allows the electronic device to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0128] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a CPU, a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above. For example, in some embodiments, the method embodiments of the present invention may be implemented as a computer program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on an electronic device via a ROM 702 and / or a communication unit 709. In some embodiments, the computing unit 701 may be configured to perform the above-described method in any other appropriate manner (e.g., by means of firmware).
[0129] The computer programs for implementing the methods of the embodiments of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer programs are executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer programs may be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0130] In the context of an embodiment of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable signal medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0131] It should be noted that the term "including" and its variations used in the embodiments of the present invention are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". The modifications of "one" and "multiple" mentioned in the embodiments of the present invention are illustrative rather than restrictive. Those skilled in the art should understand that unless the context clearly indicates otherwise, it should be understood as "one or more".
[0132] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0133] The various steps described in the method implementation methods provided in the embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method implementation methods may include additional steps and / or omit the steps shown. The scope of protection of the present invention is not limited in this respect.
[0134] The term "embodiment" in this specification refers to specific features, structures or characteristics described in conjunction with the embodiment that can be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. The various embodiments in this specification are described in a related manner, and the same or similar parts between the various embodiments refer to each other. In particular, for the device, equipment, and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts refer to the partial description of the method embodiment.
[0135] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of patent protection. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the attached claims.
Claims
1. A rollback log generation method, characterized in that: include: In an operation on one or more data tables in an execution transaction, a current data table is operated and a rollback log record corresponding to the current operation is generated, wherein the rollback log record includes a specified storage area, and the specified storage area stores one of the following location information: When the current operation is the second operation in the transaction, the address of the rollback log record corresponding to the previous operation is used as the positioning information; When the data table corresponding to the previous operation is not a new table, the positioning information stored in the rollback log record corresponding to the previous operation is used as the positioning information; When the data table corresponding to the previous operation is a new table, the address of the rollback log record corresponding to the previous operation is used as the positioning information; The rollback log records corresponding to each operation in the transaction are stored in the order of operations to obtain the rollback log of the transaction.
2. The method according to claim 1, characterized in that Generates a rollback log record corresponding to the current operation, including: Determine a head pointer storage area and a tail pointer storage area in the storage area of the rollback log record; wherein the head pointer storage area is used to store the end address of the rollback log record, and the tail pointer storage area is used to store the start address of the rollback log record; The designated storage area is determined in a storage area between the head pointer storage area and the tail pointer storage area.
3. The method according to claim 2, characterized in that Determining a head pointer storage area and a tail pointer storage area in the storage area of the rollback log record includes: Using the starting address as the starting position of the head pointer storage area, and determining the head pointer storage area in the rollback log record according to the starting position and the first specified length; The end address is used as the end position of the tail pointer storage area, and the tail pointer storage area is determined in the rollback log record according to the end position and the second specified length.
4. The method according to claim 2, characterized in that: Determining the designated storage area in a storage area between the head pointer storage area and the tail pointer storage area comprises: In the storage area between the head pointer storage area and the tail pointer storage area, a given position is used as the starting position and / or the ending position of the designated storage area; The designated storage area is determined according to the starting position and / or the ending position.
5. The method according to claim 2, characterized in that: Determining the designated storage area in a storage area between the head pointer storage area and the tail pointer storage area comprises: In an area between the head pointer storage area and the tail pointer storage area, randomly determining a starting position and / or an ending position of the designated storage area according to a third designated length of the designated storage area; The designated storage area is determined according to the starting position and / or the ending position.
6. The method according to claim 1, characterized in that Also includes: Using the designated memory space to store table identification information of the data table that has been operated by the transaction; When the data table corresponding to the previous operation is not a new table, the method includes: if the table identification information of the data table corresponding to the previous operation has been stored in the designated memory space, determining that the data table corresponding to the previous operation is not a new table; When the data table corresponding to the last operation is a new table, it includes: if the table identification information of the data table corresponding to the last operation is not stored in the designated memory space, determining that the data table corresponding to the last operation is a new table.
7. The method according to claim 1, characterized in that The positioning information includes page number data recorded in the rollback log and offset data based on recording the page number data.
8. A method for determining active data tables during transaction rollback, characterized in that: include: Determine the starting log record to be scanned in the rollback log; Based on the positioning information stored in the designated storage area of the start log record, the log record to be scanned after the start log record is obtained; wherein the rollback log is obtained according to the rollback log generation method according to any one of claims 1 to 7; The data table corresponding to the starting log record and the data tables corresponding to the log records to be scanned are used as the active data tables.
9. The method according to claim 8, characterized in that Determine the starting log record to be scanned in the rollback log, including: Find the log header of the rollback log to obtain the storage location of the tail log record; The tail log record is searched for according to the storage location of the tail log record, and the tail log record is used as the start log record to be scanned.
10. The method according to claim 8, characterized in that The method of acquiring the log record to be scanned after the start log record based on the positioning information stored in the designated storage area of the start log record includes: Scanning the location information stored in the designated storage area of the starting log record to obtain a second log record to be scanned; Scanning the positioning information stored in the designated storage area of the second log record to be scanned to obtain the next log record to be scanned; Scan the positioning information stored in the designated storage area of the next log record to be scanned until the obtained log record to be scanned is the first rollback log record in the transaction.
11. The method according to claim 8, characterized in that Also includes: Recovering the table lock information of each active data table according to the starting log record and each log record to be scanned; Restart the MySQL database corresponding to the transaction according to the table lock information.
12. A rollback log generation device, characterized in that: include: A generating module, used to operate the current data table and generate a rollback log record corresponding to the current operation in the operation of one or more data tables in the execution of the transaction, wherein the rollback log record includes a specified storage area, and the specified storage area stores one of the following positioning information: When the current operation is the second operation in the transaction, the address of the rollback log record corresponding to the previous operation is used as the positioning information; When the data table corresponding to the previous operation is not a new table, the positioning information stored in the rollback log record corresponding to the previous operation is used as the positioning information; When the data table corresponding to the previous operation is a new table, the address of the rollback log record corresponding to the previous operation is used as the positioning information; The storage module is used to store the rollback log records corresponding to each operation in the transaction in the order of operations to obtain the rollback log of the transaction.
13. A device for determining an active data table during transaction rollback, characterized in that: include: A determination module, used to determine a starting log record to be scanned in the rollback log; an acquisition module, configured to acquire the log record to be scanned after the start log record based on the positioning information stored in the designated storage area of the start log record; wherein the rollback log is obtained according to the rollback log generation method according to any one of claims 1 to 7; A data module is used to use the data table corresponding to the starting log record and the data tables corresponding to each of the log records to be scanned as the active data table.
14. A database management system, characterized in that: include: The rollback log generating device as described in claim 12, and the device for determining the active data table in transaction rollback as described in claim 13.
15. An electronic device, characterized in that: include: A processor, and a memory storing a program, wherein the program comprises instructions which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 11.
16. A non-transitory machine-readable medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-11.
17. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.