A method and apparatus for generating data snapshots

By monitoring application database log changes and generating data snapshots, the high complexity of data change auditing in existing technologies is solved, and the traceability of related fields of changed fields is realized, thus improving the accuracy of auditing.

CN115905113BActive Publication Date: 2026-03-13CHINA UNIONPAY
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-27
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

In existing technologies, when enterprises review data changes, they need to query change information from the database change log and also query related data, which increases the complexity of the review process.

Method used

By monitoring the application database logs for changes using database tools, the changed fields and their associated fields are identified, and a data snapshot is generated and stored in the snapshot database, enabling the tracing of associated fields of the changed fields.

Benefits of technology

This improved the accuracy of data change review and reduced the complexity of reviewing data changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115905113B_ABST
    Figure CN115905113B_ABST
Patent Text Reader

Abstract

This invention provides a method and apparatus for generating data snapshots, applied in the field of data processing technology. The method includes: a database tool monitoring log change information in an application database; the log change information being triggered by business operations at the application layer; the database tool determining a target field from each field of the log change information, the target field including the changed field and its associated fields; and the database tool generating a data snapshot of the target field and storing it in a snapshot database. The database tool not only monitors the changed fields in the application database but also monitors the associated fields of the changed fields, generating a data snapshot of the changed fields and their associated fields. This allows for tracing the associated fields of the changed fields when they change, thereby improving the accuracy of reviewing data changes and reducing the complexity of reviewing data changes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a method and apparatus for generating data snapshots. Background Technology

[0002] As enterprises continue to develop their information technology, the amount of data they generate is increasing, and the speed of data change is also accelerating. Operations personnel need to frequently review data changes. Generally, reviewing data changes requires reviewing the changed data along with other related data.

[0003] Currently, when reviewing data changes, enterprises not only need to query the database change log for data change information, but also need to query other related data that have not changed from the database, as the database change log only records the change information of the data that has changed, and does not record other related data that has not changed. This increases the complexity of reviewing data changes.

[0004] In summary, reducing the complexity of reviewing data changes is a pressing technical problem that needs to be solved. Summary of the Invention

[0005] This invention provides a method and apparatus for generating data snapshots to solve the problem of high complexity in reviewing data changes in the prior art.

[0006] In a first aspect, embodiments of the present invention provide a method for generating a data snapshot, comprising: a database tool monitoring log change information in an application database; the log change information being generated by a business operation at the application layer; the database tool determining a target field from each field of the log change information, the target field including the changed field and associated fields of the changed field; and the database tool generating a data snapshot of the target field and storing it in a snapshot database.

[0007] In this embodiment of the invention, the database tool not only monitors the changed fields in the application database, but also monitors the related fields of the changed fields, and generates a data snapshot of the changed fields and their related fields. This enables the tracking of the related fields of the changed fields when a field changes, thereby improving the accuracy of reviewing data changes and reducing the complexity of reviewing data changes.

[0008] Optionally, the log change information is generated by a business operation at the application layer, including: generating log change information in response to a modification operation on a first field of a first data table at the application layer; the log change information includes the first field as the changed field, each field of the first field in the same row of the first data table, and each field in the related row of the second data table; the second data table has the primary key field of the first data table; the related row has the first primary key field corresponding to the first field.

[0009] In this embodiment of the invention, log change information is generated in response to a modification operation on a first field of a first data table at the application layer, thereby facilitating the subsequent generation of a data snapshot based on the changed field and related fields in the log change information.

[0010] Optionally, before generating the log change information, the method further includes: in response to a modification operation on a first field of a first data table, modifying the first field in the first data table and updating the modification flag field of the row containing the first field based on the modification operation; each row in any data table corresponds to a unique modification flag field; determining whether there is a second data table associated with the first data table based on the first primary key field of the first data table; if there is a second data table associated with the first data table, updating the modification flag field of the row containing the first primary key field in the associated data table.

[0011] In this embodiment of the invention, when the application layer modifies the first field of the first data table, the first data table not only modifies the first field but also updates the modification flag field of the row containing the first field. Since the first data table can determine the associated second data table based on the primary key field, and then synchronously updates the modification flag field of the row containing the primary key field in the second data table, it is convenient to store all fields of the row containing the first field in the first data table and all fields of the row containing the primary key field in the associated data table in the application database log change information based on the modification flag field. This avoids changes in the fields of the second data table due to the inconsistency in the storage time of the fields of the first data table and the fields of the second data table in the application database, which would reduce the accuracy of the subsequent snapshot generation. This enables the database tool to obtain log change information when monitoring the application database.

[0012] Optionally, updating the modification marker field of the row containing the first field based on the modification operation includes: determining the first timestamp corresponding to the modification operation and updating the first timestamp to the modification marker field of the row containing the first field; updating the modification marker field of the row containing the first primary key field in the associated data table includes: updating the first timestamp to the modification marker field of the row containing the first primary key field in the associated data table.

[0013] In this embodiment of the invention, by updating the modification flag field of the row containing the first field and updating the modification flag field of the row containing the first primary key field in the associated data table, all fields of the row containing the first field in the first data table and all fields of the row containing the primary key field in the associated data table are subsequently stored in the log change information of the application database based on the modification flag field.

[0014] Optionally, the database tool determines the target field from each field of the log change information, including: the database tool determines whether the changed field in the log change information is a preset snapshot field; if so, it determines the associated field of the changed field from each field of the log change information according to the preset filter field of the snapshot field.

[0015] In this embodiment of the invention, by first determining whether the changed field is a preset snapshot field, it is possible to more accurately determine whether a snapshot needs to be generated for the changed field, avoiding the waste of resources by generating data snapshots for all changed fields. If the changed field is a preset snapshot field, then the related fields of the changed information are filtered out from the log change information, and the changed field and related fields are used to generate a target field. This enables the generation of a data snapshot based on the target field, thereby tracing the related fields of the changed field when a field is changed, improving the accuracy of reviewing data changes, and reducing the complexity of reviewing data changes.

[0016] Optionally, each snapshot field and the corresponding filter field are pre-set in the configuration file of the database tool.

[0017] In this embodiment of the invention, by pre-setting each snapshot field and the corresponding filter field in the configuration file of the database tool, the database tool can determine whether a data snapshot needs to be generated based on each snapshot field, and the database tool can filter out the target field from the log change information based on the filter field of each data snapshot.

[0018] Optionally, the database tool generates a data snapshot of the target field and stores it in a snapshot database, including: the database tool generates a second timestamp corresponding to the data snapshot; the database tool uses the first primary key field and the second timestamp as the primary key information of the data snapshot; and the database tool stores the target field and the primary key information as a data snapshot in the snapshot database.

[0019] In this embodiment of the invention, by storing the target field and primary key information as a data snapshot in the snapshot database, it is convenient to find the required data snapshot from the snapshot database based on the primary key information. Moreover, generating a data snapshot from the target field and primary key information also makes it easier to trace the related fields of the changed field when data changes, thereby improving the accuracy of reviewing data changes and reducing the complexity of reviewing data changes.

[0020] Secondly, embodiments of the present invention also provide an apparatus for generating data snapshots, comprising: an acquisition unit for monitoring log change information in an application database; the log change information is generated by a business operation at the application layer; a processing unit for determining a target field from each field of the log change information, the target field including the changed field and associated fields of the changed field; and a database tool for generating a data snapshot of the target field and storing it in a snapshot database.

[0021] Optionally, the acquisition unit is specifically used to: generate log change information in response to a modification operation on the first field of the first data table at the application layer; the log change information includes the first field as the changed field, each field of the first field in the same row of the first data table, and each field in the related row of the second data table; the second data table has the primary key field of the first data table; the related row has the first primary key field corresponding to the first field.

[0022] Optionally, the acquisition unit further includes: in response to a modification operation on a first field of a first data table, modifying the first field in the first data table and updating the modification flag field of the row containing the first field based on the modification operation; each row in any data table corresponds to a unique modification flag field; determining whether there is a second data table associated with the first data table based on the first primary key field of the first data table; if there is a second data table associated with the first data table, updating the modification flag field of the row containing the first primary key field in the associated data table.

[0023] Optionally, the processing unit is specifically used to: determine the first timestamp corresponding to the modification operation, update the first timestamp to the modification marker field of the row where the first field is located; update the modification marker field of the row where the first primary key field is located in the associated data table, including: updating the first timestamp to the modification marker field of the row where the first primary key field is located in the associated data table.

[0024] Optionally, the processing unit is specifically used for: the database tool to determine whether the changed field in the log change information is a preset snapshot field; if so, to determine the associated field of the changed field from each field of the log change information according to the preset filter field of the snapshot field.

[0025] Optionally, the processing unit is specifically used to: pre-set each snapshot field and the corresponding filter field in the configuration file of the database tool.

[0026] Optionally, the processing unit is specifically used for: the database tool generating a second timestamp corresponding to the data snapshot; the database tool using the first primary key field and the second timestamp as the primary key information of the data snapshot; and the database tool storing the target field and the primary key information as the data snapshot into the snapshot database.

[0027] Thirdly, embodiments of the present invention also provide an electronic device, including at least one processor and at least one memory, wherein the memory stores a computer program that, when executed by the processor, causes the processor to perform the method for generating a data snapshot as described in the first aspect.

[0028] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a program that, when run on a computer, causes the computer to perform the method for generating a data snapshot as described in the first aspect. Attached Figure Description

[0029] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 A flowchart of a method for generating a data snapshot provided in an embodiment of the present invention;

[0031] Figure 2 A flowchart illustrating a field modification method provided in an embodiment of the present invention;

[0032] Figure 3 A flowchart of a method for determining a target field provided in an embodiment of the present invention;

[0033] Figure 4 A flowchart illustrating a method for storing a data snapshot into a snapshot database, as provided in an embodiment of the present invention;

[0034] Figure 5 A schematic diagram of the structure of an apparatus for generating data snapshots provided in an embodiment of the present invention;

[0035] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0036] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0037] In one possible scenario, during the normal operation of Company A, due to the large volume of data and the increasing number of data changes, the process of reviewing changed data requires not only reviewing the changed data itself but also reviewing the related data to achieve a more accurate assessment. For example, if we need to review company data in Company A, which includes fields B and C, and field B has changed while field C has not, and fields B and C are related, to accurately review the changes in Company A's company data, we need to query not only the change information for field B from the database change log but also the value of field C from the database, thus reviewing both fields together. However, this increases the complexity of reviewing data changes.

[0038] like Figure 1 The diagram shows a flowchart of a method for generating a data snapshot according to an embodiment of the present invention. The method includes the following steps:

[0039] Step 101: The database tool listens for log change information in the application database.

[0040] In this embodiment of the invention, the database tool monitors log change information in the application database. The change information is generated by business operations at the application layer. The log change information is the first field of the change field, the fields of the first field in the same row of the first data table, and the fields of the related rows in the second data table. The second data table has the primary key field of the first data table. The related rows have the first primary key field corresponding to the first field.

[0041] Step 102: The database tool determines the target field from the fields of the log change information.

[0042] In this embodiment of the invention, as can be seen from step 101 above, the database tool monitors log change information in the application database. This log change information includes the changed field and all associated fields. However, since generating a subsequent data snapshot does not require all fields in the log change information, the database tool needs to filter out the required target fields from the fields in the log change information. These target fields are used for generating the subsequent data snapshot.

[0043] Step 103: The database tool generates a data snapshot of the target field and stores it in the snapshot database.

[0044] In this embodiment of the invention, the database tool generates a data snapshot of the target field and stores the generated data snapshot in the snapshot database.

[0045] As can be seen from steps 101 to 103, the database tool not only monitors the changed fields in the application database, but also monitors the related fields of the changed fields, and generates a data snapshot of the changed fields and their related fields. This enables the tracking of the related fields of the changed fields when a field changes, thereby improving the accuracy of reviewing data changes and reducing the complexity of reviewing data changes.

[0046] In this embodiment of the invention, the solution involves using a database tool to monitor log change information in the application database. The database tool then identifies the changed fields and associated fields from the log change information as target fields. This allows for the generation of a data snapshot based on the target fields, thereby improving the accuracy of data change auditing and reducing its complexity. Therefore, it is first necessary to determine how the fields are changed at the application layer.

[0047] like Figure 2 The diagram shown is a flowchart of a field modification method provided by an embodiment of the present invention. The method includes the following steps:

[0048] Step 201: For the modification operation of the first field of the first data table, modify the first field in the first data table and update the modification flag field of the row containing the first field based on the modification operation.

[0049] In this embodiment of the invention, at the application layer, for a modification operation on the first field of the first data table, the first field is modified in the first data table, and the modification flag field of the row containing the first field is updated. The modification flag field can be a first timestamp, representing the time the first field was updated. It can also be a first label or other flag fields, without limitation. For ease of explanation, the modification flag field will be the first timestamp as an example below. For example, the first data table is a merchant information table, as shown in Table 1. The merchant number in the first data table is the first primary key field. It can be seen that in the row where the merchant number is 1, the merchant name is B and the merchant phone number is 1111. In the row where the merchant number is 2, the merchant name is C and the merchant phone number is 0000. If the first field is the merchant phone number in the row where the merchant number is 1, and the modification operation on the first field of the first data table is to change the merchant phone number from 1111 to 1000, since the first timestamp of the modification operation on the first field of the first data table is 10:00, then the modification flag field of the row where the first field is located is updated to 10:00.

[0050] Table 1 Merchant Information Sheet

[0051] Merchant ID Merchant Name Merchant phone number Modify the tag field 1 B 1000 2 C 0000 10:00

[0052] Step 202: Determine whether there is a second data table associated with the first data table based on the first primary key field of the first data table. If yes, proceed to step 203; otherwise, proceed to step 204.

[0053] In this embodiment of the invention, the existence of a second data table associated with the first data table is determined based on the first primary key field of the first data table. If a second data table is associated with the first data table, it means that the first primary key field in the first data table is the same as the first primary key field in the second data table. Although the second data table does not contain the first field from the first data table, all fields in the row containing the same first primary key field as the first data table are associated fields of the first field. When reviewing changes to fields later, these fields need to be reviewed together, thereby reducing the complexity of reviewing data changes and improving the accuracy of reviewing data changes. For example, if the second data table is a merchant turnover table, as shown in Table 2, it can be seen that the daily turnover in the row with merchant number 1 in the second data table is 6000 yuan, and the daily turnover in the row with merchant number 2 in the second data table is 10000 yuan. Referring to Table 1, if the merchant phone number in the row containing merchant number 2 is the first field, and the merchant phone number is changed from 1111 to 1000, since the first timestamp of the modification operation on the first field of the first data table is 10:00, then the modification flag field of the row containing the first field should be updated to 10:00. Since the second data table is a related table to the first data table, the modification flag field in the row containing merchant number 2 in the second data table also needs to be updated to 10:00.

[0054] If the first data table has no associated second data table, it means that the first primary key field in the first data table is different from the first primary key field in other data tables. In this case, you only need to modify the first field in the first data table according to step 201 and update the modification flag field of the row where the first field is located based on the modification operation.

[0055] Table 2 Merchant Revenue Table

[0056] Merchant ID Daily turnover Modify the tag field 1 6000 yuan 2 10,000 yuan 10:00

[0057] Step 203: Update the modification flag field of the row containing the first primary key field in the second data table.

[0058] In this embodiment of the invention, the modification flag field of the row containing the first primary key field in the second data table is updated, thereby enabling all fields of the row containing the first field in the first data table and all fields of the row containing the primary key field in the associated data table to be stored in the log change information of the application database based on the modification flag field.

[0059] Step 204, End.

[0060] As can be seen from steps 201 to 204 above, when the application layer modifies the first field of the first data table, the first data table not only modifies the first field but also updates the modification flag field of the row containing the first field. Since the first data table can determine the associated second data table based on the primary key field, and then synchronously updates the modification flag field of the row containing the primary key field in the second data table, it is convenient to store all fields of the row containing the first field in the first data table and all fields of the row containing the primary key field in the associated data table in the application database log change information based on the modification flag field. This avoids changes in the fields of the second data table due to the inconsistency in the storage time of the fields of the first data table and the fields of the second data table in the application database, which would reduce the accuracy of the subsequent snapshot generation. Thus, the database tool can obtain log change information when monitoring the application database.

[0061] In this embodiment of the invention, the database tool monitors log change information in the application database, wherein the log change information is generated by business operations at the application layer. Specifically, in response to a modification operation on a first field of a first data table at the application layer, log change information is generated, wherein the log change information includes the first field as the modified field, each field of the first field in the same row of the first data table, and each field in the related row of the second data table; the second data table has the primary key field of the first data table; and the related row has the first primary key field corresponding to the first field.

[0062] In this embodiment of the invention, since the log change information includes many fields, not all fields in the log change information generate data snapshots. Instead, before generating data snapshots, the database tool needs to filter the fields in the log change information to obtain the target fields. The following describes how to filter the fields in the log change information to obtain the target fields.

[0063] like Figure 3 The diagram shows a flowchart of a method for determining a target field according to an embodiment of the present invention. The method includes the following steps:

[0064] Step 301: The database tool determines whether the changed field in the log change information is a preset snapshot field. If yes, proceed to step 302; otherwise, proceed to step 303.

[0065] In this embodiment of the invention, since not all changed fields in the log change information will generate data snapshots, the database tool needs to first determine whether the changed fields in the log change information are preset snapshot fields. If so, it means that the changed field is a snapshot field that needs to generate a snapshot. If not, it means that the changed field is a snapshot field that does not need to generate a snapshot, and it can be understood that there is no need to determine the target field subsequently.

[0066] Step 302: The database tool determines the associated fields of the changed fields from each field of the log change information based on the preset snapshot field filtering fields.

[0067] In this embodiment of the invention, although the changed field is a snapshot field, not all fields in the log change information generate data snapshots. The database tool needs to determine the associated fields of the changed field from each field in the log change information based on preset snapshot field filtering fields. The filtering fields corresponding to each snapshot field are preset in the database tool's configuration file.

[0068] Step 303, End.

[0069] Step 304: Generate the target field from the changed field and its associated fields.

[0070] In this embodiment of the invention, the changed field and its associated fields are generated into a target field, thereby enabling the subsequent generation of a data snapshot based on the target field. This allows for the tracing of the associated fields of the changed field when a field is changed, improving the accuracy of the audit of data changes and reducing the complexity of the audit of data changes.

[0071] As can be seen from steps 301 to 304 above, by first determining whether the changed field is a preset snapshot field, it is possible to accurately determine whether a snapshot needs to be generated for that changed field, avoiding the waste of resources by generating data snapshots for all changed fields. If the changed field is a preset snapshot field, then the related fields of the changed information are filtered out from the log change information, and the changed field and related fields are used to generate the target field. This enables the generation of a data snapshot based on the target field, thereby tracing the related fields of the changed field when a field is changed, improving the accuracy of auditing data changes, and reducing the complexity of auditing data changes.

[0072] After obtaining the target field, the database tool will generate a data snapshot of the target field and store it in the snapshot database. The following details how to store the data snapshot generated for the target field in the snapshot database.

[0073] like Figure 4 The diagram shows a flowchart of a method for storing a data snapshot into a snapshot database according to an embodiment of the present invention. The method includes the following steps:

[0074] Step 401: The database tool generates a second timestamp corresponding to the data snapshot.

[0075] In this embodiment of the invention, the database tool generates a second timestamp corresponding to the data snapshot, wherein the second timestamp is the time when the data snapshot is stored in the snapshot database.

[0076] Step 402: The database tool uses the first primary key field and the second timestamp as the primary key information of the data snapshot.

[0077] In this embodiment of the invention, the database tool uses the first primary key field and the second timestamp as the primary key information of the data snapshot, which facilitates the subsequent storage of the data snapshot and the primary key information of the data snapshot into the snapshot database.

[0078] Step 403: The database tool stores the target field and primary key information as a data snapshot in the snapshot database.

[0079] In this embodiment of the invention, the database tool stores the target field and primary key information as a data snapshot in the snapshot database, thereby improving the accuracy of reviewing data changes and reducing the complexity of reviewing data changes.

[0080] As can be seen from steps 401 to 403 above, by storing the target field and primary key information as a data snapshot in the snapshot database, it is easier to find the required data snapshot from the snapshot database based on the primary key information. Moreover, generating a data snapshot with the target field and primary key information also makes it easier to trace the related fields of the changed field when data changes, thereby improving the accuracy of reviewing data changes and reducing the complexity of reviewing data changes.

[0081] Based on the same technical concept described above, embodiments of the present invention also provide an apparatus for generating data snapshots, such as... Figure 5 As shown, the device 500 includes: an acquisition unit 501, used to monitor log change information in the application database; the log change information is generated by business operations at the application layer; a processing unit 502, used to determine a target field from each field of the log change information, the target field including the changed field and the associated fields of the changed field; and the database tool generates a data snapshot of the target field and stores it in a snapshot database.

[0082] Optionally, the acquisition unit 501 is specifically used to: generate log change information in response to a modification operation on the first field of the first data table at the application layer; the log change information includes the first field as the changed field, each field of the first field in the same row of the first data table, and each field in the related row of the second data table; the second data table has the primary key field of the first data table; the related row has the first primary key field corresponding to the first field.

[0083] Optionally, the acquisition unit 501 further includes: in response to a modification operation on a first field of a first data table, modifying the first field in the first data table and updating the modification flag field of the row containing the first field based on the modification operation; each row in any data table corresponds to a unique modification flag field; determining whether there is a second data table associated with the first data table based on the first primary key field of the first data table; if there is a second data table associated with the first data table, updating the modification flag field of the row containing the first primary key field in the associated data table.

[0084] Optionally, the processing unit 502 is specifically used to: determine the first timestamp corresponding to the modification operation, update the first timestamp to the modification marker field of the row where the first field is located; update the modification marker field of the row where the first primary key field is located in the associated data table, including: updating the first timestamp to the modification marker field of the row where the first primary key field is located in the associated data table.

[0085] Optionally, the processing unit 502 is specifically used for: the database tool to determine whether the changed field in the log change information is a preset snapshot field; if so, to determine the associated field of the changed field from each field of the log change information according to the preset filter field of the snapshot field.

[0086] Optionally, the processing unit 502 is specifically used to: pre-install each snapshot field and the corresponding filter field in the configuration file of the database tool.

[0087] Optionally, the processing unit 502 is specifically used for: the database tool generating a second timestamp corresponding to the data snapshot; the database tool using the first primary key field and the second timestamp as the primary key information of the data snapshot; and the database tool storing the target field and the primary key information as the data snapshot into the snapshot database.

[0088] Based on the same technical concept, embodiments of this application also provide an electronic device, such as... Figure 6 As shown, the electronic device 600 includes at least one processor 601 and a memory 602 connected to the at least one processor. In this embodiment, the specific connection medium between the processor 601 and the memory 602 is not limited. Figure 6 Taking the connection between the processor 601 and the memory 602 via a bus as an example, the bus can be divided into address bus, data bus, control bus, etc.

[0089] In this embodiment of the application, the memory 602 stores instructions that can be executed by at least one processor 601. By executing the instructions stored in the memory 602, at least one processor 601 can perform the steps included in the aforementioned data snapshot method.

[0090] The processor 601 is the control center of the computing device. It can connect to various parts of the computing device using various interfaces and lines, and performs data processing by running or executing instructions stored in the memory 602 and calling data stored in the memory 602. Optionally, the processor 601 may include one or more processing units. The processor 601 may integrate an application processor and a modem processor. The application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles issuing instructions. It is understood that the modem processor may not be integrated into the processor 601. In some embodiments, the processor 601 and the memory 602 may be implemented on the same chip; in some embodiments, they may also be implemented on separate chips.

[0091] Processor 601 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the data snapshot method embodiments can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0092] Memory 602, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 602 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 602 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 602 may also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.

[0093] Based on the same technical concept, embodiments of this application also provide a computer-readable storage medium storing a computer program executable by a computing device, which, when run on the computing device, causes the computing device to perform the steps of the above-described data snapshot method.

[0094] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0095] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0096] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0097] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0098] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0099] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A method of generating a data snapshot, characterized by, The database tool listens to log change information in an application database, wherein, in response to a modification operation on a first field of a first data table at an application layer, log change information is generated, the log change information including the first field as a changed field, fields in the same row as the first field in the first data table, and fields in an associated row in a second data table; the second data table has a primary key field of the first data table; the associated row has a first primary key field corresponding to the first field; The database tool filters target fields from the fields of the log change information, the target fields including the changed field and associated fields of the changed field, wherein, when the database tool determines that the changed field in the log change information is a preset snapshot field, the database tool determines the associated fields of the changed field from the fields of the log change information according to a preset filtering field of the snapshot field; The database tool generates a data snapshot of the target fields and stores the data snapshot in a snapshot database, wherein, the database tool generates a second timestamp corresponding to the data snapshot, the second timestamp is a time when the data snapshot is stored in the snapshot database, the first primary key field and the second timestamp are used as primary key information of the data snapshot, and the target fields and the primary key information are stored in the snapshot database as the data snapshot. Before the log change information is generated, the method further includes:

2. The method of claim 1, wherein, In response to the modification operation on the first field of the first data table, the first field in the first data table is modified, and a modification marker field of a row where the first field is located is updated based on the modification operation; any row in any data table corresponds to a unique modification marker field; It is determined whether there is a second data table associated with the first data table according to the first primary key field of the first data table; If there is a second data table associated with the first data table, a modification marker field of a row where the first primary key field is located in the associated data table is updated. The modification marker field of the row where the first field is located is updated based on the modification operation, including:

3. The method of claim 2, wherein, A first timestamp corresponding to the modification operation is determined, and the first timestamp is updated as the modification marker field of the row where the first field is located; The modification marker field of the row where the first primary key field is located in the associated data table is updated, including: The first timestamp is updated as the modification marker field of the row where the first primary key field is located in the associated data table. Each snapshot field and a filtering field corresponding to each snapshot field are preset in a configuration file of the database tool.

4. The method of claim 1, wherein, The database tool listens to log change information in an application database, wherein, in response to a modification operation on a first field of a first data table at an application layer, log change information is generated, the log change information including the first field as a changed field, fields in the same row as the first field in the first data table, and fields in an associated row in a second data table; the second data table has a primary key field of the first data table; the associated row has a first primary key field corresponding to the first field; 5. An apparatus for generating a data snapshot, the apparatus comprising: ​ ​ The processing unit is configured to filter a target field from each field of the log change information, wherein the database tool determines an associated field of the change field from each field of the log change information according to a preset filtering field of the snapshot field when determining that the change field in the log change information is the preset snapshot field. The processing unit is further configured to generate a data snapshot of the target field and store the data snapshot in a snapshot database, wherein the database tool generates a second timestamp corresponding to the data snapshot, the second timestamp is a time when the data snapshot is stored in the snapshot database, the first primary key field and the second timestamp are taken as primary key information of the data snapshot, and the target field and the primary key information are stored in the snapshot database as the data snapshot.

6. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the steps of the method in any one of claims 1-4 when executing the program.

7. A computer readable storage medium characterized in that, The computer device stores a computer program executable by the computer device, and when the program runs on the computer device, the computer device executes the steps of the method in any one of claims 1-4.

Citation Information

Patent Citations

  • Data change information synchronization method and apparatus

    CN108287886A

  • Method, device and system for data synchronizing, medium and electronic equipment

    CN108920698A

  • Operation record generation method and device and electronic equipment

    CN114637762A