Data synchronization updating method and device
By using the data operation record table and central storage server between the primary database thread server and the secondary database thread server in the bank technology information system, data synchronization updates between the databases of each product group are achieved, data synchronization problem is solved, and data consistency is maintained.
Patent Information
- Application Number
- CN202311211916.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-19
- Publication Date
- 2025-03-28
AI Technical Summary
In the banking technology information system, how to synchronously update data between databases of each product group has become a challenge facing the existing technology.
The main database thread server generates data operation records in the data operation record table, and uploads specific operation information to the central storage server. When the auxiliary database thread server detects the newly generated operation record, it obtains the specific operation information corresponding to the operation record from the central storage server, generates database operation statements, and performs data operations on the auxiliary database.
After the main database performs data operations, each auxiliary database performs the same data operations, maintains the consistency of data in the main database and each auxiliary database, and realizes data synchronization between the product group databases.
Smart Images

Figure CN119719213A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database technology, and in particular to a method and device for synchronously updating data. Background Art
[0002] At present, the banking technology information system is more complex than before, the transaction links have increased significantly, the business logic rules have become more complex, and the pressure on the database from a single data storage is increasing day by day. With the decoupling and splitting of product groups, each product group can use its own unique database for data storage, solving the problem of a single data storage putting a lot of pressure on the database. However, this brings with it a new problem: how to synchronize data between the databases of each product group. How to effectively synchronize data between the databases of each product group is a problem faced by the existing technology. Summary of the invention
[0003] In order to solve at least one technical problem in the above-mentioned background technology, the present invention proposes a data synchronization update method and device.
[0004] In order to achieve the above object, according to one aspect of the present invention, a data synchronization update method is provided, the method comprising:
[0005] When the data operation on the main database is completed, the main database thread server generates an operation record corresponding to the data operation in the data operation record table, and uploads the specific operation information corresponding to the data operation to the central storage server;
[0006] When the auxiliary database thread server corresponding to each auxiliary database detects that there is a newly generated operation record in the data operation record table, the auxiliary database thread server obtains the specific operation information corresponding to the newly generated operation record from the central storage server, generates a database operation statement according to the obtained specific operation information, and then performs data operations on the corresponding auxiliary database according to the generated database operation statement.
[0007] Optionally, the data operation record table includes: a push flag field; and the method further includes:
[0008] When the main database thread server successfully uploads the specific operation information to the central storage server, the main database thread server sets the push flag field in the corresponding operation record in the data operation record table to a first field value, wherein the first field value is used to indicate that the push is successful;
[0009] When the main database thread server fails to upload specific operation information to the central storage server, the main database thread server sets the push flag field in the corresponding operation record in the data operation record table to a second field value, wherein the second field value is used to indicate push failure.
[0010] Optionally, the data operation record table further includes: a pull flag field corresponding to each auxiliary database; the method further includes:
[0011] When the auxiliary database thread server successfully obtains the specific operation information from the central storage server, the auxiliary database thread server sets the corresponding pull flag field in the corresponding operation record in the data operation record table to a third field value, wherein the third field value is used to indicate that the data is pulled successfully;
[0012] When the auxiliary database thread server fails to obtain specific operation information from the central storage server, the auxiliary database thread server sets the corresponding pull flag field in the corresponding operation record in the data operation record table to a fourth field value, wherein the fourth field value is used to indicate data pulling failure.
[0013] Optionally, the data synchronization update method further includes:
[0014] Checking, by the main database thread server, whether the push flag field in each operation record in the data operation record table has the second field value, and if so, re-initiating uploading of specific operation information corresponding to the operation record with the push flag field having the second field value to the central storage server;
[0015] The auxiliary database thread server checks whether the corresponding pull flag field in each operation record in the data operation record table has a fourth field value. If so, re-initiate the acquisition of specific operation information corresponding to the operation record whose pull flag field is the fourth field value from the central storage server.
[0016] Optionally, the data synchronization update method further includes:
[0017] If the upload of the specific operation information re-initiated by the main database thread server still fails, the specific operation information that failed to be uploaded will be sent to each auxiliary database thread server through the main database thread server, and after successful sending, the push flag field in the operation record corresponding to the specific operation information will be set to the first field value, and each pull flag field in the operation record corresponding to the specific operation information will be set to the third field value, wherein each auxiliary database thread server generates a database operation statement based on the received specific operation information, and then performs data operations on the corresponding auxiliary database according to the generated database operation statement.
[0018] Optionally, the data synchronization update method further includes:
[0019] If the specific operation information acquisition re-initiated by the auxiliary database thread server still fails, the specific operation information that failed to be acquired is directly acquired from the main database thread server through the auxiliary database thread server. After successfully acquiring the specific operation information from the main database thread server, the corresponding pull flag field in the operation record corresponding to the specific operation information is set to the third field value.
[0020] Optionally, the data synchronization update method further includes:
[0021] If the main database thread server sends the specific operation information of the upload failure to each auxiliary database thread server and still fails, the data in each auxiliary database will be updated to be consistent with the main database through the data repair thread server, and then the push flag field in all operation records in the data operation record table will be set to the first field value, and the pull flag field in all operation records in the data operation record table will be set to the third field value.
[0022] Optionally, the data synchronization update method further includes:
[0023] If the auxiliary database thread server still fails to obtain specific operation information from the main database thread server, the data in the auxiliary database corresponding to the auxiliary database thread server is updated to be consistent with the main database through the data repair thread server, and then the corresponding pull flag field in the operation record corresponding to the specific operation information is set to the third field value.
[0024] In order to achieve the above object, according to another aspect of the present invention, a data synchronization update device is provided, the device comprising:
[0025] The data push unit is used to generate an operation record corresponding to the data operation in the data operation record table through the main database thread server when the data operation is completed on the main database, and upload the specific operation information corresponding to the data operation to the central storage server;
[0026] The data pulling unit is used to obtain the specific operation information corresponding to the newly generated operation record from the central storage server through the auxiliary database thread server when the auxiliary database thread server corresponding to each auxiliary database detects that there is a newly generated operation record in the data operation record table, generate a database operation statement according to the obtained specific operation information, and then perform data operations on the corresponding auxiliary database according to the generated database operation statement.
[0027] In order to achieve the above-mentioned purpose, according to another aspect of the present invention, a computer device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned data synchronization update method when executing the computer program.
[0028] In order to achieve the above object, according to another aspect of the present invention, a computer-readable storage medium is provided, on which a computer program / instruction is stored, and when the computer program / instruction is executed by a processor, the steps of the above data synchronization update method are implemented.
[0029] The beneficial effects of the present invention are:
[0030] In an embodiment of the present invention, when a data operation is completed on a main database, an operation record corresponding to the data operation is generated in a data operation record table by the main database thread server, and specific operation information corresponding to the data operation is uploaded to a central storage server. When the auxiliary database thread server corresponding to each auxiliary database detects that there is a newly generated operation record in the data operation record table, the auxiliary database thread server obtains the specific operation information corresponding to the newly generated operation record from the central storage server, generates a database operation statement according to the obtained specific operation information, and then performs data operations on the corresponding auxiliary database according to the generated database operation statement, thereby achieving the same data operation on each auxiliary database after the main database performs data operations, maintaining data consistency between the main database and each auxiliary database, and achieving data synchronization between the databases of each product group. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0032] Figure 1 is a flow chart of a method for synchronously updating data according to an embodiment of the present invention;
[0033] Figure 2 This is a flowchart of updating a push flag field according to an embodiment of the present invention;
[0034] Figure 3 This is a flowchart of updating the pull flag field according to an embodiment of the present invention;
[0035] Figure 4 It is a schematic diagram of the data synchronization process according to an embodiment of the present invention;
[0036] Figure 5 is a schematic diagram of the system architecture of the present invention;
[0037] Figure 6 It is a structural block diagram of a data synchronization updating device according to an embodiment of the present invention;
[0038] Figure 7 It is a schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0039] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0040] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented 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.
[0041] It should be noted that the terms "including" and "having" and any variations thereof in the specification and claims of the present invention and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or apparatus.
[0042] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0043] It should be noted that the acquisition, storage, use, and processing of data in the technical solution of this application are in compliance with the relevant provisions of national laws and regulations.
[0044] It should be noted that the data synchronization update method and device of the present invention can be used in the financial field, and can also be used in any field other than the financial field. The application field of the data synchronization update method and device of the present invention is not limited.
[0045] Figure 5It is a schematic diagram of the system architecture of the present invention, such as Figure 5 As shown, the system for implementing the data synchronization update method of the present invention includes: a main database thread server corresponding to the main database, auxiliary database thread servers corresponding to each auxiliary database, and a central storage server.
[0046] The present invention first collects information of each product group in the bank's technology information system, establishes a product group information table, as shown in Table 1 below, and then sets a database of a certain product group as the primary database in the product group information table, and the databases of all other product groups are auxiliary databases.
[0047]
[0048] Table 1
[0049] like Figure 5 As shown, by default, there is only one product group that is the primary database, and the databases of the other product groups are all auxiliary databases, regardless of the order. Each database deploys a corresponding thread server, the primary database thread server is connected to the primary database, and the auxiliary database thread server corresponds to the auxiliary database one by one.
[0050] Figure 1 is a flow chart of a method for synchronously updating data according to an embodiment of the present invention. Figure 1 As shown, in one embodiment of the present invention, the data synchronization update method of the present invention includes step S101 and step S102.
[0051] Step S101, when a data operation is completed on a main database, an operation record corresponding to the data operation is generated in a data operation record table by the main database thread server, and specific operation information corresponding to the data operation is uploaded to a central storage server.
[0052] In the present invention, when the main database completes data operation according to DML (Data Manipulation Language) statements, the main database thread server adds an operation record corresponding to this data operation in the data operation record table, and at the same time uploads the specific operation information corresponding to this data operation to the central storage server for storage.
[0053] In one embodiment of the present invention, the data operation record table specifically includes: record table name, relevant fields, relevant field values, push flag, pull flag and other fields.
[0054] In one embodiment of the present invention, the data operation record table is specifically stored in a central storage server.
[0055] In one embodiment of the present invention, the data operation record table further includes: an identification information field of the corresponding specific operation information. The identification information of the specific operation information may be an ID of the specific operation information.
[0056] In one embodiment of the present invention, the specific operation information includes: operation type, relevant fields and field values. The operation type specifically includes: add (insert) type, using the insert statement of the corresponding database type to insert the relevant fields and field values into the auxiliary database; delete (delete) type, deleting the data that matches the relevant fields and field values from the corresponding auxiliary database; update (update) type, updating the data that matches the relevant fields and field values into the corresponding auxiliary database.
[0057] Step S102, when the auxiliary database thread server corresponding to each auxiliary database detects that there is a newly generated operation record in the data operation record table, the auxiliary database thread server obtains the specific operation information corresponding to the newly generated operation record from the central storage server, generates a database operation statement according to the obtained specific operation information, and then performs data operations on the corresponding auxiliary database according to the generated database operation statement.
[0058] In the present invention, a program code for scanning a data operation record table and a program code for pulling specific operation information from a central storage server are deployed on the auxiliary database thread server. When a newly generated operation record is detected in the data operation record table, the specific operation information corresponding to the newly generated operation record is obtained from the central storage server. After obtaining the specific operation information, a corresponding database operation statement (DML statement) is generated according to the type of the auxiliary database (such as MYSQL, ORACLE, GAUSSDB, etc.), and then the auxiliary database executes the database operation statement to complete the data operation, thereby achieving the same data operation of each auxiliary database after the main database performs the data operation, maintaining the data consistency between the main database and each auxiliary database, and achieving data synchronization between the databases of each product group.
[0059] In one embodiment of the present invention, the data operation record table includes: a push flag field. The push flag field is used to indicate whether the main database thread server successfully uploads the specific operation information to the central storage server.
[0060] In one embodiment of the present invention, the data operation record table further includes: a pull flag field corresponding to each auxiliary database. The pull flag field is used to indicate whether the auxiliary database thread server successfully pulls specific operation information from the central storage server to the local.
[0061] In one embodiment of the present invention, the data operation record table may be specifically as shown in Table 2 below.
[0062]
[0063] Table 2
[0064] like Figure 2 As shown, in one embodiment of the present invention, the data synchronization update method of the present invention further includes step S201 and step S202.
[0065] Step S201, when the main database thread server successfully uploads the specific operation information to the central storage server, the main database thread server sets the push flag field in the corresponding operation record in the data operation record table to the first field value, wherein the first field value is used to indicate that the push is successful.
[0066] Step S202, when the main database thread server fails to upload specific operation information to the central storage server, the main database thread server sets the push flag field in the corresponding operation record in the data operation record table to a second field value, wherein the second field value is used to indicate push failure.
[0067] In an optional embodiment of the present invention, the first field value is 0 and the second field value is 1.
[0068] In the present invention, if the main database thread server pushes successfully, the push flag is set to 0, and if the push fails, the push flag is set to 1.
[0069] like Figure 3 As shown, in one embodiment of the present invention, the data synchronization update method of the present invention further includes step S301 and step S302.
[0070] Step S301, when the auxiliary database thread server successfully obtains specific operation information from the central storage server, the auxiliary database thread server sets the corresponding pull flag field in the corresponding operation record in the data operation record table to a third field value, wherein the third field value is used to indicate that data pulling is successful.
[0071] Step S302, when the auxiliary database thread server fails to obtain specific operation information from the central storage server, the auxiliary database thread server sets the corresponding pull flag field in the corresponding operation record in the data operation record table to a fourth field value, wherein the fourth field value is used to indicate data pulling failure.
[0072] In an optional embodiment of the present invention, the third field value is 0 and the fourth field value is 1.
[0073] For example, when the auxiliary database thread server 1 corresponding to the auxiliary database 1 detects that a new operation record with an operation record number 10001 is added to the data operation record table, the specific operation information corresponding to the operation record with the operation record number 10001 is obtained from the central storage server locally according to the ID of the corresponding specific operation information recorded in the operation record. If the acquisition is successful, the auxiliary database thread server 1 sets the pull flag corresponding to the auxiliary database 1 in the operation record with the operation record number 10001 to 0. If the acquisition is unsuccessful, the auxiliary database thread server 1 sets the pull flag corresponding to the auxiliary database 1 in the operation record with the operation record number 10001 to 1.
[0074] In the present invention, the present invention also performs data monitoring on the data operation record table. The main database thread server and each auxiliary database thread server are provided with a timing thread to scan the push flag and pull flag fields in the table. If the push flag field is 1, the specific operation information upload is directly re-initiated and the push flag field is reset to 0; if the pull flag field is 1, the specific operation information pulling action is re-initiated and the pull flag field is restarted to 0, thereby further ensuring the data synchronization of the database.
[0075] like Figure 4 As shown, in one embodiment of the present invention, the data synchronization update method of the present invention further includes step S401 and step S402.
[0076] Step S401, checking through the main database thread server whether the push flag field in each operation record in the data operation record table has a second field value, if so, re-initiating uploading of specific operation information corresponding to the operation record whose push flag field is the second field value to the central storage server.
[0077] In the present invention, the main database thread server checks whether the push flag field in each operation record in the data operation record table is 1 according to a preset frequency. If there is an operation record with a push flag field of 1, the main database thread server re-initiates uploading the specific operation information corresponding to the operation record to the central storage server. If the re-initiated upload is successful, the push flag field in the corresponding operation record is set to 0.
[0078] Step S402, checking through the auxiliary database thread server whether there is a fourth field value in the corresponding pull flag field in each operation record in the data operation record table, if so, re-initiating the acquisition of specific operation information corresponding to the operation record whose pull flag field is the fourth field value from the central storage server.
[0079] For example, the auxiliary database thread server 1 checks whether the pull flag field corresponding to the auxiliary database 1 in each operation record in the data operation record table is 1 according to a preset frequency. If there is a pull flag field that is 1, first determine which operation record the operation record with the pull flag field that is 1 is, assuming it is the operation record numbered 10003, and then according to the ID of the corresponding specific operation information recorded in the operation record numbered 10003, re-initiate the acquisition of the specific operation information corresponding to the operation record numbered 10001 from the central storage server to the local. If the acquisition is successful, set the pull flag field corresponding to the auxiliary database 1 in the operation record numbered 10003 to 0.
[0080] The above-mentioned method of re-initiating sending and pulling in the present invention is only applicable to failures caused by system fluctuations. If the failure is caused by force majeure such as data problems or system programs, the second monitoring system needs to be used. Monitor the table data of the synchronization table. If the push mark and pull mark are still found to fail after the first data monitoring, the second detection system needs to be used. If the push fails, the main database skips the central storage server and directly pushes the relevant specific operation information to each auxiliary database thread server to notify the corresponding DML operation on the respective auxiliary database; if the pull fails, the corresponding auxiliary database thread server directly pulls the corresponding specific operation information from the main database thread server to perform the relevant DML operation on the corresponding auxiliary database.
[0081] In one embodiment of the present invention, the data synchronization update method of the present invention further includes:
[0082] If the upload of the specific operation information re-initiated by the main database thread server still fails, the specific operation information that failed to be uploaded will be sent to each auxiliary database thread server through the main database thread server, and after successful sending, the push flag field in the operation record corresponding to the specific operation information will be set to the first field value, and each pull flag field in the operation record corresponding to the specific operation information will be set to the third field value, wherein each auxiliary database thread server generates a database operation statement based on the received specific operation information, and then performs data operations on the corresponding auxiliary database according to the generated database operation statement.
[0083] In one embodiment of the present invention, the data synchronization update method of the present invention further includes:
[0084] If the specific operation information acquisition re-initiated by the auxiliary database thread server still fails, the specific operation information that failed to be acquired is directly acquired from the main database thread server through the auxiliary database thread server. After successfully acquiring the specific operation information from the main database thread server, the corresponding pull flag field in the operation record corresponding to the specific operation information is set to the third field value.
[0085] For example, if the auxiliary database thread server 1 still fails to re-initiate the acquisition of the specific operation information corresponding to the operation record with operation number 10003 from the central storage server to the local, the auxiliary database thread server 1 directly accesses the main database thread server, and then obtains the specific operation information corresponding to the operation record with operation number 10003 from the main database thread server to the local. If the acquisition is successful, the auxiliary database thread server 1 sets the pull flag field corresponding to the auxiliary database 1 in the operation record with operation number 10003 to 0.
[0086] When data synchronization still fails after ensuring data synchronization through the above two data self-checking solutions, the present invention further provides a data repair solution to further ensure data consistency between the primary database and each auxiliary database.
[0087] The data repair of the present invention is implemented by a separately deployed data repair thread server, which also scans the data in the data operation record table. If a record feedback of a push flag or a pull flag failure is detected, it is to re-trigger a synchronization (the probability of ensuring the success of data synchronization through the above two data self-checking schemes is already small, and it is only used as a guarantee). If the re-triggered synchronization still fails, the data repair thread server directly compares the relevant data rows of the corresponding tables of the main database and each auxiliary database. If the push flag fails, all auxiliary databases are updated to be consistent with the main database. If the pull flag fails, the corresponding auxiliary databases are updated to be consistent with the main database.
[0088] Specifically, in one embodiment of the present invention, the data synchronization update method of the present invention further includes:
[0089] If the main database thread server sends the specific operation information of the upload failure to each auxiliary database thread server and still fails, the data in each auxiliary database will be updated to be consistent with the main database through the data repair thread server, and then the push flag field in all operation records in the data operation record table will be set to the first field value, and the pull flag field in all operation records in the data operation record table will be set to the third field value.
[0090] Specifically, in one embodiment of the present invention, the data synchronization update method of the present invention further includes:
[0091] If the auxiliary database thread server still fails to obtain specific operation information from the main database thread server, the data in the auxiliary database corresponding to the auxiliary database thread server is updated to be consistent with the main database through the data repair thread server, and then the corresponding pull flag field in the operation record corresponding to the specific operation information is set to the third field value.
[0092] It can be seen from the above embodiments that the data synchronization update method of the present invention has at least the following advantages:
[0093] 1. The present invention is a data synchronization method between different database types among various product groups in financial scenarios, with wide applicability and high stability.
[0094] 2. The present invention has high versatility and can be used and deployed in most scenarios that require data synchronization.
[0095] 3. The present invention also has a highly effective self-checking and self-repairing system, which can complete self-checking and self-repairing in the event of partial data synchronization failure.
[0096] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0097] Based on the same inventive concept, an embodiment of the present invention also provides a data synchronization update device, which can be used to implement the data synchronization update method described in the above embodiment, as described in the following embodiment. Since the principle of solving the problem by the data synchronization update device is similar to that of the data synchronization update method, the embodiment of the data synchronization update device can refer to the embodiment of the data synchronization update method, and the repeated parts will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0098] Figure 6 is a structural block diagram of a data synchronization updating device according to an embodiment of the present invention. Figure 6 As shown, in one embodiment of the present invention, the data synchronization update device of the present invention includes:
[0099] The data push unit 1 is used to generate an operation record corresponding to the data operation in the data operation record table through the main database thread server when the data operation is completed on the main database, and upload the specific operation information corresponding to the data operation to the central storage server;
[0100] The data pulling unit 2 is used for obtaining the specific operation information corresponding to the newly generated operation record from the central storage server through the auxiliary database thread server when the auxiliary database thread server corresponding to each auxiliary database detects that there is a newly generated operation record in the data operation record table, generating a database operation statement according to the obtained specific operation information, and then performing data operations on the corresponding auxiliary database according to the generated database operation statement.
[0101] In one embodiment of the present invention, the data operation record table includes: a push flag field.
[0102] In one embodiment of the present invention, the data synchronization update device of the present invention further includes:
[0103] A first field value setting unit is used to set the push flag field in the corresponding operation record in the data operation record table to a first field value through the main database thread server when the main database thread server successfully uploads the specific operation information to the central storage server, wherein the first field value is used to indicate that the push is successful;
[0104] The second field value setting unit is used to set the push flag field in the corresponding operation record in the data operation record table to the second field value through the main database thread server when the main database thread server fails to upload specific operation information to the central storage server, wherein the second field value is used to indicate push failure.
[0105] In one embodiment of the present invention, the data operation record table further includes: a pull flag field corresponding to each auxiliary database.
[0106] In one embodiment of the present invention, the data synchronization update device of the present invention further includes:
[0107] A third field value setting unit, configured to set the corresponding pull flag field in the corresponding operation record in the data operation record table to a third field value through the auxiliary database thread server when the auxiliary database thread server successfully obtains the specific operation information from the central storage server, wherein the third field value is used to indicate that the data is pulled successfully;
[0108] The fourth field value setting unit is used to set the corresponding pull flag field in the corresponding operation record in the data operation record table to the fourth field value through the auxiliary database thread server when the auxiliary database thread server fails to obtain specific operation information from the central storage server, wherein the fourth field value is used to indicate data pulling failure.
[0109] In one embodiment of the present invention, the data synchronization update device of the present invention further includes:
[0110] a push failure processing unit, configured to check, through the main database thread server, whether the push flag field in each operation record in the data operation record table has a second field value, and if so, re-initiate uploading to the central storage server specific operation information corresponding to the operation record with the push flag field having the second field value;
[0111] The pull failure processing unit is used to check whether the corresponding pull flag field in each operation record in the data operation record table has a fourth field value through the auxiliary database thread server. If so, re-initiate the acquisition of specific operation information corresponding to the operation record whose pull flag field is the fourth field value from the central storage server.
[0112] In one embodiment of the present invention, the data synchronization update device of the present invention further includes:
[0113] The re-upload failure processing unit is used to send the specific operation information of the upload failure to each auxiliary database thread server through the main database thread server if the upload of the specific operation information re-initiated by the main database thread server still fails, and after successful sending, set the push flag field in the operation record corresponding to the specific operation information to the first field value, and set each pull flag field in the operation record corresponding to the specific operation information to the third field value, wherein each auxiliary database thread server generates a database operation statement according to the received specific operation information, and then performs data operations on the corresponding auxiliary database according to the generated database operation statement.
[0114] In one embodiment of the present invention, the data synchronization update device of the present invention further includes:
[0115] The re-pulling failure processing unit is used to obtain the specific operation information that failed to be obtained directly from the main database thread server through the auxiliary database thread server if the acquisition of the specific operation information re-initiated by the auxiliary database thread server still fails. After successfully obtaining the specific operation information from the main database thread server, the corresponding pulling flag field in the operation record corresponding to the specific operation information is set to the third field value.
[0116] In one embodiment of the present invention, the data synchronization update device of the present invention further includes:
[0117] The first repair unit is used to update the data in each auxiliary database to be consistent with the main database through the data repair thread server if the main database thread server fails to send specific operation information of the upload failure to each auxiliary database thread server, and then set the push flag field in all operation records in the data operation record table to the first field value, and set the pull flag field in all operation records in the data operation record table to the third field value.
[0118] In one embodiment of the present invention, the data synchronization update device of the present invention further includes:
[0119] The second repair unit is used to update the data in the auxiliary database corresponding to the auxiliary database thread server to be consistent with the main database through the data repair thread server if the auxiliary database thread server still fails to obtain specific operation information from the main database thread server, and then set the corresponding pull flag field in the operation record corresponding to the specific operation information to the third field value.
[0120] In order to achieve the above object, according to another aspect of the present application, a computer device is also provided. Figure 7 As shown, the computer device includes a memory, a processor, a communication interface and a communication bus. A computer program that can be executed on the processor is stored in the memory. When the processor executes the computer program, the steps in the above-mentioned embodiment method are implemented.
[0121] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0122] The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs and units, such as the corresponding program units in the above method embodiments of the present invention. The processor executes various functional applications of the processor and works data processing by running the non-transitory software programs, instructions and modules stored in the memory, that is, implementing the method in the above method embodiments.
[0123] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0124] The one or more units are stored in the memory, and when executed by the processor, the method in the above embodiment is performed.
[0125] The specific details of the above-mentioned computer device can be understood by referring to the corresponding related descriptions and effects in the above-mentioned embodiments, and will not be repeated here.
[0126] In order to achieve the above purpose, according to another aspect of the present application, a computer-readable storage medium is also provided, wherein the computer-readable storage medium stores a computer program, and the computer program implements the steps in the above data synchronization update method when executed in a computer processor. Those skilled in the art can understand that the implementation of all or part of the process in the above embodiment method can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and the program can include the process of the embodiment of each method as described above when executed. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (Flash Memory), a hard disk (Hard Disk Drive, abbreviated as: HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.
[0127] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a computer program product is further provided, comprising a computer program / instruction, which implements the steps of the above-mentioned data synchronization update method when executed by a processor.
[0128] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0129] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A data synchronization update method, characterized in that: include: When the data operation on the main database is completed, the main database thread server generates an operation record corresponding to the data operation in the data operation record table, and uploads the specific operation information corresponding to the data operation to the central storage server; When the auxiliary database thread server corresponding to each auxiliary database detects that there is a newly generated operation record in the data operation record table, the auxiliary database thread server obtains the specific operation information corresponding to the newly generated operation record from the central storage server, generates a database operation statement according to the obtained specific operation information, and then performs data operations on the corresponding auxiliary database according to the generated database operation statement.
2. The data synchronization update method according to claim 1, characterized in that: The data operation record table includes: a push flag field; The method further comprises: When the main database thread server successfully uploads the specific operation information to the central storage server, the main database thread server sets the push flag field in the corresponding operation record in the data operation record table to a first field value, wherein the first field value is used to indicate that the push is successful; When the main database thread server fails to upload specific operation information to the central storage server, the main database thread server sets the push flag field in the corresponding operation record in the data operation record table to a second field value, wherein the second field value is used to indicate push failure.
3. The data synchronization update method according to claim 2, characterized in that: The data operation record table further includes: a pull flag field corresponding to each auxiliary database; The method further comprises: When the auxiliary database thread server successfully obtains the specific operation information from the central storage server, the auxiliary database thread server sets the corresponding pull flag field in the corresponding operation record in the data operation record table to a third field value, wherein the third field value is used to indicate that the data is pulled successfully; When the auxiliary database thread server fails to obtain specific operation information from the central storage server, the auxiliary database thread server sets the corresponding pull flag field in the corresponding operation record in the data operation record table to a fourth field value, wherein the fourth field value is used to indicate data pulling failure.
4. The data synchronization update method according to claim 3, characterized in that: Also includes: Checking, by the main database thread server, whether the push flag field in each operation record in the data operation record table has the second field value, and if so, re-initiating uploading of specific operation information corresponding to the operation record with the push flag field having the second field value to the central storage server; The auxiliary database thread server checks whether the corresponding pull flag field in each operation record in the data operation record table has a fourth field value. If so, re-initiate the acquisition of specific operation information corresponding to the operation record whose pull flag field is the fourth field value from the central storage server.
5. The data synchronization update method according to claim 4, characterized in that: Also includes: If the upload of the specific operation information re-initiated by the main database thread server still fails, the specific operation information that failed to be uploaded will be sent to each auxiliary database thread server through the main database thread server, and after successful sending, the push flag field in the operation record corresponding to the specific operation information will be set to the first field value, and each pull flag field in the operation record corresponding to the specific operation information will be set to the third field value, wherein each auxiliary database thread server generates a database operation statement based on the received specific operation information, and then performs data operations on the corresponding auxiliary database according to the generated database operation statement.
6. The data synchronization update method according to claim 4, characterized in that: Also includes: If the specific operation information acquisition re-initiated by the auxiliary database thread server still fails, the specific operation information that failed to be acquired is directly acquired from the main database thread server through the auxiliary database thread server. After successfully acquiring the specific operation information from the main database thread server, the corresponding pull flag field in the operation record corresponding to the specific operation information is set to the third field value.
7. The data synchronization update method according to claim 5, characterized in that: Also includes: If the main database thread server sends the specific operation information of the upload failure to each auxiliary database thread server and still fails, the data in each auxiliary database will be updated to be consistent with the main database through the data repair thread server, and then the push flag field in all operation records in the data operation record table will be set to the first field value, and the pull flag field in all operation records in the data operation record table will be set to the third field value.
8. The data synchronization update method according to claim 6, characterized in that: Also includes: If the auxiliary database thread server still fails to obtain specific operation information from the main database thread server, the data in the auxiliary database corresponding to the auxiliary database thread server is updated to be consistent with the main database through the data repair thread server, and then the corresponding pull flag field in the operation record corresponding to the specific operation information is set to the third field value.
9. A data synchronization update device, characterized in that: include: The data push unit is used to generate an operation record corresponding to the data operation in the data operation record table through the main database thread server when the data operation is completed on the main database, and upload the specific operation information corresponding to the data operation to the central storage server; The data pulling unit is used to obtain the specific operation information corresponding to the newly generated operation record from the central storage server through the auxiliary database thread server when the auxiliary database thread server corresponding to each auxiliary database detects that there is a newly generated operation record in the data operation record table, generate a database operation statement according to the obtained specific operation information, and then perform data operations on the corresponding auxiliary database according to the generated database operation statement.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.