CN115309763A - Database updating method, device, system, equipment and computer medium - Google Patents

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

Info

Publication number
CN115309763A
CN115309763A CN202210972983.XA CN202210972983A CN115309763A CN 115309763 A CN115309763 A CN 115309763A CN 202210972983 A CN202210972983 A CN 202210972983A CN 115309763 A CN115309763 A CN 115309763A
Authority
CN
China
Prior art keywords
database
updating
databases
stage
key value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210972983.XA
Other languages
Chinese (zh)
Inventor
朱培航
杨彬
韩涛
赵亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202210972983.XA priority Critical patent/CN115309763A/en
Publication of CN115309763A publication Critical patent/CN115309763A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Abstract

The application provides a database updating method, a database updating device, a database updating system, a database updating device and a computer medium, wherein the method comprises the following steps: if a database change request is received, generating a key value for indicating the update state of the database, and setting the initial state of the key value as a generation stage; sending the database change request to a plurality of databases to be updated, and setting the key value from a generation stage to an update stage; and receiving the updating results of the databases to be updated, setting the key value from the updating stage to the completion stage if the databases to be updated all complete the updating of the databases based on the data change request, and generating a database updating completion indication message based on the key value set to the completion stage. By the method, the database is managed based on the form of the key value dynamic data block, and the consistency of database updating in the database chain can be effectively guaranteed.

Description

Database updating method, device, system, equipment and computer medium
Technical Field
The present application relates to the field of big data technologies, and in particular, to a database updating method, apparatus, system, device, and computer medium.
Background
With the continuous development of internet technology, in order to facilitate the storage and utilization of data, the updating mode of the database is also continuously improved.
The replication of the database is one of the database updating methods, and includes circular replication, master-slave replication, one-way replication, and the like, for example, circular replication among the methods, the database after circular replication can make the data of each query identical, but the database may collide during circular replication, so that the consistency of the database in the database chain cannot be guaranteed.
Therefore, it is necessary to provide a technical solution for guaranteeing the consistency of the database in the database chain when querying data.
Disclosure of Invention
In order to solve the above problem, that is, to solve the problem that the consistency of the database in the database chain cannot be guaranteed in the database updating process, the present application provides a database updating method, apparatus, system, device, and computer medium.
In order to achieve the above purpose, the present application provides the following technical solutions:
in a first aspect, the present application provides a database updating method, including:
if a database change request is received, generating a key value for indicating the update state of the database, and setting the initial state of the key value as a generation stage;
sending the database change request to a plurality of databases to be updated, and setting the key value from a generation stage to an update stage;
and receiving the updating results of the databases to be updated, setting the key value from the updating stage to the completion stage if the databases to be updated all complete the updating of the databases based on the data change request, and generating a database updating completion indication message based on the key value set to the completion stage.
In an embodiment, the key value is carried in the database change request, so that the databases to be updated are updated based on the key value set as the update stage.
In one embodiment, 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:
and if the first database in the databases to be updated completes database updating based on the data updating request, authorizing the first database to access the updating state of other databases in the databases to be updated, and enabling the first database to send the database changing request to a second database which is not subjected to database updating in the other databases.
In one embodiment, if a first database in the databases to be updated completes the database update based on the data update request, the method further includes:
receiving a verification request sent by the first database, wherein the verification request is sent when a second database which is not updated by the database exists in other databases after the first database accesses the update state of other databases in the databases to be updated,
checking the current state of the key value based on the checking request, and resetting the key value to be in an updating stage if the current state of the key value is in a non-updating stage.
In one embodiment, if a first database of the databases to be updated completes the database update based on the data update request, the method further includes:
acquiring first updating data obtained by the first database after completing data updating, and caching the first updating data;
and the first updating data is sent when a second database which is not updated by the database exists in other databases after the first database accesses the updating state of other databases in the databases to be updated.
In an embodiment, if the databases to be updated all complete the database update based on the data change request, before setting the key value from the update stage to the completion stage, the method further includes:
and if the second updating data after the second database completes data updating is the same as the first updating data, executing the key value from the updating stage to the completing stage.
In one embodiment, after generating the database update completion indication message based on the key value set to the completion phase, the method further includes:
sending the updating completion indication message to a client sending a database change request; and setting the key value from the completion stage to a destruction stage, and destroying the key value.
In a second aspect, the present application provides a database updating apparatus, including:
the system comprises a generating module, a sending module and a processing module, wherein the generating module is used for generating a key value for indicating the updating state of the database if a database change request is received, the key value comprises a generating stage, an updating stage and a finishing stage, and the state of the key value is set as the generating stage;
the state change module is used for sending the database change requests to a plurality of databases to be updated and setting the key values from the generation stage to the update stage;
and the updating indication module is set to set the key value from the updating stage to the completion stage if the plurality of databases to be updated all complete database updating based on the data change request, and generates a database updating completion indication message based on the key value set to the completion stage.
In a third aspect, the present application provides an electronic device, comprising: a memory and a processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored by the memory to cause the electronic device to perform the database update method.
In a third aspect, the present application provides a computer-readable storage medium having stored therein computer-executable instructions for implementing the database updating method when executed by a processor.
In a fourth aspect, the present application provides a database update system, which includes a client, a Python server, and a plurality of databases to be updated,
the client is used for initiating a database change request to the Python server;
the Python server is used for receiving the database change request sent by the client, generating a key value for indicating the update state of the database, setting the initial state of the key value as a generation stage, sending the database change request to the databases to be updated, and setting the key value from the generation stage to the update stage,
the databases to be updated are used for receiving a database change request sent by the Python server, and completing database updating based on the database change request when the key value is in an updating stage to obtain an updating result;
the Python server is further configured to receive update results of the databases to be updated, set the key value from the update stage to the completion stage when the databases to be updated all complete database update based on the data change request, generate a database update completion indication message based on the key value set to the completion stage, and return the message to the client.
In one embodiment, the plurality of databases includes a first database that completes a database update based on the data update request and a second database that does not perform a database update based on the data update request,
and if the first database receives authorization information which is sent by the Python server and authorizes the access to the update state of other databases in the databases to be updated, sending the database change request to the second database.
It can be understood that, according to the database update method, apparatus, system, device, and computer medium provided in the embodiments of the present application, when a database change request is received, a key value for indicating an update state of a database is generated, and an initial state of the key value is set as a generation stage; sending the database change requests to a plurality of databases to be updated, and setting the key values from a generation stage to an update stage; and receiving the updating results of the plurality of databases to be updated, setting the key value from the updating stage to the completion stage if the plurality of databases to be updated all complete database updating based on the data change request, and generating a database updating completion indication message based on the key value set to the completion stage. By the method, the database is managed based on the form of the key value dynamic data block, and the consistency of database updating in the database chain can be effectively guaranteed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
Fig. 1 is a schematic diagram of one possible scenario provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of a database updating method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of another database updating method according to an embodiment of the present application;
fig. 4 is a second possible scenario diagram provided by the embodiment of the present application;
fig. 5 is a schematic structural diagram of a database updating apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a database updating system according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
With the above figures, there are shown specific embodiments of the present application, which will be described in more detail below. These drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.
Detailed Description
It will be appreciated that the cyclically replicated database nodes, which replicate changes sent directly by the application server and from the database server node, are then processed and sent to the next database server node. Changes made at any one database server node will be replicated to the next server until every server in the chain has processed the update. Compared with single item replication and master-slave replication, circular replication can enable data of each query to be the same, because the final circular replication enables data of each node to be consistent, and a certain time delay exists between one-way replication and master-slave replication.
However, conflicts may occur in the circular replication of the database server because the way the database handles replication updates and database Query Language (SQL) direct statements from clients is parallel, and the consistency of all databases in the chain is not guaranteed. This is because the replication request may act on the column simultaneously with a direct request from either the client or the application server, and the direct request from the client may have updated the same row due to the time it takes to receive the replication update and process it, even though the initial event that triggered the replication from another server may occur first, in terms of the overall sequence of events.
In view of the above, embodiments of the present application provide a database update scheme, where a dynamic data block of a Python server is used to manage update consistency of a database, and specifically, the Python server receives a database update request and generates a dynamic key value for indicating an update state of the database, where the key value is updated and recorded along with an update stage of the database, and may be used to instruct each database to update, and set the key value to a complete state when all databases to be updated are completely updated, and when a client performs data query, may return data information with the key value being the complete state to the client, so as to effectively ensure consistency of the database.
In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the embodiments of the present application will be described in more detail below with reference to the accompanying drawings in the embodiments of the present application. 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 embodiments described are some, but not all embodiments of the disclosure. The embodiments described below with reference to the drawings are exemplary and intended to be used for explaining the present application and should not be construed as limiting the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
Fig. 1 is a schematic view of a possible scenario provided in the embodiment of the present application, and it should be noted that the database updating method disclosed in the present disclosure may be used in the field of big data. The method can also be used in any field except the big data field, and the application field of the database updating method is not limited.
Taking a database loop replication scenario as an example, as shown in fig. 1, the database loop replication scenario 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 with the python server 120, the python server 120 is electrically connected with each database, and the python server is used for receiving database change requests and data query requests of the client and sending the database change requests and the data query requests to each server. Optionally, in the process of updating the database, the python server 120 undertakes primary computing work, and the client 110 undertakes secondary computing work; the python server 120 undertakes the primary computational work and undertakes the computational work alone.
The client 110 may include, but is not limited to, a computer, a smart phone, a tablet computer, an e-book reader, a motion Picture experts group audio layer III (MP 3) player, a motion Picture experts group audio layer 4 (MP 4) player, a portable computer, a vehicle-mounted computer, a wearable device, a desktop computer, a set-top box, a smart television, and the like.
The Python server 120 is installed with a Python basic environment, and this embodiment implements database operation and management by using the data analysis processing function of Python, and it can be understood that mature modules in Python can selectively complete the above functions. In the embodiment, the python server is electrically connected with the client, receives the database change request of the client, records the update stage of each database in a dynamic data block mode, and effectively ensures the data consistency of each database in the data update process in a circulating copy mode and other modes.
Alternatively, the number of the terminals 110 or the python servers 120 may be more or less, which is not limited in the embodiment of the present application. In some embodiments, the terminal 110 and the python server 120 may also serve as nodes in the blockchain system to synchronize the database update result to other nodes in the blockchain, so as to achieve wide application of the database.
The scenario diagram of the present application is briefly described above, and the database updating method provided in the embodiment of the present application is described in detail below by taking the python server 120 applied in fig. 1 as an example.
In some embodiments, the method provided by the present application may also be applied to other servers, but is not limited to the python server 120 in this embodiment, and may be a server cluster or a distributed system formed by a plurality of physical servers, and may also be a cloud server that provides basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, content Delivery Network (CDN), and big data and artificial intelligence platform.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating a database updating method according to an embodiment of the present application, where the method includes steps S201 to S203.
Step S201, if a database change request is received, generating a key value for indicating the update state of the database, and setting the initial state of the key value as a generation stage.
In this embodiment, the database change request is a request initiated by a client to a python server, and may be a database circular copy request or other requests for database update operation, where the database change request may include database change information, such as application information, database information, and SQL statements, and the like, where the application information includes application information of the client that issued the database change request, the database information includes information of a database to be changed, such as identification information, index information, and the like, and the SQL statements, that is, SQL statements of data to be updated, perform data change at corresponding locations of the database.
It can be understood that, after receiving the database change request, the Python server generates a key value, and sets the key value as a generation phase, where the generation phase represents initial preparation of entering an update state of the database.
In one implementation, the Python server employs a RAM (Random Access Memory) caching technology, can withstand data change requests at high concurrency, and can dynamically manipulate keys, which coexist in four phases, generate (create), update (update), complete update (finish), and destroy (store).
Step S202, sending the database change requests to a plurality of databases to be updated, and setting the key values from the generation stage to the update stage.
The number of the databases to be updated may be one or more, and in a scenario of cyclically copying the databases, the number of the databases to be updated is usually multiple. In this embodiment, a Python server sends a database change request to each database to be updated, and sets the key value from the generation stage to the update stage.
In a preferred embodiment, the key value is carried in the database change request, so that the databases to be updated are updated based on the key value set as the update stage.
In combination with the scenario of cyclically copying the databases in fig. 1, if the first database receives a database update request, where the key value is in an update stage, the first database performs database update and completes operations according to the database update request, and other databases to be updated complete mutual copying according to the update content of the first database when receiving the database update request; in other implementations, if the key value in the database update request received by the first database, the second database and other databases is in the update stage, and the first database, the second database and other databases are respectively updated, the databases are mutually transmitted between every two databases to complete the database replication.
Step S203, receiving the updating results of the plurality of databases to be updated, setting the key value from the updating stage to the completion stage if the plurality of databases to be updated all complete the updating of the databases based on the data change request, and generating a database updating completion indication message based on the key value set to the completion stage.
In this embodiment, the Python server receives the update result of each database to be updated to determine whether each database to be updated is updated, and sets the key value as the completion stage after the update is completed, which indicates that all the update requests for the database are completed.
It can be understood that the database update completion indication message in this embodiment is used to indicate that all the databases to be updated of the database update request are updated, and when the client initiates data query, the obtained data query result can ensure high consistency regardless of which database the client queries.
Compared with the related art, the database end directly receives the database change request and completes the database updating operation, and for the synchronous updating process among a plurality of databases, especially the cyclic replication process, because the updating time difference exists among the databases or the databases do not enter the data replication process, the consistency of data updating may not be guaranteed, so that the data queried by different database nodes in the data query process are different.
Referring to fig. 3, fig. 3 is a schematic flow chart of another database updating method provided in this embodiment of the present application, based on the above embodiment, in this embodiment, in consideration of a situation that a partial database is not updated or an update is delayed in a data updating process, the updated database is authorized to update other databases to indicate the other databases to enter an updated state, and specifically, in an implementation manner, after the database change request is sent to a plurality of databases to be updated (step S202), and before the key value is set from the update stage to the completion stage (step S203), the following step S301 is further included.
Step S301, if a first database in the databases to be updated completes database update based on the data update request, authorizing the first database to access an update status of another database in the databases to be updated, so that the first database sends the database change request to a second database that is not updated in the another database.
Referring to fig. 4, after the first database completes 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, the update result carries a key value, the key value state key _1finish is returned, the Python server is requested to check the update state of the second database, and when the update is not performed, the key value is set to the update stage, and the key value of the second database is set to key _2update.
In a preferred embodiment, in consideration of the condition that the key value assignment fails, resulting in some databases not receiving a database change request or not entering an update state, and eventually causing out-of-synchronization among the databases to be updated, if a first database in the databases to be updated completes database update based on the data update request, the method further includes the following steps:
receiving a verification request sent by the first database, wherein the verification request is sent when a second database which is not updated by the database exists in other databases after the first database accesses the update state of other databases in the databases to be updated,
checking the current state of the key value based on the checking request, and resetting the key value to be in an updating stage if the current state of the key value is in a non-updating stage.
For example, the first database determines whether the other databases are not updated, and may confirm according to the key value states of the other databases, specifically, the key value is carried when Python sends a database change request to each database, each database modifies the key value state according to the respective update state, for example, the second database does not enter the update state, which modifies the key value to key _2create, and if the state of the second database (or other databases) is key _2update, key _ u 2finish, or key _2 delete, the Python server does not modify the key value state, and the first database does not need to synchronize data to the second database.
In one embodiment, if a first database of the databases to be updated completes the database update based on the data update request, the method further includes the following steps:
acquiring first updating data obtained by the first database after completing data updating, and caching the first updating data;
and the first updating data is sent when a second database which is not updated by the database exists in other databases after the first database accesses the updating state of other databases in the databases to be updated.
In this embodiment, the Python server uses an RAM cache technology, and after the first database completes the database update, the update data of the first database is cached, so that the update data can be checked to determine whether the update data conforms to the database update request, and the update data can be compared with the update data of other databases to verify the update consistency between different databases.
In one embodiment, if the databases to be updated all complete the database update based on the data change request, before setting the key value from the update stage to the completion stage (step S203), the method further includes the following steps:
and if the second updating data after the second database completes data updating is the same as the first updating data, executing the key value from the updating stage to the completing stage.
In this embodiment, a Python database is used to check whether the update data between the databases are the same, so as to further ensure the consistency of database update. Specifically, after the first database and the second database complete data updating, the updated data of the first database and the second database are returned to the Python database, and the Python database checks whether the updated data between the databases are the same based on the updated data returned by the first database and the second database.
It should be noted that the first database, the second database, and the first update data and the second update data in this embodiment are only used for distinguishing similar objects, and have no other meaning, where the first database and the second database may be the same type of database or different types of databases, and the first update data and the second update data may be the same data or different data.
In a preferred embodiment, after the database update is completed, the key value is destroyed, so as to avoid confusion among different database update processes, and at the same time, the cache pressure of the Python server can be effectively relieved, and after a database update completion indication message is generated based on the key value set as the completion stage (step S203), the method further includes the following steps:
sending the updating completion indication message to a client sending a database change request; and setting the key value from the completion stage to a destruction stage, and destroying the key value.
The update completion indication message may carry database information and update data information that have completed updating the database.
In order to facilitate understanding of the embodiments of the present application, the present application provides an exemplary embodiment, and in a scenario where there are more than two database nodes, the following process is performed:
a. firstly, a database change request is initiated by the app, and the data change request is simultaneously sent to the dynamic data block of python to generate a key value which can be changed.
The Python dynamic database adopts an RAM (random access memory) caching technology, can bear data change requests under high concurrency, can dynamically control keys, and can generate (create) and update (update) in four stages in a coexistence manner, and completes (finish) and destroys (destroy) the keys.
c. Because data updating has time delay, after the first database A is updated, the data is firstly returned to the python dynamic cache block, and the key is set to finish, at this time, the first database A can check the updating state of other databases.
d. If the state of other databases is create, the first database A will actively send update requests to other databases, and send related requests to the python dynamic data block, and set the database state as update. And directly returning the result to the python dynamic data block after the other data blocks are updated, and setting to finish after receiving the request.
e. If the other databases are in update, finish, and store states, then A will not access and synchronize data to other servers.
After receiving the request, the dynamic data block of python sets the change key of each data to create, and sends a change request to all servers, and at this time, the key becomes update. And returning to finish after all the databases are updated.
g. And finally, checking the key of the dynamic data block of the python, returning to the client, and destroying the key.
According to another aspect of the present application, there is also provided a database updating apparatus according to the embodiments of the present application, as shown in fig. 5, the database updating apparatus includes a generating module 51, a status changing module 52, and an update indicating module 53, wherein,
the generating module 51 is configured to generate a key value for indicating an update state of the database if a database change request is received, where the key value includes a generating stage, an updating stage, and a completing stage, and the state of the key value is set as the generating stage;
the state change module 52 is configured to send the database change request to a plurality of databases to be updated, and set the key value from the generation stage to the update stage;
and the update indicating module 53 is configured to set the key value from the update stage to the completion stage if the plurality of databases to be updated all complete database update based on the data change request, and generate a database update completion indicating message based on the key value set to the completion stage.
In an embodiment, the key value is carried in the database change request, so that the databases to be updated are updated based on the key value set as the update stage.
In one embodiment, the apparatus further comprises:
and the authorization access module is configured to authorize the first database to access the update state of other databases in the databases to be updated when the first database in the databases to be updated completes database update based on the data update request, so that the first database sends the database change request to a second database which is not updated in the other databases.
In one embodiment, the apparatus further comprises:
a receiving module, configured to receive a verification request sent by the first database, where the verification request is sent when the first database accesses an update state of another database in the databases to be updated and determines that a second database without database update exists in the other databases,
and the resetting module is set to check the current state of the key value based on the checking request, and if the current state of the key value is in a non-updating stage, the key value is reset to be in an updating stage.
In one embodiment, the apparatus further comprises:
the acquisition module is configured to acquire first update data obtained by the first database after completing data update and cache the first update data;
and the first updating data is sent when a second database which is not updated by the database exists in other databases after the first database accesses the updating state of other databases in the databases to be updated.
In one embodiment, the apparatus further comprises:
and the execution module is set to execute the key value from the updating stage to the completion stage when second updating data after the second database completes data updating is the same as the first updating data.
In one embodiment, the apparatus further comprises:
the sending and destroying module is configured to send the update completion indication message to a client sending a database change request; and setting the key value from the completion stage to a destruction stage, and destroying the key value.
According to a fourth aspect of the present application, there is also provided a database updating system according to the embodiments of the present application, as shown in fig. 6, the system includes a client 110, a Python server 120, and several databases 610 to be updated, wherein,
the client 110 is configured to initiate a database change request to the Python server;
the Python server 120 is configured to receive the database change request sent by the client 110, generate a key value indicating an update state of the database, set an initial state of the key value as a generation phase, send the database change request to the databases to be updated, set the key value from the generation phase to the update phase,
the databases 610 to be updated are configured to receive a database change request sent by the Python server 120, and complete database update based on the database change request when the key value is in an update stage, so as to obtain an update result;
the Python server 120 is further configured to receive an update result of the databases 610 to be updated, set the key value from the update stage to the completion stage when all the databases to be updated complete database update based on the data change request, generate a database update completion indication message based on the key value set to the completion stage, and return the message to the client 110.
In one embodiment, the plurality of databases includes a first database 130 that completes a database update based on the data update request and a second database 140 that does not perform a database update based on the data update request,
if the first database 130 receives authorization information that is sent by the Python server 120 and authorizes access to the update status of other databases in the databases to be updated, the database change request is sent to the second database.
According to another aspect of the present application, there is correspondingly provided an electronic device, as shown in fig. 7, the electronic device includes: a memory 71 and a processor 72;
the memory 71 stores computer-executable instructions;
the processor 72 executes computer-executable instructions stored by the memory 71 to cause the electronic device to perform the database update method.
According to yet another aspect of the present application, an embodiment of the present application correspondingly provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, the computer-executable instructions are used to implement the database updating method.
The present invention also provides a computer program product, which includes a computer program code, and when the computer program code runs on a computer, the computer executes the database updating method.
The embodiment of the present application correspondingly provides a chip, which includes a memory and a processor, where the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, and execute the database updating method.
It will be understood by those of ordinary skill in the art that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. In a hardware implementation, the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation. Some or all of the 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. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media).
The term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as is well known to those of ordinary skill in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by a computer.
In addition, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as is well known to those skilled in the art.
In the description of the embodiments of the present application, the term "and/or" merely represents an association relationship describing an associated object, and means that three relationships may exist, for example, a and/or B may represent: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" means any one of a variety or any combination of at least two of a variety, for example, including at least one of A, B, and may mean any one or more elements selected from the group consisting of A, B and C communication. Further, the term "plurality" means two or more unless specifically stated otherwise.
In the description of the embodiments of the present application, the terms "first," "second," "third," "fourth," and the like (if any) are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (12)

1. A database update method, comprising:
if a database change request is received, generating a key value for indicating the update state of the database, and setting the initial state of the key value as a generation stage;
sending the database change request to a plurality of databases to be updated, and setting the key value from a generation stage to an update stage;
and receiving the updating results of the plurality of databases to be updated, setting the key value from the updating stage to the completion stage if the plurality of databases to be updated all complete database updating based on the data change request, and generating a database updating completion indication message based on the key value set to the completion stage.
2. The method according to claim 1, wherein the key value is carried in the database change request, so that the databases to be updated are updated based on the key value set as an update stage.
3. The method of claim 1, 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, further comprising:
and if the first database in the databases to be updated completes database updating based on the data updating request, authorizing the first database to access the updating state of other databases in the databases to be updated, and enabling the first database to send the database changing request to a second database which is not subjected to database updating in the other databases.
4. The method of claim 3, wherein if a first database of the plurality of databases to be updated completes a database update based on the data update request, the method further comprises:
receiving a verification request sent by the first database, wherein the verification request is sent when a second database which is not updated by the database exists in other databases after the first database accesses the update state of other databases in the databases to be updated,
checking the current state of the key value based on the checking request, and resetting the key value to be in an updating stage if the current state of the key value is in a non-updating stage.
5. The method of claim 3, wherein if a first database of the plurality of databases to be updated completes a database update based on the data update request, the method further comprises:
acquiring first updating data obtained by the first database after completing data updating, and caching the first updating data;
and the first updating data is sent when a second database which is not updated by the database exists in other databases after the first database accesses the updating state of other databases in the databases to be updated.
6. The method of claim 5, wherein if the databases to be updated all complete database updating based on the data change request, before setting the key value from the updating stage to the completing stage, further comprising:
and if the second updating data after the second database completes data updating is the same as the first updating data, the key value is executed from the updating stage to the completing stage.
7. The method of claim 1, further comprising, after generating the database update complete indication message based on the key value that has been placed into the completion phase:
sending the updating completion indication message to a client sending a database change request; and setting the key value from the completion stage to a destruction stage, and destroying the key value.
8. A database updating apparatus, comprising:
the system comprises a generating module, a sending module and a processing module, wherein the generating module is used for generating a key value for indicating the updating state of the database if a database change request is received, the key value comprises a generating stage, an updating stage and a finishing stage, and the state of the key value is set as the generating stage;
the state change module is arranged for sending the database change requests to a plurality of databases to be updated and setting the key values from a generation stage to an update stage;
and the updating indication module is set to set the key value from the updating stage to the completion stage if the databases to be updated all complete the database updating based on the data change request, and generates a database updating completion indication message based on the key value set to the completion stage.
9. A database updating system is characterized by comprising a client, a Python server and a plurality of databases to be updated, wherein,
the client is used for initiating a database change request to the Python server;
the Python server is used for receiving the database change request sent by the client, generating a key value for indicating the update state of the database, setting the initial state of the key value as a generation stage, sending the database change request to the databases to be updated, and setting the key value from the generation stage to the update stage,
the databases to be updated are used for receiving a database change request sent by the Python server, and completing database updating based on the database change request when the key value is in an updating stage to obtain an updating result;
the Python server is further configured to receive update results of the databases to be updated, set the key value from the update stage to the completion stage when the databases to be updated all complete database update based on the data change request, generate a database update completion indication message based on the key value set to the completion stage, and return the message to the client.
10. The system of claim 9, wherein the plurality of databases comprises a first database that performs database updates based on the data update request and a second database that does not perform database updates based on the data update request,
and if the first database receives authorization information which is sent by the Python server and authorizes the access to the update state of other databases in the databases to be updated, sending the database change request to the second database.
11. An electronic device, comprising: a memory and a processor;
the memory stores computer-executable instructions;
the processor executes the computer-executable instructions stored by the memory to cause the electronic device to perform the database update method of any of claims 1-7.
12. A computer-readable storage medium having computer-executable instructions stored therein, which when executed by a processor, are configured to implement the database update method of any one of claims 1-7.
CN202210972983.XA 2022-08-15 2022-08-15 Database updating method, device, system, equipment and computer medium Pending CN115309763A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210972983.XA CN115309763A (en) 2022-08-15 2022-08-15 Database updating method, device, system, equipment and computer medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210972983.XA CN115309763A (en) 2022-08-15 2022-08-15 Database updating method, device, system, equipment and computer medium

Publications (1)

Publication Number Publication Date
CN115309763A true CN115309763A (en) 2022-11-08

Family

ID=83862548

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210972983.XA Pending CN115309763A (en) 2022-08-15 2022-08-15 Database updating method, device, system, equipment and computer medium

Country Status (1)

Country Link
CN (1) CN115309763A (en)

Similar Documents

Publication Publication Date Title
CN109189751B (en) Data synchronization method based on block chain and terminal equipment
CN106899648B (en) Data processing method and equipment
CN108280080B (en) Data synchronization method and device and electronic equipment
CN110888858B (en) Database operation method and device, storage medium and electronic device
CN107402821B (en) Access control method, device and equipment for shared resources
EP4310689A1 (en) Data archiving method and apparatus, device, storage medium, and computer program product
CN107580032B (en) Data processing method, device and equipment
US20200125453A1 (en) Systems and methods for cross-regional back up of distributed databases on a cloud service
CN114328029B (en) Backup method and device of application resources, electronic equipment and storage medium
CN107967265B (en) File access method, data server and file access system
CN103905512A (en) Data processing method and equipment
CN108090152B (en) Data synchronization method and system
CN115098528B (en) Service processing method, device, electronic equipment and computer readable storage medium
CN115309763A (en) Database updating method, device, system, equipment and computer medium
JP6233846B2 (en) Variable-length nonce generation
CN110532243A (en) Data processing method, device and electronic equipment
CN115510161A (en) Data synchronization method, device, equipment and storage medium
CN114757777A (en) Optimal link selection method and device for block chain and electronic equipment
CN117010889A (en) Data processing method, device, equipment, medium and product
CN115022307A (en) File downloading method and device, storage medium and electronic equipment
CN113590711A (en) High-elasticity extensible multi-chain data hierarchical shared storage system and method
CN113760519A (en) Distributed transaction processing method, device and system and electronic equipment
CN113468215A (en) Data processing method and device, electronic equipment and computer storage medium
CN111382200A (en) Information loading method and device, server and storage medium
NL2032902B1 (en) User data management method, device, terminal apparatus and medium

Legal Events

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