Database updating method, device, system, equipment and computer medium

By managing dynamic data blocks that update the database status using a Python server, the consistency problem in database circular replication is solved, and consistent querying of data in the database chain is achieved.

CN115309763BActive Publication Date: 2026-02-10INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210972983.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-15
Publication Date
2026-02-10
Estimated Expiration
2042-08-15

AI Technical Summary

Technical Problem

The consistency of databases in the database chain cannot be guaranteed during the database circular replication process, resulting in inconsistent query data.

Method used

The system generates key values ​​for dynamic data blocks using a Python server, manages database update status, ensures that the key value is set to the completion stage after all pending database updates are completed, and generates a database update completion indication message.

Benefits of technology

It effectively ensures the consistency of database updates in the database chain and guarantees a high degree of consistency in data query results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115309763B_ABST
    Figure CN115309763B_ABST
Patent Text Reader

Abstract

The application provides a database updating method, device, system, equipment and computer medium, wherein the method comprises: if a database change request is received, generating a key value for indicating a database updating state, and setting an initial state of the key value as a generating stage; sending the database change request to a plurality of databases to be updated, and setting the key value from the generating stage to an updating stage; receiving updating results of the plurality of databases to be updated, if the plurality of databases to be updated are all completed database updating based on the database change request, setting the key value from the updating stage to a completion stage, and generating a database updating completion indication message based on the key value set as the completion stage. Through the above method, the application can manage the database in the form of a key value dynamic data block, and can effectively guarantee the consistency of database updating in a database chain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of big data technology, and in particular to a database update method, apparatus, system, device, and computer medium. Background Technology

[0002] With the continuous development of Internet technology, the way databases are updated is also constantly improving in order to facilitate data storage and utilization.

[0003] Database replication, as one of the methods of database update, includes circular replication, master-slave replication, and one-way replication. For example, circular replication ensures that the data queried each time is the same, but database conflicts may occur during circular replication, which may lead to the inability to guarantee the consistency of databases in the database chain.

[0004] Therefore, there is an urgent need to propose a technical solution that can ensure the consistency of databases in the database chain when querying data. Summary of the Invention

[0005] To address the aforementioned problem—namely, the inability to guarantee consistency among databases in the database chain during the database update process—this application provides a database update method, apparatus, system, device, and computer medium.

[0006] To achieve the above objectives, this application provides the following technical solution:

[0007] Firstly, this application provides a database update method, including:

[0008] If a database change request is received, a key value is generated to indicate the database update status, and the initial state of the key value is set to the generation stage;

[0009] Send the database change request to several databases to be updated, and set the key value from the generation stage to the update stage;

[0010] The update results of the plurality of databases to be updated are received. If all of the plurality of databases to be updated have completed the database update based on the data change request, the key value is set from the update stage to the completion stage, and a database update completion indication message is generated based on the key value that has been set to the completion stage.

[0011] In one implementation, the database change request carries the key value so that the plurality of databases to be updated can perform database updates based on the key value that has been set to the update phase.

[0012] In one implementation, after sending the database change request to a plurality of databases to be updated, and before setting the key value from the update phase to the completion phase, the method further includes:

[0013] If the first database in the plurality of databases to be updated completes the database update based on the data update request, then the first database is authorized to access the update status of other databases in the plurality of databases to be updated, and the first database sends the database change request to the second database in the other databases that has not been updated.

[0014] In one implementation, if the first database in the plurality of databases to be updated completes a database update based on the data update request, the method further includes:

[0015] The system receives a verification request from the first database. This verification request is sent by the first database after accessing the update status of other databases among the plurality of databases to be updated, and determining that there is a second database among the other databases that has not been updated.

[0016] Based on the verification request, the current state of the key value is verified. If the current state of the key value is not in the update stage, the key value is reset to the update stage.

[0017] In one implementation, if the first database in the plurality of databases to be updated completes a database update based on the data update request, the method further includes:

[0018] Obtain the first updated data obtained after the first database has completed the data update, and cache the first updated data;

[0019] The first update data is sent by the first database after accessing the update status of other databases in the plurality of databases to be updated and determining that there is a second database in the other databases that has not been updated.

[0020] In one implementation, if all of the plurality of databases to be updated have completed database updates based on the data change request, the method further includes the following step before setting the key value from the update stage to the completion stage:

[0021] If the second updated data after the second database completes the data update is the same as the first updated data, then the key value is set from the update stage to the completion stage.

[0022] In one implementation, after generating a database update completion indication message based on the key value that has been set to the completion stage, the method further includes:

[0023] Send the update completion indication message to the client that issued the database change request; and set the key value from the completion stage to the destruction stage and destroy the key value.

[0024] Secondly, this application provides a database updating apparatus, comprising:

[0025] The generation module is configured to generate a key value indicating the database update status if a database change request is received. The key value includes a generation stage, an update stage, and a completion stage, and the status of the key value is set to the generation stage.

[0026] The status change module is configured to send the database change request to several databases to be updated, and to set the key value from the generation stage to the update stage.

[0027] The update indication module is configured to, if all of the databases to be updated have completed the database update based on the data change request, set the key value from the update stage to the completion stage, and generate a database update completion indication message based on the key value that has been set to the completion stage.

[0028] Thirdly, this application provides an electronic device, including: a memory and a processor;

[0029] The memory stores computer-executed instructions;

[0030] The processor executes computer execution instructions stored in the memory, causing the electronic device to perform the database update method.

[0031] Thirdly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the database update method described above.

[0032] Fourthly, this application provides a database update system, including a client, a Python server, and several databases to be updated, wherein...

[0033] The client is used to initiate a database change request to the Python server;

[0034] The Python server receives database change requests from the client, generates a key value indicating the database update status, sets the initial state of the key value to the generation stage, sends the database change requests to the plurality of databases to be updated, and sets the key value from the generation stage to the update stage.

[0035] The plurality of databases to be updated are used to receive database change requests sent by the Python server, and to complete the database update based on the database change requests when the key value is in the update phase, so as to obtain the update result;

[0036] The Python server is also used to receive the update results of the plurality of databases to be updated. When the plurality of databases to be updated have completed the database update based on the data change request, the key value is set from the update stage to the completion stage, and a database update completion indication message is generated based on the key value that has been set to the completion stage and returned to the client.

[0037] In one implementation, the plurality of databases includes a first database that has completed a database update based on the data update request and a second database that has not completed a database update based on the data update request.

[0038] If the first database receives authorization information from the Python server granting access to the update status of other databases among the plurality of databases to be updated, then it sends the database change request to the second database.

[0039] It is understood that the database update method, apparatus, system, device, and computer medium provided in this application, upon receiving a database change request, generates a key value indicating the database update status and sets the initial state of the key value to the generation stage; sends the database change request to several databases to be updated and sets the key value from the generation stage to the update stage; receives the update results of the several databases to be updated; if all the databases to be updated have completed the database update based on the data change request, then sets the key value from the update stage to the completion stage and generates a database update completion indication message based on the key value set to the completion stage. Through the above method, this application manages the database based on dynamic data blocks of key values, which can effectively ensure the consistency of database updates in the database chain. Attached Figure Description

[0040] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0041] Figure 1 This is one of the possible scenario diagrams provided for an embodiment of this application;

[0042] Figure 2 A schematic flowchart illustrating a database update method provided in an embodiment of this application;

[0043] Figure 3A flowchart illustrating another database update method provided in an embodiment of this application;

[0044] Figure 4 This is a second possible scenario illustration provided for an embodiment of this application;

[0045] Figure 5 This is a schematic diagram of the structure of a database update device provided in an embodiment of this application;

[0046] Figure 6 This is a schematic diagram of the structure of a database update system provided in an embodiment of this application;

[0047] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0048] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0049] Understandably, in circular replication, each database node copies changes sent directly from the application server as well as changes from other database server nodes, processes them, and then sends them to the next database server node. Changes made on any one database server node are replicated to the next server until every server in the chain has processed the update. Compared to one-way replication and master-slave replication, circular replication ensures that the data queried is identical on every occasion because it ultimately keeps the data consistent across all nodes, whereas one-way replication and master-slave replication introduce latency.

[0050] However, conflicts can occur in database server circular replication because the way the database processes replication updates and direct SQL statements from clients is in parallel, and consistency across all databases in the chain is not guaranteed. This is because replication requests may act on columns simultaneously with direct requests from clients or application servers. Due to the time spent receiving and processing replication updates, direct requests from clients may have already updated the same row, even though, in terms of the overall order of events, the initial event that triggered replication from another server may have occurred first.

[0051] In view of this, this application provides a database update scheme to address the above-mentioned technical problems. It utilizes dynamic data blocks from a Python server to manage database update consistency. Specifically, the Python server receives database update requests and generates a dynamic key value indicating the database update status. This key value is updated and recorded as the database update progresses and can be used to instruct each database to update. When all databases to be updated have completed their updates, the key value is set to a completed state. When the client performs a data query, data information with the key value set to completed state can be returned to the client, effectively ensuring database consistency.

[0052] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be described in more detail below with reference to the accompanying drawings. In the drawings, the same or similar reference numerals denote the same or similar components or components having the same or similar functions throughout. The described embodiments are some, but not all, embodiments of this application. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0053] Figure 1 This is a schematic diagram illustrating a possible scenario for an embodiment of this application. It should be noted that the database update method disclosed herein can be used in the field of big data. It can also be used in any field other than big data, and the application field of the database update method disclosed herein is not limited.

[0054] Taking a database circular replication scenario as an example, such as Figure 1 As shown, the system includes a client 110, a Python server 120, a first database (server) 130, a second database (server) 140, and a third database (server) 150. The client 110 is electrically connected to the Python server 120, and the Python server 120 is electrically connected to each of the databases. The Python server receives database change requests and data query requests from the client and forwards them to the respective servers. Optionally, during database updates, the Python server 120 performs the primary computational work, while the client 110 performs secondary computational work; the Python server 120 may also perform the primary computational work independently.

[0055] The client 110 may include, but is not limited to, computers, smartphones, tablets, e-book readers, Moving Picture Experts Group Audio Layer III (MP3) players, Moving Picture Experts Group Audio Layer IV (MP4) players, portable computers, in-vehicle computers, wearable devices, desktop computers, set-top boxes, smart TVs, etc.

[0056] The Python server 120 is equipped with a basic Python environment. This embodiment utilizes Python's data analysis and processing capabilities to perform database operations and management. It is understood that Python has mature modules available to perform these functions. In this embodiment, the Python server is electrically connected to the client, receives database change requests from the client, and records the update stages of each database using dynamic data blocks, effectively ensuring data consistency during data updates such as cyclic replication.

[0057] Optionally, the number of terminals 110 or Python servers 120 may be more or less, and this application embodiment does not limit this. In some embodiments, the terminals 110 and Python servers 120 may also act as nodes in a blockchain system, synchronizing database update results with other nodes in the blockchain to achieve widespread application of the database.

[0058] The above provides a brief illustration of the scenario of this application. The following section describes its application... Figure 1 Taking Python server 120 as an example, this application will explain in detail the database update method provided in the embodiments.

[0059] In some embodiments, the method provided in this application can also be applied to other servers, not limited to the Python server 120 in this embodiment. It can be a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.

[0060] Please refer to Figure 2 , Figure 2 This is a flowchart illustrating a database update method provided in an embodiment of this application, the method including steps S201-S203.

[0061] Step S201: If a database change request is received, a key value is generated to indicate the database update status, and the initial state of the key value is set to the generation stage.

[0062] In this embodiment, the database change request is a request initiated by the client to the Python server. It can be a database loop replication request or other requests for database update operations. The database change request can include database change information, such as application information, database information, and SQL statements. The application information includes the application information of the client that issued the database change request. The database information includes information about the database to be changed, such as identification information and index information. The SQL statement is the SQL statement for updating the data, which modifies the data at the corresponding location in the database.

[0063] Understandably, after receiving a database change request, the Python server generates a key value and sets the key value to the generation stage. This generation stage represents the initial preparation for the database to enter the update state. In some embodiments, upon receiving a database change request, the Python server may first perform security verification on the database change request to improve the security of the database update operation. For example, it may verify the identity information of the client that issued the database change request and whether it has the authorization information to issue the change request. If it does not have the authorization information, the key value will not be generated and the subsequent database change operation will not proceed.

[0064] In one implementation, the Python server uses RAM (Random Access Memory) caching technology, which can withstand high concurrency data change requests and can dynamically manipulate keys. Keys exist in four stages: creation, update, finish, and destruction.

[0065] Step S202: Send the database change request to several databases to be updated, and set the key value from the generation stage to the update stage.

[0066] In this scenario, there can be one or more databases to be updated; in a database cyclic replication scenario, there are usually multiple databases to be updated. This embodiment uses a Python server to send database change requests to each database to be updated, and sets the key value from the generation stage to the update stage.

[0067] In a preferred embodiment, the database change request carries the key value so that the plurality of databases to be updated perform database updates based on the key value that has been set to the update phase.

[0068] Combination Figure 1 In a database circular replication scenario, if the first database receives a database update request with the key value being the update stage, the first database will perform the database update and complete the operation based on the database update request. Other databases awaiting updates will then complete the mutual replication based on the update content of the first database upon receiving the database update request. In other implementations, if the first database, the second database, and other databases receive database update requests with the key value being the update stage, and the first database, the second database, and other databases have each performed data updates, the databases will transfer data between each other to complete the database replication.

[0069] Step S203: Receive the update results of the plurality of databases to be updated. If all the plurality of databases to be updated have completed the database update based on the data change request, then set the key value from the update stage to the completion stage, and generate a database update completion indication message based on the key value that has been set to the completion stage.

[0070] In this embodiment, the Python server receives the update results of each database to be updated to determine whether each database has been updated. After the update is completed, the key value is set to the completion stage, indicating that all database change requests have been updated. In one possible implementation, the update results of each database to be updated can be fed back from one of the databases to be updated. Furthermore, the update results of each database to be updated can also be returned to the Python server in the form of a key value, so that the Python server can identify whether each database to be updated has been updated.

[0071] Understandably, the database update completion indication message in this embodiment is used to indicate that all databases to be updated in this database update request have been updated. When the client initiates a data query, regardless of which database it queries, the data query results it obtains can be guaranteed to be highly consistent.

[0072] Compared to related technologies where the database side directly receives database change requests and completes database update operations, for synchronous update processes between multiple databases, especially in cyclic replication processes, the consistency of data updates may not be guaranteed due to update time differences between databases or databases not yet entering the data replication process. This can lead to inconsistent data retrieved by different database nodes during data queries. This embodiment utilizes dynamic data blocks of a Python server to manage database update consistency. Specifically, the Python server receives database update requests and generates dynamic key values ​​to indicate the database update status. These key values ​​are updated and recorded as the database update phase progresses and can be used to instruct each database to perform updates. When all databases to be updated have completed the update, the key value is set to a completed state. When the client performs a data query, data information with a completed key value can be returned to the client, effectively ensuring database consistency.

[0073] Please refer to Figure 3 , Figure 3 This is a flowchart illustrating another database update method provided in this application embodiment. Based on the above embodiment, this embodiment takes into account situations where some databases do not start updating or the update is delayed during the data update process. By authorizing the update status of the updated database to other databases, other databases are instructed to enter the update status. Specifically, in one embodiment, after sending the database change request to several databases to be updated (step S202) and before setting the key value from the update stage to the completion stage (step S203), the following step S301 is further included.

[0074] Step S301: If the first database in the plurality of databases to be updated completes the database update based on the data update request, then the first database is authorized to access the update status of other databases in the plurality of databases to be updated, and the first database sends the database change request to the second database in the other databases that has not been updated.

[0075] Combination Figure 4 As shown, after completing the database update, the first database returns its update result to the Python server. For example, in an embodiment where the Python server sends a data change request to each database with a key value, it returns the key value status key_1finish and requests the Python server to verify the update status of the second database. If no update is performed, the key value is set to the update stage, and the key value of the second database is set to key_2update.

[0076] In a preferred embodiment, considering the possibility of key value assignment failure, which may result in some databases not receiving the database change request or not entering the update state, ultimately causing asynchrony among multiple databases to be updated, if the first database among the plurality of databases to be updated completes the database update based on the data update request, the method further includes the following steps:

[0077] The system receives a verification request from the first database. This verification request is sent by the first database after accessing the update status of other databases among the plurality of databases to be updated, and determining that there is a second database among the other databases that has not been updated.

[0078] Based on the verification request, the current state of the key value is verified. If the current state of the key value is not in the update stage, the key value is reset to the update stage.

[0079] For example, the first database can determine whether other databases have not been updated by checking the key value status of other databases. Specifically, when Python sends a database change request to each database, it includes the key value. Each database modifies the key value status according to its own update status, for example, by adding a suffix to represent its update status. For instance, if the second database has not entered the update state, it modifies the key value to key_2create. If the status of the second database (or other databases) is key_2update, key_2finish, or key_2destroy, the Python server does not change the key value status, and the first database does not need to synchronize data to the second database.

[0080] In one implementation, if the first database in the plurality of databases to be updated completes a database update based on the data update request, the method further includes the following steps:

[0081] Obtain the first updated data obtained after the first database has completed the data update, and cache the first updated data;

[0082] The first update data is sent by the first database after accessing the update status of other databases in the plurality of databases to be updated and determining that there is a second database in the other databases that has not been updated.

[0083] In this embodiment, the Python server uses RAM caching technology to cache the updated data of the first database after the first database completes its update. This allows for the verification of the updated data to determine whether it meets the database update request. It can also be compared with the updated data of other databases to verify the consistency of updates between different databases.

[0084] In one implementation, if all of the plurality of databases to be updated have completed database updates based on the data change request, the following steps are further included before setting the key value from the update stage to the completion stage (step S203):

[0085] If the second updated data after the second database completes the data update is the same as the first updated data, then the key value is set from the update stage to the completion stage.

[0086] In this embodiment, a Python database is used to verify whether the updated data between the databases is the same, in order to further ensure the consistency of database updates. Specifically, after the first database and the second database complete their data updates, they return their updated data to the Python database. The Python database then verifies whether the updated data between the databases is the same based on the updated data returned by the two databases.

[0087] It should be noted that the first database, the second database, the first updated data, and the second updated data in this embodiment are only used to distinguish similar objects and have no other meaning. The first database and the second database can be databases of the same type or databases of different types, and the first updated data and the second updated data can be the same data or different data.

[0088] In a preferred embodiment, after the database update is completed, the key value is destroyed to avoid confusion between different database update processes and to effectively alleviate the caching pressure on the Python server. After generating a database update completion indication message based on the key value that has been set to the completed stage (step S203), the following steps are also included:

[0089] Send the update completion indication message to the client that issued the database change request; and set the key value from the completion stage to the destruction stage and destroy the key value.

[0090] The update completion indication message can carry database information and updated data information, etc., indicating that the database update has been completed.

[0091] To facilitate understanding of the embodiments of this application, this application provides an exemplary embodiment in a scenario with more than two database nodes, wherein the following process is performed:

[0092] a. First, the app initiates a database change request, which is simultaneously sent to Python's dynamic data block to generate a changeable key value.

[0093] b. Python dynamic databases use RAM caching technology, which can withstand data change requests under high concurrency and can dynamically manipulate keys. Keys exist in four stages: creation, update, finish, and destruction.

[0094] c. Due to the time delay in data updates, after the first database A is updated, the data is first returned to the Python dynamic cache block, and the key is set to finish. At this time, the first database A can view the update status of other databases.

[0095] d. If other databases are in the "create" state, the first database A will proactively send update requests to the other databases and related requests to the Python dynamic data block, setting its database state to "update". Once the other data blocks have completed their updates, they will directly return the results to the Python dynamic data block, setting its state to "finish" upon receiving the request.

[0096] e. If other databases are in update, finish, or destroy state, then A will not access or synchronize data to other servers.

[0097] When f.python's dynamic data block receives a request, it sets the change key for each data item to "create" and sends a change request to all servers, at which point the key becomes "update". It returns "finish" once all databases have been updated.

[0098] g. Finally, the Python dynamic data block verification key is returned to the client, and the key is destroyed.

[0099] According to another aspect of this application, embodiments of this application also provide a database update apparatus, such as... Figure 5 As shown, the database update device includes a generation module 51, a status change module 52, and an update indication module 53, wherein...

[0100] The generation module 51 is configured to generate a key value indicating the database update status if a database change request is received. The key value includes a generation stage, an update stage, and a completion stage, and the status of the key value is set to the generation stage.

[0101] The status change module 52 is configured to send the database change request to several databases to be updated, and to set the key value from the generation stage to the update stage.

[0102] The update indication module 53 is configured to, if all of the databases to be updated have completed the database update based on the data change request, set the key value from the update stage to the completion stage, and generate a database update completion indication message based on the key value that has been set to the completion stage.

[0103] In one implementation, the database change request carries the key value so that the plurality of databases to be updated can perform database updates based on the key value that has been set to the update phase.

[0104] In one embodiment, the device further includes:

[0105] The authorized access module is configured to, when the first database in the plurality of databases to be updated completes a database update based on the data update request, authorize the first database to access the update status of other databases in the plurality of databases to be updated, so that the first database sends the database change request to the second database in the other databases that has not been updated.

[0106] In one embodiment, the device further includes:

[0107] The receiving module is configured to receive a verification request sent by the first database. This verification request is sent by the first database after it has accessed the update status of other databases among the plurality of databases to be updated and determined that a second database among those other databases has not yet been updated.

[0108] The reset module is configured to verify the current state of the key value based on the verification request. If the current state of the key value is in the non-update stage, the key value will be reset to the update stage.

[0109] In one embodiment, the device further includes:

[0110] The acquisition module is configured to acquire the first updated data obtained after the first database has completed the data update, and cache the first updated data;

[0111] The first update data is sent by the first database after accessing the update status of other databases in the plurality of databases to be updated and determining that there is a second database in the other databases that has not been updated.

[0112] In one embodiment, the device further includes:

[0113] The execution module is configured to set the key value from the update stage to the completion stage when the second updated data after the second database has completed the data update is the same as the first updated data.

[0114] In one embodiment, the device further includes:

[0115] The sending and destroying module is configured to send the update completion indication message to the client that issued the database change request; and to set the key value from the completion stage to the destroy stage and destroy the key value.

[0116] According to the fourth aspect of this application, embodiments of this application also provide a database update system, such as... Figure 6 As shown, the system includes a client 110, a Python server 120, and several databases 610 to be updated.

[0117] The client 110 is used to initiate a database change request to the Python server;

[0118] The Python server 120 is used to receive database change requests sent by the client 110, generate a key value to indicate the database update status, set the initial state of the key value to the generation stage, send the database change request to the plurality of databases to be updated, and set the key value from the generation stage to the update stage.

[0119] The plurality of databases to be updated 610 are used to receive database change requests sent by the Python server 120, and to complete the database update based on the database change requests when the key value is in the update phase, so as to obtain the update result;

[0120] The Python server 120 is also used to receive the update results of the plurality of databases 610 to be updated. When the plurality of databases to be updated have completed the database update based on the data change request, the key value is set from the update stage to the completion stage, and a database update completion indication message is generated based on the key value that has been set to the completion stage and returned to the client 110.

[0121] In one embodiment, the plurality of databases includes a first database 130 that has completed a database update based on the data update request and a second database 140 that has not completed a database update based on the data update request.

[0122] If the first database 130 receives authorization information from the Python server 120 authorizing access to the update status of other databases among the plurality of databases to be updated, then it sends the database change request to the second database.

[0123] According to another aspect of this application, embodiments of this application also provide an electronic device, such as... Figure 7As shown, the electronic device includes: a memory 71 and a processor 72;

[0124] The memory 71 stores computer-executed instructions;

[0125] The processor 72 executes computer execution instructions stored in the memory 71, causing the electronic device to perform the database update method.

[0126] According to another aspect of this application, an embodiment of this application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the database update method described above.

[0127] This application also provides a computer program product, which includes computer program code. When the computer program code is run on a computer, it causes the computer to execute the database update method.

[0128] This application also provides a chip, including a memory and a processor. The memory is used to store a computer program, and the processor is used to call and run the computer program from the memory to execute the database update method.

[0129] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).

[0130] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer.

[0131] Furthermore, as is known to those skilled in the art, communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0132] In the description of the embodiments of this application, the term "and / or" merely indicates a relationship describing the associated objects, meaning that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the term "at least one" indicates any combination of at least two of a plurality of options, for example, including at least one of A, B, and C, which can represent any one or more elements selected from a set including communication between A, B, and C. Furthermore, the term "multiple" means two or more, unless otherwise precisely specified.

[0133] In the description of the embodiments of this application, the terms "first," "second," "third," "fourth," etc. (if present) are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0134] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A database update method, characterized in that, include: If a database change request is received, a key value is generated to indicate the database update status, and the initial state of the key value is set to the generation stage; Send the database change request to several databases to be updated, and set the key value from the generation stage to the update stage; Receive the update results of the plurality of databases to be updated. If all of the plurality of databases to be updated have completed the database update based on the database change request, then set the key value from the update stage to the completion stage, and generate a database update completion indication message based on the key value that has been set to the completion stage. The method further includes: If the first database in the plurality of databases to be updated completes the database update based on the database change request, then the first database is authorized to access the update status of other databases in the plurality of databases to be updated, and the first database sends the database change request to the second database in the other databases that has not been updated. The system receives a verification request sent by the first database. The verification request is sent by the first database after it accesses the update status of other databases in the plurality of databases to be updated and determines that there is a second database in the other databases that has not been updated. Based on the verification request, the current state of the key value is verified. If the current state of the key value is not in the update stage, the key value is reset to the update stage.

2. The method according to claim 1, characterized in that, The database change request carries the key value so that the several databases to be updated can perform database updates based on the key value that has been set to the update stage.

3. The method according to claim 1, characterized in that, If the first database in the plurality of databases to be updated completes the database update based on the database change request, the method further includes: Obtain the first updated data obtained after the first database has completed the data update, and cache the first updated data; The first update data is sent by the first database after accessing the update status of other databases in the plurality of databases to be updated and determining that there is a second database in the other databases that has not been updated.

4. The method according to claim 3, characterized in that, If all of the databases to be updated have completed database updates based on the database change request, the process further includes the following steps before setting the key value from the update stage to the completion stage: If the second updated data after the second database completes the data update is the same as the first updated data, then the key value is set from the update stage to the completion stage.

5. The method according to claim 1, characterized in that, After generating a database update completion indication message based on the key value that has been set to the completion stage, the following is also included: Send the update completion indication message to the client that issued the database change request; and set the key value from the completion stage to the destruction stage and destroy the key value.

6. A database update device, characterized in that, include: The generation module is configured to generate a key value indicating the database update status if a database change request is received. The key value includes a generation stage, an update stage, and a completion stage, and the status of the key value is set to the generation stage. The status change module is configured to send the database change request to several databases to be updated, and to set the key value from the generation stage to the update stage. The update indication module is configured to, if all of the databases to be updated have completed the database update based on the database change request, set the key value from the update stage to the completion stage, and generate a database update completion indication message based on the key value that has been set to the completion stage. The authorized access module is configured to, if the first database in the plurality of databases to be updated completes the database update based on the database change request, authorize the first database to access the update status of other databases in the plurality of databases to be updated, so that the first database sends the database change request to the second database in the other databases that has not been updated. The receiving module is configured to receive a verification request sent by the first database. The verification request is sent by the first database after accessing the update status of other databases in the plurality of databases to be updated and determining that there is a second database in the other databases that has not been updated. The reset module is configured to verify the current state of the key value based on the verification request. If the current state of the key value is in the non-update stage, the key value will be reset to the update stage.

7. A database update system, characterized in that, This includes a client, a Python server, and several databases to be updated. The client is used to initiate a database change request to the Python server; The Python server receives database change requests from the client, generates a key value indicating the database update status, sets the initial state of the key value to the generation stage, sends the database change requests to the plurality of databases to be updated, and sets the key value from the generation stage to the update stage. The plurality of databases to be updated are used to receive database change requests sent by the Python server, and to complete the database update based on the database change requests when the key value is in the update phase, so as to obtain the update result; The Python server is also used to receive the update results of the plurality of databases to be updated. When the plurality of databases to be updated have completed the database update based on the database change request, the key value is set from the update stage to the completion stage, and a database update completion indication message is generated based on the key value that has been set to the completion stage and returned to the client. The Python server is also configured to, if the first database in the plurality of databases to be updated completes the database update based on the database change request, authorize the first database to access the update status of other databases in the plurality of databases to be updated, and enable the first database to send the database change request to the second database in the other databases that has not been updated. The system receives a verification request sent by the first database. The verification request is sent by the first database after it accesses the update status of other databases in the plurality of databases to be updated and determines that there is a second database in the other databases that has not been updated. Based on the verification request, the current state of the key value is verified. If the current state of the key value is not in the update stage, the key value is reset to the update stage.

8. The system according to claim 7, characterized in that, The plurality of databases to be updated includes a first database that has completed a database update based on the database change request and a second database that has not been updated based on the database change request. If the first database receives authorization information from the Python server granting access to the update status of other databases among the plurality of databases to be updated, then it sends the database change request to the second database.

9. An electronic device, characterized in that, include: Memory and processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the electronic device to perform the database update method according to any one of claims 1-5.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the database update method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Distributed data service processing method, system and device and storage medium

    CN110633320A