Disclosure of Invention
In order to solve the technical problems, the application provides a service lock-based data synchronization method and device, electronic equipment and storage medium, which are used for providing a data synchronization scheme in a data storage system with multiple write sources and multiple databases.
In one aspect, the present application provides a service lock-based data synchronization method, the method being suitable for processing data synchronization in a data storage system of a multi-write source multi-database, comprising:
configuring a service lock of a data table for a writing source based on a data writing request of the writing source; the data writing request carries the identification of the writing source and the identification of the data table;
analyzing the synchronous task corresponding to the data writing request;
and executing the synchronization task to make the data of the data tables stored in the databases consistent.
Further alternatively, in the method as described above, configuring a service lock of a data table for the write source includes: and configuring the information of the service lock, wherein the information of the service lock comprises the identification of the writing source, the identification of the data table and the state of the service lock, and the state of the service lock is set to be occupied.
Further optionally, in the method as described above, analyzing the synchronization task corresponding to the data writing request includes: analyzing the synchronous task corresponding to the data writing request, and arranging and generating a task chain, wherein the task chain at least sequentially comprises: creating a synchronous task, executing the synchronous task and deleting the synchronous task;
or after the creation of the synchronization task in the task chain and before the execution of the synchronization task, a data writing task is further included.
Further optionally, in the method as described above, after configuring a service lock of the data table for the write source, before parsing a synchronization task corresponding to the data write request, the method further includes:
creating a task corresponding to the data writing request, and storing a task identifier and a corresponding task state in a task management database; the task state is unexecuted;
correspondingly, before analyzing the synchronous task corresponding to the data writing request, the method further comprises the following steps:
and acquiring the unexecuted task from the task management database.
Further optionally, in the method as described above, performing the synchronization task includes:
scheduling a plurality of task executors on a main node server to execute each task in the task chain respectively;
Modifying the state of the corresponding task in the task management database into execution;
before the task executors on the dispatching master node server execute the tasks in the task chain respectively, the method further comprises the following steps:
each of the plurality of servers controlling the deployment detects whether itself is a master node server.
Further alternatively, in the method as described above, controlling each of the plurality of deployed servers to detect whether itself is a master node server includes:
controlling each server to send a main selection request carrying a node identifier of the server and the task identifier to a main selection module; and detecting whether other servers execute the tasks corresponding to the task identifiers by the main selection module, if not, setting the servers as main node servers, and feeding back detection results to the servers.
Further optionally, in the method as described above, after performing the synchronization task, the method further includes:
modifying the state of the corresponding task in the task management database to be finished;
and modifying the state of the service lock in the configured information of the service lock to be released.
In another aspect, the present application further provides a service lock-based data synchronization apparatus, the apparatus being adapted to process data synchronization in a data storage system of a multi-write source multi-database, including:
the lock service component is used for configuring a service lock of a data table for a writing source based on a data writing request of the writing source; the data writing request carries the identification of the writing source and the identification of the data table;
the task scheduler is used for analyzing the synchronous task corresponding to the data writing request;
and the task executor is used for executing the synchronous task so that the data of the data tables stored in the databases are consistent.
In yet another aspect, the present application further provides an electronic device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of the preceding claims.
In yet another aspect, the present application also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the method of any one of the above.
One embodiment of the above application has the following advantages or benefits: configuring a service lock of a data table for a write source by a data write request based on the write source; the data writing request carries the identification of a writing source and the identification of a data table; analyzing a synchronous task corresponding to the data writing request; the synchronization task is executed, so that the data of the data tables stored in each database are consistent, a complete data synchronization mechanism suitable for a data storage system of multiple write-in sources and multiple databases can be provided, the data synchronization operation can be executed under the protection of a service lock configured during data writing, the safety of the data synchronization operation and the accuracy of the data are ensured, and the consistency of the data among the databases can be effectively ensured.
Furthermore, the method and the device can also adopt the task management database to comprehensively manage all the tasks, and under the dispatching of the task dispatcher, the main node server selects and executes the unexecuted tasks, so that the execution safety of the synchronous tasks and the accuracy of data can be effectively ensured.
Furthermore, the method and the device can update the state of the task in task execution, avoid the task from being executed for multiple times, and ensure the accuracy of data synchronization and the consistency of data. Meanwhile, the state of the service lock can be updated in time, and the safety of data in the system can be effectively ensured.
Other effects of the above alternative will be described below in connection with specific embodiments.
Detailed Description
Exemplary embodiments of the present application are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present application to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
FIG. 1 is a schematic diagram of a first embodiment of the present application, and as shown in FIG. 1, a service lock-based data synchronization method is described in detail, and the method is applicable to data synchronization in a data storage system for processing multiple write sources and multiple databases, and may specifically include the following steps:
s101, configuring a service lock of a data table for a writing source based on a data writing request of the writing source; the data writing request carries the identification of a writing source and the identification of a data table;
the execution main body of the service lock-based data synchronization method of the embodiment may be a service lock-based data synchronization device, where the service lock-based data synchronization device may be disposed in a multi-write source multi-database data storage system, and is configured to establish a corresponding service lock when writing data into a storage database from a write source, and further implement data synchronization between databases based on the service lock, so as to ensure accuracy and consistency of data in the data storage system.
For example, fig. 2 is an application architecture diagram of a data storage system with multiple write sources and multiple databases according to the present embodiment. As shown in fig. 2, taking an example of two databases including a and B, wherein the database a is responsible for data writing operation, the database B is responsible for data reading operation, and the data of the database B is synchronized by the data in the database a. C and D are two sources of data writing, where C may be a user and D represents a data administrator.
When the user C modifies a piece of data in the database a, the data manager D modifies the same data before the data in the database a is synchronized to the database B, and at this time, after the data synchronization is completed, the modification made by the user C is covered, and it cannot be known whether the operation of the user C is successful. Therefore, in the context of multiple write sources and multiple databases, it is desirable to provide a service lock-based data synchronization mechanism to ensure data consistency and accuracy.
The embodiment shown in fig. 2 uses two writing sources as an example, and in practical application, there may be other more users writing to the database a. In addition, optionally, other databases may be further included in the present embodiment, and during synchronization, the data in database a may be used to synchronize the data in other databases.
Specifically, the writing source in this embodiment may be a data administrator, that is, an administrator of the data storage system, or may be a general user. When in use, a user can log in the client of the data storage system to initiate a data writing request, for example, the data writing request can carry an identifier of a writing source and an identifier of a data table for requesting data writing. Wherein the identification of the write source is used to uniquely identify the write source. For example, if there are multiple data administrators in the system, the corresponding data Administrator identifiers may be respectively an administtrator 1, an administtrator 2, and the User identifiers may be a User1, a User2, and the like. The identification of the data table in this embodiment may specifically be the name of the data table.
The data write request of this embodiment may be a request initiated by way of an interface call, for example, the request may be a hypertext transfer protocol (hypertext transfer protocol; http) request.
For example, the data writing request in this embodiment may also be considered as a locking request initiated by a writing source, where the writing source initiates the request, and is used to request the data processing apparatus to configure a service lock of the data table for the writing source first, so that the writing source occupies the operation right of the data table, and can perform a data writing operation on the data table. However, since the data manager and any user can perform data writing operation on the data table, the data synchronizer based on the service lock can detect whether the operation right of the data table is occupied by the manager or other users after receiving the request; if the operation right is occupied, the operation right of the data table is fed back to the writing source, and the operation is ended. Otherwise, if not, a service lock of the data table can be configured for the writing source, so that a data maintenance period can be entered, the writing source can occupy the operation right of the data table, and the data table can be operated.
For example, in this embodiment, a piece of service lock information may be directly configured, so as to configure the service lock of the data table for the write source. The information of the service lock includes the identification of the write source, the identification of the data table, and the status of the service lock, which needs to be set to be occupied because the service lock is configured for the write source. For each unoccupied data table, the service lock-based data synchronization device may configure service lock information for the write source that first requests the operation right of the data table in the above manner, and store the information, which is equivalent to allocating a service lock for the write source. In practical applications, the information of all service locks can be stored one by one in a list manner.
Further, the information of the service lock may further include information such as an establishment time of the service lock, so that when the service lock is forgotten and is not released in time, an expiration time period may be set, and when the service lock occupies a time period exceeding the expiration time period, the service lock may be forcedly released. In this embodiment, the state of the service lock may be set to released or released according to different scenes.
Further alternatively, if the write source is a data manager, since the data manager usually modifies a larger amount of data, the write time is longer, and the synchronization time is longer, at this time, in addition to configuring the service lock information, a locking operation needs to be separately performed on the data table in the storage database, so as to ensure the security and accuracy of the data when the data table is subjected to the data write operation by the data manager. While multiple write sources are common users, it is contemplated that common users typically modify a smaller amount of data without having to perform a locking operation on the data table separately in the storage database. Only by configuring information of one service lock.
S102, analyzing a synchronous task corresponding to a data writing request;
s103, executing a synchronization task to make the data of the data tables stored in the databases consistent.
Under the limitation of the step S101, when the writing source writes data, after the service lock is configured for the data table to be written by the writing source, the data writing operation can be executed.
Since the data storage system of the present embodiment includes a plurality of databases, in order to ensure data consistency among the databases, in the present embodiment, it is necessary to perform data synchronization after data writing. Specifically, the synchronous task corresponding to the data writing request can be analyzed first, and a corresponding task chain can be arranged and generated.
In this embodiment, in order to ensure the data writing effect, different ways may be set for writing by the user and the data administrator, for example, writing by the user involves a small amount of data, and writing by the user may be set to writing in time; the writing of the data manager involves large data volume, and the writing of the data manager can be non-timely writing.
For timely writing of a user, data writing operation information can be directly carried in a data writing request; for non-timely writing by a data manager, the data writing operation information may not be carried in the data writing request. At this time, the synchronous task corresponding to the data writing request is analyzed, and the generated task chain can be arranged to sequentially comprise the steps of creating the synchronous task, writing the data into the task, executing the synchronous task and deleting the synchronous task. The data writing operation information of the present embodiment includes, but is not limited to, writing, updating, deleting of data.
In the above embodiment, the tasks in the two cases of parsing are only two examples, and in the actual scenario, other more tasks may be parsed according to the actual data writing request, which is not described in detail herein.
The data manager applies for locking firstly, after the locking is successful, the data manager performs data writing operation firstly, after the writing operation is finished, the data manager can apply for releasing the lock firstly, and trigger the synchronous task to start when the service lock is released in the storage database, but the state of the service lock in the information of the service lock configured at the moment is still in the release state, at the moment, the data table is still in a data maintenance period, and other users or the data manager cannot occupy the operation right of the data table. At this time, since the data writing operation is completed, the synchronous task corresponding to the data writing request is parsed, and the task chain generated by arranging may sequentially include creating the synchronous task, executing the synchronous task, and deleting the synchronous task.
Finally, executing the synchronous task, for example, executing each task in the task chain generated by arranging after analysis, in this embodiment, a plurality of task executors may be adopted to execute each task in the task chain respectively. In this embodiment, the synchronization task is synchronization with the data table as granularity, that is, synchronizing the whole data table in which data writing occurs in the storage database to other databases, so that the data of the data tables stored in the databases are consistent.
According to the service lock-based data synchronization method, a service lock of a data table is configured for a writing source through a data writing request based on the writing source; the data writing request carries the identification of a writing source and the identification of a data table; analyzing a synchronous task corresponding to the data writing request; the synchronization task is executed, so that the data of the data tables stored in each database are consistent, a complete data synchronization mechanism suitable for a data storage system of multiple write-in sources and multiple databases can be provided, the data synchronization operation can be executed under the protection of a service lock configured during data writing, the safety of the data synchronization operation and the accuracy of the data are ensured, and the consistency of the data among the databases can be effectively ensured.
Fig. 3 is a schematic view of a second embodiment of the present application. As shown in fig. 3, the present embodiment describes in detail a data synchronization scheme in a data storage system of a multi-write source multi-database. As shown in fig. 3, the service lock-based data synchronization method of the present embodiment may specifically include the following steps:
s301, a lock service component in a service lock-based data synchronization device receives a data writing request of a writing source; the data writing request carries an identification of a writing source and an identification of a data table;
s302, the lock service component detects whether the operation right of the data table is occupied; if the operation right of the data table is already occupied, step S303 is executed; otherwise, executing step S304;
specifically, in this embodiment, information of each service lock in the storage database is recorded in the lock service component, and each piece of information of the service lock may include an identifier of a writing source, that is, an identifier of a person applying for the service lock, a name of a data table, and a state of the service lock, for example, the state of the service lock may include: occupancy, release, and released. The lock service component can detect whether the operation right of the data table is occupied according to the recorded information of all service locks.
In practical applications, for a released service lock, only a certain length of time may be reserved in the lock service component, and the information of the corresponding service lock may be deleted.
S303, the lock service component returns the message that the operation right of the data table is occupied to the writing source; and (5) ending.
S304, the lock service component configures information of the service lock;
s305, the task dispatcher creates a synchronous task corresponding to the data writing request, and stores the task identification and the corresponding task state in a task management database;
the task created at this time is not yet executed, and the task state is set to be unexecuted correspondingly. In subsequent operations, the task state may also be in execution or already executed.
All data synchronization tasks of the data storage system may be recorded in the task management database one by one.
S306, the task dispatcher acquires unexecuted synchronous tasks from the task management database; analyzing the data writing request corresponding to the task to obtain a corresponding task chain;
for example, if the user is a write source, the corresponding task chain is to create a sync task, write data to a task, execute a sync task, and delete a sync task. If the data manager is a writing source, the corresponding task chain is to create a synchronous task, execute the synchronous task and delete the synchronous task.
S307, the task scheduler schedules a plurality of task executors on the main node server to execute each task in the task chain respectively;
s308, the task dispatcher modifies the state of the corresponding task in the task management database into execution;
first, the task scheduler needs to select a master node server that performs the task from a plurality of servers deployed. The specific operation process can be as follows: the task scheduler controls each of the plurality of deployed servers to detect whether the server itself is a master node server. When the detection is carried out, each server can send a main selection request carrying the node identification and the task identification of the server to the main selection module; and detecting whether other servers execute tasks corresponding to the task identifiers by the main selection module, if not, setting the servers as the main node servers, and feeding back detection results to the servers. Meanwhile, the main selection module also records the identification of the main node server and the identification of the task to be executed in the main selection module.
It should be noted that, a set of task executors on multiple servers are service instances where one service is deployed on different servers, in the task execution process, it is possible that multiple sets of task executors can all obtain unexecuted tasks, but each server can ignore tasks and not execute tasks if determining itself to be a non-master node server through detection of a master module; if the server is the master node server, the task of data synchronization is performed. Naturally, if there is only one server, all the servers need to execute the detection, and the detection of the master node is not needed.
In the process of executing the synchronous task, the task executor can acquire the data in the data table from a source database (such as a storage database); then converting the data into a data format which is adapted to the target database through a data adapter; further, the data converted by the data adapter is stored in the target database, so that the data in the data table in the target data are synchronously updated. That is, in the synchronization process, the data table is used as granularity synchronization.
S309, after the task scheduler detects that the execution of the task executors on the main node server is finished, modifying the state of the corresponding task in the task management database to be finished;
s310, a task dispatcher feeds back that the task of the lock service assembly is executed;
s311, the lock service component modifies the state of the service lock in the information of the configured service lock to released.
The process of this embodiment is emphasized on the execution of the synchronization task based on the data of the service lock. The set-up and release process of the service lock of this embodiment may also vary from one write source to another.
For example, the writing source is a user, referring to the technical solution of this embodiment, step S301 may be considered as a locking request applied while writing data, and step S304 is a configuration of the service lock, where a separate locking operation is not required to be performed in the storage database. According to the steps of the present embodiment, writing of data is completed in the process of executing the synchronization task.
If the write source is a data management source, as in the above embodiment, there is no data write operation in the synchronization task. After the service lock is configured in step S304, before step S305, the following steps may be further included:
(a) Performing a locking operation on the data table in a storage database; and returns a successful locking message to the data manager;
(b) Performing a data write operation in the storage database based on a data write operation performed by the data manager;
(c) After the data writing operation of the data manager is completed, a lock releasing request is initiated; the lock release request may include an identification of the data manager and a name of the data table;
(d) The lock service component receives a lock release request of a data manager and detects whether the data table meets a release condition; if yes, executing step (e); otherwise, returning to the data manager, and ending if the release condition is not satisfied.
In this embodiment, detecting whether the data table meets the release condition may specifically include detecting whether a service lock of the data table exists, expires, and is occupied by a current data administrator; if the service lock of the data table does exist and is not expired and is occupied by the current data manager, determining that a release condition is met; otherwise, if the service lock of the data table does not exist, or the service lock of the data table has expired, or the service lock is not occupied by the current data manager, the release condition is not satisfied.
Specifically, if the release condition is not satisfied, error information may be further returned to the data administrator, for example, the error information may include, but is not limited to, "operation authority of the data table is not obtained", "operation authority of the data table is expired", "request parameter is wrong", and the like.
(e) The lock service component requests the task scheduler to release the lock for the data table;
(f) The task scheduler releases the service lock of the data table configured by the data manager in the storage database;
(g) The lock service component modifies the state of the service lock in the information of the configured service lock to be in release; and returning the message in service lock release to the data manager; the synchronization task may then be performed starting from step S305.
Further, after step S310, the lock service component may also feed back the results to the write source. If the writing source is a user, the completion of data writing can be directly fed back to the user due to the link established by the previous request. If the write source is a data manager, the previously established request link is released, and the service component needs to inform the data manager that the service lock is released. For example, the notification service component may notify the data manager of the released completed message by way of a short message or mail.
Further, in this embodiment, in order to avoid a situation that a data administrator forgets to apply for releasing a lock after importing data is completed, and the data table cannot be released, the lock service component sets an expiration time for each service lock, and may further set a timing detection service component to periodically check the service lock, and check whether the service lock is overtime, that is, periodically detect whether the occupation time of the configured service lock exceeds a preset time length; when the occupied time of the service lock exceeds the preset time length, the service lock is considered to be out of date, the service lock is notified to the lock service component to automatically release the service lock, and the service lock is notified to the task dispatcher to release the service lock in the storage database by the lock service component; and notifies the data manager of the lock release message through the notification service. When the service locks are configured, the lock service component records the occupation starting time of each service lock and can be recorded in the information of the service lock. The preset time period may be set according to actual experience.
By adopting the technical scheme, the data synchronization method based on the service lock can provide a complete data synchronization mechanism suitable for the data storage system of multiple write-in sources and multiple databases, can execute data synchronization operation under the protection of the service lock configured during data writing, ensures the safety of the data synchronization operation and the accuracy of the data, and can also effectively ensure the consistency of the data among the databases.
In addition, in the embodiment, the task management database is adopted to comprehensively manage all tasks, and under the dispatching of the task dispatcher, the main node server selects and executes the unexecuted tasks, so that the execution safety of the synchronous tasks and the accuracy of data can be effectively ensured.
Furthermore, in the embodiment, the state of the task can be updated in the task execution process, so that the task is prevented from being executed for multiple times, and the accuracy of data synchronization and the consistency of data are ensured. Meanwhile, the state of the service lock can be updated in time, and the safety of data in the system can be effectively ensured.
Fig. 4 is an application architecture diagram of the embodiment shown in fig. 3. As shown in fig. 4, in this embodiment, a lock service component, a task scheduler, a task executor, a data adapter, a timing detection service component, and the like are included in the service lock-based data synchronization apparatus. The present embodiment includes four task executors, for example: creating a task executor (Create Task Executor), updating a data executor (Update Data Executor), synchronizing a task executor (SyncTask Executor), deleting a task executor (Delete Task Executor). And the embodiment shown in fig. 4 is exemplified by two databases including a source database and a target database. The data processing method according to the embodiment shown in fig. 3 may implement corresponding data processing in the application architecture shown in fig. 4.
FIG. 5 is a schematic diagram according to a third embodiment of the present application; as shown in fig. 5, the service lock-based data synchronization apparatus 500 of the present embodiment is suitable for processing data synchronization in a data storage system of multiple write sources and multiple databases, and includes:
the lock service component 501 is configured to configure a service lock of a data table for a write source based on a data write request of the write source; the data writing request carries the identification of a writing source and the identification of a data table;
the task scheduler 502 is configured to parse a synchronous task corresponding to the data writing request;
the task executor 503 is configured to execute a synchronization task so that data of the data tables stored in the respective databases are identical.
Further, in the service lock-based data synchronization apparatus 500 of the present embodiment, a lock service component 501 is configured to configure service lock information, where the service lock information includes an identifier of a writing source, an identifier of a data table, and a status of the service lock, and the status of the service lock is set to be occupied.
Further, in the service lock-based data synchronization device 500 of the present embodiment, the task scheduler 502 is configured to parse a synchronization task corresponding to a data writing request, and schedule and generate a task chain, where the task chain at least sequentially includes: creating a synchronous task, executing the synchronous task and deleting the synchronous task;
Or after the synchronous task is created in the task chain and before the synchronous task is executed, a data writing task is further included.
Further, in the service lock-based data synchronization device 500 of the present embodiment, the task scheduler 502 is further configured to:
creating a task corresponding to the data writing request, and storing a task identifier and a corresponding task state in a task management database; the task state is unexecuted;
the task scheduler 502 is further configured to obtain an unexecuted task from the task management database.
Further, in the service lock-based data synchronization device 500 of the present embodiment, the task scheduler 502 is specifically configured to:
scheduling a plurality of task executors 503 on the master node server to execute each task in the task chain, respectively;
modifying the state of the corresponding task in the task management database into execution;
the task scheduler 502 is further configured to control each of the plurality of deployed servers to detect whether the server is itself a master node server.
Further, in the service lock-based data synchronization apparatus 500 of the present embodiment, the task scheduler 502 is further configured to:
controlling each server to send a main selection request carrying a node identifier and a task identifier of the server to a main selection module; and detecting whether other servers execute tasks corresponding to the task identifiers by the main selection module, if not, setting the servers as the main node servers, and feeding back detection results to the servers.
Further, in the service lock-based data synchronization device 500 of the present embodiment, the task executor 503 is further configured to modify the state of the corresponding task in the task management database to be executed; in particular by the task executor 503 which performs the delete sync task.
The lock service component 501 is also operable to modify the status of a service lock in the information of a configured service lock to released.
Further optionally, the service lock-based data synchronization device 500 of the present embodiment may further include the timing detection service component shown in fig. 4, and details of the foregoing description of the embodiment shown in fig. 4 may be referred to, which is not described herein.
The implementation principle and technical effects of the service lock-based data synchronization device 500 in this embodiment for implementing the service lock-based data synchronization process by using the above components are the same as those of the related method embodiments, and detailed descriptions of the related method embodiments may be referred to and will not be repeated here.
According to embodiments of the present application, an electronic device and a readable storage medium are also provided.
As shown in fig. 6, a block diagram of an electronic device implementing a service lock-based data synchronization method according to an embodiment of the present application is shown. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the application described and/or claimed herein.
As shown in fig. 6, the electronic device includes: one or more processors 601, memory 602, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions executing within the electronic device, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In other embodiments, multiple processors and/or multiple buses may be used, if desired, along with multiple memories and multiple memories. Also, multiple electronic devices may be connected, each providing a portion of the necessary operations (e.g., as a server array, a set of blade servers, or a multiprocessor system). One processor 601 is illustrated in fig. 6.
Memory 602 is a non-transitory computer-readable storage medium provided herein. Wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the service lock based data synchronization method provided herein. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the service lock based data synchronization method provided by the present application.
The memory 602 is used as a non-transitory computer readable storage medium for storing non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules (e.g., the components shown in fig. 5) corresponding to the service lock-based data synchronization method in the embodiments of the present application. The processor 601 executes various functional applications of the server and data processing by running non-transitory software programs, instructions and modules stored in the memory 602, i.e., implements the service lock-based data synchronization method in the above-described method embodiments.
The memory 602 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, at least one application program required for a function; the storage data area may store data created by the use of an electronic device implementing a service lock-based data synchronization method, and the like. In addition, the memory 602 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 602 optionally includes memory remotely located with respect to processor 601, which may be connected via a network to an electronic device implementing a service lock based data synchronization method. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device implementing the service lock-based data synchronization method may further include: an input device 603 and an output device 604. The processor 601, memory 602, input device 603 and output device 604 may be connected by a bus or otherwise, for example in fig. 6.
The input device 603 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device implementing the service lock based data synchronization method, such as a touch screen, keypad, mouse, trackpad, touch pad, pointer stick, one or more mouse buttons, trackball, joystick, etc. input devices. The output means 604 may include a display device, auxiliary lighting means (e.g., LEDs), tactile feedback means (e.g., vibration motors), and the like. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device may be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASIC (application specific integrated circuit), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
These computing programs (also referred to as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented in a high-level procedural and/or object-oriented programming language, and/or in assembly/machine language. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
According to the technical scheme of the embodiment of the application, the service lock of the data table is configured for the writing source through the data writing request based on the writing source; the data writing request carries the identification of a writing source and the identification of a data table; analyzing a synchronous task corresponding to the data writing request; the synchronization task is executed, so that the data of the data tables stored in each database are consistent, a complete data synchronization mechanism suitable for a data storage system of multiple write-in sources and multiple databases can be provided, the data synchronization operation can be executed under the protection of a service lock configured during data writing, the safety of the data synchronization operation and the accuracy of the data are ensured, and the consistency of the data among the databases can be effectively ensured.
According to the technical scheme of the embodiment of the application, the task management database can be used for comprehensively managing all tasks, and under the dispatching of the task dispatcher, the main node server selects and executes the unexecuted tasks, so that the execution safety of the synchronous tasks and the accuracy of data can be effectively ensured.
According to the technical scheme of the embodiment of the application, the state of the task can be updated in task execution, so that the task is prevented from being executed for multiple times, and the accuracy of data synchronization and the consistency of data are ensured. Meanwhile, the state of the service lock can be updated in time, and the safety of data in the system can be effectively ensured.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present application may be performed in parallel, sequentially, or in a different order, provided that the desired results of the technical solutions disclosed in the present application can be achieved, and are not limited herein.
The above embodiments do not limit the scope of the application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application are intended to be included within the scope of the present application.