CN115858471A - Service data change recording method, device, computer equipment and medium - Google Patents

Service data change recording method, device, computer equipment and medium Download PDF

Info

Publication number
CN115858471A
CN115858471A CN202211562491.XA CN202211562491A CN115858471A CN 115858471 A CN115858471 A CN 115858471A CN 202211562491 A CN202211562491 A CN 202211562491A CN 115858471 A CN115858471 A CN 115858471A
Authority
CN
China
Prior art keywords
field
change
record
preset
acquiring
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211562491.XA
Other languages
Chinese (zh)
Inventor
潘斌
鲁健翔
薛海伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan Changyin May 8th Consumer Finance Co ltd
Original Assignee
Hunan Changyin May 8th Consumer Finance Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan Changyin May 8th Consumer Finance Co ltd filed Critical Hunan Changyin May 8th Consumer Finance Co ltd
Priority to CN202211562491.XA priority Critical patent/CN115858471A/en
Publication of CN115858471A publication Critical patent/CN115858471A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a method and a device for changing and recording service data, computer equipment and a storage medium. The method comprises the following steps: acquiring a binary log file of a service system; analyzing the binary log file, and extracting an updating statement in the binary log file; acquiring a preset change record configuration table, and searching a target field matched with the preset change record configuration table in the field name in the update statement; reading the change information corresponding to the target field from the service system database; and writing the change information into a record table of a preset data change process. By adopting the scheme, the service can be improved efficiency of data change logging.

Description

Service data change recording method, device, computer equipment and medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a computer device, a storage medium, and a computer program product for changing and recording service data.
Background
Based on the core service system important table data, it is usually necessary to pay attention to the change of the data of the key service field before and after the service handling process to form a data change link, so as to support the needs of service backtracking and the like. To achieve this, a backup operation needs to be performed for each changed link of the data.
For the table fields needing to be recorded and changed, all related function modules need to be developed with program functions for backup operation, program development is easy to miss changes brought by a certain scene, so that process records are meaningless, and each updating operation needs to call programs written in the function modules, so that the burden and the complexity of application are increased.
Therefore, the current method for changing the recorded data has low efficiency.
Disclosure of Invention
In view of the foregoing, it is necessary to provide an efficient business data change recording method, apparatus, computer device, computer readable storage medium and computer program product for solving the above technical problems.
In a first aspect, the present application provides a method for recording service data change. The method comprises the following steps:
acquiring a binary log file of a service system;
analyzing the binary log file, and extracting an updating statement in the binary log file;
acquiring a preset change record configuration table, and searching a target field in the update statement, wherein the field name of the target field is matched with the preset change record configuration table;
reading the change information corresponding to the target field from the service system database;
and writing the change information into a record table of a preset data change process.
In one embodiment, the obtaining a preset change record configuration table, and searching for a target field in the update statement, where a field name of the target field matches the preset change record configuration table, includes:
acquiring a preset change record configuration table, and searching the update statement;
acquiring key value pairs in the update statements;
acquiring the field name in the update statement according to the key value pair;
and acquiring a target field matched with the preset change record configuration table by the field name in the update statement.
In one embodiment, the obtaining, according to the key-value pair, a field name in the update statement includes:
acquiring a field sequence number of the key-value pair;
inquiring a field name corresponding to the field sequence number according to the field sequence number;
and acquiring the field name in the updating statement.
In one embodiment, the writing the change information into a record table of a preset data change process includes:
generating a result record of the target field according to the change information;
and writing the result record into a record table of a preset data change process.
In one embodiment, the preset change record configuration table carries the target field and a database table name where the target field is located.
In one embodiment, the binary log is log data based on a Binlog log format.
In a second aspect, the present application further provides a service data change recording device. The device comprises:
the system comprises a binary log file acquisition module, a service system acquisition module and a service system acquisition module, wherein the binary log file acquisition module is used for acquiring a binary log file of the service system;
the update statement acquisition module is used for analyzing the binary log file and extracting the update statements in the binary log file;
the target field searching module is used for acquiring a preset change record configuration table and searching a target field matched with the preset change record configuration table in the field name in the updating statement;
the change information reading module is used for reading the change information corresponding to the target field from the service system database;
and the change information writing module is used for writing the change information into a record table of a preset data change process.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the following steps when executing the computer program:
acquiring a binary log file of a service system;
analyzing the binary log file, and extracting an updating statement in the binary log file;
acquiring a preset change record configuration table, and searching a target field matched with the preset change record configuration table in the field name in the update statement;
reading the change information corresponding to the target field from the service system database;
and writing the change information into a record table of a preset data change process.
In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring a binary log file of a service system;
analyzing the binary log file, and extracting an updating statement in the binary log file;
acquiring a preset change record configuration table, and searching a target field matched with the preset change record configuration table in the field name in the update statement;
reading the change information corresponding to the target field from the service system database;
and writing the change information into a record table of a preset data change process.
In a fifth aspect, the present application further provides a computer program product. The computer program product comprising a computer program which when executed by a processor performs the steps of:
acquiring a binary log file of a service system;
analyzing the binary log file, and extracting an updating statement in the binary log file;
acquiring a preset change record configuration table, and searching a target field matched with the preset change record configuration table in the field name in the update statement;
reading the change information corresponding to the target field from the service system database;
and writing the change information into a record table of a preset data change process.
According to the automatic record data change method, the automatic record data change device, the computer equipment, the storage medium and the computer program product, the binary log file of the service system is obtained; analyzing the binary log file, and extracting an updating statement in the binary log file; acquiring a preset change record configuration table, and searching a target field matched with the preset change record configuration table in the update statement; reading change information corresponding to the target field from a service system database; and writing the change information into a record table of the preset data change process. According to the scheme, the binary log file of the application system is analyzed, the updating sentences in the binary log file are extracted, the change information corresponding to the fields is obtained according to the field names in the updating sentences, the program can be prevented from being called for many times when the change information corresponding to the fields is obtained, and the efficiency of business data change recording is improved.
Drawings
FIG. 1 is a diagram of an application environment of a method for change recording of business data in an embodiment;
FIG. 2 is a flowchart illustrating a method for recording changes to business data according to an embodiment;
FIG. 3 is a flow chart illustrating a method for recording changes to business data according to another embodiment;
FIG. 4 is a schematic view of a main flow of a business data change record;
FIG. 5 is a block diagram showing the structure of a business data change recording apparatus according to an embodiment;
FIG. 6 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of and not restrictive on the broad application.
The method for changing and recording the service data provided by the embodiment of the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104, or may be located on the cloud or other network server. The method comprises the steps that a terminal 102 sends a service data change request to a server 104, the server 104 responds to the service data change request and inquires a binary log file of a service system corresponding to the terminal 102, the server 104 extracts an update statement in the binary log file by analyzing the binary log file, obtains a preset change record configuration table, searches a target field in the update statement, the field name of which is matched with the preset change record configuration table, reads change information corresponding to the target field from a database of the service system, and writes the change information into a record table of a preset data change process. The terminal 102 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and the like. The server 104 may be implemented as a stand-alone server or as a server cluster comprised of multiple servers.
In one embodiment, as shown in fig. 2, a business data change recording method is provided, which is described by taking the method as an example applied to the server 104 in fig. 1, and includes the following steps:
s100, acquiring a binary log file of the service system.
The Binary Log file is a Binary Log file recorded by a MySQL Server layer, and MySQL has a Binary Log function for recording data update of MySQL, and usually, in an environment where binlog _ format = ROW, all historical SQL execution records, such as insert, delete, update, and the like, can be obtained through Binary Log.
Specifically, under a data directory of a database MySQL, a binary log file of a service system is obtained to obtain an update statement in the binary log file.
S200, analyzing the binary log file, and extracting the update statement in the binary log file.
The update statement comprises an addition statement and a modification statement, and further comprises insert and update operation statements in SQL.
Specifically, the automatic recorded data changing device sends a dump protocol to the MySQL node, the MySQL node starts to push the Binary Log to the automatic recorded data changing device after receiving the dump protocol request, the automatic recorded data changing device realizes line-by-line analysis of the Binary Log based on JAVA codes, and only extracts operation statements of insert and update.
S300, acquiring a preset change record configuration table, and searching a target field matched with the preset change record configuration table in the update statement.
The preset change record configuration table is a configuration table for recording field names in the update statement and database table names of the field names.
Specifically, searching for insert and update operation statements from an analyzed binary log file, and if SQL in the binary log file is an insert operation statement and the field name in the insert operation statement is matched with the field name recorded in a preset change record configuration table, acquiring the matched field name, namely the target field; if SQL in the binary log file is an update operation statement and the field name in the update operation statement is matched with the field name recorded in the preset change record configuration table, the matched field name is obtained, and the field name is the target field.
And S400, reading the change information corresponding to the target field from the service system database.
The change information comprises a target field name, a table name of a database where the target field is located, a data main key in the database table where the target field is located, a changed value and operation time.
Specifically, if the field names in insert and update operation statements in the binary log file are matched with the field names recorded in the preset change record configuration table, change information such as the target field name corresponding to the target field, the table name of the database where the target field is located, the data primary key in the database table where the target field is located, the changed value, the changed operation time and the like is read from the business system database.
And S500, writing the change information into a record table of the preset data change process.
The data change process record table records change information of the target field, and the change information comprises a table name, a table field, a table data primary key, a changed value and an operation time field and is used for storing change information corresponding to the target field.
Specifically, a result record is generated according to the target field name corresponding to the target field, the table name of the database where the target field is located, the data primary key in the database table where the target field is located, the changed value, the operation time and other change information, the result record of the change information is written into a preset data change process record table, data in the preset data change process record table are compared, and the business information before and after the change is obtained so as to analyze the related business.
In the service data change recording method, the binary log file of the service system is acquired, the binary log file is analyzed, the update statement in the binary log file is extracted, the preset change record configuration table is acquired, the target field of which the field name is matched with the preset change record configuration table in the update statement is searched, the change information corresponding to the target field is read from the database of the service system, and the change information is written into the record table in the preset data change process, so that the program can be prevented from being called for many times when the change information corresponding to the field is acquired, and the efficiency of service data change recording is improved.
In one embodiment, as shown in fig. 3, S300 includes:
s320, obtaining a preset change record configuration table and searching for an update statement.
S340, obtaining the key value pair in the update statement.
And S360, acquiring the field name in the update statement according to the key value pair.
And S380, acquiring a target field of the updated statement, wherein the field name of the target field is matched with the preset change record configuration table.
The key value pair can obtain a corresponding value according to a key value, and the key value pair consists of a field sequence number and a corresponding field value.
Specifically, the preset change record configuration table dynamically specifies a table and table-related fields that need to record data changes, and the configuration table mainly includes a table name and a table field set. In practical applications, taking the application to a financial business system as an example, the change record configuration table of the financial business system is shown in table 1:
table 1 change record configuration table
Name of table Table field set (comma split)
Borrow table (ccs _ loan) Principal (prin _ amt), interest (int _ amt)
... ...
Extracting operation statements of INSERT and update, and dividing the operation statements into initialization and process records, wherein the initialization is to configure which tables need to record process change according to a preset change record configuration table, store a result into a preset data change process record table, when an INSERT operation statement exists in a current binlog, a key value pair of '@ field sequence number = field value' behind SET in the INSERT statement is obtained, a field name in the INSERT operation statement is obtained through the key value pair, and if the field name in the INSERT operation statement is matched with the preset change record configuration table, a target field is obtained; the process record is that all operations after a certain field of certain data is initialized are recorded, only an UPDATE statement is extracted, when the current binlog has the UPDATE operation statement, a key value pair of 'field sequence number = field value' is obtained after a SET in the UPDATE statement, a key value pair of 'field sequence number = field value' is obtained after the SET, a key value pair of data before the SET is changed, a key value pair of data after the SET is changed, a field name in the UPDATE operation statement is obtained through the key value pairs, and if the field name in the UPDATE operation statement is matched with a preset change record configuration table, a target field is obtained.
In this embodiment, the field name of the service data change can be obtained by obtaining the preset change record configuration table, searching the update statement, obtaining the key value pair in the update statement, obtaining the field name in the update statement according to the key value pair, obtaining the target field of the update statement, where the field name is matched with the preset change record configuration table.
In one embodiment, obtaining the field name in the update statement according to the key-value pair includes:
acquiring a field serial number of the key-value pair; inquiring the field name corresponding to the field sequence number according to the field sequence number; and acquiring the field name in the updating statement.
Specifically, after a key value pair of '@ field sequence number = field value' behind the SET in the INSERT statement is obtained, metadata information is queried through the field sequence number to obtain a field name corresponding to the field sequence number in the INSERT statement; after a key-value pair of 'field sequence number = field value' is obtained after the SET and a key-value pair of 'field sequence number = field value' is obtained after the SET in the UPDATE statement, metadata information is inquired through the field sequence number to obtain a field name corresponding to the field sequence number in the UPDATE statement.
In this embodiment, the field name corresponding to the field sequence number is queried according to the field sequence number by obtaining the field sequence number of the key-value pair, and the field name in the update statement is obtained, which can facilitate obtaining the target field.
In one embodiment, writing the change information into the record table of the preset data change process includes:
generating a result record of the target field according to the change information; and writing the result record into a record table of the preset data change process.
Wherein, the result record is the field name of the business system data change and the corresponding value thereof.
Specifically, the preset data change process recording table is used for recording data changes in real time, and the main elements include a table name, a table field, a table data main key, a changed value, operation time and the like. In practical applications, taking the application to a financial system as an example, the data change process record table of the financial system is shown in table 2:
table 2 data change process record table
Name of table Table field Table data primary key Changed value Time of operation
Borrow table Principal Borrow number 900 2022-09-27 18:00
Borrow table Interest information Borrow number 110 2022-09-27 18:00
...
Acquiring a key value pair of '@ field serial number = field value' behind the SET in the INSERT statement, inquiring metadata information through the field serial number to obtain a field name, and if the field name is matched with a field configured in a preset change record configuration table, generating a result record of the field and writing the result record into a preset data change process record table; acquiring a key value pair of 'field sequence number = field value' before SET and a key value pair of 'field sequence number = field value' after SET in an UPDATE statement, inquiring metadata information through the field sequence number to obtain a field name, and if the field name is matched with a field configured in a preset change record configuration table, generating a result record of the field and writing the result record into a preset data change process record table.
In this embodiment, the result record of the target field is generated according to the change information, and the result record is written into the preset data change process record table, so that the information records before and after the data change of the service system can be obtained through the data change process record table.
In one embodiment, the preset change record configuration table carries the target field and the name of the database table where the target field is located.
Specifically, the preset change record configuration table configures fields needing to record data changes and database table names where the fields are located, provides page functions to support maintenance of configuration contents, and mainly comprises table names and table field sets.
In this embodiment, the preset change record configuration table carries the target field and the database table name where the target field is located, and the field to be recorded with data change and the database table name where the field is located can be obtained.
In one embodiment, the binary log is log data based on a Binlog log format.
Specifically, the binary log file of the service system is read at regular intervals, and if the preset reading interval time is exceeded, whether a new changed data object is generated in the database needs to be checked. Newly adding and modifying data in the service system can be recorded in a binary log file, and the newly added and modified data is stored in the binary log file in a Binlog log format; the analysis, the filtration and the analysis of the log are realized through a preset analysis rule, and the service tracking and the positioning of an administrator are facilitated.
In this embodiment, the binary log is log data based on a Binlog log format, which can facilitate obtaining insert and update operation statements, and is beneficial to copying and recovering service data.
In order to describe the technical solution of the method for changing and recording service data and the effect thereof in detail, a description will be given below by using a specific application example. In practical application, fig. 4 is a main flow of the service data change record, and the whole service data change record method includes the following steps:
1. the method comprises the steps of obtaining a Binary Log file of a service system, wherein the Binary Log function of MySQL is self-contained by the MySQL, the binlog is a Binary Log file recorded by a MySQL Server layer and used for recording data update of the MySQL, and all historical SQL execution records such as insert, delete, update and the like can be obtained through the binlog under the environment that the binlog _ format = ROW. The generated data of the code function core of the business system is stored in a database (the database can be a relation database of mysql), and then the data is maintained, including deletion and modification. And if the operation is a new addition operation, the binlog records the execution statement of insert, and if the operation is an update, the execution statement of update is recorded.
2. Designing a configuration table to dynamically specify a table and a table related field needing to record data change, providing a page function to support maintenance of configuration content, wherein the configuration table mainly comprises a table name and a table field set.
3. The data process record table is designed for recording data change in real time, and the main elements include table name, table field, table data main key, changed value and operation time.
4. The automatic recording data changing device is designed and positioned as a third-party system, is separated from an application and a database, and the table designed at the point 2 and the point 3 belongs to the content in the device. A certain data in a table may be applied, N transactions in a code relate to the operation of the certain data, and some important data need to know values before and after each change of the certain data, so that logic for recording changes is realized in the N transactions.
5. And automatically capturing, and sending the dump protocol to the MySQL node by the automatic recording data change device. After receiving the dump protocol request, the node starts to push Binary Log to the device. The device analyzes executed SQL sentences from the Binary Log and automatically records the change process of important data.
6. In order to record changes, binary Log is analyzed line by line based on JAVA codes (the analysis is a mature technology at present, for example, mysql-binlog-connector-JAVA analysis is used), only operation statements of insert and update are extracted, and the operation statements are divided into initialization and process recording. The initialization is to configure which tables need to record process change according to the configuration table designed at the point 2, and store the result in the 'data process record table' designed at the point 3, so that when a record is added to the specified table, an initialization datum needs to be inserted into the data process record table. The operation sql corresponding to the newly added record is an insert statement, so when the configured table is analyzed to have the insert statement, N pieces of data are initialized, and N is determined by which fields configured by the configuration table need to be recorded. Specifically, after a key value pair of '@ field serial number = field value' following the SET in the INSERT statement is obtained, metadata information is queried through the field serial number to obtain a field name corresponding to the field serial number in the INSERT statement, and if the field name is matched with a configuration table, a result record of the field is generated and stored in a data process record table.
The process record is the process record of all the operations after some data and some field are initialized, and only the update statement is captured because the purpose of the scheme is to record change. The starting point is not based on the configuration table, but based on the data process record table, whether the current binlog has the update execution process of the data or not is checked, and if so, the process record is continuously generated. Specifically, after a key value pair of 'field serial number = field value' of data before a SET is obtained after a WHERE in an UPDATE statement, after the key value pair of 'field serial number = field value' of the data after the SET is obtained, metadata information is inquired through the field serial number to obtain a field name corresponding to the field serial number in the UPDATE statement, the metadata information is inquired through the field serial number, and if the field name is matched with a configuration table, a result record of the field is generated and stored in a data process record table. Because the operation time is set in the data process record table, the record of the same service takes the latest data as the starting point each time, and the 2 similar records achieve the recording effect before and after the change according to the time-ordering.
It should be understood that, although the steps in the flowcharts related to the embodiments as described above are sequentially displayed as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the embodiments described above may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the execution order of the steps or stages is not necessarily sequential, but may be rotated or alternated with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the present application further provides a change recording device for implementing the above-mentioned service data change recording method. The implementation scheme for solving the problem provided by the apparatus is similar to the implementation scheme described in the method, so specific limitations in one or more embodiments of the change recording apparatus provided below may refer to the limitations in the foregoing service data change recording method, and details are not described here again.
In one embodiment, as shown in fig. 5, there is provided a business data change recording apparatus, including: a binary log file obtaining module 100, an update statement obtaining module 200, a target field searching module 300, a change information reading module 400, and a change information writing module 500, wherein:
a binary log file obtaining module 100, configured to obtain a binary log file of a service system;
an update statement acquisition module 200, configured to parse the binary log file and extract an update statement in the binary log file;
a target field searching module 300, configured to obtain a preset change record configuration table, and search for a target field in an update statement, where a field name of the target field matches the preset change record configuration table;
a change information reading module 400, configured to read change information corresponding to a target field from a service system database;
and a change information writing module 500, configured to write the change information into a record table of a preset data change process.
In one embodiment, the target field searching module 300 is further configured to obtain a preset change record configuration table, and search for an update statement; acquiring a key value pair in an updating statement; acquiring the field name in the update statement according to the key value pair; and acquiring a target field matched with the preset change record configuration table by the field name in the update statement.
In one embodiment, the target field search module 300 is further configured to obtain a field number of the key-value pair; inquiring the field name corresponding to the field sequence number according to the field sequence number; and acquiring the field name in the updating statement.
In one embodiment, the change information writing module 500 is further configured to generate a result record of the target field according to the change information; and writing the result record into a record table of the preset data change process.
All or part of each module in the service data change recording device can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent of a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operating system and the computer program to run on the non-volatile storage medium. The database of the computer device is used to store binary log file data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a business data change recording method.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring a binary log file of a service system; analyzing the binary log file, and extracting an updating statement in the binary log file; acquiring a preset change record configuration table, and searching a target field matched with the preset change record configuration table in the updated statement; reading change information corresponding to the target field from a service system database; and writing the change information into a record table of the preset data change process.
In one embodiment, the processor when executing the computer program further performs the steps of:
acquiring a preset change record configuration table, and searching an update statement; acquiring a key value pair in an updating statement; acquiring the field name in the update statement according to the key value pair; and acquiring a target field matched with the preset change record configuration table by the field name in the update statement.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
acquiring a field serial number of the key-value pair; inquiring the field name corresponding to the field sequence number according to the field sequence number; and acquiring the field name in the updating statement.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
generating a result record of the target field according to the change information; and writing the result record into a record table of the preset data change process.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and the preset change record configuration table carries the target field and the name of the database table where the target field is located.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring a binary log file of a service system; analyzing the binary log file, and extracting an updating statement in the binary log file; acquiring a preset change record configuration table, and searching a target field matched with the preset change record configuration table in the updated statement; reading change information corresponding to the target field from a service system database; and writing the change information into a record table of the preset data change process.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring a preset change record configuration table, and searching for an update statement; acquiring a key value pair in an updating statement; acquiring the field name in the update statement according to the key value pair; and acquiring a target field matched with the preset change record configuration table by the field name in the update statement.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring a field serial number of the key-value pair; inquiring the field name corresponding to the field sequence number according to the field sequence number; and acquiring the field name in the updating statement.
In one embodiment, the computer program when executed by the processor further performs the steps of:
generating a result record of the target field according to the change information; and writing the result record into a record table of the preset data change process.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and the preset change record configuration table carries the target field and the name of the database table where the target field is located.
In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, performs the steps of:
acquiring a binary log file of a service system; analyzing the binary log file, and extracting an updating statement in the binary log file; acquiring a preset change record configuration table, and searching a target field matched with the preset change record configuration table in the updated statement; reading change information corresponding to the target field from a service system database; and writing the change information into a record table of the preset data change process.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring a preset change record configuration table, and searching for an update statement; acquiring a key value pair in an updating statement; acquiring the field name in the update statement according to the key value pair; and acquiring a target field matched with the preset change record configuration table by the field name in the update statement.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring a field serial number of the key-value pair; inquiring the field name corresponding to the field sequence number according to the field sequence number; and acquiring the field name in the updating statement.
In one embodiment, the computer program when executed by the processor further performs the steps of:
generating a result record of the target field according to the change information; and writing the result record into a record table of the preset data change process.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and the preset change record configuration table carries the target field and the name of the database table where the target field is located.
It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), magnetic Random Access Memory (MRAM), ferroelectric Random Access Memory (FRAM), phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (10)

1. A method for recording changes to business data, the method comprising:
acquiring a binary log file of a service system;
analyzing the binary log file, and extracting an updating statement in the binary log file;
acquiring a preset change record configuration table, and searching a target field matched with the preset change record configuration table in the field name in the update statement;
reading the change information corresponding to the target field from the service system database;
and writing the change information into a record table of a preset data change process.
2. The method of claim 1, wherein the obtaining a preset change record configuration table and searching for a target field in the update statement, the field name of which matches the preset change record configuration table, comprises:
acquiring a preset change record configuration table, and searching the update statement;
acquiring key value pairs in the update statements;
acquiring the field name in the update statement according to the key value pair;
and acquiring a target field matched with the preset change record configuration table by the field name in the update statement.
3. The method of claim 2, wherein obtaining the field name in the update statement according to the key-value pair comprises:
acquiring a field sequence number of the key-value pair;
inquiring the field name corresponding to the field sequence number according to the field sequence number;
and acquiring the field name in the updating statement.
4. The method of claim 1, wherein writing the change information into a pre-set data change process record table comprises:
generating a result record of the target field according to the change information;
and writing the result record into a record table of a preset data change process.
5. The method of claim 1, wherein the preset change record configuration table carries the target field and a name of a database table where the target field is located.
6. The method of claim 1, wherein the binary log is log data based on a Binlog log format.
7. A business data change recording apparatus, comprising:
the system comprises a binary log file acquisition module, a service system acquisition module and a service system acquisition module, wherein the binary log file acquisition module is used for acquiring a binary log file of the service system;
the update statement acquisition module is used for analyzing the binary log file and extracting the update statements in the binary log file;
the target field searching module is used for acquiring a preset change record configuration table and searching a target field in the update statement, wherein the field name of the target field is matched with the preset change record configuration table;
the change information reading module is used for reading the change information corresponding to the target field from the service system database;
and the change information writing module is used for writing the change information into a record table of a preset data change process.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 6.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 6 when executed by a processor.
CN202211562491.XA 2022-12-07 2022-12-07 Service data change recording method, device, computer equipment and medium Pending CN115858471A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211562491.XA CN115858471A (en) 2022-12-07 2022-12-07 Service data change recording method, device, computer equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211562491.XA CN115858471A (en) 2022-12-07 2022-12-07 Service data change recording method, device, computer equipment and medium

Publications (1)

Publication Number Publication Date
CN115858471A true CN115858471A (en) 2023-03-28

Family

ID=85670630

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211562491.XA Pending CN115858471A (en) 2022-12-07 2022-12-07 Service data change recording method, device, computer equipment and medium

Country Status (1)

Country Link
CN (1) CN115858471A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117407369A (en) * 2023-12-14 2024-01-16 宁德时代新能源科技股份有限公司 Operation log recording method and device and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117407369A (en) * 2023-12-14 2024-01-16 宁德时代新能源科技股份有限公司 Operation log recording method and device and electronic equipment
CN117407369B (en) * 2023-12-14 2024-05-28 宁德时代新能源科技股份有限公司 Operation log recording method and device and electronic equipment

Similar Documents

Publication Publication Date Title
CN110276002B (en) Search application data processing method and device, computer equipment and storage medium
US9367574B2 (en) Efficient query processing in columnar databases using bloom filters
CN113901279B (en) Graph database retrieval method and device
CN112395157A (en) Audit log obtaining method and device, computer equipment and storage medium
CN112434027A (en) Indexing method and device for multi-dimensional data, computer equipment and storage medium
CN111708895B (en) Knowledge graph system construction method and device
Li et al. Database management strategy and recovery methods of Android
CN111008183B (en) Storage method and system for business wind control log data
CN115858471A (en) Service data change recording method, device, computer equipment and medium
Zhang et al. Recovering SQLite data from fragmented flash pages
CN115858322A (en) Log data processing method and device and computer equipment
CN115809311A (en) Data processing method and device of knowledge graph and computer equipment
CN114924911A (en) Method, device, equipment and storage medium for backing up effective data of Windows operating system
CN114691653A (en) Account set migration method and device, computer equipment and storage medium
CN114265828A (en) Line migration elimination method and device, computer equipment and storage medium
CN108984720B (en) Data query method and device based on column storage, server and storage medium
CN108614838B (en) User group index processing method, device and system
CN112988474B (en) Method, system, equipment and medium for backing up hot data by mass small files
CN104572711A (en) Distribution document-type data storage and extraction method and device
US11861206B1 (en) Garbage collection for object-based storage systems
CN117540056B (en) Method, device, computer equipment and storage medium for data query
CN115292094B (en) Data recovery processing method, device, equipment, storage medium and program product
CN112364007B (en) Mass data exchange method, device, equipment and storage medium based on database
CN114036171B (en) Application data management method, device, computer equipment and storage medium
CN115941760A (en) Interface information input method and device, computer equipment and storage medium

Legal Events

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