CN112506941B - Processing method and device for checking point, electronic equipment and storage medium - Google Patents

Processing method and device for checking point, electronic equipment and storage medium Download PDF

Info

Publication number
CN112506941B
CN112506941B CN202110145331.4A CN202110145331A CN112506941B CN 112506941 B CN112506941 B CN 112506941B CN 202110145331 A CN202110145331 A CN 202110145331A CN 112506941 B CN112506941 B CN 112506941B
Authority
CN
China
Prior art keywords
target
dirty page
array
mark
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110145331.4A
Other languages
Chinese (zh)
Other versions
CN112506941A (en
Inventor
邱海港
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202110145331.4A priority Critical patent/CN112506941B/en
Publication of CN112506941A publication Critical patent/CN112506941A/en
Application granted granted Critical
Publication of CN112506941B publication Critical patent/CN112506941B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2358Change logging, detection, and notification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/219Managing data history or versioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables

Landscapes

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

Abstract

The application provides a processing method and device for checking points, an electronic device and a storage medium, wherein the method comprises the following steps: determining the minimum value in the dirty page mark of the target dirty page contained in the target dirty page linked list as a first reference value of a target check point, wherein the target dirty page is a dirty page of a target database, and the dirty page mark is a log serial number of a redo log with the dirty page updated for the first time; determining a difference between the first reference value and the first predetermined value as a second reference value of the target check point; and finding out a target mark from the dirty page marks of the at least one historical dirty page to obtain a log serial number of a target check point, wherein each historical dirty page in the at least one historical dirty page is a dirty page which is refreshed to a disk in a target database, and the target mark is less than or equal to a second reference value. By the method and the device, the problem that database versions are difficult to upgrade due to the fact that the mode of concurrently adding dirty pages in the related technology cannot be compatible with check point records of existing version redo logs is solved.

Description

Processing method and device for checking point, electronic equipment and storage medium
Technical Field
The present application relates to the field of data processing, and in particular, to a method and an apparatus for processing a checkpoint, an electronic device, and a storage medium.
Background
At present, after a database incremental log (redo log ) is optimized without lock, the incremental log copies data from a memory area of a user thread to a log public buffer area (log buffer), and can concurrently execute to add dirty pages to a dirty page linked list (flush _ list), where there may be 1 or more dirty page linked lists. When the flushing is performed, the dirty pages in the dirty page linked list may be sequentially flushed to the disk according to an old _ modification from small to large, where the old _ modification is used to indicate an LSN (Log Sequence Number) of a redo Log in which a data page is updated for the first time.
Since the addition of the dirty pages to the dirty page linked list is performed concurrently, during one time of flushing dirty, LSNs of the dirty pages in the dirty page linked list are not ordered, and there may be a hole, that is, there is a possibility that the old _ modification of the dirty pages is smaller than the maximum old _ modification of the dirty pages in the dirty page linked list, but has not been added to the dirty page linked list. For this, when computing checkpoint, a fixed interval (recovery _ close) may be subtracted to ensure that all dirty pages whose old _ modification is smaller than checkpoint are dropped from disk, where checkpoint is used to indicate the LSN when the last data page flushed to disk is modified for the first time.
The checkpoint point obtained in the above manner may not be an MRT (mini-transaction, atomic recording) start position, but an intermediate position of a recording, so that the LSN of the MRT start position needs to be calculated again based on the checkpoint of the recording when crash recovery.
For the above concurrent dirty page adding manner, because the LSN of the MRT start position needs to be recalculated during recovery, and the existing version (for example, 5.7 version) of the database is recovered by directly reading the redo log from the checkpoint recorded point, the manner of flushing the dirty page to the disk is incompatible with the checkpoint recorded in the redo log of the existing version, and cannot be directly upgraded, so that the existing version has the above concurrent function.
Therefore, the method for concurrently adding dirty pages in the related art has the problem that the database version is difficult to upgrade due to the fact that the dirty pages cannot be compatible with the checkpoint records of the existing version redo log.
Disclosure of Invention
The application provides a processing method and device of check points, electronic equipment and a storage medium, which are used for solving the problem that database versions are difficult to upgrade due to the fact that the compatibility with check point records of existing version redo logs cannot be achieved in a concurrent dirty page adding mode in the related technology.
According to an aspect of an embodiment of the present application, there is provided a method for processing a checkpoint, including: determining a minimum value in a dirty page mark of a target dirty page contained in a target dirty page linked list as a first reference value of a target check point, wherein the target dirty page is a dirty page of a target database, and the dirty page mark is a log serial number of a redo log updated for the first time by the dirty page; determining a difference between the first reference value and a first predetermined value as a second reference value of the target checkpoint; finding out a target mark from the dirty page marks of at least one historical dirty page to obtain a log serial number of the target check point, wherein each historical dirty page in the at least one historical dirty page is a dirty page which is refreshed to a disk in the target database, and the target mark is smaller than or equal to the second reference value.
Optionally, the determining, as the first reference value of the target checkpoint, the minimum value of the dirty page markers of the target dirty pages included in the target dirty page linked list includes: respectively determining the minimum value of the dirty page marks of the target dirty pages contained in each dirty page linked list of the dirty page linked lists to obtain a plurality of candidate values under the condition that the target dirty page linked list contains a plurality of dirty page linked lists, wherein the candidate values are in one-to-one correspondence with the dirty page linked lists; determining a smallest candidate value of the plurality of candidate values as the first reference value of the target checkpoint.
Optionally, the finding a target mark from the dirty page marks of at least one historical dirty page comprises: and finding the target mark from a target array according to the second reference value, wherein the dirty page mark of one historical dirty page in the at least one historical dirty page is stored as an array element at an array position in the target array.
Optionally, the finding the target mark from the target array according to the second reference value includes: acquiring a first hash value corresponding to the second reference value, wherein the first hash value is obtained by using a second predetermined value to carry out remainder on the second reference value, and the second predetermined value is greater than or equal to the first predetermined value; sequentially searching array elements in the target array from an array position corresponding to the first hash value to the front until the target mark is found, wherein the dirty page mark of each historical dirty page is stored in the array position corresponding to the hash value of the dirty page mark of each historical dirty page in the target array.
Optionally, sequentially looking up array elements in the target array from the array position corresponding to the first hash value forward until the target mark is found includes: sequentially searching array elements at each array position in the target array from the array position corresponding to the first hash value; and under the condition that the first array element which is smaller than or equal to the second reference value and has a difference value with the second reference value smaller than or equal to the second preset value is found, determining the first array element as the target mark.
Optionally, the sequentially searching array elements in the target array from the array position corresponding to the first hash value forward until the target mark is found includes: sequentially searching array elements at each array position in the target array from the last array position of the target array to the front under the condition that the target mark is not found at the first array position of the target array; and determining the second array element as the target mark under the condition that the second array element which is smaller than or equal to the second reference value and has a difference value with the second reference value smaller than or equal to the second preset value is found.
Optionally, before the finding of the target mark from the dirty page marks of the at least one historical dirty page, the method further includes: acquiring a second hash value corresponding to the dirty page mark of a target historical dirty page, wherein the target historical dirty page is one historical dirty page of the at least one historical dirty page; and storing the dirty page mark of the target historical dirty page to an array position corresponding to the second hash value in the target array.
Optionally, after the target mark is found from the dirty page marks of the at least one historical dirty page, the method further includes: storing the target mark into a target storage file, wherein the target storage file is used for storing a log serial number of an audit point corresponding to the target dirty page linked list; under the condition of recovering the data in the target database, reading the target mark from the target storage file; acquiring a target redo log which corresponds to the target database and has a corresponding log serial number greater than or equal to the target mark; and recovering the data in the target database by using the target redo log.
According to another aspect of the embodiments of the present application, there is also provided a device for processing checkpoints, including: the first determining unit is used for determining a minimum value in a dirty page mark of a target dirty page contained in a target dirty page linked list as a first reference value of a target check point, wherein the target dirty page is a dirty page of a target database, and the dirty page mark is a log serial number of a redo log updated for the first time by the dirty page; a second determination unit configured to determine a difference between the first reference value and a first predetermined value as a second reference value of the target check point; the searching unit is configured to search a target mark from the dirty page marks of at least one historical dirty page to obtain a log serial number of the target check point, where each historical dirty page in the at least one historical dirty page is a dirty page that has been refreshed to a disk in the target database, and the target mark is smaller than or equal to the second reference value.
Optionally, the first determining unit includes: a first determining module, configured to determine, when the target dirty page linked list includes multiple dirty page linked lists, a minimum value in the dirty page flag of the target dirty page included in each of the multiple dirty page linked lists, respectively, to obtain multiple candidate values, where the multiple candidate values are in one-to-one correspondence with the multiple dirty page linked lists; a second determining module, configured to determine a smallest candidate value of the multiple candidate values as the first reference value of the target checkpoint.
Optionally, the search unit includes: a first searching module, configured to search the target flag from a target array according to the second reference value, where the dirty page flag of one historical dirty page of the at least one historical dirty page is stored as an array element at an array position in the target array.
Optionally, the first lookup module includes: an obtaining submodule, configured to obtain a first hash value corresponding to the second reference value, where the first hash value is a value obtained by using a second predetermined value to perform remainder on the second reference value, and the second predetermined value is greater than or equal to the first predetermined value; and the searching submodule is used for sequentially searching array elements in the target array from an array position corresponding to the first hash value to the front until the target mark is found, wherein the dirty page mark of each historical dirty page is stored in the array position corresponding to the hash value of the dirty page mark of each historical dirty page in the target array.
Optionally, the lookup sub-module includes: the first searching subunit is configured to sequentially search array elements at each array position in the target array from the array position corresponding to the first hash value forward; a first determining subunit, configured to determine, when a first array element that is smaller than or equal to the second reference value and whose difference with the second reference value is smaller than or equal to the second predetermined value is found, the first array element as the target mark.
Optionally, the lookup sub-module includes: the second searching subunit is configured to, when the target mark is not found yet at the first array position where the target array is found, sequentially search array elements at each array position in the target array from the last array position of the target array forward; a second determining subunit, configured to determine, when a second array element that is smaller than or equal to the second reference value and whose difference with the second reference value is smaller than or equal to the second predetermined value is found, the second array element as the target mark.
Optionally, the apparatus further comprises: a first obtaining unit, configured to obtain a second hash value corresponding to a dirty page flag of a target historical dirty page before a target flag is found from the dirty page flag of at least one historical dirty page, where the target historical dirty page is one of the at least one historical dirty page; a first storage unit, configured to store the dirty page flag of the target historical dirty page in an array position corresponding to the second hash value in the target array.
Optionally, the apparatus further comprises: a second storage unit, configured to store a target mark in a target storage file after the target mark is found from the dirty page marks of the at least one historical dirty page, where the target storage file is used to store a log sequence number of an checkpoint corresponding to the target dirty page chain table; a reading unit, configured to read the target mark from the target storage file when the data in the target database is restored; the second acquisition unit is used for acquiring a target redo log which corresponds to the target database and has the corresponding log serial number greater than or equal to the target mark; and the recovery unit is used for recovering the data in the target database by using the target redo log.
According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory communicate with each other through the communication bus; wherein the memory is used for storing the computer program; a processor for performing the method steps in any of the above embodiments by running the computer program stored on the memory.
According to a further aspect of the embodiments of the present application, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to perform the method steps of any of the above embodiments when the computer program is executed.
In the embodiment of the application, a checking point is determined according to a target mark of a historical dirty page, and a minimum value in dirty page marks of the target dirty page contained in a target dirty page linked list is determined as a first reference value of the target checking point, wherein the target dirty page is a dirty page of a target database, and the dirty page mark is a log serial number of a redo log updated for the first time by the dirty page; determining a difference between the first reference value and the first predetermined value as a second reference value of the target check point; finding a target mark from dirty page marks of at least one historical dirty page to obtain a log serial number of a target check point, wherein each historical dirty page in the at least one historical dirty page is a dirty page which is refreshed to a disk in a target database, the target mark is less than or equal to a second reference value, because in a scene of concurrently adding dirty pages to a dirty page chain table, after a fixed interval is removed to obtain a reference value of the check point, a target mark is found from the dirty page marks (e.g., old _ modification) of the at least one historical dirty page as the check point, the check point is a dirty page mark of the dirty page and is inevitably an initial value of an MRT (maximum likelihood test value), and the check point can be directly used for data recovery when a server recovers, so that the aim of compatibility with the existing version can be achieved, and the technical effects of improving the version compatibility of the dirty page concurrently adding function and reducing the difficulty of database version upgrading are achieved, and the problem that the database version is difficult to upgrade due to the fact that the mode of concurrently adding dirty pages in the related technology cannot be compatible with the check point records of existing version redo logs is solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
FIG. 1 is a schematic diagram of a hardware environment for an alternative method of processing a checkpoint in accordance with an embodiment of the present application;
FIG. 2 is a flow chart illustrating an alternative method of processing a checkpoint in accordance with an embodiment of the present application;
FIG. 3 is a schematic diagram of an alternative method of processing a checkpoint in accordance with an embodiment of the present application;
FIG. 4 is a schematic flow chart diagram illustrating an alternative method for processing checkpoints in accordance with embodiments of the present application;
FIG. 5 is a block diagram of an alternative processing device for checking points according to an embodiment of the present disclosure;
fig. 6 is a block diagram of an alternative electronic device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of an embodiment of the present application, a method for processing a checkpoint is provided. Alternatively, in this embodiment, the processing method of the check point may be applied to a hardware environment formed by the terminal 102 and the server 104 as shown in fig. 1. As shown in fig. 1, the server 104 is connected to the terminal 102 through a network, and may be a database server (storage node) for providing services (e.g., data storage services, application services, etc.) for the terminal or a client installed on the terminal.
The network may include, but is not limited to, at least one of: wired networks, wireless networks. The wired network may include, but is not limited to, at least one of: wide area networks, metropolitan area networks, local area networks, which may include, but are not limited to, at least one of the following: WIFI (Wireless Fidelity), bluetooth. The terminal 102 may not be limited to a PC, a mobile phone, a tablet computer, etc.
The processing method of the checkpoint in the embodiment of the present application may be executed by the server 104, may be executed by the terminal 102 (the terminal has a database function), or may be executed by both the server 104 and the terminal 102. The processing method for the terminal 102 to execute the checkpoint in the embodiment of the present application may also be executed by a client installed thereon.
Taking the server 104 to execute the processing method of the checkpoint in this embodiment as an example, fig. 2 is a schematic flowchart of an optional processing method of the checkpoint according to this embodiment, and as shown in fig. 2, the flowchart of the method may include the following steps:
step S202, determining the minimum value in the dirty page marks of the target dirty pages contained in the target dirty page linked list as a first reference value of the target check point, wherein the target dirty pages are dirty pages of the target database, and the dirty pages are marked as log serial numbers of redo logs updated for the first time by the dirty pages.
The processing method of the checkpoint in this embodiment may be applied to a database architecture, for example, in a distributed database architecture, to determine a scenario of a Log Sequence Number (LSN for short) of a checkpoint (checkpoint) in a database, where the checkpoint may be a checkpoint performed for refreshing a dirty page to a disk for a redo Log.
The database may have data pages stored therein. When a data page is modified (updated), the data page may be loaded into a memory buffer (buffer, buffer pool) first. In the memory cache, dirty pages are generated after a data page is modified. A dirty page refers to a page of data that has been modified in the memory cache but has not been flushed to disk. At this time, the data of the data page in the memory of the database instance is inconsistent with the data of the data page in the disk.
Each modification to a data page may be recorded via a redo log, which may be used to record the modifications made to the data page. The LSN of the redo log refers to the log sequence number, which is used to indicate the number of bytes of the redo log that have been generated from the beginning to the redo log.
The update of the data page may have two flags: old _ modification (dirty page marker) indicating the LSN of the redo log of the first update of a data page; newest _ modification, which represents the LSN of the redo log of the last update of a data page. After the data page is modified for the first time, dirty data pages (dirty pages) may be added to a dirty page list (flush _ list), and the dirty pages added to the dirty page list may be updated by other threads. Correspondingly, the newest _ modification of a dirty page may be increasing.
In the process of concurrently adding the dirty pages, the dirty pages can be concurrently added to the dirty page linked list by a plurality of threads. The server may periodically traverse the target dirty page linked list, and determine a minimum value of dirty page markers of the target dirty pages included in the target dirty page linked list as a first reference value of the target check point. Alternatively, the server may start the target thread, and periodically traverse the target dirty page linked list (for example, traverse the dirty page linked list every 1 s), record LSNs (old _ modification, dirty page markers) of the latest page (the latest dirty page) that has been flushed to the disk, where the recorded LSNs may be LSNs of the checkpoint, which indicates that data before the LSN is flushed (flush) to the disk, and if a recovery operation is to be performed, the target thread may start recovering from the current LSN.
For a target thread (e.g., a log checkpoint thread), the target thread may be triggered to recompute the LSN of a checkpoint (i.e., checkpoint LSN) via a checkpoint event. Checkpoint is a database event (event) and the LSN of the Checkpoint may be used to indicate (in the buffer) the LSN of the latest page that has been flushed to disk.
The target dirty page linked list may include at least one target dirty page, each target dirty page may have a dirty page flag, and the dirty page flag may be the old _ modification and may be used to indicate a log sequence number of a redo log that is updated for the first time by the corresponding dirty page. In the event of a checkpoint event, the target thread may recalculate the checkpoint's value (LSN). After recalculating the value of checkpoint, the target thread may read the minimum LSN in the target dirty page chain table, that is, the target thread may read the minimum value in the dirty page flag of at least one target dirty page included in the target dirty page chain table, to obtain the first reference value of the target checkpoint (i.e., the first reference value of the log sequence number of the target checkpoint). The first reference value is an MTR start value.
It should be noted that the dirty page flag generally refers to the LSN of the redo log updated for the first time by the corresponding dirty page, the dirty page flag of a certain dirty page refers to the log serial number of the redo log updated for the first time by the local dirty page, and the dirty page flags of different dirty pages are different.
In step S204, the difference between the first reference value and the first predetermined value is determined as a second reference value of the target check point.
After obtaining the first reference value, the target thread may determine a difference value obtained by subtracting a predetermined value (first predetermined value) from the first reference value as a second reference value of the target checkpoint. The first predetermined value may be a preset fixed value, or a fixed interval (receiver _ close), and is configured to avoid that the LSN of the determined checkpoint is inaccurate due to the existence of the hole, so as to avoid missing data during data recovery.
For example, as shown in fig. 3, the smallest dirty page flag (old _ modification) in the dirty page list is 94, but the two dirty pages with dirty page flags 80 and 85 have not been added to the dirty page list and have not fallen to disk. If the LSN of the checkpoint is configured to 94 directly, if the server goes down at this time, the data is recovered from 94, which results in the missing of the data and causes an exception to the data page. If a fixed interval, e.g., 30, is configured, then subtracting the fixed interval 30 from 94 to obtain 64 ensures that the data before 64 has fallen off the disk.
Step S206, finding out a target mark from the dirty page marks of the at least one historical dirty page to obtain a log serial number of the target check point, wherein each historical dirty page in the at least one historical dirty page is a dirty page which is refreshed to a disk in the target database, and the target mark is smaller than or equal to a second reference value.
According to the processing mode in some database versions (version MySQL 8.0), after the second reference value is obtained, the second reference value may be determined as the LSN of checkpoint, and then, the checkpoint point recorded may not be the starting position of an MRT but a position in the middle of a record, so that when a crash recovers, the checkpoint point needs to be calculated again. According to some versions without concurrent function (MySQL 5.7 versions), recovery is directly started from a recorded checkpoint point during data recovery, and then the concurrent function is incompatible with the versions due to different processing modes and cannot be directly upgraded.
For example, as shown in fig. 3, 64 obtained by subtracting the fixed interval 30 from 94 is saved as a checkpoint in accordance with the MySQL 8.0 version processing method. When data recovery is required, the forward progress needs to be continued until 60 is found, since 64 is not the starting position of an MRT. If the above mentioned manner of determining checkpoint is applied to version MySQL 5.7, according to the processing manner of version MySQL 5.7, it will start to recover from the saved checkpoint 64, and will not backtrack, but 64 is not a starting position of MRT, so that data recovery cannot be performed.
In this embodiment, the dirty page flag of the at least one historical dirty page may be stored in advance, and each historical dirty page in the at least one historical dirty page is a dirty page that has been flushed to the disk in the target database. After obtaining the second reference value, the server may find a target mark from the dirty page marks of the at least one historical dirty page, where the found target mark is less than or equal to the second reference value.
The target flag may be any one of the dirty page flags of the at least one historical dirty page, for example, any one of the dirty page flags of the at least one historical dirty page that is greater than the log sequence number of the last check point of the target check point and is less than or equal to the second reference value. In order to reduce the amount of data to be restored when data is restored, the largest dirty page flag, which is smaller than or equal to the second reference value, of the dirty page flags of the at least one historical dirty page may be determined as the target flag.
Since the target mark was a dirty page mark (old _ modification) of a dirty page, it must be the starting position of an MRT, and it is taken as the target sequence number of the target check point. When the data is recovered, the data can be directly recovered according to the data without recalculation, so that the database version (for example, MySQL 5.7 version) of the data which is directly recovered from a checkpoint can be compatible, and the database version can be directly upgraded to have a function of concurrently adding dirty pages.
Determining the minimum value in the dirty page marks of the target dirty pages contained in the target dirty page linked list as a first reference value of the target check point through the steps S202 to S206, wherein the target dirty pages are dirty pages of the target database, and the dirty pages are marked as log serial numbers of redo logs updated for the first time by the dirty pages; determining a difference between the first reference value and the first predetermined value as a second reference value of the target check point; the target mark is searched from the dirty page marks of at least one historical dirty page to obtain the log serial number of the target check point, wherein each historical dirty page in the at least one historical dirty page is a dirty page which is refreshed to a disk in a target database, and the target mark is smaller than or equal to a second reference value.
As an alternative embodiment, determining the minimum value of the dirty page flags of the target dirty pages included in the target dirty page linked list as the first reference value of the target checkpoint includes:
s11, respectively determining the minimum value of dirty page marks of target dirty pages contained in each dirty page linked list in the dirty page linked lists to obtain a plurality of candidate values under the condition that the target dirty page linked list contains a plurality of dirty page linked lists, wherein the candidate values are in one-to-one correspondence with the dirty page linked lists;
s12, determining a minimum candidate value of the plurality of candidate values as a first reference value of the target checkpoint.
For a scenario in which the dirty pages are stored by the multiple dirty page linked lists, that is, the target dirty page linked list includes multiple dirty page linked lists, and the size of the dirty page flag of the dirty page in each dirty page linked list is random. When the first reference value is determined, the minimum value of the dirty page markers of the target dirty pages included in any one of the dirty page linked lists may be determined as the first reference value.
In order to ensure the reasonability of the log serial number of the determined check point, the server can respectively determine the minimum value in the dirty page marks of the target dirty pages contained in each dirty page linked list to obtain a plurality of candidate values, and the candidate values are in one-to-one correspondence with the dirty page linked lists. After obtaining the plurality of candidate values, the server may determine a minimum value of the plurality of candidate values as a first reference value of the target checkpoint.
By the embodiment, when the dirty page linked lists are multiple, the rationality of determining the log serial number of the check point can be improved by acquiring the minimum value of the dirty page marks of all the dirty pages contained in the multiple dirty page linked lists as the reference value of the check point.
As an alternative embodiment, the finding of the target mark from the dirty page marks of the at least one historical dirty page comprises:
s21, finding out a target mark from the target array according to the second reference value, wherein the dirty page mark of one historical dirty page in the at least one historical dirty page is stored as an array element at an array position in the target array.
The dirty page marks of at least one historical dirty page can be stored in various ways, for example, the dirty page marks can be sequentially stored according to the sequence that the dirty pages are refreshed to a disk, and when the target mark is searched, the dirty page marks of the historical dirty pages can be sequentially searched, so that the target mark meeting the searching condition is obtained.
To improve lookup efficiency, a target storage structure (e.g., an array) may be employed to store dirty page tags for at least one historical dirty page. For example, a dirty page tag for at least one historical dirty page may be stored by the target array, and the dirty page tag for each historical dirty page may be stored as an array element of the target array at an array location in the target array.
Optionally, the dirty page flag of one historical dirty page may be mapped to a position in the target array corresponding to the dirty page flag of the historical dirty page in a target mapping manner. The dirty page flag of one historical dirty page may be stored as an array element at an array position in the target array according to a target mapping relationship, where the target mapping relationship is a mapping relationship between the array element and a storage position of the array element in the target array, and thus, a size relationship of the array element may be represented by a position relationship of different array elements in the target array.
The server may search in the target array according to the second reference value, and the search parameter (e.g., search direction, search termination condition, etc.) may be determined by a relationship between the array element and a storage location of the array element in the target array. According to the second reference value and the search parameter, the server can determine an initial search position, a search direction and the like, and search according to the determined initial search position and the search direction to obtain an array element meeting the search condition, wherein the searched array element is the target mark.
For example, the server may sequentially search each array element in the target array, and update the candidate tag according to the searched array elements that satisfy the update condition: less than or equal to the second parameter value and larger than the current candidate mark. After all array elements are searched, the current candidate mark is the target mark. After all array elements are found, the current candidate mark is the target mark.
By the embodiment, the dirty page marks of the dirty pages are stored in the target array, and the mapping relation between the array elements and the array positions is utilized, so that the searching efficiency of the target marks can be improved.
As an alternative embodiment, finding the target mark from the target array according to the second reference value comprises:
s31, acquiring a first hash value corresponding to a second reference value, wherein the first hash value is obtained by using a second preset value to carry out remainder on the second reference value, and the second preset value is greater than or equal to the first preset value;
and S32, sequentially searching array elements in the target array from the array position corresponding to the first hash value to the front until a target mark is found, wherein the dirty page mark of each historical dirty page is stored in the array position corresponding to the hash value of the dirty page mark of each historical dirty page in the target array.
In order to reduce the storage space occupied by the target array, the dirty page flag of each historical dirty page may be stored in the target array at an array position corresponding to the hash value of the dirty page flag of each historical dirty page in a hash mapping manner. When data is searched, hash calculation may be performed on the second reference value to obtain a corresponding hash value, that is, the first hash value.
The hash mapping may use a division leaving a remainder, and the divisor used may be a second predetermined value, which may be a value greater than or equal to the first predetermined value, for example, twice the first predetermined value. When performing the hash calculation on the second reference value, the server may calculate a remainder obtained by dividing the second reference value by the second predetermined value, as the first hash value.
After obtaining the first hash value, the server may sequentially search array elements in the target array from an array position corresponding to the first hash value forward until a target mark satisfying a search condition is found. Since the largest dirty page flag smaller than or equal to the second parameter value is to be searched, the corresponding target search condition may be: is less than or equal to the second parameter value and differs from the second reference value by less than or equal to a second predetermined value.
Through the embodiment, the dirty page marks of the historical dirty pages are stored in the array positions corresponding to the hash values of the dirty pages, so that the storage space occupied by the array can be reduced, meanwhile, the dirty pages are searched in a certain direction, and the searching efficiency can be improved.
As an alternative embodiment, sequentially looking up array elements in the target array from the array position corresponding to the first hash value forward until the target mark is found includes:
s41, sequentially searching array elements at each array position in the target array from the array position corresponding to the first hash value;
and S42, determining the first array element as the target mark under the condition that the first array element which is less than or equal to the second reference value and has the difference value with the second reference value less than or equal to the second preset value is found.
When the target mark is searched, array elements at each array position in the target array may be sequentially searched from the array position corresponding to the first hash value forward, and the size between the current array element and the second reference value may be determined.
If the current array element meets the target searching condition, the current array element can be determined to be the array element to be searched, and the searching is stopped. If the current array element does not meet the target searching condition, the last data element in the target array can be searched continuously, and at least the array element meeting the target searching condition is searched.
It should be noted that, satisfying the target search condition means: the current array element is less than or equal to a second reference value, and the difference value between the current array element and the second reference value is less than or equal to a second predetermined value, and the condition that the target searching condition is not met refers to that: the current array element is greater than the second reference value or the difference with the second reference value is greater than a second predetermined value.
By the embodiment, the rationality of searching the target mark can be improved by searching the target mark which is smaller than or equal to the second reference value and the difference value of which with the second reference value is smaller than or equal to the second preset value.
As an alternative embodiment, sequentially looking up array elements in the target array from the array position corresponding to the first hash value forward until the target mark is found includes:
s51, sequentially searching array elements at each array position in the target array from the last array position of the target array to the front under the condition that the target mark is not found at the first array position of the target array;
and S52, determining the second array element as the target mark under the condition that the second array element which is less than or equal to the second reference value and has the difference value with the second reference value less than or equal to the second preset value is found.
The array position corresponding to the first hash value is random, which may be any position in the target array, and then there is a possibility that the target mark is not found at the first array position where the target array is found. If the array elements meeting the target searching condition are not found in the first array position of the target array, the array elements at each array position in the target array can be sequentially found from the last array position of the target array.
When searching, the array elements at each array position may be sequentially obtained as the current array element until the array element satisfying the target search condition is found, or the array position corresponding to the first hash value is found.
If the array position corresponding to the first hash value is found, and the target mark is not found yet, the target mark may be found again by traversing the entire target array, for example, sequentially finding from the first array position of the target array backward, or sequentially finding from the last array position of the target array forward, or respectively finding from any middle position to both ends, or traversing the target array by other means, which is not limited in this embodiment.
By the embodiment, if the target mark is not found at the first array position, the search is carried out from the last array position, so that the search efficiency can be improved.
As an alternative embodiment, before finding the target mark from the dirty page marks of the at least one historical dirty page, the method further comprises:
s61, acquiring a second hash value corresponding to a dirty page mark of a target historical dirty page, wherein the target historical dirty page is one historical dirty page of at least one historical dirty page;
and S62, storing the dirty page mark of the target historical dirty page to the array position corresponding to the second hash value in the target array.
For any historical dirty page, that is, the target historical dirty page, after the historical dirty page is refreshed to the disk, the server or the corresponding thread may obtain a second hash value corresponding to the dirty page flag of the target historical dirty page, and store the dirty page flag of the target historical dirty page in an array position corresponding to the second hash value in the target array.
In order to improve the storage efficiency, if the array position corresponding to the second hash value in the target array has a value, the target array can be directly replaced by adopting an overlay storage mode.
For example, a hash array of fixed length may be created first, which may be 2 times the length of the aforementioned fixed interval (receiver _ close), about 2 × 1024 (4M). When the thread of the dirty page deletes the current dirty page from the dirty page linked list, the old _ modification (namely, the dirty page mark) of the current dirty page is recorded, and the old _ modification of the current dirty page is subjected to remainder calculation (the hash array is recycled) and then stored in the hash array in an overlay type storage mode.
Through the embodiment, the dirty page mark of the current dirty page is stored in the array position corresponding to the hash value of the dirty page mark of the current dirty page in the array in a hash calculation mode, so that the storage efficiency can be improved, and the accuracy of array searching can be improved.
As an alternative embodiment, after finding the target mark from the dirty page marks of the at least one historical dirty page, the method further comprises:
s71, storing the target mark into a target storage file, wherein the target storage file is used for storing the log serial number of the check point corresponding to the target dirty page chain table;
s72, reading out the target mark from the target storage file under the condition of restoring the data in the target database;
s73, acquiring a target redo log corresponding to the target database and having a corresponding log serial number greater than or equal to the target mark;
and S74, recovering the data in the target database by using the target redo log.
After determining the log sequence number of the target check point, that is, the target marker, the server may store the target marker in a target storage file, where the target storage file may be used to store the log sequence number of the check point corresponding to the target dirty page linked list. The way of storing the log serial number of the check point may be stored in an overwriting way, that is, the new log serial number of the check point is used to overwrite the old log serial number of the target storage file.
If the data recovery is performed after the server is down, the log serial number of the current check point, for example, the target mark, may be read from the target storage file, and what needs to be recovered is data whose log serial number of the corresponding redo log is greater than the target mark.
The server may obtain a redo log corresponding to the target database and having a log sequence number greater than or equal to the target marker, that is, a target redo log, and perform data recovery on the target database using the target redo log, where the data recovery process may refer to related technologies, which is not described in detail in this embodiment.
According to the embodiment, the stored log serial number of the check point is read, and the stored log serial number of the check point is used for directly recovering data, so that the compatibility of a dirty page parallel adding function and a database version can be improved, and the database version is convenient to upgrade.
The following explains a processing method of the check point in the embodiment of the present application with reference to an alternative example.
In this example, during the concurrent addition of dirty pages, because there are holes, it is possible to ensure that all the dirty pages have fallen off the disk by subtracting a fixed interval value, for example, 2 × 1024 (2M). Meanwhile, a hash array of fixed length can be created, the length of the array being 2 times the length of the fixed interval, about 2 × 2M (4M).
When a dirty page is deleted from the dirty page linked list, the old _ modification (dirty page mark) of the current dirty page may be stored in the hash array in an overlay storage manner, where the stored value is the old _ modification of the current dirty page, and the stored position is the array position corresponding to the value obtained after the old _ modification of the current dirty page is deleted.
In recalculating the value of the check point, as shown in fig. 4, the flow of the processing method of the check point in the present alternative example may include the following steps:
and S402, reading the minimum LSN in the dirty page linked list, and subtracting the fixed length from the read LSN to obtain a value M.
The log _ checkpoint thread in the server may read the minimum LSN from one or more dirty page linked lists, that is, read the minimum aggregate _ modification of a dirty page in a dirty page linked list, and subtract a fixed interval (receiver _ close) from the read minimum LSN to obtain a value M.
Step S404, an LSN smaller than M is searched in the hash array and is recorded as M1.
The M value is a value obtained by subtracting a fixed interval from an MRT start value, which is not necessarily an MRT start value. A value other than 0 can be found forward by looking up the hash array after remainder is given to M, and the value is marked as M1, and M1 can be used as a checkpoint value. If the dirty page linked list is empty, the linked list is not searched. If the dirty page linked list is not empty, the following situations can be distinguished:
(1) the first non-0 value is a qualified value, and the value is marked as M1;
(2) the first value not 0 is the value of the previous round (which can be determined by judging that the difference between the forward searched value not 0 and the value of M is greater than 2 x 1024), if the value is not less than the maximum value of M, the search is continued until the position with the subscript of 0 in the array is found; if the position with the subscript of 0 is not found, starting to find from the maximum value (namely the tail of the hash array) and obtaining the value until the position is found;
(3) if the record of the current redo log is particularly long, namely, greater than 4M, and the value of the array fails to satisfy the condition and differs from the value of M by less than 2 x 1024 (4M), then a maximum value is searched from the end of the array as the value of M1.
Since the found M1 was once the old _ modification of a dirty page, it can be taken as the current checkpoint value.
By the present example, the LSNs (old _ modification) of the dirty pages removed from the dirty page chain table are recorded into the hash array according to the hash value; when the value of checkpoint is calculated, after subtracting a value of a fixed interval from the minimum LSN in the dirty page chain table, hash data is searched according to the hash value, and the searched LSN is recorded as the value of checkpoint, so that the aim of searching again an MRT initial value as the value of checkpoint after a log of an MRT is truncated can be achieved, and meanwhile, the compatibility of redoing log files during version upgrading can be achieved.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (e.g., a ROM (Read-Only Memory)/RAM (Random Access Memory), a magnetic disk, an optical disk) and includes several instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the methods according to the embodiments of the present application.
According to another aspect of the embodiments of the present application, there is also provided a processing apparatus for a checkpoint, which is used for implementing the processing method for a checkpoint. Fig. 5 is a block diagram of a processing apparatus for an optional checkpoint according to an embodiment of the present disclosure, and as shown in fig. 5, the apparatus may include:
a first determining unit 502, configured to determine a minimum value in a dirty page flag of a target dirty page included in a target dirty page linked list as a first reference value of a target check point, where the target dirty page is a dirty page of a target database, and the dirty page flag is a log serial number of a redo log in which the dirty page is updated for the first time;
a second determining unit 504, connected to the first determining unit 502, for determining a difference between the first reference value and the first predetermined value as a second reference value of the target checking point;
the searching unit 506 is connected to the second determining unit 504, and configured to search a target mark from the dirty page marks of the at least one historical dirty page, to obtain a log sequence number of the target check point, where each historical dirty page in the at least one historical dirty page is a dirty page that has been refreshed to a disk in the target database, and the target mark is smaller than or equal to the second reference value.
It should be noted that the first determining unit 502 in this embodiment may be configured to execute the step S202, the second determining unit 504 in this embodiment may be configured to execute the step S204, and the searching unit 506 in this embodiment may be configured to execute the step S206.
Determining a minimum value in a dirty page mark of a target dirty page contained in a target dirty page linked list as a first reference value of a target check point through the module, wherein the target dirty page is a dirty page of a target database, and the dirty page mark is a log serial number of a redo log updated for the first time by the dirty page; determining a difference between the first reference value and the first predetermined value as a second reference value of the target check point; the target mark is searched from the dirty page marks of at least one historical dirty page to obtain the log serial number of the target check point, wherein each historical dirty page in the at least one historical dirty page is a dirty page which is refreshed to a disk in a target database, and the target mark is smaller than or equal to a second reference value.
As an alternative embodiment, the first determining unit 502 includes:
the device comprises a first determining module, a second determining module and a judging module, wherein the first determining module is used for respectively determining the minimum value of dirty page marks of target dirty pages contained in each dirty page linked list in the dirty page linked lists to obtain a plurality of candidate values under the condition that the target dirty page linked list contains the dirty page linked lists, and the candidate values are in one-to-one correspondence with the dirty page linked lists;
and the second determining module is used for determining the minimum candidate value in the candidate values as the first reference value of the target check point.
As an alternative embodiment, the lookup unit 506 includes:
and the first searching module is used for searching a target mark from the target array according to the second reference value, wherein the dirty page mark of one historical dirty page in at least one historical dirty page is stored as an array element at one array position in the target array.
As an alternative embodiment, the first lookup module includes:
the obtaining submodule is used for obtaining a first hash value corresponding to a second reference value, wherein the first hash value is obtained by using a second preset value to carry out remainder on the second reference value, and the second preset value is greater than or equal to the first preset value;
and the searching submodule is used for sequentially searching array elements in the target array from the array position corresponding to the first hash value to the front until a target mark is found, wherein the dirty page mark of each historical dirty page is stored in the array position corresponding to the hash value of the dirty page mark of each historical dirty page in the target array.
As an alternative embodiment, the lookup sub-module includes:
the first searching subunit is used for sequentially searching array elements at each array position in the target array from the array position corresponding to the first hash value to the front;
and the first determining subunit is used for determining the first array element as the target mark under the condition that the first array element which is smaller than or equal to the second reference value and has a difference value with the second reference value smaller than or equal to a second preset value is found.
As an alternative embodiment, the lookup sub-module includes:
the second searching subunit is used for sequentially searching array elements at each array position in the target array from the last array position of the target array to the front under the condition that the target mark is not searched yet at the first array position of the searched target array;
and the second determining subunit is used for determining the second array element as the target mark under the condition that the second array element which is smaller than or equal to the second reference value and has a difference value with the second reference value smaller than or equal to a second preset value is found.
As an alternative embodiment, the apparatus further comprises:
the first obtaining unit is used for obtaining a second hash value corresponding to a dirty page mark of a target historical dirty page before the target mark is found out from the dirty page marks of at least one historical dirty page, wherein the target historical dirty page is one historical dirty page of the at least one historical dirty page;
and the first storage unit is used for storing the dirty page mark of the target historical dirty page to the array position corresponding to the second hash value in the target array.
As an alternative embodiment, the apparatus further comprises:
the second storage unit is used for storing the target mark into a target storage file after the target mark is found out from the dirty page marks of at least one historical dirty page, wherein the target storage file is used for storing the log serial number of the check point corresponding to the target dirty page chain table;
a reading unit, configured to read a target mark from a target storage file in a case of restoring data in a target database;
the second acquisition unit is used for acquiring a target redo log which corresponds to the target database and has a log serial number greater than or equal to the target mark;
and the recovery unit is used for recovering the data in the target database by using the target redo log.
It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules described above as a part of the apparatus may be operated in a hardware environment as shown in fig. 1, and may be implemented by software, or may be implemented by hardware, where the hardware environment includes a network environment.
According to another aspect of the embodiments of the present application, there is also provided an electronic device for implementing the processing method of the above-mentioned check point, where the electronic device may be a server, a terminal, or a combination thereof.
Fig. 6 is a block diagram of an alternative electronic device according to an embodiment of the present invention, as shown in fig. 6, including a processor 602, a communication interface 604, a memory 606, and a communication bus 608, where the processor 602, the communication interface 604, and the memory 606 communicate with each other through the communication bus 608, where,
a memory 606 for storing computer programs;
the processor 602, when executing the computer program stored in the memory 606, implements the following steps:
s1, determining the minimum value in the dirty page marks of the target dirty pages contained in the target dirty page linked list as a first reference value of the target check point, wherein the target dirty pages are dirty pages of the target database, and the dirty pages are marked as log serial numbers of redo logs updated for the first time by the dirty pages;
s2, determining a difference between the first reference value and the first predetermined value as a second reference value of the target checkpoint;
s3, finding out a target mark from the dirty page marks of the at least one historical dirty page to obtain a log serial number of the target check point, wherein each historical dirty page in the at least one historical dirty page is a dirty page which is refreshed to a disk in the target database, and the target mark is smaller than or equal to a second reference value.
Alternatively, in this embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 6, but this is not intended to represent only one bus or type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The memory may include RAM, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
As an example, the memory 606 may include, but is not limited to, the first determining unit 502, the second determining unit 504, and the searching unit 506 in the processing device including the check point. In addition, the processing apparatus may further include, but is not limited to, other module units in the processing apparatus of the above-mentioned check point, which is not described in detail in this example.
The processor may be a general-purpose processor, and may include but is not limited to: a CPU (Central Processing Unit), an NP (Network Processor), and the like; but also a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
It can be understood by those skilled in the art that the structure shown in fig. 6 is only an illustration, and the device implementing the processing method of the check point may be a terminal device, and the terminal device may be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 6 is a diagram illustrating a structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 6, or have a different configuration than shown in FIG. 6.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disk, ROM, RAM, magnetic or optical disk, and the like.
According to still another aspect of an embodiment of the present application, there is also provided a storage medium. Optionally, in this embodiment, the storage medium may be configured to execute a program code of any one of the processing methods of the check point in this embodiment.
Optionally, in this embodiment, the storage medium may be located on at least one of a plurality of network devices in a network shown in the above embodiment.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps:
s1, determining the minimum value in the dirty page marks of the target dirty pages contained in the target dirty page linked list as a first reference value of the target check point, wherein the target dirty pages are dirty pages of the target database, and the dirty pages are marked as log serial numbers of redo logs updated for the first time by the dirty pages;
s2, determining a difference between the first reference value and the first predetermined value as a second reference value of the target checkpoint;
s3, finding out a target mark from the dirty page marks of the at least one historical dirty page to obtain a log serial number of the target check point, wherein each historical dirty page in the at least one historical dirty page is a dirty page which is refreshed to a disk in the target database, and the target mark is smaller than or equal to a second reference value.
Optionally, the specific example in this embodiment may refer to the example described in the above embodiment, which is not described again in this embodiment.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing program codes, such as a U disk, a ROM, a RAM, a removable hard disk, a magnetic disk, or an optical disk.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a storage medium, and including instructions for causing one or more computer devices (which may be personal computers, servers, network devices, or the like) to execute all or part of the steps of the method described in the embodiments of the present application.
In the above embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, and may also be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution provided in the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

Claims (11)

1. A method for processing a checkpoint, comprising:
determining a minimum value in a dirty page mark of a target dirty page contained in a target dirty page linked list as a first reference value of a target check point, wherein the target dirty page is a dirty page of a target database, and the dirty page mark is a log serial number of a redo log updated for the first time by the dirty page;
determining a difference between the first reference value and a first predetermined value as a second reference value of the target checkpoint;
finding out a target mark from the dirty page marks of at least one historical dirty page to obtain a log serial number of the target check point, wherein each historical dirty page in the at least one historical dirty page is a dirty page which is refreshed to a disk in the target database, and the target mark is smaller than or equal to the second reference value.
2. The method of claim 1, wherein determining a minimum value of the dirty page tags of the target dirty pages included in the target dirty page chain table as the first reference value of the target checkpoint comprises:
respectively determining the minimum value of the dirty page marks of the target dirty pages contained in each dirty page linked list of the dirty page linked lists to obtain a plurality of candidate values under the condition that the target dirty page linked list contains a plurality of dirty page linked lists, wherein the candidate values are in one-to-one correspondence with the dirty page linked lists;
determining a smallest candidate value of the plurality of candidate values as the first reference value of the target checkpoint.
3. The method of claim 1, wherein the finding a target mark from the dirty page marks of at least one historical dirty page comprises:
and finding the target mark from a target array according to the second reference value, wherein the dirty page mark of one historical dirty page in the at least one historical dirty page is stored as an array element at an array position in the target array.
4. The method of claim 3, wherein the finding the target mark from the target array according to the second reference value comprises:
acquiring a first hash value corresponding to the second reference value, wherein the first hash value is obtained by using a second predetermined value to carry out remainder on the second reference value, and the second predetermined value is greater than or equal to the first predetermined value;
sequentially searching array elements in the target array from an array position corresponding to the first hash value to the front until the target mark is found, wherein the dirty page mark of each historical dirty page is stored in the array position corresponding to the hash value of the dirty page mark of each historical dirty page in the target array.
5. The method of claim 4, wherein sequentially looking up array elements in the target array from an array position corresponding to the first hash value forward until the target mark is found comprises:
sequentially searching array elements at each array position in the target array from the array position corresponding to the first hash value;
and under the condition that the first array element which is smaller than or equal to the second reference value and has a difference value with the second reference value smaller than or equal to the second preset value is found, determining the first array element as the target mark.
6. The method of claim 4, wherein sequentially looking up array elements in the target array from an array position corresponding to the first hash value forward until the target mark is found comprises:
sequentially searching array elements at each array position in the target array from the last array position of the target array to the front under the condition that the target mark is not found at the first array position of the target array;
and determining the second array element as the target mark under the condition that the second array element which is smaller than or equal to the second reference value and has a difference value with the second reference value smaller than or equal to the second preset value is found.
7. The method of claim 4, wherein prior to said finding a target mark from said dirty page marks of at least one historical dirty page, said method further comprises:
acquiring a second hash value corresponding to the dirty page mark of a target historical dirty page, wherein the target historical dirty page is one historical dirty page of the at least one historical dirty page;
and storing the dirty page mark of the target historical dirty page to an array position corresponding to the second hash value in the target array.
8. The method according to any of the claims 1 to 7, wherein after said finding a target mark from said dirty page marks of at least one historical dirty page, the method further comprises:
storing the target mark into a target storage file, wherein the target storage file is used for storing a log serial number of an audit point corresponding to the target dirty page linked list;
reading the target mark from the target storage file under the condition of recovering the data in the target database;
acquiring a target redo log which corresponds to the target database and has a corresponding log serial number greater than or equal to the target mark;
and using the target redo log to recover the data of the target database.
9. A device for processing checkpoints, comprising:
the first determining unit is used for determining a minimum value in a dirty page mark of a target dirty page contained in a target dirty page linked list as a first reference value of a target check point, wherein the target dirty page is a dirty page of a target database, and the dirty page mark is a log serial number of a redo log updated for the first time by the dirty page;
a second determination unit configured to determine a difference between the first reference value and a first predetermined value as a second reference value of the target check point;
the searching unit is configured to search a target mark from the dirty page marks of at least one historical dirty page to obtain a log serial number of the target check point, where each historical dirty page in the at least one historical dirty page is a dirty page that has been refreshed to a disk in the target database, and the target mark is smaller than or equal to the second reference value.
10. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein said processor, said communication interface and said memory communicate with each other via said communication bus,
the memory for storing a computer program;
the processor for performing the method steps of any one of claims 1 to 8 by running the computer program stored on the memory.
11. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to carry out the method steps of any one of claims 1 to 8 when executed.
CN202110145331.4A 2021-02-03 2021-02-03 Processing method and device for checking point, electronic equipment and storage medium Active CN112506941B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110145331.4A CN112506941B (en) 2021-02-03 2021-02-03 Processing method and device for checking point, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110145331.4A CN112506941B (en) 2021-02-03 2021-02-03 Processing method and device for checking point, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112506941A CN112506941A (en) 2021-03-16
CN112506941B true CN112506941B (en) 2021-05-11

Family

ID=74952450

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110145331.4A Active CN112506941B (en) 2021-02-03 2021-02-03 Processing method and device for checking point, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112506941B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113590596A (en) * 2021-07-02 2021-11-02 阿里巴巴新加坡控股有限公司 Data processing method, system, device, computer program product and storage medium
CN114328700B (en) * 2022-03-16 2022-07-05 上海柯林布瑞信息技术有限公司 Data checking method and device in medical data ETL task

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101706736A (en) * 2009-12-22 2010-05-12 北京大学 High-efficiency dirty page acquiring method
CN103092955A (en) * 2013-01-17 2013-05-08 华为技术有限公司 Checking point operation method, operation device and operation system
CN110795287A (en) * 2019-10-30 2020-02-14 深圳前海环融联易信息科技服务有限公司 Data recovery method, system, electronic device and computer storage medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63307551A (en) * 1987-06-08 1988-12-15 インターナシヨナル・ビジネス・マシーンズ・コーポレーシヨン Roll backing in system for first write logging type transaction
US7200623B2 (en) * 1998-11-24 2007-04-03 Oracle International Corp. Methods to perform disk writes in a distributed shared disk system needing consistency across failures
CN102999564B (en) * 2012-11-06 2015-12-02 华为技术有限公司 Write the method for data, device and equipment
CN103049396B (en) * 2012-12-10 2015-10-28 浪潮(北京)电子信息产业有限公司 The method of writing with a brush dipped in Chinese ink of data and device
US20180144015A1 (en) * 2016-11-18 2018-05-24 Microsoft Technology Licensing, Llc Redoing transaction log records in parallel
CN110971468B (en) * 2019-12-12 2022-04-05 广西大学 Delayed copy incremental container check point processing method based on dirty page prediction
CN112182010B (en) * 2020-11-30 2021-03-12 北京金山云网络技术有限公司 Dirty page refreshing method and device, storage medium and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101706736A (en) * 2009-12-22 2010-05-12 北京大学 High-efficiency dirty page acquiring method
CN103092955A (en) * 2013-01-17 2013-05-08 华为技术有限公司 Checking point operation method, operation device and operation system
CN110795287A (en) * 2019-10-30 2020-02-14 深圳前海环融联易信息科技服务有限公司 Data recovery method, system, electronic device and computer storage medium

Also Published As

Publication number Publication date
CN112506941A (en) 2021-03-16

Similar Documents

Publication Publication Date Title
CN109343790B (en) Data storage method based on NAND FLASH, terminal equipment and storage medium
CN112506941B (en) Processing method and device for checking point, electronic equipment and storage medium
KR101870521B1 (en) Methods and systems for improving storage journaling
CN110018989B (en) Snapshot comparison method and device
CN110162525B (en) B+ tree-based read-write conflict resolution method, device and storage medium
CN110765076B (en) Data storage method, device, electronic equipment and storage medium
CN112182010B (en) Dirty page refreshing method and device, storage medium and electronic equipment
CN108255989B (en) Picture storage method and device, terminal equipment and computer storage medium
US10366052B2 (en) Identifying partial update for tape file system
US20190317698A1 (en) Disk Data Reading/Writing Method and Device
CN109697140B (en) Data backup method and device, data recovery method and device and storage medium
CN110674084A (en) Method, apparatus, and computer-readable storage medium for data protection
CN113468118B (en) File increment storage method, device and storage medium based on blockchain
CN113419897B (en) File processing method and device, electronic equipment and storage medium thereof
US20210326271A1 (en) Stale data recovery using virtual storage metadata
KR101676175B1 (en) Apparatus and method for memory storage to protect data-loss after power loss
CN109144766B (en) Data storage and reconstruction method and device and electronic equipment
CN114003172B (en) Storage capacity correction method, storage capacity correction device, computer equipment and storage medium
CN114625697A (en) File system recovery method and device, electronic equipment and storage medium
CN114675776A (en) Resource storage method and device, storage medium and electronic equipment
JP5972455B2 (en) How to delete information
CN108614838B (en) User group index processing method, device and system
CN109491861B (en) Database repair method and device for overflow page exception and storage medium
CN113342751B (en) Metadata processing method, device, equipment and readable storage medium
CN110874285A (en) Method for realizing reducible write operation of EXT file system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant