Data management method and device, program product, equipment and storage medium
By allocating and synchronizing the data reorganization tasks of the distributed database in the shared storage area, the problem of low data reorganization efficiency in the distributed database is solved, and efficient task execution and data consistency are achieved.
Patent Information
- Application Number
- CN202410773827.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-10-11
AI Technical Summary
Distributed databases need to perform data reorganization during the data management process, and different database instances need to ensure that the progress of data reorganization is unified and the data is consistent. However, in the existing technology, the data reorganization process takes up a lot of computing resources and it is difficult to improve efficiency.
By filling in the task allocation file in the shared storage area, the data reorganization task is assigned to different database instances in the distributed database for execution, and the execution results are synchronized through the shared storage area to reduce the congestion of computing resources and inefficiency caused by task concentration, and avoid Each database performs the data reorganization task once.
It improves the execution efficiency of data reorganization tasks, ensures progress and data consistency between different databases, and reduces computing resource usage.
Smart Images

Figure CN118760705A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of database technology, and in particular, to a data management method and apparatus, program product, device, and storage medium. Background Art
[0002] With the rapid development of the Internet and informatization, the generation of data is exploding, so the requirements for databases and their management are getting higher and higher. The current distributed database has multiple database instances, which can provide multiple data copies to increase the stability of the distributed database. The distributed database can access shared storage, so that database instances deployed across regions can use large-bandwidth, low-cost shared storage services to quickly and efficiently manage data.
[0003] Generally speaking, distributed databases need to reorganize data during data management, and different database instances need to ensure that the progress of data reorganization is unified and the data is consistent. In the related art, the data reorganization process of distributed databases requires a large amount of computing resources and is difficult to improve in efficiency. Summary of the invention
[0004] In view of this, one or more embodiments of the present specification provide a data management method and apparatus, a program product, a device, and a storage medium.
[0005] To achieve the above objectives, one or more embodiments of this specification provide the following technical solutions:
[0006] According to a first aspect of one or more embodiments of this specification, a data management method is provided, which is applied to a first database among multiple databases of a distributed database, and the method includes:
[0007] Reading a task allocation file in a shared storage area, wherein the task allocation file is filled in by a leader database in the distributed database, and the task allocation file includes at least one data reorganization task, and the data reorganization task records an execution object;
[0008] In response to the execution object recorded in the first data reorganization task among the at least one data reorganization task being the first database, the first data reorganization task is executed in the first database, and the execution result is stored in the shared storage area, so that other databases among the databases except the first database synchronize the execution result of the first data reorganization task in the shared storage area to the local area.
[0009] In one or more embodiments of the present specification, the method further includes:
[0010] A task check value is determined according to the execution result of the first data reorganization task, and the task check value is stored in the shared storage area.
[0011] In one or more embodiments of the present specification, the method further includes:
[0012] In response to the fact that the execution object recorded in the second data reorganization task in the at least one data reorganization task is not the first database, executing the second data reorganization task in the first database and determining a task check value;
[0013] In response to the locally determined task check value being the same as the task check value of the second data reorganization task in the shared storage area, synchronizing the execution result of the second data reorganization task in the shared storage area to the local area;
[0014] Among them, the execution result and task verification value of the second data reorganization task are stored in the shared storage area by the second database among the multiple databases of the distributed database, and the second database is the execution object of the second data reorganization task recorded in the task allocation file.
[0015] In one or more embodiments of the present specification, the method further includes:
[0016] Storing a completion mark of the first data reorganization task in the shared storage area;
[0017] In response to the fact that the execution object recorded in the second data reorganization task in the at least one data reorganization task is not the first database, executing the second data reorganization task in the first database and determining the task check value according to the execution result, comprises:
[0018] In response to the fact that the execution object recorded by the second data reorganization task in the at least one data reorganization task is not the first database, and the completion mark of the second data reorganization task is stored in the shared storage area, the second data reorganization task is executed in the first database and the task verification value is determined according to the execution result.
[0019] In one or more embodiments of the present specification, the method further includes:
[0020] In response to the locally determined task check value being the same as the task check value of the second data reorganization task in the shared storage area, storing a check pass identifier of the second data reorganization task in the shared storage area;
[0021] In response to the fact that the execution object recorded in the second data reorganization task in the at least one data reorganization task is not the first database, executing the second data reorganization task in the first database and determining the task check value according to the execution result, comprises:
[0022] In response to the fact that the execution object recorded by the second data reorganization task in the at least one data reorganization task is not the first database, and the verification pass mark of the second data reorganization task is not stored in the shared storage area, the second data reorganization task is executed in the first database and the task verification value is determined according to the execution result.
[0023] In one or more embodiments of the present specification, the method further includes:
[0024] In response to the fact that the execution object recorded in the second data reorganization task in the at least one data reorganization task is not the first database, and the verification pass mark of the second data reorganization task is stored in the shared storage area, the execution result of the second data reorganization task in the shared storage area is synchronized to the local.
[0025] In one or more embodiments of the present specification, the method further includes:
[0026] In response to the locally determined task check value being different from the task check value of the second data reorganization task in the shared memory area, an alarm message is output.
[0027] In one or more embodiments of the present specification, the method further includes:
[0028] The device status of the first database is stored in the shared storage area, so that the leader database fills in the task allocation file according to the device status of at least one database in the distributed database.
[0029] In one or more embodiments of the present specification, the first data reorganization task records a first target partition and a first target site, and the second data reorganization task records a second target partition and a second target site;
[0030] The performing of the first data reorganization task in the first database includes:
[0031] Performing partition merging in the first database for the first target partition with the first target location as a read time location;
[0032] The performing the second data reorganization task in the first database includes:
[0033] Partition merging is performed within the first database for the second target partition using the second target site as a read time site.
[0034] In one or more embodiments of the present specification, the shared storage area stores a task allocation file, a device-level task status file corresponding to at least one database in the distributed database, a system-level task status file, and a device status file;
[0035] The device-level task status file is filled in by the corresponding database, and is used to record the completion mark of the data reorganization task of the corresponding database as the execution copy, and the verification pass mark of the data reorganization task of the corresponding database not as the execution copy;
[0036] The system-level task status file is filled in by the leader database according to the device-level task status file corresponding to at least one database in the distributed database, and is used to record the completion mark and verification pass mark of all data reorganization tasks in the distributed database;
[0037] The device status file is filled in by at least one database in the distributed database, and is used to record the device status of at least one database in the distributed database.
[0038] According to a second aspect of one or more embodiments of this specification, a data management method is proposed, which is applied to a leader database in the distributed database. The method includes:
[0039] In response to receiving the data reorganization task, determining an execution object of the data reorganization task;
[0040] The received data reorganization task and the determined execution object are filled into the task allocation file in the shared storage area, so that the database that serves as the execution object executes the data reorganization task and stores the execution result in the shared storage area, and the database that does not serve as the execution object synchronizes the execution result of the data reorganization task locally.
[0041] In one or more embodiments of this specification, determining the execution object of the data reorganization task includes:
[0042] The device status of at least one database in the distributed database stored in the shared storage area is read, and the execution object of the data reorganization task is determined according to the device status of at least one database in the distributed database.
[0043] In one or more embodiments of the present specification, the method further includes:
[0044] In response to the database serving as the execution object of the data reorganization task not updating the device status in the shared storage area within a preset time period, the execution object is re-determined, and the task allocation file is updated according to the re-determined execution object.
[0045] In one or more embodiments of the present specification, the method further includes:
[0046] In response to the last leader database, no data is written into the shared storage area within a second preset time period.
[0047] According to a third aspect of one or more embodiments of this specification, a data management device is provided, which is applied to a first database among multiple databases of a distributed database, and the device includes:
[0048] A reading module, used for reading a task allocation file in a shared storage area, wherein the task allocation file is filled in by a leader database in the distributed database, and the task allocation file includes at least one data reorganization task, and the data reorganization task records an execution object;
[0049] A data reorganization module is used to execute the first data reorganization task in the first database in response to the execution object recorded in the first data reorganization task among the at least one data reorganization task being the first database, and store the execution result in the shared storage area, so that other databases among the databases except the first database can synchronize the execution result of the first data reorganization task in the shared storage area to the local area.
[0050] In one or more embodiments of this specification, the device further includes a first verification module, configured to:
[0051] A task check value is determined according to the execution result of the first data reorganization task, and the task check value is stored in the shared storage area.
[0052] In one or more embodiments of this specification, the device further includes a second verification module, configured to:
[0053] In response to the fact that the execution object recorded in the second data reorganization task in the at least one data reorganization task is not the first database, executing the second data reorganization task in the first database and determining a task check value;
[0054] In response to the locally determined task check value being the same as the task check value of the second data reorganization task in the shared storage area, synchronizing the execution result of the second data reorganization task in the shared storage area to the local area;
[0055] Among them, the execution result and task verification value of the second data reorganization task are stored in the shared storage area by the second database among the multiple databases of the distributed database, and the second database is the execution object of the second data reorganization task recorded in the task allocation file.
[0056] In one or more embodiments of the present specification, the device further includes a first identification module, configured to:
[0057] Storing a completion mark of the first data reorganization task in the shared storage area;
[0058] The second verification module is used for executing the second data reorganization task in the first database and determining the task verification value according to the execution result in response to the execution object recorded in the second data reorganization task in the at least one data reorganization task not being the first database, and for:
[0059] In response to the fact that the execution object recorded by the second data reorganization task in the at least one data reorganization task is not the first database, and the completion mark of the second data reorganization task is stored in the shared storage area, the second data reorganization task is executed in the first database and the task verification value is determined according to the execution result.
[0060] In one or more embodiments of the present specification, the device further includes a second identification module, configured to:
[0061] In response to the locally determined task check value being the same as the task check value of the second data reorganization task in the shared storage area, storing a check pass identifier of the second data reorganization task in the shared storage area;
[0062] The second verification module is used for executing the second data reorganization task in the first database and determining the task verification value according to the execution result in response to the execution object recorded in the second data reorganization task in the at least one data reorganization task not being the first database, and for:
[0063] In response to the fact that the execution object recorded by the second data reorganization task in the at least one data reorganization task is not the first database, and the verification pass mark of the second data reorganization task is not stored in the shared storage area, the second data reorganization task is executed in the first database and the task verification value is determined according to the execution result.
[0064] In one or more embodiments of this specification, the second verification module is further used for:
[0065] In response to the fact that the execution object recorded in the second data reorganization task in the at least one data reorganization task is not the first database, and the verification pass mark of the second data reorganization task is stored in the shared storage area, the execution result of the second data reorganization task in the shared storage area is synchronized to the local.
[0066] In one or more embodiments of the present specification, the device further includes an alarm module, which is used to:
[0067] In response to the locally determined task check value being different from the task check value of the second data reorganization task in the shared memory area, an alarm message is output.
[0068] In one or more embodiments of this specification, the device further includes a status reporting module, configured to:
[0069] The device status of the first database is stored in the shared storage area, so that the leader database fills in the task allocation file according to the device status of at least one database in the distributed database.
[0070] In one or more embodiments of the present specification, the first data reorganization task records a first target partition and a first target site, and the second data reorganization task records a second target partition and a second target site;
[0071] The data reorganization module is used to, when executing the first data reorganization task in the first database,:
[0072] Performing partition merging in the first database for the first target partition with the first target location as a read time location;
[0073] The second verification module is used to, when executing the second data reorganization task in the first database,:
[0074] Partition merging is performed within the first database for the second target partition using the second target site as a read time site.
[0075] In one or more embodiments of the present specification, the shared storage area stores a task allocation file, a device-level task status file corresponding to at least one database in the distributed database, a system-level task status file, and a device status file;
[0076] The device-level task status file is filled in by the corresponding database, and is used to record the completion mark of the data reorganization task of the corresponding database as the execution copy, and the verification pass mark of the data reorganization task of the corresponding database not as the execution copy;
[0077] The system-level task status file is filled in by the leader database according to the device-level task status file corresponding to at least one database in the distributed database, and is used to record the completion mark and verification pass mark of all data reorganization tasks in the distributed database;
[0078] The device status file is filled in by at least one database in the distributed database, and is used to record the device status of at least one database in the distributed database.
[0079] According to a fourth aspect of one or more embodiments of this specification, a data management device is provided, which is applied to a leader database in the distributed database, and the device includes:
[0080] A determination module, configured to determine an execution object of the data reorganization task in response to receiving the data reorganization task;
[0081] An allocation module is used to fill the received data reorganization task and the determined execution object into the task allocation file in the shared storage area, so that the database that serves as the execution object executes the data reorganization task and stores the execution result in the shared storage area, and the database that does not serve as the execution object synchronizes the execution result of the data reorganization task to the local.
[0082] In one or more embodiments of this specification, the determination module is used to:
[0083] The device status of at least one database in the distributed database stored in the shared storage area is read, and the execution object of the data reorganization task is determined according to the device status of at least one database in the distributed database.
[0084] In one or more embodiments of the present specification, the device further includes a switching module, configured to:
[0085] In response to the database serving as the execution object of the data reorganization task not updating the device status in the shared storage area within a preset time period, the execution object is re-determined, and the task allocation file is updated according to the re-determined execution object.
[0086] In one or more embodiments of the present specification, the device further includes a preceding module, configured to:
[0087] In response to the last leader database, no data is written into the shared storage area within a second preset time period.
[0088] According to a fifth aspect of one or more embodiments of the present specification, a computer program product is proposed, comprising a computer program / instruction, which implements the steps of the method described in the first aspect or the second aspect when executed by a processor.
[0089] According to a sixth aspect of one or more embodiments of this specification, an electronic device is provided, including:
[0090] processor;
[0091] a memory for storing processor-executable instructions;
[0092] The processor implements the method as described in the first aspect or the second aspect by running the executable instructions.
[0093] According to a seventh aspect of one or more embodiments of the present specification, a computer-readable storage medium is provided, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method described in the first aspect or the second aspect are implemented.
[0094] The technical solutions provided by the embodiments of this specification may have the following beneficial effects:
[0095] In the data management method provided in the embodiments of this specification, each database in the distributed database can read and write data to the shared storage area. The leader database can fill in the execution object of each data reorganization task in the task allocation file in the shared storage area; the first database (i.e., any non-leader database) can read the task allocation file in the shared storage area to determine whether it is an execution object or a non-execution object in each data reorganization task, and execute the task when it is determined that it is the execution object of the first data reorganization task (i.e., any data reorganization task), and store the result in the shared storage area; other databases can synchronize the execution result of the first data reorganization task to the local.
[0096] In other words, the leader database allocates data reorganization tasks and notifies the execution objects and non-execution objects of the allocation results through the shared storage area. After the execution objects execute the data reorganization tasks, they synchronize the results to other databases through the shared storage area. This can not only allocate multiple data reorganization tasks to different databases for execution, thereby reducing the squeeze and inefficiency of computing resources caused by task concentration, but also avoid each database from executing the data reorganization task once, thereby further improving the task execution efficiency. Furthermore, the database that is a non-execution object synchronizes the execution structure output by the execution object to the local area, which can ensure the progress and data consistency between different databases. BRIEF DESCRIPTION OF THE DRAWINGS
[0097] Figure 1This is a schematic diagram of the relationship between Memtable and SSTable in a storage engine of an LSM-Tree structure provided by an exemplary embodiment.
[0098] Figure 2 It is a structural diagram of a distributed database provided by an exemplary embodiment.
[0099] Figure 3 It is a flowchart of a data management method applied to a first database provided by an exemplary embodiment.
[0100] Figure 4 The invention is a flowchart of a method for verifying data consistency in a first database provided by an exemplary embodiment.
[0101] Figure 5 It is a flowchart of a data management method applied to a leader database provided by an exemplary embodiment.
[0102] Figure 6 It is a structural schematic diagram of a device provided by an exemplary embodiment.
[0103] Figure 7 It is a block diagram of a data management device applied to a first database provided by an exemplary embodiment.
[0104] Figure 8 It is a block diagram of a data management device applied to a leader database provided by an exemplary embodiment. DETAILED DESCRIPTION
[0105] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0106] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0107] First, some concepts involved in this specification are explained.
[0108] Distributed Database
[0109] A distributed database is a database that runs and stores data across multiple computers. It spreads data across multiple computers or nodes, which can be in the same geographical location or distributed across multiple geographical locations. The purpose of this is to improve data reliability, availability, and performance. To ensure data reliability and availability, distributed databases usually use a multi-copy mechanism, that is, multiple copies of data are stored on different nodes so that when a node fails, other nodes can continue to provide services. Each node can be called a database instance, or simply a database.
[0110] Shared storage
[0111] As a storage system, shared storage allows multiple entries to access data on storage devices simultaneously through the network, realizing resource sharing and centralized data management, greatly reducing the complexity of data synchronization and saving storage costs. In addition, shared storage also has the capabilities of high scalability and data consistency.
[0112] After connecting the distributed database to the shared storage, each database instance can access the data in the shared storage, so that the database instances deployed across regions can use the high-bandwidth and low-cost shared storage service to quickly and efficiently manage data. And with the elasticity of shared storage, the distributed database can quickly expand and shrink to meet the load requirements of dynamically changing resources.
[0113] Partition
[0114] Partitioning is a database management technique that divides tables and indexes in a database into multiple smaller, more manageable parts, called partitions. Partitioning is usually based on specific rules, such as value ranges, dates, hash values, list values, etc. Using partitioning technology can simplify data management and improve query efficiency.
[0115] LSM-Tree (Log Structured Merge Tree)
[0116] The storage engine of a distributed database can be based on the LSM-Tree structure. Each data partition corresponds to an LSM-Tree, and the LSM-Tree is divided into the Memtable in memory and the SSTable on the disk. Figure 1 Introduce the contents and relationship between the two:
[0117] Memtable
[0118] Memtable (Memory Table) is in pure memory state. When the user writes data, it will be written to the Memtable in memory. When the amount of data in the Memtable reaches the threshold, the Memtable will be converted into an unmodifiable Memtable, and a new Memtable will be created to provide data writing.
[0119] SSTable
[0120] SSTable (Sorted String Table) is an internally ordered disk file. Data can be sorted by Key and binary search can be used to quickly obtain data of the specified key. SSTable is converted from the unmodifiable Memtable in memory. For ease of management, the SSTable files on the disk can be divided into multiple levels. Through Compaction, the data in the SSTable will be moved and reorganized in SSTables of different levels. Usually, the bottom SSTable has the most data.
[0121] Compaction
[0122] Compaction is a data reorganization mechanism under the LSM-Tree storage engine architecture. It organizes and merges persistent and unchangeable SSTable data on the disk and recycles invalid data to reduce data storage space and improve query efficiency.
[0123] The LSM-Tree storage engine of the distributed database has multiple types of compactions, one of which is partition merging: partition merging refers to the process in which multiple copies of the same partition use the same read time point to query the data in the partition and persist it as an SSTable.
[0124] With the rapid development of the Internet and informatization, the generation of data is exploding, so the requirements for databases and their management are getting higher and higher. The current distributed database has multiple database instances, which can provide multiple data copies to increase the stability of the distributed database. The distributed database can access shared storage, so that database instances deployed across regions can use large-bandwidth, low-cost shared storage services to quickly and efficiently manage data.
[0125] Generally speaking, distributed databases need to reorganize data during data management, and different database instances need to ensure that the progress of data reorganization is unified and the data is consistent. In the related art, the data reorganization process of distributed databases requires a large amount of computing resources and is difficult to improve in efficiency.
[0126] For example, when performing a partition merge task in a distributed database, all copies of the same partition need to read local data to complete the partition merge. After multiple copies of the same partition complete the partition merge, the partition leader detects the data consistency of the SSTables generated by the multiple copies to ensure data correctness. Partition merge involves data correctness, query optimization, etc., but its resource consumption is also high. It is a CPU-intensive operation. Therefore, the method in related technologies that each partition copy performs a partition merge once occupies a lot of computing resources and is also inefficient.
[0127] Based on this, at least one embodiment of the present specification provides a data management method, which can allocate multiple data reorganization tasks (for example, data reorganization tasks for multiple data partitions) to different database instances in a distributed database for execution through a task allocation file in a shared storage area, and the database instance that executes the data reorganization task can synchronize the execution results to other database instances through shared storage, thereby reducing the squeeze and inefficiency of computing resources caused by task concentration, and avoiding each database instance from executing the data reorganization task once, thereby further improving the task execution efficiency, as well as the progress and data consistency between database instances.
[0128] This method is applied to the Figure 2 The distributed database shown, for example, a distributed database based on an LSM-Tree structure, includes multiple database instances, and the distributed database is connected to a shared storage, that is, each database instance of the distributed database can perform read and write operations to the shared storage area; the distributed database will elect a database instance as a leader database instance through a consensus protocol.
[0129] For the convenience of description, the database instance is referred to as database in the following.
[0130] This method can be completed by a common database (i.e., a database other than a leader database) and a leader database in a distributed database. Next, the details of this method are described in detail from both the common database and the leader database sides.
[0131] Please refer to the attached Figure 3 , which exemplarily shows the process of a data management method for a first database among multiple databases of a distributed database, including steps S301 to S302.
[0132] The first database is any common database, that is, this embodiment takes any common database as an example to introduce the method flow on the common database side.
[0133] In step S301, a task allocation file in a shared storage area is read, wherein the task allocation file is filled in by a leader database in the distributed database, and the task allocation file includes at least one data reorganization task, and the data reorganization task records an execution object.
[0134] Exemplarily, the first database may store the device status of the first database in the shared storage area, so that the leader database fills in the task allocation file according to the device status of at least one database in the distributed database.
[0135] The shared storage area may store a device status file, which is filled in by at least one database in the distributed database and is used to record the device status of at least one database in the distributed database. For example, the device status file may record the device status of each device at the device granularity. For example, each database in the distributed database periodically fills the latest device status into the device status file in the shared storage area. For example, the device status may include CPU load, I / O load, number of data reorganization tasks, etc.
[0136] Among them, each time the leader database receives a data reorganization task, it can determine the execution object of the data reorganization task according to the device status of each database recorded in the device status file, and fill in the task content and execution object of the data reorganization task into the task allocation file.
[0137] Exemplarily, the data reorganization task may be a partition merging task, and its task content may be a target partition and a target site. For example, the first data reorganization task and the second data reorganization task are two tasks in the task allocation file, and the first data reorganization task records the first target partition and the first target site, and the first data reorganization task records that its execution object is the first database; the second data reorganization task records the second target partition and the second target site, and the second data reorganization task records that its execution object is a database other than the first database.
[0138] It should be understood that in this step, the first database can determine whether it is an execution object or a non-execution object in each data reorganization task recorded in the task assignment file by reading the task assignment file. For example, if the first data reorganization task in the task assignment file is recorded as having its execution object as the first database, then in this step, the first database can determine that it is an execution object in the first data reorganization task; for another example, if the second data reorganization task in the task assignment file is recorded as having its execution object as a database other than the first database, then in this step, the first database can determine that it is a non-execution object in the second data reorganization task.
[0139] It should be understood that each database in the distributed database can set up an independent working thread to regularly access the shared storage area to write data and / or read data; and each database can cache data that needs to be synchronized to the shared storage area and synchronize it during regular access.
[0140] In step S302, in response to the execution object recorded in the first data reorganization task among the at least one data reorganization task being the first database, the first data reorganization task is executed in the first database, and the execution result is stored in the shared storage area, so that other databases among the database except the first database synchronize the execution result of the first data reorganization task in the shared storage area to the local area.
[0141] For example, the first data reorganization task is a partition merging task, and the recorded task content is the first target partition and the first target site; then in this step, the partition merging can be performed for the first target partition in the first database with the first target site as the read time site, and the result of the partition merging can be output, that is, the data after the partition merging.
[0142] Exemplarily, after storing the execution result in the shared storage area, the completion mark of the first data reorganization task can also be stored in the shared storage area, so that other databases among the databases except the first database can synchronize the execution result of the first data reorganization task in the shared storage area to the local area.
[0143] For example, the shared storage area stores device-level task status files and system-level task status files corresponding to at least one database (preferably each database) in the distributed database, wherein the device-level task status file is filled in by the corresponding database to record the completion mark of the data reorganization task with the corresponding database as the execution object; the system-level task status file is filled in by the leader database based on the device-level task status file corresponding to at least one database in the distributed database, and is used to record the completion mark of all data reorganization tasks in the distributed database.
[0144] For example, the first data reorganization task is a partition merging task, and the completion mark of the first data reorganization task may include the first target partition and the point where the partition merging is completed.
[0145] For example, after the other databases in the database except the first database read the completion mark of the first data reorganization task from the system-level task status file, the execution result of the first data reorganization task is copied from the shared storage area to the local area. It should be understood that if the first data reorganization task is a partition merging task, then after the other databases in the database except the first database read the completion mark of the first data reorganization task from the shared storage area, that is, the point where the first target partition and the completion partition merge are located, the execution result of the first data reorganization task can be copied from the shared storage area to the local area to replace the data before the point of the local first target partition.
[0146] Preferably, the method may further include:
[0147] In response to the fact that the execution object recorded in the second data reorganization task in the at least one data reorganization task is not the first database, the execution result of the second data reorganization task in the shared storage area is synchronized to the local, wherein the execution result of the second data reorganization task is stored in the shared storage area by the second database among the multiple databases of the distributed database, and the second database is the execution object of the second data reorganization task recorded in the task allocation file.
[0148] That is, the first database can synchronize the execution results of the data reorganization tasks of other databases as execution objects to the local. In other words, each database can execute the data reorganization tasks of itself as the execution object, and can also synchronize the execution results of the data reorganization tasks of other databases as the execution objects to the local. In this way, multiple data reorganization tasks can be assigned to different databases for execution, and the same execution results can be synchronized to each database.
[0149] In the data management method provided in the embodiments of this specification, each database in the distributed database can read and write data to the shared storage area. The leader database can fill in the execution object of each data reorganization task in the task allocation file in the shared storage area; the first database (i.e., any non-leader database) can read the task allocation file in the shared storage area to determine whether it is an execution object or a non-execution object in each data reorganization task, and execute the task when it is determined that it is the execution object of the first data reorganization task (i.e., any data reorganization task), and store the result in the shared storage area; other databases can synchronize the execution result of the first data reorganization task to the local.
[0150] In other words, the leader database assigns data reorganization tasks and notifies the assignment results to the execution object and non-execution object through the shared storage area. After the execution object executes the data reorganization task, it synchronizes the results to other databases through the shared storage area. This can not only enable multiple data reorganization tasks to be assigned to different databases for execution, thereby reducing the squeeze on computing resources and inefficiency caused by task concentration, but also avoid each database from executing the data reorganization task once, thereby further improving the efficiency of task execution. Furthermore, the database as a non-execution object synchronizes the execution structure output by the execution object to the local, which can ensure the progress and data consistency between different databases. For example, if the data reorganization task is a partition merge task, the partition merge tasks of each partition can be distributed to different replicas for execution, without the need for each replica in the partition to perform a partition merge once, thereby reducing the computing resource usage while ensuring data consistency, while improving the efficiency of partition merge.
[0151] In some embodiments of the present disclosure, the method may further include the following steps: determining a task check value according to the execution result of the first data reorganization task, and storing the task check value in the shared storage area. That is, after each database as an execution object executes the data reorganization task, not only the execution result is stored in the shared storage area, but also the task check value may be determined according to the execution result and stored in the shared storage area for other databases to verify data consistency.
[0152] In the above embodiment, the first database as the execution object stores the task check value of the first data reorganization task in the shared storage area. It should be understood that the execution objects of other data reorganization tasks (such as the second data reorganization task) can also store the task check value in the shared storage area. Next, taking the second data reorganization task whose execution object is other databases other than the first database as an example, the method flow of the first database verifying data consistency through the task check value is introduced, including the attached Figure 4 Steps S401 to S402 in .
[0153] In step S401, in response to the fact that the execution object recorded in the second data reorganization task in the at least one data reorganization task is not the first database, the second data reorganization task is executed in the first database and a task check value is determined.
[0154] Exemplarily, after storing the execution result in the shared storage area, the execution object of each data reorganization task may also store the completion mark of the data reorganization task in the shared storage area to notify other databases that the data reorganization task has been completed by the execution object and the execution result has been output. For example, the first database stores the completion mark of the first data reorganization task in the shared storage area. For another example, the second database stores the completion mark of the second data reorganization task in the shared storage area.
[0155] Based on the above example, this step can respond to the fact that the execution object recorded by the second data reorganization task in the at least one data reorganization task is not the first database, and the completion mark of the second data reorganization task is stored in the shared storage area, execute the second data reorganization task in the first database and determine the task verification value based on the execution result.
[0156] It should be understood that when executing the second data reorganization task in this step, only the calculation process in the task can be executed, and the execution result is not actually output. The task verification value can be further calculated by using the calculation process.
[0157] In step S402, in response to the locally determined task check value being the same as the task check value of the second data reorganization task in the shared storage area, the execution result of the second data reorganization task in the shared storage area is synchronized locally.
[0158] Among them, the execution result and task verification value of the second data reorganization task are stored in the shared storage area by the second database among the multiple databases of the distributed database, and the second database is the execution object of the second data reorganization task recorded in the task allocation file.
[0159] Correspondingly, in response to the fact that the task check value determined locally is different from the task check value of the second data reorganization task in the shared storage area, an alarm message can be output. For example, an alarm message is output to the leader database, and the alarm message indicates that the execution results of the second data reorganization task on different databases are inconsistent. The leader database can transmit the alarm message to the client so that the database administrator can access and check; after determining that one of the execution results is correct, the administrator can specify the correct execution result through an SQL command and store the correct execution result in the shared storage so that other databases can synchronize the execution result to the local.
[0160] For example, the second data reorganization task is a partition merging task, and the recorded task content is the second target partition and the second target site; then in this step, the partition merging calculation process can be executed in the first database for the second target partition with the second target site as the read time site, and the partition merging verification value can be output.
[0161] In this embodiment, the first database is not the execution object of the second data reorganization task. It can be used as a verification object to execute the calculation process of the data reorganization task to obtain a task verification value, and compare it with the task verification value output by the execution object of the second data reorganization task, thereby completing the data consistency verification, so that the execution result of a task synchronized from the first database to the local is the same as the execution result of the task executed locally, avoiding errors in the execution of the execution object that cause other databases to store erroneous results and affect data security.
[0162] Each non-execution object of the second data reorganization task can be verified according to the verification method in the above embodiment, and the execution result of the second data reorganization task can be synchronized to the local after the verification passes.
[0163] Alternatively, illustratively, the method may further include:
[0164] In response to the locally determined task verification value being identical to the task verification value of the second data reorganization task in the shared storage area, the verification of the second data reorganization task is stored in the shared storage area through an identifier, so that other databases other than the execution object - the second database and the verification object - the first database can directly synchronize the execution result of the second data reorganization task to the local without verifying the data consistency.
[0165] In other words, among the other databases other than the execution object in the distributed database, there can be only one database as the verification object. After the verification object verifies the task verification value of the execution object according to the verification method in the above embodiment, the execution result is synchronized to the local and the other databases are notified with a verification pass mark that the execution result can be directly synchronized, thereby completing the data consistency check and avoiding redundant operations and waste of computing power caused by each database performing a consistency check.
[0166] For example, the shared storage area stores a device-level task status file and a system-level task status file corresponding to at least one database (preferably each database) in the distributed database, wherein the device-level task status file is filled in by the corresponding database, and is used to record the verification pass mark of the data reorganization task with the corresponding database as the execution object; the system-level task status file is filled in by the leader database based on the device-level task status file corresponding to at least one database in the distributed database, and is used to record the verification pass mark of all data reorganization tasks in the distributed database.
[0167] Among them, the verification object can be one. For example, if a non-executable object completes the verification first, the verification pass mark can be stored in the shared storage area, and other non-executable objects will no longer be verified and the execution results will be directly synchronized to the local; or the verification object of the second data reorganization task is recorded in the task allocation file, that is, the leader database can determine the verification object outside the execution object during task allocation and fill in the task allocation file; then the database as the verification object reads the task allocation file and determines itself as the verification object, and can read the completion mark of the second data reorganization task in the shared storage area and perform verification in accordance with the above embodiment. After the verification is passed, the execution result will be synchronized to the local and the verification pass mark will be stored in the shared storage area, so that other databases can synchronize the execution results to the local after reading the completion mark and verification pass mark of the second data reorganization task in the system-level task status file in the shared storage area.
[0168] Alternatively, there may be multiple verification objects, for example, N (N is an integer greater than 1). For example, N non-executable objects complete verification first and store verification pass marks in the shared storage area respectively. After reading N verification pass marks in the shared storage area, other non-executable objects no longer verify and directly synchronize the execution results to the local; or the task allocation file records the N verification objects of the second data reorganization task, that is, the leader database can determine N verification objects outside the execution object during task allocation and fill in the task allocation file; then the N databases as verification objects determine themselves as verification objects after reading the task allocation file, and can perform verification in accordance with the above-mentioned embodiment after reading the completion mark of the second data reorganization task in the shared storage area. After the verification passes, the execution results are synchronized to the local and the verification pass mark is stored in the shared storage area, so that other databases can synchronize the execution results to the local after reading the completion mark of the second data reorganization task and N verification pass marks in the system-level task status file in the shared storage area.
[0169] Based on the verification pass mark introduced in this example, step S301 may be:
[0170] In response to the fact that the execution object recorded by the second data reorganization task in the at least one data reorganization task is not the first database, and the verification pass mark of the second data reorganization task is not stored in the shared storage area, the second data reorganization task is executed in the first database and the task verification value is determined according to the execution result.
[0171] Correspondingly, the first database can also synchronize the execution result of the second data reorganization task in the shared storage area to the local in response to the execution object recorded by the second data reorganization task in the at least one data reorganization task is not the first database, and the verification pass mark of the second data reorganization task is stored in the shared storage area.
[0172] It should also be noted that:
[0173] The shared storage area may be provided with a file storage area for storing control files related to the data reorganization task, such as task allocation files, device-level task status files corresponding to at least one database in the distributed database, system-level task status files, and device status files. For example, the file storage area indexes the above control files with the following directory:
[0174]
[0175] Among them, compaction_tasks is the task allocation file, compaction_status is the system-level task status file, server_id_1.compaction_report is the device status file, and server_id_1.compaction_status is the device-level character status file.
[0176] Please refer to the attached Figure 5 , which exemplarily shows the process of the data management method applied to the leader database of the distributed database, including steps S501 to S502.
[0177] In step S501, in response to receiving a data reorganization task, an execution object of the data reorganization task is determined.
[0178] Exemplarily, the device status of at least one database in the distributed database stored in the shared storage area is read, and the execution object of the data reorganization task is determined according to the device status of at least one database in the distributed database.
[0179] In step S502, the received data reorganization task and the determined execution object are filled into the task allocation file in the shared storage area, so that the database that serves as the execution object executes the data reorganization task and stores the execution result in the shared storage area, and the database that does not serve as the execution object synchronizes the execution result of the data reorganization task to the local area.
[0180] Exemplarily, the method also includes: in response to the database serving as the execution object of the data reorganization task not updating the device status in the shared storage area within a preset time period, redetermining the execution object, and updating the task allocation file based on the redetermined execution object.
[0181] When the database that is the execution object of a data reorganization task fails to update the device status in the shared storage area within the preset market, it is likely to fail. Therefore, the leader database can re-determine the execution object of the data reorganization task at this time to avoid the inability to complete the data reorganization task due to the failure of the execution object.
[0182] It should be understood that when the execution copy executes the data reorganization task and outputs the execution result, it can store the execution result in the shared storage area in stages. When the execution object determines itself as the execution object of a data reorganization task through the task allocation file, it can determine the execution progress of the task in the shared storage area before executing the task, for example, by reading whether the staged execution result of the task already exists in the shared storage area to determine the execution progress. If the progress is 0, the task is executed from the beginning. If the progress is not 0, only the unexecuted part of the task can be executed.
[0183] When the original execution object is deregistered by the leader database due to a failure, and the new execution object determines itself as the execution object of a data reorganization task through the task allocation file, it will read the interim execution results stored in the shared storage area by the original execution object, determine the execution progress of the task, and then execute the unexecuted part of the task and output the remaining execution results to the shared storage area.
[0184] The above optional method can avoid the new execution object from repeating the data reorganization task when the execution object changes, thereby improving the task execution rate and avoiding waste of computing power.
[0185] This example can switch the execution object in time when the execution object crashes, and when the old execution object returns to normal, it can determine that it is no longer the execution object through the task allocation file in the shared storage area, and thus no longer execute tasks, so as to avoid multiple execution objects writing execution results to the shared storage area at the same time and affecting data stability and correctness.
[0186] Exemplarily, the method further includes:
[0187] In response to the last leader database, no data is written into the shared storage area within a second preset time period.
[0188] In this example, the new leader database will write data to the shared storage area only after a preset period of time after taking office, thereby avoiding the situation where the old and new leader databases write data to the shared storage area at the same time when the leader database is just switched, which may affect the stability and correctness of the data. In addition, the switch between the old and new leaders does not affect other databases reporting device status, task status and other operations, so that the leader switch does not affect the execution of the data reorganization task, ensuring the stability of task execution.
[0189] The details of the data management method applied to the leader database have been introduced in detail in the various embodiments of the data management method applied to the first database, and will not be repeated here.
[0190] Figure 6 is a schematic structural diagram of a device provided by an exemplary embodiment. Figure 6 At the hardware level, the device includes a processor 602, an internal bus 604, a network interface 606, a memory 608, and a non-volatile memory 66, and may also include hardware required for other tasks. One or more embodiments of this specification may be implemented based on software, such as the processor 602 reading the corresponding computer program from the non-volatile memory 610 into the memory 608 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0191] Please refer to Figure 7 , the data management device can be used for Figure 6 The device shown in the figure is used to implement the technical solution of this specification. The data management device is applied to the first database in the distributed database, including:
[0192] A reading module 701 is used to read a task allocation file in a shared storage area, wherein the task allocation file is filled in by a leader database in the distributed database, and the task allocation file includes at least one data reorganization task, and the data reorganization task records an execution object;
[0193] The data reorganization module 702 is used to execute the first data reorganization task in the first database in response to the execution object recorded in the first data reorganization task among the at least one data reorganization task being the first database, and store the execution result in the shared storage area, so that other databases among the databases except the first database can synchronize the execution result of the first data reorganization task in the shared storage area to the local area.
[0194] In one or more embodiments of this specification, the device further includes a first verification module, configured to:
[0195] A task check value is determined according to the execution result of the first data reorganization task, and the task check value is stored in the shared storage area.
[0196] In one or more embodiments of this specification, the device further includes a second verification module, configured to:
[0197] In response to the fact that the execution object recorded in the second data reorganization task in the at least one data reorganization task is not the first database, executing the second data reorganization task in the first database and determining a task check value;
[0198] In response to the locally determined task check value being the same as the task check value of the second data reorganization task in the shared storage area, synchronizing the execution result of the second data reorganization task in the shared storage area to the local area;
[0199] Among them, the execution result and task verification value of the second data reorganization task are stored in the shared storage area by the second database among the multiple databases of the distributed database, and the second database is the execution object of the second data reorganization task recorded in the task allocation file.
[0200] In one or more embodiments of the present specification, the device further includes a first identification module, configured to:
[0201] Storing a completion mark of the first data reorganization task in the shared storage area;
[0202] The second verification module is used for executing the second data reorganization task in the first database and determining the task verification value according to the execution result in response to the execution object recorded in the second data reorganization task in the at least one data reorganization task not being the first database, and for:
[0203] In response to the fact that the execution object recorded by the second data reorganization task in the at least one data reorganization task is not the first database, and the completion mark of the second data reorganization task is stored in the shared storage area, the second data reorganization task is executed in the first database and the task verification value is determined according to the execution result.
[0204] In one or more embodiments of the present specification, the device further includes a second identification module, configured to:
[0205] In response to the locally determined task check value being the same as the task check value of the second data reorganization task in the shared storage area, storing a check pass identifier of the second data reorganization task in the shared storage area;
[0206] The second verification module is used for executing the second data reorganization task in the first database and determining the task verification value according to the execution result in response to the execution object recorded in the second data reorganization task in the at least one data reorganization task not being the first database, and for:
[0207] In response to the fact that the execution object recorded by the second data reorganization task in the at least one data reorganization task is not the first database, and the verification pass mark of the second data reorganization task is not stored in the shared storage area, the second data reorganization task is executed in the first database and the task verification value is determined according to the execution result.
[0208] In one or more embodiments of this specification, the second verification module is further used for:
[0209] In response to the fact that the execution object recorded in the second data reorganization task in the at least one data reorganization task is not the first database, and the verification pass mark of the second data reorganization task is stored in the shared storage area, the execution result of the second data reorganization task in the shared storage area is synchronized to the local.
[0210] In one or more embodiments of the present specification, the device further includes an alarm module, which is used to:
[0211] In response to the locally determined task check value being different from the task check value of the second data reorganization task in the shared memory area, an alarm message is output.
[0212] In one or more embodiments of this specification, the device further includes a status reporting module, configured to:
[0213] The device status of the first database is stored in the shared storage area, so that the leader database fills in the task allocation file according to the device status of at least one database in the distributed database.
[0214] In one or more embodiments of the present specification, the first data reorganization task records a first target partition and a first target site, and the second data reorganization task records a second target partition and a second target site;
[0215] The data reorganization module is used to, when executing the first data reorganization task in the first database,:
[0216] Performing partition merging in the first database for the first target partition with the first target location as a read time location;
[0217] The second verification module is used to, when executing the second data reorganization task in the first database,:
[0218] Partition merging is performed within the first database for the second target partition using the second target site as a read time site.
[0219] In one or more embodiments of the present specification, the shared storage area stores a task allocation file, a device-level task status file corresponding to at least one database in the distributed database, a system-level task status file, and a device status file;
[0220] The device-level task status file is filled in by the corresponding database, and is used to record the completion mark of the data reorganization task of the corresponding database as the execution copy, and the verification pass mark of the data reorganization task of the corresponding database not as the execution copy;
[0221] The system-level task status file is filled in by the leader database according to the device-level task status file corresponding to at least one database in the distributed database, and is used to record the completion mark and verification pass mark of all data reorganization tasks in the distributed database;
[0222] The device status file is filled in by at least one database in the distributed database, and is used to record the device status of at least one database in the distributed database.
[0223] Please refer to Figure 8 , the data management device can be used for Figure 6 The data management device is applied to the leader database in the distributed database, and includes:
[0224] A determination module 801 is used to determine an execution object of the data reorganization task in response to receiving the data reorganization task;
[0225] The allocation module 802 is used to fill the received data reorganization task and the determined execution object into the task allocation file in the shared storage area, so that the database that serves as the execution object executes the data reorganization task and stores the execution result in the shared storage area, and the database that does not serve as the execution object synchronizes the execution result of the data reorganization task to the local area.
[0226] In one or more embodiments of this specification, the determination module is used to:
[0227] The device status of at least one database in the distributed database stored in the shared storage area is read, and the execution object of the data reorganization task is determined according to the device status of at least one database in the distributed database.
[0228] In one or more embodiments of the present specification, the device further includes a switching module, configured to:
[0229] In response to the database serving as the execution object of the data reorganization task not updating the device status in the shared storage area within a preset time period, the execution object is re-determined, and the task allocation file is updated according to the re-determined execution object.
[0230] In one or more embodiments of the present specification, the device further includes a preceding module, configured to:
[0231] In response to the last leader database, no data is written into the shared storage area within a second preset time period.
[0232] One or more embodiments of the present specification also provide a computer program product, including a computer program / instruction, which implements the steps of the method provided in any of the above embodiments when executed by a processor.
[0233] One or more embodiments of the present specification also provide a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the method provided in any of the above embodiments.
[0234] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.
[0235] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0236] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0237] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0238] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0239] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0240] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0241] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0242] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0243] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.
Claims
1. A data management method, applied to a first database among multiple databases of a distributed database, the method comprising: Reading a task allocation file in a shared storage area, wherein the task allocation file is filled in by a leader database in the distributed database, and the task allocation file includes at least one data reorganization task, and the data reorganization task records an execution object; In response to the execution object recorded in the first data reorganization task among the at least one data reorganization task being the first database, the first data reorganization task is executed in the first database, and the execution result is stored in the shared storage area, so that other databases among the databases except the first database synchronize the execution result of the first data reorganization task in the shared storage area to the local area.
2. The data management method according to claim 1, further comprising: A task check value is determined according to the execution result of the first data reorganization task, and the task check value is stored in the shared storage area.
3. The data management method according to claim 2, further comprising: In response to the fact that the execution object recorded in the second data reorganization task in the at least one data reorganization task is not the first database, executing the second data reorganization task in the first database and determining a task check value; In response to the locally determined task check value being the same as the task check value of the second data reorganization task in the shared storage area, synchronizing the execution result of the second data reorganization task in the shared storage area to the local area; Among them, the execution result and task verification value of the second data reorganization task are stored in the shared storage area by the second database among the multiple databases of the distributed database, and the second database is the execution object of the second data reorganization task recorded in the task allocation file.
4. The data management method according to claim 3, further comprising: Storing a completion mark of the first data reorganization task in the shared storage area; In response to the fact that the execution object recorded in the second data reorganization task in the at least one data reorganization task is not the first database, executing the second data reorganization task in the first database and determining the task check value according to the execution result, comprises: In response to the fact that the execution object recorded by the second data reorganization task in the at least one data reorganization task is not the first database, and the completion mark of the second data reorganization task is stored in the shared storage area, the second data reorganization task is executed in the first database and the task verification value is determined according to the execution result.
5. The data management method according to claim 3, further comprising: In response to the locally determined task check value being the same as the task check value of the second data reorganization task in the shared storage area, storing a check pass identifier of the second data reorganization task in the shared storage area; In response to the fact that the execution object recorded in the second data reorganization task in the at least one data reorganization task is not the first database, executing the second data reorganization task in the first database and determining the task check value according to the execution result, comprises: In response to the fact that the execution object recorded by the second data reorganization task in the at least one data reorganization task is not the first database, and the verification pass mark of the second data reorganization task is not stored in the shared storage area, the second data reorganization task is executed in the first database and the task verification value is determined according to the execution result.
6. The data management method according to claim 5, further comprising: In response to the fact that the execution object recorded in the second data reorganization task in the at least one data reorganization task is not the first database, and the verification pass mark of the second data reorganization task is stored in the shared storage area, the execution result of the second data reorganization task in the shared storage area is synchronized to the local.
7. The data management method according to claim 3, further comprising: In response to the locally determined task check value being different from the task check value of the second data reorganization task in the shared memory area, an alarm message is output.
8. The data management method according to claim 1, further comprising: The device status of the first database is stored in the shared storage area, so that the leader database fills in the task allocation file according to the device status of at least one database in the distributed database.
9. The data management method according to claim 3, wherein the first data reorganization task records a first target partition and a first target site, and the second data reorganization task records a second target partition and a second target site; The performing of the first data reorganization task in the first database includes: Performing partition merging in the first database for the first target partition with the first target location as a read time location; The performing the second data reorganization task in the first database includes: Partition merging is performed within the first database for the second target partition using the second target site as a read time site.
10. The data management method according to claim 1, wherein the shared storage area stores a task allocation file, a device-level task status file corresponding to at least one database in the distributed database, a system-level task status file, and a device status file; The device-level task status file is filled in by the corresponding database, and is used to record the completion mark of the data reorganization task of the corresponding database as the execution copy, and the verification pass mark of the data reorganization task of the corresponding database not as the execution copy; The system-level task status file is filled in by the leader database according to the device-level task status file corresponding to at least one database in the distributed database, and is used to record the completion mark and verification pass mark of all data reorganization tasks in the distributed database; The device status file is filled in by at least one database in the distributed database, and is used to record the device status of at least one database in the distributed database.
11. A data management method, applied to a leader database in a distributed database, the method comprising: In response to receiving the data reorganization task, determining an execution object of the data reorganization task; The received data reorganization task and the determined execution object are filled into the task allocation file in the shared storage area, so that the database that serves as the execution object executes the data reorganization task and stores the execution result in the shared storage area, and the database that does not serve as the execution object synchronizes the execution result of the data reorganization task to the local area.
12. The data management method according to claim 11, wherein determining the execution object of the data reorganization task comprises: The device status of at least one database in the distributed database stored in the shared storage area is read, and the execution object of the data reorganization task is determined according to the device status of at least one database in the distributed database.
13. The data management method according to claim 11, further comprising: In response to the database serving as the execution object of the data reorganization task not updating the device status in the shared storage area within a preset time period, the execution object is re-determined, and the task allocation file is updated according to the re-determined execution object.
14. The data management method according to claim 11, further comprising: In response to the last leader database, no data is written into the shared storage area within a second preset time period.
15. A data management device, applied to a first database among a plurality of databases of a distributed database, the device comprising: A reading module, used for reading a task allocation file in a shared storage area, wherein the task allocation file is filled in by a leader database in the distributed database, and the task allocation file includes at least one data reorganization task, and the data reorganization task records an execution object; A data reorganization module is used to execute the first data reorganization task in the first database in response to the execution object recorded in the first data reorganization task among the at least one data reorganization task being the first database, and store the execution result in the shared storage area, so that other databases among the databases except the first database can synchronize the execution result of the first data reorganization task in the shared storage area to the local area.
16. A data management device, applied to a leader database in a distributed database, the device comprising: A determination module, configured to determine an execution object of the data reorganization task in response to receiving the data reorganization task; An allocation module is used to fill the received data reorganization task and the determined execution object into the task allocation file in the shared storage area, so that the database that serves as the execution object executes the data reorganization task and stores the execution result in the shared storage area, and the database that does not serve as the execution object synchronizes the execution result of the data reorganization task to the local area.
17. A computer program product comprising a computer program / instructions, which when executed by a processor implement the steps of the method according to any one of claims 1 to 14.
18. An electronic device, comprising: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 14 by running the executable instructions.
19. A computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 14.
Citation Information
Cited By
Data management
WO2025256379A1
