Data processing method and device for relational memory database
By using two sets of checkpoint files and initialization variables in a relational in-memory database to alternately write active and static file groups, the problem of partial write failure during data persistence is solved, efficient and consistent data recovery is achieved, and the security and stability of the system are improved.
Patent Information
- Application Number
- CN202511135068.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-14
- Publication Date
- 2025-09-12
AI Technical Summary
Existing relational in-memory databases have the risk of partial write failure during data persistence, leading to data file corruption and data inconsistency, especially in the event of a system crash, making effective recovery difficult.
Two sets of checkpoint files and initialization variables are used, active file groups and static file groups are written alternately, and data is recovered through disk mapping and redo logs to ensure data integrity and consistency.
It improves the security and stability of the system, enhances the efficiency and accuracy of data recovery, and ensures that the system can be quickly restored to a consistent state in the event of a crash.
Smart Images

Figure CN120631903A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer information processing, and also to a data processing method and device for a relational in-memory database. Background Art
[0002] For relational in-memory databases, persistence of in-memory data is a key issue. During data persistence, the primary risk is partial page write failures. Storage engines typically manage data pages in 16KB or 32KB units, but operating systems typically perform disk I / O (read / write) in 4KB units. If a system crash occurs during a write, only a partial write (e.g., 8KB) may be written to a data page, corrupting the data file. If a crash occurs, the database's storage engine must recover the data using the redo log. However, if the data page itself is corrupted, the redo log cannot be applied correctly, resulting in data inconsistency. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a data processing method and device for a relational in-memory database to improve the read / write efficiency and security of the system.
[0004] In order to solve the above technical problems, the technical solutions of the present invention are as follows:
[0005] A first aspect of the present invention provides a data processing method for a relational in-memory database, comprising:
[0006] Obtain two sets of checkpoint files and initialization variables corresponding to the memory tablespace in the relational memory database;
[0007] Obtaining an active file group and a static file group according to the two groups of checkpoint files and the initialization variables;
[0008] According to the initialization variables, dirty pages generated during the operation of the relational memory database are alternately written into the active file group and the static file group to obtain an updated active file group and an updated static file group;
[0009] Perform disk mapping processing according to the updated active file group and the updated static file group to obtain target disk data;
[0010] Data recovery is performed according to the data recovery request and the target disk data.
[0011] Optionally, obtain two sets of checkpoint files and initialization variables corresponding to the in-memory tablespace in the relational in-memory database, including:
[0012] Obtain two sets of checkpoint files corresponding to a memory table space in a relational memory database; each set of checkpoint files contains data files corresponding to the memory table space;
[0013] Obtain initialization variables; the initialization variables include a timer preset value or a dirty page threshold, and a file identifier.
[0014] Optionally, obtaining an active file group and a static file group according to the two groups of checkpoint files and the initialization variables includes:
[0015] The two groups of checkpoint files are identified according to the file identification in the initialization variable to obtain an active file group and a static file group; the file identification includes an active file group identification and a static file group identification.
[0016] Optionally, according to the initialization variable, dirty pages generated during the operation of the relational in-memory database are alternately written into the active file group and the static file group to obtain an updated active file group and an updated static file group, including:
[0017] Obtain dirty pages generated by modifying the memory table space during the operation of the relational memory database;
[0018] When a preset value of a timer in the initialization variable or a dirty page threshold is reached, the dirty pages are alternately written into the active file group and the static file group to obtain an updated active file group and an updated static file group.
[0019] Optionally, when a preset timer value or a dirty page threshold in the initialization variable is reached, the dirty pages are alternately written into the active file group and the static file group to obtain an updated active file group and an updated static file group, including:
[0020] Recording the dirty page into a redo log to obtain a redo log with data;
[0021] When a preset timer value or a dirty page threshold in the initialization variable is reached, the data in the redo log with the data is written into the active file group, the data in the redo log with the data is cleared, and the identifier of the active file group is modified to a static file group identifier to obtain an updated static file group;
[0022] The identifier of the static file group is modified to an active file group identifier to obtain an updated active file group.
[0023] Optionally, performing disk mapping processing according to the updated active file group and the updated static file group to obtain target disk data includes:
[0024] Writing the data in the updated active file group into the corresponding first disk file in sequence to obtain first disk data;
[0025] Writing the data in the updated static file group into the corresponding second disk file in sequence to obtain second disk data;
[0026] Target disk data is obtained according to the first disk data and the second disk data.
[0027] Optionally, performing data recovery according to the data recovery request and the target disk data includes:
[0028] Get the redo log with data;
[0029] Data recovery is performed according to the data recovery request, the redo log with data, the updated static file group and the target disk data.
[0030] A second aspect of the present invention provides a data processing device for a relational in-memory database, comprising:
[0031] An acquisition module is used to obtain two sets of checkpoint files and initialization variables corresponding to the memory table space in the relational memory database;
[0032] The processing module is used to obtain an active file group and a static file group based on the two groups of checkpoint files and the initialization variables; write dirty pages generated during the operation of the relational in-memory database into the active file group and the static file group alternately according to the initialization variables to obtain an updated active file group and an updated static file group; perform disk mapping processing based on the updated active file group and the updated static file group to obtain disk data; and perform data recovery based on a data recovery request and the disk data.
[0033] According to a third aspect of the present invention, a computing device is provided, comprising: a processor and a memory storing a computer program, wherein when the computer program is executed by the processor, the method according to the first aspect is executed.
[0034] A fourth aspect of the present invention provides a computer-readable storage medium storing instructions, which, when executed on a computer, causes the computer to execute the method described in the first aspect.
[0035] The above solution of the present invention includes at least the following beneficial effects:
[0036] The above-mentioned scheme of the present invention obtains two sets of checkpoint files and initialization variables corresponding to the memory table space in the relational memory database, obtains the active file group and the static file group according to the two sets of checkpoint files and initialization variables, and writes the dirty pages generated during the operation of the relational memory database into the active file group and the static file group alternately according to the initialization variables to obtain the updated active file group and the updated static file group, performs disk mapping processing according to the updated active file group and the updated static file group to obtain the target disk data, and performs data recovery according to the data recovery request and the target disk data, which not only helps to improve the security and stability of the system, but also can improve the data recovery efficiency and accuracy when the system crashes. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 1 is a flow chart of a data processing method for a relational in-memory database in an embodiment of the present invention;
[0038] Figure 2 It is a structural diagram of a data processing device for a relational in-memory database in an embodiment of the present invention. DETAILED DESCRIPTION
[0039] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0040] like Figure 1 As shown, an embodiment of the present invention provides a data processing method for a relational in-memory database, comprising the following steps:
[0041] Step 101: Obtain two sets of checkpoint files and initialization variables corresponding to the memory table space in the relational memory database;
[0042] Step 102, obtaining an active file group and a static file group according to the two groups of checkpoint files and the initialization variables;
[0043] Step 103, according to the initialization variable, alternately writing dirty pages generated during the operation of the relational in-memory database into the active file group and the static file group to obtain an updated active file group and an updated static file group;
[0044] Step 104, performing disk mapping processing according to the updated active file group and the updated static file group to obtain target disk data;
[0045] Step 105: Perform data recovery according to the data recovery request and the target disk data.
[0046] The data processing method for a relational in-memory database in an embodiment of the present invention obtains two sets of checkpoint files and initialization variables corresponding to a memory table space in the relational in-memory database, obtains an active file group and a static file group based on the two sets of checkpoint files and the initialization variables, alternately writes dirty pages generated during the operation of the relational in-memory database into the active file group and the static file group based on the initialization variables to obtain an updated active file group and an updated static file group, performs disk mapping processing based on the updated active file group and the updated static file group to obtain target disk data, and performs data recovery based on a data recovery request and the target disk data. This method not only helps to improve the security and stability of the system, but also can improve the efficiency and accuracy of data recovery when the system crashes.
[0047] In an optional embodiment of the present invention, step 101 includes:
[0048] Step 1011: obtaining two sets of checkpoint files corresponding to the memory table space in the relational memory database; each set of checkpoint files includes data files corresponding to the memory table space;
[0049] Specifically, when a relational in-memory database starts, it allocates two sets of checkpoint files (e.g., Group A and Group B). Each set contains data files corresponding to the in-memory tablespace. Checkpoint files are represented in the file system as follows: The redundant files in filegroup A and filegroup B are stored in the same data file path. Different files within the same filegroup can be stored sequentially in different data file paths, for example, db00 is stored in the ck0 directory, db01 is stored in the ck1 directory, db02 is stored in the ck0 directory, and so on.
[0050] Step 1012: Obtain initialization variables; the initialization variables include a timer preset value or a dirty page threshold, and a file identifier.
[0051] Specifically, the initialization variables may include: file identifiers (such as active file group identifiers and static file group identifiers, which distinguish between the two groups of checkpoint files to facilitate subsequent dirty page writing or storage), timer preset value (which may be a specific value, such as executed once every 3 seconds, used to write the dirty page data in the rewrite log to the current active file group when the timer preset value is reached), or dirty page threshold (which may be a specific value, such as the number of dirty pages reaches 20% of the total memory, used to write the dirty page data in the rewrite log to the current active file group when the number of dirty pages reaches the dirty page threshold), etc.
[0052] In an optional embodiment of the present invention, step 102 includes:
[0053] The two groups of checkpoint files are identified according to the file identification in the initialization variable to obtain an active file group and a static file group; the file identification includes an active file group identification and a static file group identification.
[0054] Specifically, two sets of checkpoint files are identified. One set of checkpoint files is bound to the active file group identifier and serves as the current active group file, i.e., the active file group. The other set of checkpoint files is bound to the static file group identifier and serves as the static file group. This facilitates distinguishing the two sets of checkpoint files. Subsequently, when conditions are met, dirty pages are written to the current active group file.
[0055] It should be noted that the current active group file is dynamic. For example, if there are two groups of checkpoint files, Group A and Group B, the Group A checkpoint file is bound to the active file group identifier and serves as the active file group, while the Group B checkpoint file is bound to the static file group identifier and serves as the static file group. At this point, the Group A checkpoint file is the current active group file. When a dirty page needs to be written for the first time, the dirty page is written to the Group A checkpoint file. After the writing is complete, the Group B checkpoint file is bound to the active file group identifier and serves as the active file group, while the Group A checkpoint file is bound to the static file group identifier and serves as the static file group. Therefore, it can be understood that the file identifiers of the two groups of checkpoint files are constantly changing and replacing as the database runs and the in-memory tablespace is modified. This ensures that a memory data page always has at least one clean disk image (the disk file corresponding to the Group A checkpoint file or the Group B checkpoint file). This facilitates data recovery in the event of a system crash and improves data recovery efficiency and accuracy.
[0056] In an optional embodiment of the present invention, step 103 includes:
[0057] Step 1031, obtaining dirty pages generated by modifying the memory table space during the operation of the relational memory database;
[0058] Specifically, when a relational in-memory database is running, it modifies the tablespace in memory (such as insert, update, and delete operations). The modified data pages are marked as "dirty pages", indicating that the data on these pages is inconsistent with the data on the disk.
[0059] Step 1032 : When the timer preset value or dirty page threshold in the initialization variable is reached, the dirty pages are alternately written into the active file group and the static file group to obtain an updated active file group and an updated static file group.
[0060] In an optional embodiment of the present invention, step 1032 includes:
[0061] Step 10321: Record the dirty page into a redo log to obtain a redo log with data.
[0062] Specifically, the redo log can be a group. The redo log group is a collection of transaction logs independently maintained by each node instance in a cluster database environment, which is used to record data modification operations to achieve crash recovery. In this embodiment, the dirty page is first recorded in the redo log, and the redo log saves the dirty page data.
[0063] Step 10322: When the preset value of the timer in the initialization variable or the dirty page threshold is reached, the data in the redo log with the data is written to the active file group, the data in the redo log with the data is cleared, and the identifier of the active file group is changed to a static file group identifier, thereby obtaining an updated static file group.
[0064] Step 10323: Modify the identifier of the static file group to an active file group identifier to obtain an updated active file group.
[0065] Specifically, when the time reaches the preset value of the timer or the number of dirty pages in the redo log reaches the dirty page threshold, the data in the redo log is written to the current active group file, that is, the active file group (such as group A); then the identifier of the static file group (such as group B) is modified to the active file group identifier, then group B is the current active group file (that is, the updated active file group), and group A is the static file group (that is, the updated static file group). When the preset value of the timer or the dirty page threshold is reached in the next round, the data in the redo log is written to group B, and so on. Group A or group B is written alternately. By alternating the use of two sets of checkpoint files, it is ensured that at any time there is a set of files that remain static and are not affected by write operations, which helps to quickly restore to a consistent state when a system failure occurs.
[0066] In an optional embodiment of the present invention, step 104 includes:
[0067] Step 1041, writing the data in the updated active file group into the corresponding first disk file in sequence to obtain first disk data;
[0068] Step 1042, writing the data in the updated static file group into the corresponding second disk file in sequence to obtain second disk data;
[0069] Step 1043: Obtain target disk data according to the first disk data and the second disk data.
[0070] Specifically, each in-memory page of an in-memory tablespace in a relational in-memory database corresponds to a fixed offset in the disk file (for example, if the in-memory page size is 8KB, then page N is mapped to the N×8KB position in the disk file). During disk mapping, dirty pages belonging to tablespace group A in memory are written to disk files in group A in page number order. After the file identifier is switched, dirty pages belonging to tablespace group B in memory are written to disk files in group A in page number order. The checkpoint location (such as the system change number (SCN)) is recorded in the control file or data file header to identify which pages have been written to disk.
[0071] In an optional embodiment of the present invention, step 105 includes:
[0072] Step 1051, obtain the redo log with data;
[0073] Specifically, the redo log with data is the redo log closest to the time of the system crash, and the latest dirty page is saved in the redo log.
[0074] Step 1052: Perform data recovery according to the data recovery request, the redo log with data, the updated static file group, and the target disk data.
[0075] Specifically, when a system crashes and a data recovery request is received, data recovery is performed using the static file group closest to the time of the crash (i.e., the checkpoint file associated with the last static file group identifier before the crash), the redo log containing the data, and the data on the target disk. In one specific embodiment, if a system failure or crash occurs, the relational in-memory database system can perform recovery operations using the most recently successfully completed checkpoint file group (e.g., group A) and redo log, ensuring data integrity and consistency.
[0076] A specific embodiment of the data processing method for a relational in-memory database according to an embodiment of the present invention includes:
[0077] Step 111, obtaining two sets of checkpoint files and initialization variables corresponding to the memory table space in the relational memory database;
[0078] When a relational in-memory database is started, two groups of checkpoint files (Group A and Group B) are allocated. Each group of files contains data files corresponding to the memory tablespace. Related variables are initialized to obtain initialization variables, such as the current active file group identifier and dirty page counter.
[0079] Step 112, obtaining an active file group and a static file group according to the two groups of checkpoint files and the initialization variables;
[0080] The two groups of checkpoint files are identified and bound by using the file identifiers in the initialization variables to obtain the active file group and the static file group. The active file group and the static file group change during the database operation and data modification process.
[0081] Step 113, according to the initialization variable, alternately writing dirty pages generated during the operation of the relational in-memory database into the active file group and the static file group to obtain an updated active file group and an updated static file group;
[0082] During database operation, modifications are made to the in-memory tablespace (such as inserts, updates, and deletes). Modified data pages are marked as "dirty pages," indicating that the data on these pages is inconsistent with the data on disk. The database system traverses the in-memory dirty page list and writes the dirty pages belonging to the currently active filegroup (Group A) to the corresponding data files. During this writing process, the database system ensures data integrity and consistency. For example, dirty pages can be written to a rewrite log first. When a timer preset value is reached or the number of dirty pages reaches a preset threshold, all dirty page data in the rewrite log is written to the currently active filegroup.
[0083] After all dirty pages belonging to the current active file group (group A) are written, the database system switches the active file group to another group (group B), updates the internal status, and marks the files in group A as "read-only" or "static" (that is, the updated static file group) for subsequent reading or recovery; the files in group B become the new active file group (that is, the updated active file group) and are ready to receive subsequent dirty page writes.
[0084] Step 114, performing disk mapping processing according to the updated active file group and the updated static file group to obtain target disk data;
[0085] Assume that group A is the active group. All dirty pages belonging to group A are written to the corresponding disk files. After writing is completed, the active group is switched to group B. All dirty pages belonging to group B are written to the corresponding disk files. Group A is marked as "static" for recovery.
[0086] Step 115: Perform data recovery according to the data recovery request and the target disk data.
[0087] After a system crash, the most recently successfully completed checkpoint file group (such as group A) is used to recover data, and the unwritten operations after the crash are replayed in conjunction with the redo log to ensure data consistency.
[0088] In the data processing method for a relational in-memory database according to an embodiment of the present invention, each in-memory tablespace corresponds to two sets of checkpoint files. Each set of files sequentially maps the in-memory tablespace to a disk file. These two sets of files are called "ping-pong checkpoints." During database operation, according to certain trigger conditions (such as timer timing and dirty page count), changed data pages in memory are written to the data files with corresponding page numbers.
[0089] A specific embodiment of the data processing method for a relational in-memory database according to an embodiment of the present invention in an application scenario of data writing and reading includes:
[0090] (1) Dirty page management: When a DDL (Data Manipulation Language) / DML (Data Definition Language) operation occurs in the database and a change is written to a data page in the database, a dirty page flag is added to the page header of the data page and added to the dirty page list.
[0091] (2) Checkpoint trigger: When the user explicitly triggers a checkpoint through a command or the specified time interval or the specified number of log files is reached, all dirty pages on the dirty page list are written sequentially to the currently used file group (assuming it is file group 0).
[0092] (3) Switching data file groups: If the checkpoint operation is successfully completed, file group 0 is set to stable state (stable state), file group 1 is set to unstable state (unstable state), and the records are recorded in the control file.
[0093] (4) Log file cleanup: Since this checkpoint operation was successfully completed, the previous data update logs are no longer needed to be restored. To reduce disk usage, the log files before the start of this checkpoint are deleted.
[0094] (5) Continue to execute database data page changes: The database continues to run, and row-level changes are recorded in the log file.
[0095] (6) Database shutdown: Database restart: When the database restarts, the data file group number (assuming it is 0) in the stable state is read from the control file, and the data file of file group 0 is read into the memory to complete the data page initialization of the memory database; Database transaction recovery: Read the log on the disk to complete the roll forward and roll back of the transaction.
[0096] (7) In this process, if the write process of file group 0 stops unexpectedly during the checkpoint operation, incomplete data pages may appear in data file group 0. When the control file is read during the restart, the stable state file group recorded is 1 (the file group that completed the last checkpoint operation). All data pages in this group of files have been written to disk, and incomplete data pages will not appear.
[0097] The data processing method for a relational in-memory database according to an embodiment of the present invention can ensure that a memory data page always has at least one clean disk image. When a system crash occurs, the system can be restored through this clean image and redo logs. When the file systems where the checkpoints are located do not belong to the same disk / storage system, they can be written or read simultaneously, thereby improving I / O (read / write) performance. The redundancy of the dual checkpoint files improves the security and stability of the system.
[0098] like Figure 2 As shown, an embodiment of the present invention provides a data processing device 200 for a relational in-memory database, comprising:
[0099] An acquisition module 201 is used to acquire two sets of checkpoint files and initialization variables corresponding to the memory table space in the relational memory database;
[0100] The processing module 202 is used to obtain an active file group and a static file group based on the two groups of checkpoint files and the initialization variables; write dirty pages generated during the operation of the relational in-memory database alternately into the active file group and the static file group according to the initialization variables to obtain an updated active file group and an updated static file group; perform disk mapping processing based on the updated active file group and the updated static file group to obtain disk data; and perform data recovery based on a data recovery request and the disk data.
[0101] Optionally, obtain two sets of checkpoint files and initialization variables corresponding to the in-memory tablespace in the relational in-memory database, including:
[0102] Obtain two sets of checkpoint files corresponding to a memory table space in a relational memory database; each set of checkpoint files contains data files corresponding to the memory table space;
[0103] Obtain initialization variables; the initialization variables include a timer preset value or a dirty page threshold, and a file identifier.
[0104] Optionally, obtaining an active file group and a static file group according to the two groups of checkpoint files and the initialization variables includes:
[0105] The two groups of checkpoint files are identified according to the file identification in the initialization variable to obtain an active file group and a static file group; the file identification includes an active file group identification and a static file group identification.
[0106] Optionally, according to the initialization variable, dirty pages generated during the operation of the relational in-memory database are alternately written into the active file group and the static file group to obtain an updated active file group and an updated static file group, including:
[0107] Obtain dirty pages generated by modifying the memory table space during the operation of the relational memory database;
[0108] When a preset value of a timer in the initialization variable or a dirty page threshold is reached, the dirty pages are alternately written into the active file group and the static file group to obtain an updated active file group and an updated static file group.
[0109] Optionally, when a preset timer value or a dirty page threshold in the initialization variable is reached, the dirty pages are alternately written into the active file group and the static file group to obtain an updated active file group and an updated static file group, including:
[0110] Recording the dirty page into a redo log to obtain a redo log with data;
[0111] When a preset timer value or a dirty page threshold in the initialization variable is reached, the data in the redo log with the data is written into the active file group, the data in the redo log with the data is cleared, and the identifier of the active file group is modified to a static file group identifier to obtain an updated static file group;
[0112] The identifier of the static file group is modified to an active file group identifier to obtain an updated active file group.
[0113] Optionally, performing disk mapping processing according to the updated active file group and the updated static file group to obtain target disk data includes:
[0114] Writing the data in the updated active file group into the corresponding first disk file in sequence to obtain first disk data;
[0115] Writing the data in the updated static file group into the corresponding second disk file in sequence to obtain second disk data;
[0116] Target disk data is obtained according to the first disk data and the second disk data.
[0117] Optionally, performing data recovery according to the data recovery request and the target disk data includes:
[0118] Get the redo log with data;
[0119] Data recovery is performed according to the data recovery request, the redo log with data, the updated static file group and the target disk data.
[0120] The data processing device for a relational in-memory database in an embodiment of the present invention obtains two sets of checkpoint files and initialization variables corresponding to a memory table space in the relational in-memory database, obtains an active file group and a static file group based on the two sets of checkpoint files and the initialization variables, and alternately writes dirty pages generated during the operation of the relational in-memory database into the active file group and the static file group based on the initialization variables to obtain an updated active file group and an updated static file group, performs disk mapping processing based on the updated active file group and the updated static file group to obtain target disk data, and performs data recovery based on a data recovery request and the target disk data, which not only helps to improve the security and stability of the system, but also can improve data recovery efficiency and accuracy when the system crashes.
[0121] It should be noted that the device is a device corresponding to the above method, and all implementations in the above method embodiment are applicable to the embodiment of the device and can achieve the same technical effects, which will not be described in detail in this embodiment.
[0122] An embodiment of the present invention further provides a computing device comprising: a processor and a memory storing a computer program. When the computer program is executed by the processor, the computer program performs the method described in any of the above embodiments. All implementations in the above method embodiments are applicable to the embodiments of this device and can achieve the same technical effects. These are not further described in this embodiment.
[0123] An embodiment of the present invention further provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method described in any of the above embodiments. All implementations in the above method embodiments are applicable to the embodiments of the device and can achieve the same technical effects. These are not further described in this embodiment.
[0124] It should be noted that, in the apparatus and method of the present invention, it is apparent that each component or step can be decomposed and / or recombined. Such decomposition and / or recombination should be considered equivalent solutions of the present invention. Furthermore, the steps of performing the above series of processes can naturally be performed in chronological order according to the order described, but do not necessarily need to be performed in chronological order. Certain steps can be performed in parallel, interleaved, or independently of each other.
[0125] It should be noted that, in the above embodiments, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be pointed out that the scope of the methods and devices in the implementation methods of the above embodiments is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0126] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. A data processing method for a relational in-memory database, characterized in that: include: Obtain two sets of checkpoint files and initialization variables corresponding to the memory tablespace in the relational memory database; Obtaining an active file group and a static file group according to the two groups of checkpoint files and the initialization variables; According to the initialization variables, dirty pages generated during the operation of the relational memory database are alternately written into the active file group and the static file group to obtain an updated active file group and an updated static file group; Perform disk mapping processing according to the updated active file group and the updated static file group to obtain target disk data; Data recovery is performed according to the data recovery request and the target disk data.
2. The data processing method for a relational in-memory database according to claim 1, characterized in that: Obtain two sets of checkpoint files and initialization variables corresponding to the in-memory tablespace in the relational in-memory database, including: Obtain two sets of checkpoint files corresponding to a memory table space in a relational memory database; each set of checkpoint files contains data files corresponding to the memory table space; Obtain initialization variables; the initialization variables include a timer preset value or a dirty page threshold, and a file identifier.
3. The data processing method for a relational in-memory database according to claim 2, characterized in that: According to the two groups of checkpoint files and the initialization variables, an active file group and a static file group are obtained, including: The two groups of checkpoint files are identified according to the file identification in the initialization variable to obtain an active file group and a static file group; the file identification includes an active file group identification and a static file group identification.
4. The data processing method for a relational in-memory database according to claim 2, wherein: According to the initialization variables, dirty pages generated during the operation of the relational memory database are alternately written into the active file group and the static file group to obtain an updated active file group and an updated static file group, including: Obtain dirty pages generated by modifying the memory table space during the operation of the relational memory database; When a preset value of a timer in the initialization variable or a dirty page threshold is reached, the dirty pages are alternately written into the active file group and the static file group to obtain an updated active file group and an updated static file group.
5. The data processing method for a relational in-memory database according to claim 4, characterized in that: When a preset timer value or a dirty page threshold in the initialization variable is reached, the dirty pages are alternately written into the active file group and the static file group to obtain an updated active file group and an updated static file group, including: Recording the dirty page into a redo log to obtain a redo log with data; When a preset timer value or a dirty page threshold in the initialization variable is reached, the data in the redo log with the data is written into the active file group, the data in the redo log with the data is cleared, and the identifier of the active file group is modified to a static file group identifier to obtain an updated static file group; The identifier of the static file group is modified to an active file group identifier to obtain an updated active file group.
6. The data processing method for a relational in-memory database according to claim 1, characterized in that: Performing disk mapping processing according to the updated active file group and the updated static file group to obtain target disk data includes: Writing the data in the updated active file group into the corresponding first disk file in sequence to obtain first disk data; Writing the data in the updated static file group into the corresponding second disk file in sequence to obtain second disk data; Target disk data is obtained according to the first disk data and the second disk data.
7. The data processing method for a relational in-memory database according to claim 1, characterized in that: Performing data recovery according to the data recovery request and the target disk data includes: Get the redo log with data; Data recovery is performed according to the data recovery request, the redo log with data, the updated static file group and the target disk data.
8. A data processing device for a relational in-memory database, characterized in that: include: An acquisition module is used to obtain two sets of checkpoint files and initialization variables corresponding to the memory table space in the relational memory database; A processing module, configured to obtain an active file group and a static file group according to the two groups of checkpoint files and the initialization variables; According to the initialization variables, dirty pages generated during the operation of the relational memory database are alternately written into the active file group and the static file group to obtain an updated active file group and an updated static file group; Disk mapping processing is performed according to the updated active file group and the updated static file group to obtain disk data; and data recovery is performed according to the data recovery request and the disk data.
9. A computing device, characterized in that include: A processor and a memory storing a computer program, wherein when the computer program is executed by the processor, the method according to any one of claims 1 to 7 is performed.
10. A computer-readable storage medium, characterized in that The device stores instructions, which, when executed on a computer, enable the computer to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Log check point recovery method applied to memory data base OLTP (online transaction processing)
CN102541691A
Method and device for data persistence processing and data base system
CN102750317A
Method, device and equipment for writing in data
CN102999564A
Data disk writing method of database, storage medium and equipment
CN115599756A
Data Persistence Processing Method and Apparatus, and Database System
US20150058295A1
