Unlock instant, AI-driven research and patent intelligence for your innovation.

Log synchronization method and device, equipment and storage medium

A log and synchronized technology, applied in the database field, can solve problems such as inability to roll back data pages, incorrect switching, and affecting the running speed of the main database.

Active Publication Date: 2021-08-10
SHANGHAI DAMENG DATABASE
View PDF9 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] However, under the above mechanism, the persistence of the redo log on the local disk can be equivalent to the persistence of the data page, so the redo log cannot be truncated at will. If you want to truncate the redo log, you need to truncate the redo log The data modification recorded in the log is rolled back from the corresponding data page
For traditional databases, after the redo log is written to the disk, it is not excluded that the data page will also be written to the disk immediately (for example, when the checkpoint is being advanced). If the transaction that executes the data page modification has been committed, these modifications It will be stored in the database persistently (transaction persistence feature). Even if the database fails, these data pages cannot be rolled back after the failure recovery, so traditional databases cannot support log truncation
Based on this feature, when a traditional database cluster supports automatic failover, it must confirm the failure through a third-party arbitration, otherwise there may be a wrong switch and the old master database cannot be added back (for example, the master database and the standby database cannot be added back). Only a network exception occurs between the databases. The main database is still running normally and writing local data. Due to the network failure, the standby database thinks that the main database has failed and automatically switches to the new main database. The data currently written by the old main database is stored in the new primary database The database does not exist, and the old master database cannot truncate the log and roll back the data. The old master database and the new master database have inconsistent data, and cannot rejoin the cluster)
Furthermore, in order to ensure real-time data synchronization between the primary database and the standby database in traditional database clusters, the primary database needs to receive responses from all standby databases after sending redo logs before continuing to generate new redo logs. Data processing delay will greatly affect the running speed of the main library

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Log synchronization method and device, equipment and storage medium
  • Log synchronization method and device, equipment and storage medium
  • Log synchronization method and device, equipment and storage medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0067] figure 1 It is a flow chart of a log synchronization method provided by Embodiment 1 of the present invention. This embodiment is applicable to the case of log synchronization between the master and standby databases in a database cluster. This method can be executed by a log synchronization device. The log synchronization The device may be implemented by software and / or hardware, and the log synchronization device may be configured on a computing device, and the computing device may be composed of two or more physical entities, or may be composed of one physical entity.

[0068] It should be clarified that the log synchronization method provided in Embodiment 1 is applied to a database cluster, and the database cluster includes a master database and at least two standby databases, and the number of standby databases is an even number. A database cluster can be understood as a virtual single database logical image composed of multiple database servers, which can provide...

Embodiment 2

[0083] figure 2 It is a flow chart of a log synchronization method provided by Embodiment 2 of the present invention. The technical solution of the embodiment of the present invention is further refined on the basis of the above-mentioned optional technical solutions. The value array determines the sequence number of the log package submitted by the main library and the sequence value of the log submitted by the main library, provides a method for determining the sequence number of the log package submitted by the main library and the sequence value of the log submitted by the main library, and sets the sequence number of the log package submitted by the main library and The submitted log sequence value of the main database is carried in the log to be synchronized and sent to each standby database, so that after the standby database replays according to the log to be synchronized, it can be aligned according to the serial number of the log package submitted by the main databas...

Embodiment 3

[0154] Figure 5 It is a schematic structural diagram of a log synchronization device provided by Embodiment 3 of the present invention. The log synchronization device is applied to a database cluster, and the database cluster includes a master database and at least two backup databases, and the number of backup databases is an even number. The log synchronization device includes: a log packet generation module 31 , a replay feedback module 32 and an array update module 33 .

[0155] Wherein, the log packet generating module 31 is used for the master database to generate a log packet to be synchronized according to the array of synchronized log packet serial numbers, the array of synchronized log sequence values ​​and the received data modification operation, and send the log packet to be synchronized to each standby database The replay feedback module 32 is used for the backup library to replay according to the received log packets to be synchronized, and after modifying the ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The embodiment of the invention discloses a log synchronization method and device, equipment and a storage medium. The method comprises the following steps: a main library generates a to-be-synchronized log packet according to a synchronized log packet sequence number array, a synchronized log sequence value array and a received data modification operation, and sends the to-be-synchronized log packet to each standby library; the standby library carries out replay according to the received to-be-synchronized log packet, and after log packet parameters of the standby library are modified according to the to-be-synchronized log packet, the log packet serial number of the to-be-synchronized log packet and the maximum log sequence value in the to-be-synchronized log packet are fed back to the main library; and the main library updates the synchronized log packet sequence number array and the synchronized log sequence value array according to the received log packet sequence number and the maximum log sequence value. According to the technical scheme, log truncation is allowed when the database breaks down, the availability and reliability of the database cluster are improved, and the running speed of the main database in the database cluster is increased.

Description

technical field [0001] Embodiments of the present invention relate to the technical field of databases, and in particular, to a log synchronization method, device, device, and storage medium. Background technique [0002] With the rapid development of information technology, databases play an extremely important role in daily work, business activities and people's lives. In order to avoid downtime during database use and unable to provide services normally, existing applications often adopt the method of building database clusters, that is, multiple databases are divided into main database and standby database, so that the standby database can still continue when the main database is down. Provide services. [0003] In order to ensure the data synchronization of each database in the database cluster, redo logs will be generated after data modification operations such as adding, deleting, and modifying are performed on the main database, and the redo logs will be sent to the...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F16/27G06F16/23
CPCG06F16/27G06F16/23Y02D10/00
Inventor 韩朱忠王蒙蒙钱晨亮刘新宇
Owner SHANGHAI DAMENG DATABASE