A data updating method and storage medium

After the database server detects the target database log file update, it sends the log file to the disaster recovery library device and forwards it to the message subscription management device, which solves the problem that applications need to frequently poll the database for data updates, alleviates the working pressure of the database server and improves the timeliness of data changes.

CN111444200BActive Publication Date: 2025-03-21CHINA PING AN LIFE INSURANCE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202010122949.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-02-27
Publication Date
2025-03-21
Estimated Expiration
2040-02-27

AI Technical Summary

Technical Problem

In the prior art, applications need to repeatedly access the database through timed polling to obtain data change sets, resulting in increased resource consumption of database servers, increased working pressure, and poor timeliness of data change of applications.

Method used

After the database server detects the target database log file update, the log file is sent to the disaster recovery library device. The disaster recovery library device identifies the processing type of the log file tag and forwards it to the message subscription management device. The message subscription management device writes the log file to the topic partition and notifies the subscription application.

Benefits of technology

It reduces the working pressure of the database server, improves the timeliness of application data changes, and avoids the situation where applications need to frequently poll the database to query for data updates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111444200B_ABST
    Figure CN111444200B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a data update method and storage medium, which are applied to a data update system, wherein the data update system includes a database server, a disaster recovery library device, a message subscription management device, and a terminal device. The method includes: after the database server detects that the target database log file is updated, the target database log file is sent to the disaster recovery library device so that the disaster recovery library device identifies the processing type corresponding to the log file label. If the processing type is a specified forwarding processing type, the target database log file is sent to the message subscription management device; the message subscription management device writes the target database log file into the partition corresponding to the topic of the target database log file, and determines the application that has subscribed to the topic, and sends a notification message to the terminal device running the application. The use of this application can reduce the workload of the database server and make the data changes of the application more timely.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data updating method and a storage medium. Background Art

[0002] In the business system architecture, the database is mainly used to persist data, save data change sets, and record state transition relationships. It is an indispensable part of the current business system. Since almost all data is stored in the database, data changes for each row of data, such as deletion, update, and addition, also occur in the database. The current business system relationships are complex and have many dependencies. In many cases, other systems need to obtain data change information in the database, and then trigger corresponding logic based on the change content.

[0003] Currently, applications mainly interact with databases actively and cannot passively obtain database data updates and changes. For scenarios where data updates are required, most applications need to repeatedly access the database to obtain data change sets using a timed polling method. Since the polling time interval is fixed and the application needs to actively trigger it, this method consumes database server resources and increases the workload of the database server. In addition, the timeliness of application data changes is seriously delayed and not timely enough. Summary of the invention

[0004] The embodiments of the present application provide a data updating method and storage medium, which can reduce the workload of a database server and make data changes of an application more timely.

[0005] In a first aspect, an embodiment of the present application provides a data update method, which is applied to a data update system, wherein the data update system includes a database server, a disaster recovery library device, a message subscription management device, and a terminal device, and the method includes:

[0006] After detecting that the target database log file is updated, the database server sends the target database log file to the disaster recovery library device, where the target database log file carries a log file tag;

[0007] The disaster recovery warehouse device receives the target database log file sent by the database server, and identifies the processing type corresponding to the log file tag carried by the target database log file, and if the processing type is a specified forwarding processing type, sends the target database log file to the message subscription management device;

[0008] The message subscription management device receives the target database log file sent by the disaster recovery library device, and writes the target database log file into a partition of the topic corresponding to the target database log file;

[0009] The message subscription management device determines the application that has subscribed to the topic, and sends a notification message to the terminal device running the application, where the notification message is used to notify the topic of data update.

[0010] Optionally, the database server sends the target database log file to the disaster recovery library device, including:

[0011] The database server sends the target database log file to the disaster recovery library device through a bound database log processing component.

[0012] Optionally, the disaster recovery warehouse device sends the target database log file to the message subscription management device, including:

[0013] The disaster recovery library device sends the target database log file to the message subscription management device through the bound database log processing component.

[0014] Optionally, the disaster recovery warehouse device sends the target database log file to the message subscription management device, including:

[0015] The disaster recovery warehouse device determines the identifier of the subject corresponding to the target database log file according to the preset correspondence relationship between the database log file and the identifier of the subject;

[0016] The disaster recovery warehouse device generates a message including the target database log file and an identifier of a topic corresponding to the target database log file, and sends the message to the message subscription management device.

[0017] Optionally, the message subscription management device receives the target database log file sent by the disaster recovery library device, and writes the target database log file into a partition of a topic corresponding to the target database log file, including:

[0018] The message subscription management device receives the message sent by the disaster recovery warehouse device, and writes the target database log file into a partition corresponding to the topic of the target database log file according to an identifier of the topic corresponding to the target database log file.

[0019] Optionally, the method further comprises:

[0020] The terminal device receives the notification message, where the notification message carries the target database log file; or,

[0021] After receiving the notification message, the terminal device obtains the target database log file from the message subscription management device.

[0022] Optionally, the method further comprises:

[0023] The terminal device parses the target database log file through the application to obtain target data, and uses the target data to update the local data of the application.

[0024] Optionally, the terminal device parses the target database log file through the application to obtain target data, including:

[0025] The terminal device converts the target database log file into a text file through the application program, and extracts target data from the text file.

[0026] Optionally, the target database log file includes an update event corresponding to a specified database operation, the target data includes a database operation statement corresponding to the specified database operation, and using the target data to update the local data of the application program includes:

[0027] The local data of the application is updated using the database operation statement corresponding to the specified database operation.

[0028] In a second aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method described in the first aspect.

[0029] To summarize, after detecting that the target database log file is updated, the database server can send the target database log file to the disaster recovery warehouse device; the disaster recovery warehouse device can receive the target database log file sent by the database server, and can identify the processing type of the log file label carried by the target database log file. If the processing type is a specified forwarding processing type, the target database log file is sent to the message subscription management device; the message subscription management device can receive the target database log file sent by the disaster recovery warehouse device, and can write the target database log file into the partition of the topic corresponding to the target database log file; the message subscription management device can determine the application that has subscribed to the topic, and can send a notification message to the terminal device running the application. The notification message is used to notify the topic that there is a data update. The use of this process eliminates the need for the application to periodically poll the database server to inquire whether there is a data update, which not only reduces the workload of the database server, but also makes the data changes of the application more timely. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0031] Figure 1 It is a flowchart of a data updating method provided in an embodiment of the present application;

[0032] Figure 2 is a flowchart of another data updating method provided in an embodiment of the present application;

[0033] Figure 3 It is a structural diagram of a data updating system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0034] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0035] See also Figure 1 , is a flow chart of a data update method provided in an embodiment of the present application. The method can be applied to a data update system, and the subscription update processing system includes a database server, a disaster recovery library device, a message subscription management device, and a terminal device. Specifically, the method may include the following steps:

[0036] S101. After detecting that a target database log file is updated, the database server sends the target database log file to the disaster recovery warehouse device, where the target database log file carries a log file tag.

[0037] Among them, the database server mentioned in the embodiment of the present application may be a server corresponding to the target database.

[0038] In one embodiment, when the target database is a first database, the target database log file may be a binlog binary log file included in the first database, wherein the first database may be a Mysql database or a TIDB database, etc. When the target database is a second database, the target database log file may be a redo log redo log file included in the second database.

[0039] The target database log file mentioned above may include one or more update events. The update event may include, for example, trigger time, data before change, and other information. In one embodiment, when the target database log file is a binlog file, the target database file may be set to row mode. The row mode makes it unnecessary for the binlog file to record information related to the context of the executed SQL statement, but only needs to record the information of each row of data that is modified, and the recorded content is clearer and more detailed for easy understanding.

[0040] Among them, the log file label mentioned in the embodiment of the present application can be a category label, and the category label refers to information used to identify the category to which the target database log file belongs. For example, the log file label of the target database log file can be category label 1, and category label 1 indicates that the target database log file belongs to the first category. For another example, the label of the target database log file can also be category label 2, and category label 2 indicates that the target database log file belongs to the second category. Among them, the classification of categories can be based on business or scenario requirements, and the embodiment of the present application does not limit it.

[0041] In one embodiment, the log file label mentioned in the embodiment of the present application can also be a processing type label. The processing type label refers to information used to identify the processing type of the target database log file. For example, the log file label of the target database log file can be processing type label 1, and processing type label 1 indicates that the processing type of the target database log file is a storage processing type. For another example, the label of the target database log file can also be processing label 2, and processing label 2 indicates that the processing type of the target database log file specifies a forwarding processing type.

[0042] In one embodiment, the log file tag may include the category tag and the processing type tag. When the log file tag includes the category tag and the processing type tag, the server may identify the processing type corresponding to the processing type tag carried by the target database log file based on the processing type tag.

[0043] In one embodiment, the database server may send the target database log file to the disaster recovery library device by: the database server sends the target database log file to the disaster recovery library device through a bound database log processing component. For example, when the database server is a server corresponding to a TIDB database, the database log processing component bound to the database server may be a pump component, and the functions of recording binlog files and synchronizing binlog files may be realized through the pump component.

[0044] In one embodiment, the database server detects that the target database log file is updated, which may mean that the database server detects that a new update event is written into the target database log file.

[0045] For example, when the database server detects a specified database operation on the target database, it can obtain an update event corresponding to the specified database operation and write the update event corresponding to the specified database operation into the target database log file. The specified database operation includes but is not limited to any of the following: an operation of adding data, an operation of deleting data, and an operation of modifying data.

[0046] S102. The disaster recovery library device receives the target database log file sent by the database server, and identifies the processing type corresponding to the log file tag carried by the target database log file. If the processing type is a specified forwarding processing type, the target database log file is sent to the message subscription management device.

[0047] In the embodiment of the present application, the disaster recovery library device can receive the target database log file sent by the database server, and identify the processing type corresponding to the log file tag carried by the database log file. If the processing type is a specified forwarding processing type, the target database log file is sent to the message subscription management device. Compared with the prior art database server that needs to synchronize the disaster recovery library device and the message subscription management device at the same time, the database server in the embodiment of the present application no longer needs to synchronize the message subscription management device, thereby effectively reducing the workload of the database server.

[0048] In one embodiment, the disaster recovery warehouse device may include a correspondence between a log file label and a processing type, and the server may determine that the log file label carried by the target database log file corresponds to a specified forwarding processing type based on the correspondence between the log file label and the processing type. In one embodiment, if the processing type corresponding to the log file label carried by the target database log file is a storage processing type, the disaster recovery warehouse device may perform storage processing on the target database log file. Or, if the processing type corresponding to the log file label carried by the target database log file is a first forwarding processing type, the disaster recovery warehouse device may forward the target database log file to the first device. Or, if the processing type corresponding to the log file label carried by the target database log file is a second forwarding processing type, the disaster recovery warehouse device may forward the target database log file to the second device.

[0049] In one embodiment, the target database log file may also carry compression indication information, and the compression indication information may include information on whether to perform compression processing on the target database log file. In one embodiment, when the compression indication information includes information on performing compression processing on the target database log file, the compression indication information may also include a compression method during compression processing and / or identification information of a first file compressed together with the target database log file during compression processing. In one embodiment, if the compression indication information carried by the target database log file includes information on performing compression processing on the target database log file, the target database log file is compressed to obtain a compressed package including the target database log file. Accordingly, the process of the disaster recovery library device sending the target database log file to the message subscription management device may be to send a compressed package including the target database log file to the message subscription management device. If the target database log file also carries a compression method during compression processing, the disaster recovery library device may perform compression processing on the target database log file according to the compression processing method. If the target database log file also carries the identification information of the first file compressed together with the target database log file during the compression process, the disaster recovery warehouse device can obtain the first file according to the identification information of the first file, and can compress the target database log file and the first file to obtain a compressed package including the target database log file and the first file. Correspondingly, the disaster recovery warehouse device sends the target database log file to the message subscription management device, and the disaster recovery warehouse device sends the compressed package including the target database log file and the first file to the message subscription management device. If the target database log file also carries the compression method during the compression process and the identification information of the first file compressed together with the target database log file during the compression process, the disaster recovery warehouse device can obtain the first file according to the identification information of the first file, and can use the compression method to compress the target database log file and the first file to obtain a compressed package including the target database log file and the first file. In one embodiment, if the compression indication information includes information that the target database log file should not be compressed, the disaster recovery library device can execute the step of identifying the processing type corresponding to the log file tag carried by the target database log file or execute the step of sending the target database log file to the message subscription management device.

[0050] In one embodiment, the target database log file may also carry merge indication information, and the merge indication information may include information on whether to merge the target database log file. In one embodiment, when the merge indication information includes information on merging the target database log file, the merge indication information may also carry identification information of a second file whose data content is merged with the target database log file during the merge process. In one embodiment, if the target database log file also carries identification information of a second file whose data content is merged with the target database log file during the compression process, the disaster recovery library device may obtain the second file according to the identification information of the second file, and may use the compression method to merge the data content of the target database log file and the second file to obtain a merged file, which includes the data content of the target database log file and the data content of the second file. Accordingly, the disaster recovery library device sends the target database log file to the message subscription management device, and the disaster recovery library device sends the merged file to the message subscription management device. In one embodiment, if the merge indication information includes information that the target database log file is not to be compressed, the disaster recovery library device may execute the step of identifying the processing type corresponding to the log file tag carried by the target database log file or execute the step of sending the target database log file to the message subscription management device.

[0051] In one embodiment, the target database log file may carry the above-mentioned merge indication information and target compression indication information. The target compression indication information may include information on whether to perform compression processing on the merged file. In one embodiment, when the target compression indication information includes information on performing compression processing on the merged file, the target compression indication information may also include a compression method during compression processing and / or identification information of a third file compressed together with the merged file during compression processing. After obtaining the merged file, if the compression indication information includes information on not performing compression processing on the merged file, the disaster recovery library device may send the target database log file to the message subscription management device. The disaster recovery library device may send the merged file to the message subscription management device. If the compression indication information includes information on performing compression processing on the merged file, the disaster recovery library device may perform compression processing on the merged file. In one embodiment, if the compression indication information also includes a compression method during compression, the disaster recovery library device may perform compression processing on the merged file according to the compression method. If the compression indication information also includes the identification information of the third file compressed together with the merged file during the compression process, the disaster recovery warehouse device can obtain the third file according to the identification of the third file, and compress the merged file and the third file to obtain a compressed package including the merged file and the third file. Correspondingly, the disaster recovery warehouse device sends the target database log file to the message subscription management device, and the disaster recovery warehouse device sends the compressed package including the merged file and the third file to the message subscription management device. If the compression indication information includes the compression method during the compression process and the identification information of the third file compressed together with the merged file during the compression process, the server can compress the merged file and the third file according to the compression method to obtain a compressed package including the merged file and the third file. In one embodiment, if the compression indication information includes information that the target database log file is not compressed, the disaster recovery warehouse device can perform a step of identifying the processing type corresponding to the log file tag carried by the target database log file or perform a step of sending the target database log file to the message subscription management device. If the compression indication information includes information on not compressing the merged file, the disaster recovery library device can execute the step of identifying the processing type corresponding to the log file tag carried by the target database log file or execute the step of sending the merged file to the message subscription management device.

[0052] In one embodiment, the disaster recovery library device sends the target database log file to the message subscription management device in a manner that: the disaster recovery library device sends the target database log file to the message subscription management device through a bound database log processing component. For example, when the database server is a server corresponding to a TIDB database, the database log processing component bound to the disaster recovery library device may be a pump component.

[0053] In one embodiment, the disaster recovery warehouse device may be a local disaster recovery warehouse device. The local disaster recovery warehouse device may be in the same city as the database server. The message subscription management device may refer to a Kafka server. The Kafka server may refer to a server running a Kafka application.

[0054] In one embodiment, the disaster recovery library device can generate a copy of the target database log file for storage for backup. In one application scenario, when the database server fails, the target database log file is detected to be updated by switching to the disaster recovery library device, and after the target database log file is detected to be updated, the target database log file is sent to the message subscription management device; the message subscription management device receives the target database log file sent by the disaster recovery library device, and writes the target database log file to the partition of the topic corresponding to the target database log file; the message subscription management device determines the application that has subscribed to the topic, and sends a notification message to the terminal device running the application. In another application scenario, when the database server resumes normal operation, the target database log file saved by the disaster recovery library device can be obtained, and the update of the target data log file can be detected.

[0055] In one embodiment, the disaster recovery warehouse device may send the target database log file to the message subscription management device in the following manner: the disaster recovery warehouse device determines the identifier of the topic corresponding to the target database log file based on the preset correspondence between the identifiers of the database log file and the topic; the disaster recovery warehouse device generates a message including the target database log file and the identifier of the topic corresponding to the target database log file, and sends the message to the message subscription management device.

[0056] In one embodiment, when the message subscription management device is a Kafka server, the message may be a Kafka message.

[0057] In one embodiment, the disaster recovery warehouse device can send the message to the message subscription management device through a bound database log processing component.

[0058] S103: The message subscription management device receives the target database log file sent by the disaster recovery warehouse device, and writes the target database log file into a partition of a topic corresponding to the target database log file.

[0059] In one embodiment, the number of partitions for the topic may be 1.

[0060] In one embodiment, the message subscription management device receives the target database log file sent by the disaster recovery warehouse device, and writes the target database log file into the partition of the topic corresponding to the target database log file in the following manner: the message subscription management device receives the message sent by the disaster recovery warehouse device, and according to the identifier of the topic corresponding to the target database log file, writes the target database log file into the partition of the topic corresponding to the target database log file.

[0061] In one embodiment, the message subscription management device may obtain the target database log file from a message including the target database log file and an identifier of a topic corresponding to the target database log file.

[0062] In one embodiment, the message subscription management device may write a message including the target database log file and an identifier of a topic corresponding to the target database log file into a partition of the topic corresponding to the target database log file.

[0063] S104: The message subscription management device determines the application that has subscribed to the topic, and sends a notification message to the terminal device running the application, where the notification message is used to notify that there is data update on the topic.

[0064] In the embodiment of the present application, the message subscription management device can determine the application that has subscribed to the topic and send a notification message to the terminal device running the application. Compared with the prior art where the application needs to continuously poll the database server to check whether the topic has been updated, the embodiment of the present application can make the application data update more timely and reduce the pressure on the database server. The terminal device includes but is not limited to smart phones, tablet computers, laptops, desktop computers, smart wearable devices and other smart terminals.

[0065] In one embodiment, the message subscription management device can directly send the target database log file to the terminal device running the application. In one embodiment, the notification message can carry the target database log file, and the message subscription management device can send the notification message to the terminal device running the application, and the terminal device can receive the notification message and obtain the target database log file carried by the notification message through the application.

[0066] In one embodiment, the message subscription management device may receive a compressed package or a merged file sent by the server, and write the compressed package or the merged file into a partition corresponding to a topic in a target database log file.

[0067] In one embodiment, in addition to sending a notification message, the message subscription management device may also directly send the merged file or compressed package to the terminal device running the application. In one embodiment, the notification message may carry the merged file or compressed package, and the message subscription management device may send the notification message to the terminal device running the application, and the terminal device may receive the notification message and obtain the merged file or compressed package carried by the notification message through the application.

[0068] In one embodiment, the terminal device may split the merged file or decompress the compressed package to obtain the specified data, and use the specified data to update the local data. In one embodiment, the specified data may include the target database log file, and the terminal device parses the target database log file through the application to obtain the target data, and uses the target data to update the local data of the application.

[0069] visible, Figure 1 In the illustrated embodiment, after detecting that the target database log file is updated, the database server sends the target database log file to the disaster recovery library device; the disaster recovery library device receives the target database log file sent by the database server, and identifies the processing type of the log file tag carried by the target database log file. If the processing type is a specified forwarding processing type, the target database log file is sent to the message subscription management device; the message subscription management device receives the target database log file sent by the disaster recovery library device, and writes the target database log file into the partition of the topic corresponding to the target database log file; the message subscription management device determines the application that has subscribed to the topic, and sends a notification message to the terminal device running the application. The notification message is used to notify the topic that there is a data update. This process reduces the resource consumption and work pressure of the database server, and makes the data changes of the application more timely.

[0070] In one application scenario, after the server corresponding to the TIDB database detects an update to the binlog file, it sends the binlog file to the disaster recovery warehouse device. The disaster recovery warehouse device receives the binlog file sent by the server corresponding to the TIDB database, and sends the binlog file to the kafka server; the kafka server receives the binlog file sent by the disaster recovery warehouse device, and writes the binlog file to the partition of the topic corresponding to the binlog file. The kafka server determines the applications that have subscribed to the topic, such as application 1, application 2, and application 3, and sends a notification message to terminal device 1 running application 1, terminal device 2 running application 2, and terminal device 3 running application 3. Among them, the notification message is used to notify the topic that there is a data update. In another application scenario, after the server corresponding to the TIDB database detects an update to the binlog file, it sends the binlog file to the disaster recovery warehouse device. The disaster recovery warehouse device receives the binlog file sent by the server corresponding to the TIDB database. The binlog file carries a log file tag, and after identifying that the processing type of the log file tag carried by the binlog file is the specified forwarding processing type, the binlog file is sent to the kafka server; the kafka server receives the binlog file sent by the disaster recovery warehouse device, and writes the binlog file to the partition of the topic corresponding to the binlog file. The kafka server determines the applications that have subscribed to the topic, such as application 1, application 2, and application 3, and sends notification messages to terminal device 1 running application 1, terminal device 2 running application 2, and terminal device 3 running application 3. Among them, the notification message is used to notify the topic that there is a data update.

[0071] See also Figure 2 , is a flow chart of another data update method provided in an embodiment of the present application. The data update system includes a database server, a disaster recovery library device, a message subscription management device, and a terminal device. Specifically, the method may include the following steps:

[0072] S201. After detecting that a target database log file is updated, the database server sends the target database log file to the disaster recovery warehouse device, where the target database log file carries a log file tag.

[0073] S202. The disaster recovery library device receives the target database log file sent by the database server, and identifies the processing type corresponding to the log file tag carried by the target database log file. If the processing type is a specified forwarding processing type, the target database log file is sent to the message subscription management device.

[0074] S203: The message subscription management device receives the target database log file sent by the disaster recovery warehouse device, and writes the target database log file into a partition of a topic corresponding to the target database log file.

[0075] S204: The message subscription management device determines the application that has subscribed to the topic, and sends a notification message to the terminal device running the application, where the notification message is used to notify that there is data update on the topic.

[0076] In the embodiment of the present application, steps S201-S204 can refer to Figure 1 Steps S101-S104 in the embodiment are not described in detail in the embodiment of the present application.

[0077] S205. After receiving the notification message, the terminal device obtains the target database log file from the message subscription management device.

[0078] S206: The terminal device parses the target database log file through the application to obtain target data, and uses the target data to update local data of the application.

[0079] In step S205-step S206, after receiving the notification message, the terminal device can obtain the target database log file from the message subscription management device, and can parse the target database log file through the application to obtain the target data, thereby using the target data to update the local data of the application.

[0080] In one embodiment, the terminal device may convert the target database log file into a text file through the application program, and extract target data from the text file.

[0081] In one embodiment, the target database log file includes an update event corresponding to a specified database operation, the target data includes a database operation statement corresponding to the specified database operation, and the specific manner in which the terminal device uses the target data to update the local data of the application can be that the terminal device uses the database operation statement corresponding to the specified database operation to update the local data of the application. For example, the specified database operation is an operation of adding data, the target data includes a database operation statement corresponding to the operation of adding data, and the terminal device can use the operation of adding data to add data to the local data of the application.

[0082] In one embodiment, a binary protocol, such as a binary parsing protocol, may be used to convert the database log file into a text file.

[0083] In one embodiment, after obtaining the target database log file, the terminal device can output a prompt message to prompt whether to update the data. If a confirmation instruction output according to the prompt message is detected, the terminal device parses the target database log file through the application, obtains the target data, and uses the target data to update the local data of the application.

[0084] visible, Figure 2 In the illustrated embodiment, after detecting that the target database log file is updated, the database server sends the target database log file to the disaster recovery library device; the disaster recovery library device receives the target database log file sent by the database server, and identifies the processing type of the log file tag carried by the target database log file. If the processing type is a specified forwarding processing type, the target database log file is sent to the message subscription management device; the message subscription management device receives the target database log file sent by the disaster recovery library device, and writes the target database log file into the partition of the topic corresponding to the target database log file; the message subscription management device determines the application that has subscribed to the topic, and sends a notification message to the terminal device running the application, the notification message is used to notify the topic that there is a data update; after receiving the notification information, the terminal device can obtain the target database log file from the message subscription management device, and use the target database log file to update the local data of the application. This process reduces the resource consumption and work pressure of the database server, and makes the data changes of the application more timely.

[0085] See also Figure 3 , is a structural diagram of a data update system provided in an embodiment of the present application. The data update system includes a database server 10, a disaster recovery warehouse device 20, a message subscription management device 30, and a terminal device 40. The database server 10 can establish communication with the disaster recovery warehouse device 20, the disaster recovery warehouse device 20 can establish communication with the message subscription management device 30, and the message subscription management device 30 can establish communication with the terminal device 40. Among them:

[0086] The database server 10 can execute step S101 to send the target database log file to the disaster recovery library device 20 after detecting the target database log file update, and the target database log file carries the log file label; the disaster recovery library device 20 can execute step S102 to receive the target database log file sent by the database server 10, and after identifying that the processing type of the log file label carried by the target database log file is the specified forwarding processing type, send the target database log file to the message subscription management device 30; the message subscription management device 30 can execute step S103 to receive the target database log file sent by the disaster recovery library device 20, and write the target database log file into the partition of the topic corresponding to the target database log file; the message subscription management device 30 can execute step S104 to determine the application subscribed to the topic, and send a notification message to the terminal device 40 running the application, and the notification message is used to notify the existence of data update in the topic. The above method can reduce the resource consumption and work pressure of the database server, and can make the data change of the application more timely.

[0087] In one embodiment, a person skilled in the art can understand that all or part of the processes in the above-mentioned embodiment method can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the medium is a computer-readable storage medium, and the computer-readable storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0088] What is disclosed above is only a preferred embodiment of the present application, and it certainly cannot be used to limit the scope of rights of the present application. Ordinary technicians in this field can understand that all or part of the processes of implementing the above embodiment and equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A data updating method, characterized in that: Applied to a data update system, the data update system includes a database server, a disaster recovery library device, a message subscription management device, and a terminal device, and the method includes: After detecting that the target database log file is updated, the database server sends the target database log file to the disaster recovery warehouse device, where the target database log file carries a log file label and compression indication information; the log file label is used to indicate the processing type of the target database log file, and the processing type includes a storage processing type and a forwarding processing type. The storage processing type is used to instruct the disaster recovery warehouse device to perform storage processing on the database log file, and the forwarding processing type is used to instruct the disaster recovery warehouse device to forward the database log file to a corresponding device; the compression indication information includes information on whether to perform compression processing on the target database log file. When the compression indication information includes information on performing compression processing on the target database log file, the compression indication information also includes a compression method during compression processing and identification information of a first file compressed together with the target database log file during compression processing, so as to instruct the disaster recovery warehouse device to compress the target database log file and the first file together based on the compression method; The disaster recovery warehouse device receives the target database log file sent by the database server, and identifies the processing type corresponding to the log file tag carried by the target database log file, and if the processing type is a specified forwarding processing type, sends the target database log file to the message subscription management device; The message subscription management device receives the target database log file sent by the disaster recovery library device, and writes the target database log file into a partition of the topic corresponding to the target database log file; The message subscription management device determines the application that has subscribed to the topic, and sends a notification message to the terminal device running the application, where the notification message is used to notify the topic of data update.

2. The method according to claim 1, characterized in that The database server sends the target database log file to the disaster recovery library device, including: The database server sends the target database log file to the disaster recovery library device through a bound database log processing component.

3. The method according to claim 1 or 2, characterized in that: The disaster recovery warehouse device sends the target database log file to the message subscription management device, including: The disaster recovery library device sends the target database log file to the message subscription management device through the bound database log processing component.

4. The method according to claim 1, characterized in that: The disaster recovery warehouse device sends the target database log file to the message subscription management device, including: The disaster recovery warehouse device determines the identifier of the subject corresponding to the target database log file according to the preset correspondence relationship between the database log file and the identifier of the subject; The disaster recovery warehouse device generates a message including the target database log file and an identifier of a topic corresponding to the target database log file, and sends the message to the message subscription management device.

5. The method according to claim 4, characterized in that The message subscription management device receives the target database log file sent by the disaster recovery library device, and writes the target database log file into a partition of a topic corresponding to the target database log file, including: The message subscription management device receives the message sent by the disaster recovery warehouse device, and writes the target database log file into a partition corresponding to the topic of the target database log file according to an identifier of the topic corresponding to the target database log file.

6. The method according to claim 1, characterized in that The method further comprises: The terminal device receives the notification message, where the notification message carries the target database log file; or, After receiving the notification message, the terminal device obtains the target database log file from the message subscription management device.

7. The method according to claim 1 or 6, characterized in that: The method further comprises: The terminal device parses the target database log file through the application to obtain target data, and uses the target data to update the local data of the application.

8. The method according to claim 7, characterized in that The terminal device parses the target database log file through the application to obtain target data, including: The terminal device converts the target database log file into a text file through the application program, and extracts target data from the text file.

9. The method according to claim 7, characterized in that: The target database log file includes an update event corresponding to a specified database operation, the target data includes a database operation statement corresponding to the specified database operation, and the terminal device uses the target data to update the local data of the application program, including: The terminal device updates the local data of the application program using the database operation statement corresponding to the designated database operation.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Retransmitting method of message in cloud environment

    CN103051521A

  • Data disaster recovery device, system and method

    CN106776121A

  • Data synchronization method and device and terminal device

    CN110321387A