WO2015014170A1 - 分区日志队列同步管理方法及设备 - Google Patents

分区日志队列同步管理方法及设备 Download PDF

Info

Publication number
WO2015014170A1
WO2015014170A1 PCT/CN2014/080378 CN2014080378W WO2015014170A1 WO 2015014170 A1 WO2015014170 A1 WO 2015014170A1 CN 2014080378 W CN2014080378 W CN 2014080378W WO 2015014170 A1 WO2015014170 A1 WO 2015014170A1
Authority
WO
WIPO (PCT)
Prior art keywords
log
node
partition interval
standby
primary
Prior art date
Application number
PCT/CN2014/080378
Other languages
English (en)
French (fr)
Inventor
王铁英
刘哲
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2015014170A1 publication Critical patent/WO2015014170A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/16Error detection or correction of the data by redundancy in hardware
    • G06F11/20Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
    • G06F11/2097Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements maintaining the standby controller/processing unit updated
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/82Solving problems relating to consistency

Definitions

  • the embodiments of the present invention relate to communication technologies, and in particular, to a partition log queue synchronization management method and device. Background technique
  • a distributed database system consists of a collection of several nodes. Each node is responsible for part of the data in the distributed database, so that the distributed database system can process massive business data, effectively solving the problem of poor scalability of the centralized database.
  • the log record is written asynchronously, that is, the master node writes the log records to the primary log queue, and the standby node writes the log records to the corresponding standby log queue.
  • the standby node returns the log record successfully.
  • the primary node writes the log record in the primary log queue to the memory, it returns a successful write to the client.
  • the master node periodically sends a write request to the standby node, and the standby node writes the log records in the standby log queue to the memory.
  • the embodiment of the invention provides a method and a device for managing the synchronization of the partitioned log queues, so as to ensure the availability of the log partitioning interval and the consistency of the data of the active and standby nodes when the distributed system changes.
  • the embodiment of the present invention provides a method for managing a partitioned log queue synchronization, comprising: receiving, by a primary node, a log record write request message sent by a client, where the log record write request message includes a log triggered by the client Record
  • the primary node Determining, by the primary node, the primary log partition interval as a writable primary log partition interval according to a write flag bit of the primary log partition interval, and writing the log record triggered by the client to the writable main log partition interval Corresponding main log queue;
  • the master node sends a log record synchronization request message to the standby node, where the log record synchronization request message includes the client-triggered log record and the writable main log partition interval, so that the standby node is configured according to the Deleting a main log partition section to determine a writable log partition section corresponding to the standby node, and writing the log record to a standby log queue corresponding to the writable log partition section; wherein, the writable main log The partition interval corresponds to the same writable partition partition interval corresponding to the writable log partition partition.
  • the method further includes: the primary node receiving routing table update request information sent by a management node, where the routing table update request message includes a routing table ;
  • the master node determines, according to the routing entry in the routing table, a write flag bit of the primary log partition interval corresponding to the primary node.
  • the primary node determines, according to a routing entry in the routing table, a primary log partition corresponding to the primary node
  • the write flag of the interval including:
  • the master node sets the local writable log partition interval as non-writable, writes the write flag position of the route log partition interval to be writable, and uses the route log partition interval as the writable master. a log partition interval and maintaining a corresponding primary log queue for the writable main log partition interval;
  • the routing log partition interval is used as the writable main log partition interval, and the corresponding main host is maintained for the writable main log partition interval. Log queue.
  • the primary node is configured according to a primary log partition interval
  • the flag bit determines that the main log partition interval is writable, and further includes:
  • the primary node receives the log partition interval change information sent by the management node, where the log partition interval change information includes the split and merge information of the primary log partition interval, and the splitting and merging of the primary log partition interval will cause the routing table to be Routing entries have changed;
  • the primary node Determining, by the primary node, the primary log partition interval according to the log partition interval change information; wherein, when the primary log partition interval is a new primary log partition interval after splitting or merging, writing the primary log partition interval
  • the input flag is writable.
  • the write flag of the primary log partition interval is not writable.
  • the master node sends a log record synchronization request to the standby node After the message, it also includes:
  • the master node receives a log record synchronization response message sent by the standby node, and determines that the backup node writes the log record into the standby log queue;
  • the master node writes the log record in the primary log queue to a commit log buffer queue and memory.
  • the master node writes the log record in the primary log queue to a commit log buffer After the column and memory, it also includes:
  • the master node sends a write request message to the standby node, so that the standby node writes the log record in the standby log buffer queue to the commit log buffer queue and the memory corresponding to the standby node.
  • the method further includes:
  • the master node receives a log record missing message sent by the standby node
  • the master node sends a log record missing response message to the standby node.
  • the method further includes:
  • the primary node deletes the log record that meets the preset condition
  • the primary node determines whether the primary log partition interval exists in the routing entry of the routing table, and if not, deletes the primary log partition interval.
  • the embodiment of the present invention provides a method for managing a partitioned log queue synchronization, comprising: receiving, by a standby node, a log record synchronization request message sent by a primary node, where the log record synchronization request message includes the log record triggered by the client And a writable main log partition interval, where the writable log partition interval is determined by the main node according to the write flag bit;
  • the standby node sends a log synchronization response message to the primary node, so that the primary node writes the log record in the primary log queue to the submit log buffer queue and memory corresponding to the primary node;
  • the writable main log partition interval corresponds to the writable log partition interval corresponding to the writable log partition interval.
  • the method further includes: The standby node receives the routing table update request information sent by the management node, where the routing table update request message includes a routing table;
  • the standby node manages the backup log partition interval and the standby log queue corresponding to the spare log partition interval according to the routing entry in the routing table.
  • the standby node according to the routing entry in the routing table, the backup log partition interval and the standby The backup log queue corresponding to the log partition interval is managed, including:
  • the standby node determines that the routing log partition interval in the routing entry belongs to the standby node; the standby node determines that the routing entry is different from the local routing entry;
  • the standby node determines that the routing log partition interval is different from the local standby log partition interval; the standby node increases the routing log partition interval, and uses the routing log partition interval as a writable log partition interval, and is The writeable backup log partition interval creates a corresponding standby log queue.
  • the standby node sends a log synchronization to the primary node After the response message, it also includes:
  • the standby node receives a write request message sent by the primary node
  • the standby node writes the log records in the standby log queue to the commit log buffer queue and the memory corresponding to the standby node.
  • the standby node writes the log record in the standby log queue to the commit log buffer queue and the memory Previously, it also included:
  • the standby node sends a log record missing message to the primary node
  • the standby node receives a log record missing response message sent by the primary node.
  • the method further includes:
  • the standby node deletes the log record that meets the preset condition
  • the standby node determines whether the backup log partition interval exists in the routing entry of the routing table, and if not, deletes the standby log partition interval.
  • an embodiment of the present invention provides a master node, including:
  • a first receiving module configured to receive a log record write request message sent by the client, where the log record write request message includes a log record triggered by the client;
  • a first writing module configured to determine, according to a write flag bit of the main log partition interval, the main log partition interval as a writable main log partition interval, and write the log record triggered by the client into the The main log queue corresponding to the main log partition interval can be written;
  • a first sending module configured to send a log record synchronization request message to the standby node, where the log record synchronization request message includes the log record triggered by the client and the writable main log partition interval, so that the standby node Determining, according to the writable primary log partition interval, a writable backup log partition interval corresponding to the standby node, and writing the log record to the standby log queue corresponding to the writable backup log partition interval;
  • the writeable primary log partition interval and the writable standby log partition interval correspond to the same writable partition interval.
  • the method further includes: a second receiving module, configured to receive routing table update request information sent by the management node, where the routing table update request message includes a routing table ;
  • a flag determining module configured to determine, according to the routing entry in the routing table, a write flag bit of the primary log partition interval corresponding to the primary node.
  • the flag determining module is specifically configured to:
  • the local writable log partition interval is set to be non-writable, the write flag position of the routing log partition interval is writable, and the routing log partition interval is used as the writable main log partition interval. Maintaining a corresponding primary log queue for the writable primary log partition interval;
  • the routing log partition interval is used as the writable main log partition interval, and the corresponding main host is maintained for the writable main log partition interval. Log queue.
  • the third possible implementation manner of the third aspect further includes: an interval determining module, configured to The write flag bit of the log partition interval determines that the main log partition interval is writable,
  • log partition interval change information sent by the management node, where the log partition interval change information includes splitting and merging information of the main log partition interval, where the splitting and merging of the main log partition interval causes the routing entry in the routing table to occur Variety;
  • the write flag of the primary log partition interval is writable, and the primary log partition interval is a split or merge before the original In the main log partition interval, the write flag bit of the main log partition interval is not writable.
  • the fourth possible implementation manner of the third aspect further includes: a second writing module, configured to After the standby node sends the log record synchronization request message,
  • the method further includes: a second sending module, configured to write the log record in the primary log queue After the log buffer queue and the memory are submitted, the write request message is sent to the standby node, so that the standby node writes the log record in the backup log buffer queue to the submit log buffer team corresponding to the standby node.
  • a second sending module configured to write the log record in the primary log queue After the log buffer queue and the memory are submitted, the write request message is sent to the standby node, so that the standby node writes the log record in the backup log buffer queue to the submit log buffer team corresponding to the standby node.
  • the method further includes: a processing module, after sending the write request message to the standby node,
  • a deleting module configured to determine whether a log record in the primary log queue corresponding to the primary log partition interval is empty
  • the primary node deletes the log record that meets the preset condition
  • the primary node determines whether the primary log partition interval exists in the routing entry of the routing table, and if not, deletes the primary log partition interval.
  • an embodiment of the present invention provides a standby node, including:
  • a first receiving module configured to receive a log record synchronization request message sent by the master node, where the log record synchronization request message includes the client-triggered log record and a writable main log partition interval, and the writable log partition interval Determined by the primary node according to a write flag bit;
  • a first write module configured to determine, according to the writable main log partition interval, a writable backup log partition interval corresponding to the standby node, and write the log record into the writable backup log partition interval Reserve queue
  • a first sending module configured to send a log synchronization response message to the primary node, so that the primary node writes the log record in the primary log queue to a submit log buffer queue and a memory corresponding to the primary node;
  • the writeable primary log partition interval and the writable standby log partition interval correspond to the same writable partition interval.
  • the method further includes: a second receiving module, configured to receive routing table update request information sent by the management node, where the route The table update request message includes a routing table;
  • the management module is configured to manage the backup log partition interval and the backup log queue corresponding to the standby log partition interval according to the routing entry in the routing table.
  • the management module is specifically configured to:
  • the routing log partitioning interval is added, and the routing log partitioning interval is used as a writable log partitioning interval, and a corresponding standby log queue is created for the writable standby log partitioning interval.
  • a second writing module configured to send a log synchronization response message to the primary node
  • the method further includes:
  • a processing module configured to write the log records in the standby log queue before submitting the log buffer queue and the memory
  • the fifth possible implementation manner of the fourth aspect further includes: a deleting module, configured to determine the standby Whether the log record in the standby log queue corresponding to the log partition interval is empty.
  • the standby node deletes the log record that meets the preset condition; If yes, the standby node determines whether the backup log partition interval exists in the routing entry of the routing table, and if not, deletes the standby log partition interval.
  • the master node receives a log record write request message sent by the client, and the master node determines the master according to the write flag bit of the main log partition interval.
  • the log partition interval is a writable main log partition interval, and the log record triggered by the client is written into the main log queue corresponding to the writable main log partition interval; the primary node sends a log record synchronization request message to the standby node.
  • FIG. 1 is a schematic flowchart of Embodiment 1 of a method for managing synchronization of a partitioned log queue according to the present invention
  • FIG. 2 is a schematic structural diagram of a distributed database cluster according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of a partitioning of a main log partition interval according to an embodiment of the present invention.
  • Figure 4 is a schematic diagram of a storage format of a primary log queue corresponding to a primary log partition
  • FIG. 5 is a schematic diagram of a format of a synchronous data according to an embodiment of the present invention.
  • Embodiment 1 of a log queue update process according to an embodiment of the present invention
  • FIG. 7 is a schematic flowchart of Embodiment 2 of a method for managing a partitioned log queue synchronization according to the present invention
  • FIG. 8 is a storage format of a backup log queue corresponding to a backup log partition
  • FIG. 9 is a schematic diagram of Embodiment 2 of a log queue update process according to an embodiment of the present invention.
  • FIG. 10 is a schematic diagram of Embodiment 1 of a synchronization process between a primary node and a standby node according to an embodiment of the present invention
  • FIG. 11 is a schematic diagram of a second embodiment of a synchronization process between a primary node and a standby node according to an embodiment of the present invention
  • FIG. 12 is a schematic diagram of a correspondence between a log partitioning interval and a log queue according to an embodiment of the present invention; Schematic diagram of the partition interval;
  • FIG. 14 is a schematic flowchart of deleting a log partition interval of a standby node according to an embodiment of the present invention.
  • Embodiment 15 is a schematic structural diagram of Embodiment 1 of a master node according to the present invention.
  • Embodiment 16 is a schematic structural diagram of Embodiment 2 of a master node according to the present invention.
  • Embodiment 17 is a schematic structural diagram of Embodiment 1 of a standby node according to the present invention.
  • FIG. 18 is a schematic structural diagram of Embodiment 2 of a standby node according to the present invention. detailed description
  • Embodiment 1 is a schematic flowchart of Embodiment 1 of a method for managing a partitioned log queue synchronization according to the present invention.
  • the execution entity of this embodiment is a master node, and the master node can be implemented by software and/or hardware.
  • the method in this embodiment may include:
  • Step 1 01 The master node receives a log record write request message sent by the client, where the log record write request message includes a log record triggered by the client.
  • Step 1 02 The primary node determines, according to a write flag bit of the primary log partition interval, that the primary log partition interval is a writable primary log partition interval, and writes the log record triggered by the client to the writable The main log queue corresponding to the main log partition interval;
  • Step 1 03 The master node sends a log record synchronization request message to the standby node, where the log record synchronization request message includes the log record triggered by the client and the writable main log partition interval.
  • the write flag of the main log partition interval is writable, and when the main log partition interval is the old log partition interval before the change, the main The write flag of the log partition interval is not writable.
  • the partition log queue management method provided in this embodiment can be applied to a distributed database cluster.
  • 2 is a schematic structural diagram of a distributed database cluster according to an embodiment of the present invention.
  • a distributed database cluster consists of a manager node and several cluster nodes.
  • the cluster node is a general term for the primary node (ma s ter ) and the standby node (s l ave ).
  • Each master node includes two or more standby nodes.
  • the management node maintains the state of the cluster node and pushes the latest routing table to the cluster node by periodically checking the heartbeat sent by the cluster node.
  • a node belonging to a cluster node may serve as a master node or a standby node, and correspondingly, nodes belonging to a cluster node have a primary log partition interval and/or The backup log partition interval, each partition interval corresponds to a log queue, wherein the log queue is used to store data rows of the partition interval.
  • this embodiment limits the primary and secondary nodes of the node belonging to the cluster node.
  • the partition log queue management method provided in this embodiment is mainly used for the management method of the partition log queue when the main log partition interval corresponding to the primary node changes.
  • the new primary node involved in this embodiment joins, including the merge and segmentation of the original primary log partition interval.
  • the specific implementation process of the main log partition interval changes is:
  • the primary node receives the log partition interval change information sent by the management node, where the log partition interval change information includes the split and merge information of the primary log partition interval, and the splitting and merging of the primary log partition interval will cause the routing table to be Routing entries have changed;
  • the master node determines the primary log partition interval according to the log partition interval change information.
  • the main log partition interval is divided into examples, which are described in detail.
  • the master node includes a new master node and an old master node.
  • the new primary node sends a join request directly to the management node, the management node traverses the routing table, performs load statistics of the log partition, and then the management node performs an existing primary log partition interval according to the load of each log partition.
  • the management node then sends the log partition interval change information to the old master node, and the log partition interval change information includes the segmentation information of the main log partition interval.
  • the old master node creates a new log queue based on the split information, and sets the old log partition queue to be unwritable. Then, the new primary node creates a corresponding log queue on the local node, and requests data corresponding to the primary log partition interval corresponding to the new primary node from the corresponding old primary node. During the data transfer process, if there is a new journal record written in the new node log partition interval, the new log record will be written to the old master node's new log queue and synchronized to the new node to write to the new node's corresponding log queue. . After all the data has been received, the old master node and the new master node sequentially update the routing table. The new primary node is added as the primary node responsible for this primary log partition interval.
  • FIG. 3 is a schematic diagram of a segmentation of a main log partition interval according to an embodiment of the present invention.
  • the distributed database has six primary nodes, and the primary log partition intervals corresponding to the six primary nodes are [0, 100], [101, 200], [201, 300], [301, 400, respectively. ], [401, 500] and [501, 900].
  • the management node divides the primary log partition interval [501, 900] into two main log partition intervals [501, 750] and [751, 900] according to the load of each log partition, and The main log partition interval [751, 900] is assigned to the new node.
  • the old master node After receiving the notification from the management node, the old master node locally sets [501, 900] as non-writable, and creates two new log queues [501, 750] and [751, 900] to be writable; The node creates a new standby log queue [751, 900] locally.
  • the old master node In the process of transmitting data to the standby node by the master node, if new data belongs to [751, 900], the old master node will write the data to the corresponding writable interval [751, 900] and synchronize to the new one.
  • the master node, the new master node writes data to the standby log queue [751, 900].
  • the old master node sets the interval [751, 900] to be unwritable and triggers the submit request for the interval.
  • the new master node writes the records of the spare interval [751, 900] to the memory
  • the old master node and the new master node sequentially update the routing table, and update the respective primary log partition interval and the standby log partition interval according to the routing table.
  • the primary node receives a log record write request message sent by the client, and the log record write request includes a log record triggered by the client.
  • the log record includes the process of inserting, updating and deleting during the database operation.
  • the master node determines that the log record triggered by the client can be written into the primary log queue corresponding to the primary log partition interval according to the write flag of the primary log partition interval corresponding to the primary node.
  • the write flag when the main log partition interval is a new log partition interval after the change, the write flag is writable, and when the main log partition interval is the old log partition interval before the change, the write flag of the main log partition interval The bit is not writable.
  • the write flag bit 0 represents writable
  • the write flag bit 1 represents non-writable.
  • FIG. 4 is a schematic diagram of the storage format of the primary log queue corresponding to the primary log partition.
  • a primary log partition interval corresponds to a log queue, 0/1 represents a write flag, 0 represents writable, and 1 represents non-writable.
  • the master node may be a new master node or an old master node.
  • the master node writes the log record triggered by the client to the log queue corresponding to the main log partition interval according to the judgment result.
  • the old and new main nodes are only artificially divided, and there is no difference between the main node and the local machine.
  • step 103 after the primary node writes the log record to the primary log queue, the primary node sends a log record synchronization request message to the standby node, where the log record synchronization request message includes a client-triggered log record and a writable main log partition interval.
  • the synchronous data format sent by the primary node to the standby node is as shown in FIG. 5 (FIG. 5 is a schematic diagram of a synchronous data format according to an embodiment of the present invention), and then, the standby node determines a writable standby corresponding to the standby node according to the writable main log partition interval. Log partition interval, and write the log record to the standby log queue corresponding to the logable partition partition interval.
  • the writable main log partition interval is the same as the writable log partition interval corresponding to the writable log partition interval.
  • the master node receives the log record write request message sent by the client, and the master node determines, according to the write flag bit of the main log partition interval, that the main log partition interval is Write the main log partition interval, and log the client triggered Recording a primary log queue corresponding to the writeable primary log partition interval; the primary node sends a log record synchronization request message to the standby node, so that the standby node determines the standby according to the writable primary log partition interval The log partition partition corresponding to the node is written, and the log record is written into the standby log queue corresponding to the writeable backup log partition interval, and the same log partition interval is written between the active and standby nodes, thereby avoiding the primary node and The inconsistency of the standby node data.
  • the management node finds that the routing table of the primary node is not up-to-date through the heartbeat check, the latest routing table is pushed to the primary node.
  • the master node receives the routing table update request message sent by the management node, where the routing table update request message includes a routing table, and the master node determines the write flag bit of the primary log partition interval corresponding to the master node according to the routing entry in the routing table.
  • FIG. 6 is a schematic diagram of Embodiment 1 of a log queue update process according to an embodiment of the present invention.
  • Step 601 The master node obtains a route entry in the routing table.
  • the master node obtains each route entry in the routing table by traversing.
  • Step 6 02 The primary node determines whether the routing log partition interval in the routing entry belongs to the primary node, and if yes, go to step 603, if no, go to step 6 01;
  • the routing entry includes a node identifier and a corresponding routing log partition interval
  • the primary node determines, according to the node identifier, whether the routing log partition interval belongs to the primary node, and if yes, performs step 6 03, if not, performs Step 601.
  • Step 6 03 The master node determines whether there is an intersection between the routing log partition interval and the local writable log partition interval. If yes, go to step 604, if no, go to step 605;
  • Step 6 04 The master node sets the local writable log partition interval to be unwritable, The write log location of the routing log partition interval is writable, the routing log partition interval is used as the writable main log partition interval, and the corresponding main log queue is maintained for the writable main log partition interval.
  • Step 6 05 Write the write flag position of the routing log partition interval to be writable, use the routing log partition interval as the writable main log partition interval, and maintain the corresponding main host for the writable main log partition interval. Log queue.
  • the write flag of the primary log partition interval corresponding to the primary node is updated according to the updated routing entry, thereby avoiding that the log record may be written into the primary log partition interval or the local writable log partition interval, resulting in a log. Inconsistent records, new log records will be written to the main log partition interval corresponding to the routing log partition interval.
  • FIG. 7 is a schematic flowchart of the second embodiment of the method for managing the synchronization of the partitioned log queue according to the present invention.
  • the execution entity of the embodiment is a standby node, and the standby node can be implemented by software and/or hardware. As shown in FIG. 7, the method in this embodiment may include:
  • Step 7 01 The standby node receives a log record synchronization request message sent by the master node, where the log record synchronization request message includes the client-triggered log record and the writable main log partition interval, where the writable log partition interval is The master node is determined according to the write flag bit.
  • the application scenario provided in this embodiment is similar to the application scenario in the embodiment shown in FIG. 1, and the standby node can back up data of the primary node.
  • the writeable log partition interval is a writable main log partition interval determined by the main node according to the write flag bit. Since the standby node performs backup on the master node, the writeable main log partition interval and the writable backup log partition interval may be the same. Write the log partition interval, you can write the main log partition interval and the writeable log partition interval.
  • Step 7 02 The standby node determines, according to the writable primary log partition interval, a writable backup log partition interval corresponding to the standby node, and writes the log record to the standby corresponding to the writable backup log partition interval.
  • Log queue
  • the standby node determines the writable standby corresponding to the standby node according to the writable main log partition interval.
  • Log partition interval and write the log record to the standby log queue corresponding to the logable partition partition interval.
  • the log record is written to the log queue corresponding to the primary node and then written to the log queue corresponding to the standby node. Therefore, the log queue storage format corresponding to the backup log partition interval may not include the write flag.
  • Figure 8 shows the storage format of the standby log queue corresponding to the standby log partition.
  • Step 7 03 The standby node sends a log synchronization response message to the primary node, so that the primary node writes the log record in the primary log queue to a commit log buffer queue and a memory corresponding to the primary node.
  • the standby node After the standby node writes the log records to the standby log queue, it sends a log synchronization response message to the primary node, so that the primary node writes the log records in the primary log queue to the commit log buffer queue and memory corresponding to the primary node.
  • the standby node receives the log record synchronization request message sent by the master node, and the standby node determines the writable standby corresponding to the standby node according to the writable main log partition interval. a log partition interval, and the log record is written to the standby log queue corresponding to the writable log partition interval; the standby node sends a log synchronization response message to the primary node, and the same is written between the active and standby nodes.
  • the log partition interval avoids the inconsistency between the primary node and the standby node.
  • the management node finds that the routing table of the standby node is not up-to-date through the heartbeat check, the latest routing table is pushed to the standby node.
  • the standby node receives the routing table update request information sent by the management node, where the routing table update request message includes a routing table, and the standby node performs the backup log partition interval and the standby log according to the routing entry in the routing table.
  • the standby log queue corresponding to the partition interval is managed.
  • the standby node determines, according to the routing entry in the routing table, a spare log partition interval corresponding to the standby node, as shown in FIG. 9.
  • FIG. 9 is a schematic diagram of Embodiment 2 of a log queue update process according to an embodiment of the present invention, including the following steps:
  • Step 901 The standby node acquires a route entry in the routing table.
  • the standby node obtains routing entries by traversing.
  • Step 902 The standby node determines whether the routing log partition interval in the routing entry belongs to the standby node, and if yes, go to step 903, if no, go to step 901;
  • the routing entry includes the node identifier and the corresponding routing log partitioning interval.
  • the standby node determines whether the routing log partitioning interval belongs to the standby node according to the node identifier. If yes, go to step 903. If no, go to step 901. .
  • Step 903 The standby node determines whether the routing entry is different from the local routing entry, and if yes, executing step 904, if no, executing step 901;
  • the route entry stored on the standby node is different from the route entry pushed by the management node.
  • Step 904 the standby node determines whether the routing log partition interval is different from the local standby log partition area, and if yes, go to step 905, if no, go to step 901;
  • Step 905 The standby node adds the routing log partitioning interval, and uses the routing log partitioning interval as a writable log partitioning interval, and creates a corresponding standby log queue for the writable standby log partitioning interval.
  • FIG. 10 is a schematic diagram of Embodiment 1 of a synchronization process between a primary node and a standby node according to an embodiment of the present invention.
  • This embodiment describes the synchronization process of the primary node and the standby node in detail based on the above embodiments.
  • the synchronization process in this embodiment is an asynchronous synchronization process
  • FIG. 10 is a schematic diagram of the first phase of the synchronization process. As shown in FIG. 10, the following steps are included:
  • Step 1001 The primary node receives a log record write request message sent by the client.
  • Step 1002 The primary node determines that the primary log partition interval is a writable primary log partition interval, and writes the log record triggered by the client to the primary log queue corresponding to the writable main log partition interval.
  • Step 1003 The primary node sends a log record synchronization request message to the standby node.
  • Step 1004 The standby node receives a log record synchronization request message sent by the primary node.
  • Step 1005 The standby node writes the log record to the standby log queue corresponding to the standby log partition interval.
  • Step 1006 The standby node sends a log synchronization response message to the primary node.
  • Step 1007 The master node determines whether to receive the log record synchronization response message sent by the standby node; if not, step 1008 is performed, and if yes, step 1009 is performed.
  • the master node if the master node does not receive the log record synchronization request message sent by the standby node within the preset time, the master node sends the log record and the information of the unsuccessful standby node to another. Back up on the node for use in data recovery.
  • Step 1008 The primary node sends a log record synchronization request message to other standby nodes.
  • Step 1009 The master node writes the log records in the primary log queue to the commit log buffer queue and the memory corresponding to the primary node.
  • FIG. 11 is a schematic diagram of Embodiment 2 of a synchronization process between a primary node and a standby node according to an embodiment of the present invention, which mainly includes the following steps:
  • Step 1101 The primary node sends a write request message to the standby node.
  • the master node periodically sends a write request message to the standby node.
  • Step 1102 The standby node receives a write request message sent by the primary node.
  • Step 1103 the standby node determines whether the log record is missing, if not, go to step 1108, and if yes, go to step 1104;
  • the standby node determines whether the log record is missing according to the log sequence number of the log record. When the log sequence number is not continuous, the standby node determines that the log record is missing. Step 1104 is performed. When the log sequence number is continuous, the standby node determines that the log record is not missing, and performs step 1108. Those skilled in the art can understand that when the standby node determines that the log record is not missing, the step performed by the master node ends here. Step 1104: The standby node sends a log record missing message to the primary node.
  • the missing log sequence number can be carried in the log missing message.
  • Step 1105 The primary node receives a log record missing message sent by the standby node.
  • Step 1106 The primary node sends a log record missing response message to the standby node.
  • the master node When the standby node determines that the log record is missing, the master node also receives the log record missing message sent by the standby node, and sends a log record missing response message to the standby node, where the log record missing response message may carry the log record missing from the standby node.
  • Step 1107 The standby node receives a log record missing response message sent by the primary node, and writes the missing log record into the standby log queue.
  • Step 1108 The standby node writes the log records in the standby log queue to the commit log buffer queue and the memory.
  • the standby node After the standby node receives the log record missing response message, it writes the missing log record and the log record in the standby log queue to the commit log cache queue and memory.
  • FIG. 12 is a schematic diagram of correspondence between a log partition interval and a log queue according to an embodiment of the present invention.
  • R1 - R3 are the values of the log partition interval, L1_L5 ..., LI' ⁇ L5' ... and L1', ⁇ L5', which are the log records in the corresponding log queue.
  • Ll, L1' and Ll, , respectively, are the heads of the log queue, and when there is new data, they are written from the end of the corresponding log queue.
  • the correspondence between the log partition interval and the log queue provided in this embodiment is suitable for both the primary log partition interval and the log partition interval, because the primary log partition interval and the standby log partition interval correspond to the same log partition interval.
  • FIG. 13 is a schematic flowchart of deleting a log partition interval by a primary node according to an embodiment of the present invention. As shown in Figure 13, for the primary node, the primary node deletes the old primary log partition interval.
  • the specific process is as follows: Step 1 301: The master node determines whether the log record in the primary log queue corresponding to the primary log partition interval is empty. If not, go to step 1 302, and if yes, go to step 1 303;
  • Step 1 302 The primary node deletes the log record that meets the preset condition.
  • Step 1 303 The primary node determines whether the primary log partition interval exists in the routing entry of the routing table. If not, step 1304 is performed, and if yes, step 1 305 is performed;
  • Step 1 304 The primary node deletes the primary log partition interval.
  • Step 1 305 The primary node waits for the next deletion period.
  • the log record when the log record is not empty, all the log records cannot be deleted, and only the log records that meet the preset conditions are deleted.
  • the log records that meet the preset conditions are specifically slower than the last write commit log.
  • the primary node determines whether the log partition interval exists in the routing entry of the routing table. If it does not exist, delete the primary log partition interval. If yes, wait for the next deletion process.
  • FIG. 14 is a schematic flowchart of a backup node deleting a log partition interval according to an embodiment of the present invention. As shown in Figure 14, for the standby node, the standby node deletes the old standby log partition interval. The specific process is as follows:
  • Step 1401 The standby node determines whether the log record in the standby log queue corresponding to the standby log partition interval is empty. If no, go to step 1402. If yes, go to step 1403.
  • Step 1402 The standby node deletes the log record that meets the preset condition.
  • Step 1403 The standby node determines whether the backup log partition interval exists in the routing entry of the routing table, if not, step 1404 is performed, and if yes, step 1405 is performed;
  • Step 1404 The standby node deletes the standby log partition interval.
  • Step 1405 The standby node waits for the next deletion period.
  • the standby node determines whether the log partition interval exists in the routing entry of the routing table. If it does not exist, delete the standby log partition interval. If yes, wait for the next deletion process.
  • the partition log queue management method provided by the present embodiment, after the standby node writes the log records of the old interval to the commit log buffer queue and the memory, deletes the old primary log partition interval and the standby log partition interval, thereby ensuring the integrity of the log record. Sex, and improve system resource utilization.
  • FIG. 15 is a schematic structural diagram of Embodiment 1 of a master node according to the present invention.
  • the master node 1 50 includes a first receiving module 1501, a first writing module 1502, and a first transmitting module 1503.
  • the first receiving module 1501 is configured to receive a log record write request message sent by the client, where the log record write request message includes the log record triggered by the client.
  • the first writing module 1502 is configured to determine, according to a write flag bit of the main log partition interval, that the main log partition interval is a writable main log partition interval, and write the log record triggered by the client into the Write the main log queue corresponding to the main log partition interval;
  • the first sending module 1503 is configured to send a log record synchronization request message to the standby node, where the log record synchronization request message includes the client-triggered log record and the writable main message partition interval, so that the The standby node determines the writable log partition interval corresponding to the standby node according to the writable main log partition interval, and writes the log record to the standby log queue corresponding to the writable log partition interval;
  • the writable primary log partition interval corresponds to the writable log partition interval corresponding to the writable log partition partition.
  • the master node provided by the embodiment of the present invention may be used to implement the technical solution of the foregoing method embodiment, and the implementation principle and the technical effect are similar, and details are not described herein again.
  • FIG. 16 is a schematic structural diagram of Embodiment 2 of a master node according to the present invention. As shown in FIG. 16, the embodiment of the present invention is based on the embodiment of FIG.
  • the second receiving module 1504 is configured to receive routing table update request information sent by the management node, where the routing table update request message includes a routing table.
  • the flag bit determining module 1505 is configured to determine, according to the routing entry in the routing table, a write flag bit of the primary log partition interval corresponding to the primary node.
  • the flag determining module 1505 is specifically configured to: Determining that the routing log partition interval in the routing entry belongs to the primary node;
  • routing log partition interval Determining whether there is an intersection between the routing log partition interval and the local writable log partition interval; if yes, setting the local writable log partition interval to be non-writable, and writing the write flag position of the routing log partition interval to be writable And the routing log partition interval is used as the writable main log partition interval, and the corresponding main log queue is maintained for the writable main log partition interval;
  • the routing log partition interval is used as the writable main log partition interval, and the corresponding main host is maintained for the writable main log partition interval. Log queue.
  • the method further includes: an interval determining module 1506, configured to determine, before the primary log partition interval is writable according to a write flag bit of the primary log partition interval,
  • log partition interval change information sent by the management node, where the log partition interval change information includes splitting and merging information of the main log partition interval, where the splitting and merging of the main log partition interval causes the routing entry in the routing table to occur Variety;
  • the write flag of the primary log partition interval is writable, and the primary log partition interval is a split or merge before the original In the main log partition interval, the write flag bit of the main log partition interval is not writable.
  • the method further includes: a second writing module 1 507, configured to send a log record synchronization request message to the standby node,
  • the method further includes: a second sending module 1 508, configured to send the write request message to the standby node after the log record in the primary log queue is written into the submit log buffer queue and the memory, The standby node writes the log records in the standby log buffer queue to the commit log buffer queue and the memory corresponding to the standby node.
  • the method further includes: a processing module 1509, configured to send a write request message to the standby node,
  • the method further includes: deleting the module 151 0, configured to determine whether the record in the main queue corresponding to the main log partition interval is empty;
  • the primary node deletes the log record that meets the preset condition
  • the primary node determines whether the primary log partition interval exists in the routing entry of the routing table, and if not, deletes the primary log partition interval.
  • the master node provided by the embodiment of the present invention may be used to implement the technical solution of the foregoing method embodiment, and the implementation principle and the technical effect are similar, and details are not described herein again.
  • FIG. 17 is a schematic structural diagram of Embodiment 1 of a standby node according to the present invention.
  • the standby node 170 provided by the embodiment of the present invention includes: a first receiving module 1701, a first writing module 1702, and a first sending module 1703.
  • the first receiving module 1701 is configured to receive a log record synchronization request message sent by the master node, where the log record synchronization request message includes the client-triggered log record and a writable main log partition interval, where the writable The log partition interval is determined by the master node according to the write flag bit;
  • the first write module 1702 is configured to determine, according to the writable main log partition interval, a writable backup log partition interval corresponding to the standby node, and write the log record into the writable backup log partition interval.
  • Backup log queue
  • the first sending module 1703 is configured to send a log synchronization response message to the primary node, so that the primary node writes the log record in the primary log queue to a commit log buffer queue and a memory corresponding to the primary node. ;
  • the writable primary log partition interval corresponds to the writable log partition interval corresponding to the writable log partition partition.
  • FIG. 18 is a schematic structural diagram of Embodiment 2 of a standby node according to the present invention. As shown in FIG. 18, the embodiment of the present invention is based on the embodiment of FIG.
  • the second receiving module 1704 is configured to receive routing table update request information sent by the management node, where the routing table update request message includes a routing table.
  • the management module 1 705 is configured to manage the backup log partition interval and the backup log queue corresponding to the standby log partition interval according to the routing entries in the routing table.
  • the management module 1 705 is specifically configured to:
  • the routing log partitioning interval is added, and the routing log partitioning interval is used as a writable log partitioning interval, and a corresponding standby log queue is created for the writable standby log partitioning interval.
  • the method further includes: a second writing module 1 706, configured to send a log synchronization response message to the primary node,
  • the method further includes: a processing module 1707, configured to write the log records in the standby log queue before submitting the log buffer queue and the memory,
  • the method further includes: deleting a module 1708, configured to determine whether the log record in the standby queue corresponding to the standby log partition interval is empty;
  • the standby node deletes the log record that meets the preset condition; If yes, the standby node determines whether the backup log partition interval exists in the routing entry of the routing table, and if not, deletes the standby log partition interval.
  • the standby node provided by the embodiment of the present invention may be used to implement the technical solution of the foregoing method embodiment, and the implementation principle and the technical effect are similar, and details are not described herein again.
  • the aforementioned program can be stored in a computer readable storage medium.
  • the program when executed, performs the steps including the above-described method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as ROM, RAM, disk or optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)

Abstract

提供一种分区日志队列同步管理方法及设备。该方法包括主节点接收客户端发送的日志记录写入请求消息,主节点根据主日志分区区间的写入标志位,确定主日志分区区间为可写主日志分区区间,并将客户端触发的日志记录写入可写主日志分区区间对应的主日志队列;主节点向备节点发送日志记录同步请求消息,以使备节点根据可写主日志分区区间确定备节点对应的可写备日志分区区间,并将日志记录写入可写备日志分区区间对应的备日志队列。提供的分区日志队列同步管理方法及设备,在日志分区区间发生变化时,可以保证主备节点数据一致性。

Description

分区日志队列同步管理方法及设备 技术领域
本发明实施例涉及通信技术, 尤其涉及一种分区日志队列同步管理方法及 设备。 背景技术
分布式数据库系统由若干个节点集合而成。 每个节点负责分布式数据库中 的部分数据, 从而使分布式数据库系统能够处理海量业务数据, 有效解决了集 中式数据库可扩充性差的问题。
当分布式数据库系统釆用日志记录进行数据同步时, 当日志记录写入的方 式为异步, 即主节点将日志记录写入主日志队列, 备节点将日志记录写入对应 的备日志队列后, 备节点就返回日志记录写入成功, 主节点将主日志队列中的 日志记录写入内存后, 就向客户端返回写成功。 主节点定期向备节点发送写入 请求, 备节点将备日志队列中的日志记录写入内存。 这种异步提交的方法相对 于同步提交在很大程度上能提供系统的吞吐量。
然而, 当日志分区区间发生切分或合并变化, 并产生新日志分区区间时, 如果备日志队列中的日志记录没有写入内存, 就将备日志队列删除重建新主备 日志队列, 会导致主节点和备节点的数据不一致; 如果等备日志队列中的日记 记录写入内存后, 再删除该备日志队列创建新主备日志队列的话, 会导致在这 一段时间中对于新日志分区区间不可用; 既要保证新日志分区区间可用, 又要 保证主备节点之间的数据一致, 可以保留旧日志分区区间对应的日志队列并同 时为新日志分区区间创建新的日志队列。 但在这种情况下, 当有新的日志记录 写入时, 不管是在主节点上还是备节点上都有可能将部分记录写入新日志分区 区间, 部分记录写入旧日志分区区间, 从而导致主节点和备节点日志记录的不 对应, 使日志记录进行异步提交的时候产生混乱。 发明内容
本发明实施例提供一种分区日志队列同步管理方法及设备, 以保证在分布 式系统在区间发生变化时, 日志分区区间的可用性和主备节点数据的一致性。
第一方面, 本发明实施例提供一种分区日志队列同步管理方法, 包括: 主节点接收客户端发送的日志记录写入请求消息, 所述日志记录写入请求 消息包括所述客户端触发的日志记录;
所述主节点根据主日志分区区间的写入标志位, 确定所述主日志分区区间 为可写主日志分区区间, 并将所述客户端触发的日志记录写入所述可写主日志 分区区间对应的主日志队列;
所述主节点向备节点发送日志记录同步请求消息, 所述日志记录同步请求 消息中包括所述客户端触发的日志记录以及所述可写主日志分区区间, 以使所 述备节点根据所述可写主日志分区区间确定所述备节点对应的可写备日志分区 区间, 并将所述日志记录写入所述可写备日志分区区间对应的备日志队列; 其中, 所述可写主日志分区区间与所述可写备日志分区区间对应相同的可 写曰志分区区间。
结合第一方面, 在第一方面的第一种可能的实现方式中, 所述方法还包括: 所述主节点接收管理节点发送的路由表更新请求信息, 所述路由表更新请 求消息包括路由表;
所述主节点根据所述路由表中的路由条目确定所述主节点对应的主日志分 区区间的写入标志位。
结合第一方面的第一种可能的实现方式, 在第一方面的第二种可能的实现 方式中, 所述主节点根据所述路由表中的路由条目确定所述主节点对应的主日 志分区区间的写入标志位, 包括:
所述主节点确定路由条目中的路由日志分区区间归属所述主节点; 所述主节点确定所述路由日志分区区间与本地可写日志分区区间是否存在 交集;
若是, 则所述主节点将所述本地可写日志分区区间置为不可写, 将所述路 由日志分区区间的写入标志位置为可写, 将所述路由日志分区区间作为所述可 写主日志分区区间并为所述可写主日志分区区间维护对应的主日志队列;
若否, 则将所述路由日志分区区间的写入标志位置为可写, 将所述路由日 志分区区间作为所述可写主日志分区区间并为所述可写主日志分区区间维护对 应的主日志队列。
结合第一方面, 第一方面的第一种、 第二种任一种可能的实现方式, 在第 一方面的第三种可能的实现方式中, 所述主节点根据主日志分区区间的写入标 志位判断所述主日志分区区间可写之前, 还包括:
所述主节点接收管理节点发送的日志分区区间变化信息, 所述日志分区区 间变化信息包括主日志分区区间的切分与合并信息, 所述主日志分区区间的切 分与合并将引起路由表中的路由条目发生变化;
所述主节点根据所述日志分区区间变化信息确定所述主日志分区区间; 其中, 所述主日志分区区间为切分或合并后新的主日志分区区间时, 所述 主日志分区区间的写入标志位为可写, 所述主日志分区区间为切分或合并前原 始主日志分区区间时, 所述主日志分区区间的写入标志位为不可写。
结合第一方面, 第一方面的第一种至第三种任一种可能的实现方式, 在第 一方面的第四种可能的实现方式中, 所述主节点向备节点发送日志记录同步请 求消息之后, 还包括:
所述主节点接收所述备节点发送的日志记录同步响应消息, 确定所述备节 点将所述日志记录写入备日志队列;
所述主节点将所述主日志队列中的所述日志记录写入提交日志緩冲队列和 内存。
结合第一方面的第四种可能的实现方式, 在第一方面的第五种可能的实现 方式中, 所述主节点将所述主日志队列中的所述日志记录写入提交日志緩冲队 列和内存之后, 还包括:
所述主节点向所述备节点发送写入请求消息, 以使所述备节点将备日志緩 冲队列中的日志记录写入所述备节点对应的提交日志緩冲队列和内存。
结合第一方面的第五种可能的实现方式, 在第一方面的第六种可能的实现 方式中, 所述主节点向所述备节点发送写入请求消息之后, 还包括:
所述主节点接收所述备节点发送的日志记录缺失消息;
所述主节点向所述备节点发送日志记录缺失响应消息。
结合第一方面, 第一方面的第一种至第六种任一种可能的实现方式, 在第 一方面的第七种可能的实现方式中, 所述方法还包括:
所述主节点确定所述主日志分区区间对应的主日志队列中的日志记录是否 为空;
若否, 则主节点删除满足预设条件的日志记录;
若是, 则主节点确定所述主日志分区区间是否存在与路由表的路由条目中, 若不存在, 则删除所述主日志分区区间。
第二方面, 本发明实施例提供一种分区日志队列同步管理方法, 包括: 备节点接收主节点发送的日志记录同步请求消息, 所述日志记录同步请求 消息中包括所述客户端触发的日志记录以及可写主日志分区区间, 所述可写日 志分区区间为所述主节点才艮据写入标志位确定的;
所述备节点根据所述可写主日志分区区间确定所述备节点对应的可写备日 志分区区间, 并将所述日志记录写入所述可写备日志分区区间对应的备日志队 歹 |J ;
所述备节点向所述主节点发送日志同步响应消息, 以使所述主节点将所述 主日志队列中的所述日志记录写入主节点对应的提交日志緩冲队列和内存; 其中, 所述可写主日志分区区间与所述可写备日志分区区间对应相同的可 写日志分区区间。
结合第二方面, 在第二方面的第一种可能的实现方式中, 所述方法还包括: 所述备节点接收管理节点发送的路由表更新请求信息, 所述路由表更新请 求消息包括路由表;
所述备节点根据所述路由表中的路由条目, 对备日志分区区间及所述备日 志分区区间对应的备日志队列进行管理。
结合第二方面的第一种可能的实现方式, 在第二方面的第二种可能的实现 方式中, 所述备节点根据所述路由表中的路由条目, 对备日志分区区间及所述 备日志分区区间对应的备日志队列进行管理, 包括:
所述备节点确定路由条目中的路由日志分区区间归属所述备节点; 所述备节点确定所述路由条目与本地路由条目不同;
所述备节点确定所述路由日志分区区间与本地备日志分区区间不同; 所述备节点增加所述路由日志分区区间, 并将所述路由日志分区区间作为 可写备日志分区区间, 并为所述可写备日志分区区间创建对应的备日志队列。
结合第二方面, 第二方面的第一种、 第二种任一种可能的实现方式, 在第 二方面的第三种可能的实现方式中, 所述备节点向所述主节点发送日志同步响 应消息之后, 还包括:
所述备节点接收所述主节点发送的写入请求消息;
所述备节点将所述备日志队列中的日志记录写入备节点对应的提交日志緩 冲队列和内存。
结合第二方面的第三种可能的实现方式, 在第二方面的第四种可能的实现 方式中, 所述备节点将所述备日志队列中的日志记录写入提交日志緩冲队列和 内存之前, 还包括:
所述备节点向所述主节点发送日志记录缺失消息;
所述备节点接收所述主节点发送的日志记录缺失响应消息。
结合第二方面, 第二方面的第一种至第四种任一种可能的实现方式, 在第 二方面的第五种可能的实现方式中, 所述方法还包括:
所述备节点确定所述备日志分区区间对应的备日志队列中的日志记录是否 为空;
若否, 则备节点删除满足预设条件的日志记录;
若是, 则备节点确定所述备日志分区区间是否存在与路由表的路由条目中, 若不存在, 则删除所述备日志分区区间。
第三方面, 本发明实施例提供一种主节点, 包括:
第一接收模块, 用于接收客户端发送的日志记录写入请求消息, 所述日志 记录写入请求消息包括所述客户端触发的日志记录;
第一写入模块, 用于才艮据主日志分区区间的写入标志位, 确定所述主日志 分区区间为可写主日志分区区间, 并将所述客户端触发的日志记录写入所述可 写主日志分区区间对应的主日志队列;
第一发送模块, 用于向备节点发送日志记录同步请求消息, 所述日志记录 同步请求消息中包括所述客户端触发的日志记录以及所述可写主日志分区区 间, 以使所述备节点根据所述可写主日志分区区间确定所述备节点对应的可写 备日志分区区间, 并将所述日志记录写入所述可写备日志分区区间对应的备日 志队列;
其中, 所述可写主日志分区区间与所述可写备日志分区区间对应相同的可 写曰志分区区间。
结合第三方面, 在第三方面的第一种可能的实现方式中, 还包括: 第二接收模块, 用于接收管理节点发送的路由表更新请求信息, 所述路由 表更新请求消息包括路由表;
标志位确定模块, 用于根据所述路由表中的路由条目确定所述主节点对应 的主日志分区区间的写入标志位。
结合第三方面的第一种可能的实现方式, 在第三方面的第二种可能的实现 方式中, 所述标志位确定模块具体用于:
确定路由条目中的路由日志分区区间归属所述主节点;
确定所述路由日志分区区间与本地可写日志分区区间是否存在交集; 若是, 则将所述本地可写日志分区区间置为不可写, 将所述路由日志分区 区间的写入标志位置为可写, 将所述路由日志分区区间作为所述可写主日志分 区区间并为所述可写主日志分区区间维护对应的主日志队列;
若否, 则将所述路由日志分区区间的写入标志位置为可写, 将所述路由日 志分区区间作为所述可写主日志分区区间并为所述可写主日志分区区间维护对 应的主日志队列。
结合第三方面, 第三方面的第一种、 第二种任一种可能的实现方式, 在第 三方面的第三种可能的实现方式中, 还包括: 区间确定模块, 用于在根据主日 志分区区间的写入标志位判断所述主日志分区区间可写之前,
接收管理节点发送的日志分区区间变化信息, 所述日志分区区间变化信息 包括主日志分区区间的切分与合并信息, 所述主日志分区区间的切分与合并将 引起路由表中的路由条目发生变化;
才艮据所述日志分区区间变化信息确定所述主日志分区区间;
其中, 所述主日志分区区间为切分或合并后新的主日志分区区间时, 所述 主日志分区区间的写入标志位为可写, 所述主日志分区区间为切分或合并前原 始主日志分区区间时, 所述主日志分区区间的写入标志位为不可写。
结合第三方面, 第三方面的第一种至第三种任一种可能的实现方式, 在第 三方面的第四种可能的实现方式中, 还包括: 第二写入模块, 用于向备节点发 送曰志记录同步请求消息之后,
接收所述备节点发送的日志记录同步响应消息, 确定所述备节点将所述日 志记录写入备日志队列;
将所述主日志队列中的所述日志记录写入提交日志緩冲队列和内存。
结合第三方面的第四种可能的实现方式, 在第三方面的第五种可能的实现 方式中, 还包括: 第二发送模块, 用于将所述主日志队列中的所述日志记录写 入提交日志緩冲队列和内存之后, 向所述备节点发送写入请求消息, 以使所述 备节点将备日志緩冲队列中的日志记录写入所述备节点对应的提交日志緩冲队 列和内存。
结合第三方面的第五种可能的实现方式, 在第三方面的第六种可能的实现 方式中, 还包括: 处理模块, 用于向所述备节点发送写入请求消息之后,
接收所述备节点发送的日志记录缺失消息;
向所述备节点发送日志记录缺失响应消息。
结合第三方面, 第三方面的第一种至第六种任一种可能的实现方式, 在第 三方面的第七种可能的实现方式中, 还包括:
删除模块, 用于确定所述主日志分区区间对应的主日志队列中的日志记录 是否为空;
若否, 则主节点删除满足预设条件的日志记录;
若是, 则主节点确定所述主日志分区区间是否存在与路由表的路由条目中, 若不存在, 则删除所述主日志分区区间。
第四方面, 本发明实施例提供一种备节点, 包括:
第一接收模块, 用于接收主节点发送的日志记录同步请求消息, 所述日志 记录同步请求消息中包括所述客户端触发的日志记录以及可写主日志分区区 间, 所述可写日志分区区间为所述主节点根据写入标志位确定的;
第一写入模块, 用于才艮据所述可写主日志分区区间确定所述备节点对应的 可写备日志分区区间, 并将所述日志记录写入所述可写备日志分区区间对应的 备曰志队列;
第一发送模块, 用于向所述主节点发送日志同步响应消息, 以使所述主节 点将所述主日志队列中的所述日志记录写入主节点对应的提交日志緩冲队列和 内存;
其中, 所述可写主日志分区区间与所述可写备日志分区区间对应相同的可 写曰志分区区间。
结合第四方面, 在第四方面的第一种可能的实现方式中, 还包括: 第二接收模块, 用于接收管理节点发送的路由表更新请求信息, 所述路由 表更新请求消息包括路由表;
管理模块, 用于根据所述路由表中的路由条目, 对备日志分区区间及所述 备日志分区区间对应的备日志队列进行管理。
结合第四方面的第一种可能的实现方式, 在第四方面的第二种可能的实现 方式中, 所述管理模块具体用于:
确定路由条目中的路由日志分区区间归属所述备节点;
确定所述路由条目与本地路由条目不同;
确定所述路由日志分区区间与本地备日志分区区间不同;
增加所述路由日志分区区间, 并将所述路由日志分区区间作为可写备日志 分区区间, 并为所述可写备日志分区区间创建对应的备日志队列。
结合第四方面, 第四方面的第一种、 第二种任一种可能的实现方式, 在第 四方面的第三种可能的实现方式中, 还包括:
第二写入模块, 用于向所述主节点发送日志同步响应消息之后,
接收所述主节点发送的写入请求消息;
将所述备日志队列中的日志记录写入备节点对应的提交日志緩冲队列和内 存。
结合第四方面的第三种可能的实现方式, 在第四方面的第四种可能的实现 方式中, 还包括:
处理模块, 用于将所述备日志队列中的日志记录写入提交日志緩冲队列和 内存之前,
向所述主节点发送日志记录缺失消息;
接收所述主节点发送的日志记录缺失响应消息。
结合第四方面, 第四方面的第一种至第四种任一种可能的实现方式, 在第 四方面的第五种可能的实现方式中, 还包括: 删除模块, 用于确定所述备日志 分区区间对应的备日志队列中的日志记录是否为空;
若否, 则备节点删除满足预设条件的日志记录; 若是, 则备节点确定所述备日志分区区间是否存在与路由表的路由条目中, 若不存在, 则删除所述备日志分区区间。
本发明实施例提供的分区日志队列同步管理方法及设备, 该主节点通过接 收客户端发送的日志记录写入请求消息, 所述主节点根据主日志分区区间的写 入标志位, 确定所述主日志分区区间为可写主日志分区区间, 并将所述客户端 触发的日志记录写入所述可写主日志分区区间对应的主日志队列; 所述主节点 向备节点发送日志记录同步请求消息, 以使所述备节点根据所述可写主日志分 区区间确定所述备节点对应的可写备日志分区区间, 并将所述日志记录写入所 述可写备日志分区区间对应的备日志队列, 主备节点之间写入相同的日志分区 区间 ,避免了主节点和备节点数据的不一致。 附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对实施 例或现有技术描述中所需要使用的附图作一简单地介绍, 显而易见地, 下面描 述中的附图是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出 创造性劳动性的前提下, 还可以根据这些附图获得其他的附图。
图 1为本发明分区日志队列同步管理方法实施例一的流程示意图; 图 2为本发明实施例分布式数据库集群结构示意图;
图 3为本发明实施例主日志分区区间切分示意图;
图 4为主日志分区对应的主日志队列的存储格式示意图;
图 5为本发明实施例同步数据格式示意图;
图 6为本发明实施例日志队列更新流程实施例一的示意图;
图 7为本发明分区日志队列同步管理方法实施例二的流程示意图; 图 8为备日志分区对应的备日志队列的存储格式;
图 9为本发明实施例日志队列更新流程实施例二的示意图;
图 10为本发明实施例主节点与备节点同步流程实施例一的示意图; 图 11为本发明实施例主节点与备节点同步流程实施例二的示意图; 图 12为本发明实施例日志分区区间与日志队列的对应关系示意图; 图 1 3为本发明实施例主节点删除日志分区区间的流程示意图;
图 14为本发明实施例备节点删除日志分区区间的流程示意图;
图 15为本发明主节点实施例一的结构示意图;
图 16为本发明主节点实施例二的结构示意图;
图 17为本发明备节点实施例一的结构示意图;
图 18为本发明备节点实施例二的结构示意图。 具体实施方式
为使本发明实施例的目的、 技术方案和优点更加清楚, 下面将结合本发 明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完整地描述, 显然, 所描述的实施例是本发明一部分实施例, 而不是全部的实施例。 基于 本发明中的实施例, 本领域普通技术人员在没有作出创造性劳动前提下所获 得的所有其他实施例, 都属于本发明保护的范围。
图 1为本发明分区日志队列同步管理方法实施例一的流程示意图, 本实 施例的执行主体为主节点, 该主节点可以通过软件和 /或硬件实现。 如图 1 所示, 本实施例的方法可以包括:
步骤 1 01、 主节点接收客户端发送的日志记录写入请求消息, 所述日志 记录写入请求消息包括所述客户端触发的日志记录;
步骤 1 02、 所述主节点根据主日志分区区间的写入标志位, 确定所述主 日志分区区间为可写主日志分区区间, 并将所述客户端触发的日志记录写入 所述可写主日志分区区间对应的主日志队列;
步骤 1 03、 所述主节点向备节点发送日志记录同步请求消息, 所述日志 记录同步请求消息中包括所述客户端触发的日志记录以及所述可写主日志分 区区间。 其中, 所述可写主日志分区区间与所述可写备日志分区区间对应相同的 可写日志分区区间
所述主日志分区区间为变化后新的日志分区区间时, 所述主日志分区区 间的写入标志位为可写,所述主日志分区区间为变化前旧的日志分区区间时, 所述主日志分区区间的写入标志位为不可写。
本实施例提供的分区日志队列管理方法, 可以应用到分布式数据库集群 中。 其中, 图 2为本发明实施例分布式数据库集群结构示意图。 如图 2所示, 分布式数据库集群是由一个管理 (manager ) 节点和若干个簇 (c lus ter ) 节 点构成。 其中, 簇节点是主节点 (ma s ter )和备节点 (s l ave ) 的统称。 每个 主节点包括两个及以上的备节点。 管理节点通过定期检查簇节点发送的心跳 来维护簇节点的状态和向簇节点推送最新的路由表等。 本领域技术人员可以 理解, 在具体实现过程中, 属于簇节点的节点, 其即可以作为主节点、 也可 以作为备节点, 对应地, 属于簇节点的节点, 均存在主日志分区区间和 /或备 日志分区区间, 每一个分区区间对应一个日志队列, 其中日志队列用来存储 分区区间的数据行。 本实施例为了便于说明, 对归属于簇节点的节点的主备 进行了限制。
本实施例提供的分区日志队列管理方法, 主要用于主节点对应的主日志 分区区间发生变化时, 分区日志队列的管理方法。 当新主节点加入时, 将导 致主日志分区区间的变化, 本实施例所涉及的新主节点加入, 包括对原主日 志分区区间的合并与切分。 其中, 主日志分区区间发生变化的具体实现过程 为:
所述主节点接收管理节点发送的日志分区区间变化信息, 所述日志分区 区间变化信息包括主日志分区区间的切分与合并信息, 所述主日志分区区间 的切分与合并将引起路由表中的路由条目发生变化;
所述主节点根据所述日志分区区间变化信息确定所述主日志分区区间。 在具体实现过程中, 以主日志分区区间的切分为例, 进行详细说明, 其 中, 主节点包括新主节点和旧主节点。 当新主节点加入时, 该新主节点直接 向管理节点发送加入请求, 管理节点遍历路由表,进行日志分区的负载统计, 然后管理节点根据各日志分区的负载, 对现有的主日志分区区间进行切分, 具体如图 3所示, 管理节点然后向旧主节点发送日志分区区间变化信息, 该 日志分区区间变化信息包括主日志分区区间的切分信息。 旧主节点根据切分 信息, 创建新的日志队列, 将旧的日志分区队列置为不可写。 然后新主节点 在本节点创建对应的日志队列, 并从对应的旧主节点上请求属于该新主节点 对应的主日志分区区间的数据。 在数据传送的过程中, 如果有新的属于新节 点日志分区区间的日记记录写入则新日志记录会写入旧主节点新的日志队 歹 并同步给新节点写于新节点对应的日志队列。待所有数据都接收完成后, 旧主节点和新主节点依次更新路由表。 其中新主节点以负责这段主日志分区 区间的主节点身份加入。
图 3为本发明实施例主日志分区区间切分示意图。 如图 3所示, 分布式 数据库有六个主节点,该六个主节点对应的主日志分区区间分别为 [0, 100]、 [101, 200]、 [201, 300]、 [301, 400]、 [401, 500]和 [501, 900]。 当有新 主节点加入时, 管理节点根据各日志分区的负载, 将主日志分区区间 [501, 900]切分为 [501, 750]和 [751, 900]两个主日志分区区间, 并将主日志分区 区间 [ 751 , 900]分给新节点。旧主节点收到管理节点的通知后 ,在本地将 [501, 900]置为不可写, 并创建两个新的日志队列 [501, 750]和 [751, 900]置为可 写; 新主节点则在本地创建新的备日志队列 [751, 900]。 在主节点向备节点 传送数据的过程中, 如果有新的数据属于 [751, 900]写入, 则旧主节点会将 数据写入对应的可写区间 [751, 900] , 并同步给新主节点, 新主节点将数据 写入备日志队列 [751, 900]。待数据传送完成后, 旧主节点将区间 [751, 900] 置为不可写, 并触发该段区间的提交请求。 新主节点将备区间 [751, 900]的 记录都写入内存后, 旧主节点和新主节点依次更新路由表, 并根据路由表更 新各自的主日志分区区间和备日志分区区间。 在步骤 1 01中, 主节点接收客户端发送的日志记录写入请求消息, 日志 记录写入请求包括客户端触发的日志记录。 其中, 日志记录包括数据库操作 过程中的插入、 更新和删除等过程。
在步骤 1 02中,主节点根据主节点对应的主日志分区区间的写入标志位, 判断客户端触发的日志记录可以写入主日志分区区间对应的主日志队列。 在 具体实现过程中, 当主日志分区区间为变化后新的日志分区区间时, 写入标 志位为可写, 当主日志分区区间为变化前旧的日志分区区间时, 主日志分区 区间的写入标志位为不可写。 可选地, 写入标志位 0代表可写, 写入标志位 1代表不可写。
在本实施例中, 主日志分区区间和日志队列具有对应关系。 图 4为主日 志分区对应的主日志队列的存储格式示意图。 一段主日志分区区间对应一个 日志队列, 0/ 1代表写标志, 0代表可写, 1代表不可写。
本领域技术人员可以理解, 步骤 1 01和步骤 1 02中, 主节点即可以为新 主节点, 也可以为旧主节点。 主节点根据判断结果将客户端触发的日志记录 写入主日志分区区间对应的日志队列。 本领域技术人员可以理解, 新旧主节 点仅为人为划分, 对于主节点本机而言, 并没有区别。
在步骤 1 03中, 主节点将日志记录写入主日志队列之后, 向备节点发送 曰志记录同步请求消息, 日志记录同步请求消息中包括客户端触发的日志记 录以及可写主日志分区区间, 其中, 主节点发送给备节点的同步数据格式如 图 5所示 (图 5为本发明实施例同步数据格式示意图) , 然后, 备节点根据 可写主日志分区区间确定备节点对应的可写备日志分区区间, 并将日志记录 写入可写备日志分区区间对应的备日志队列。 本领域技术人员可以理解, 可 写主日志分区区间与可写备日志分区区间对应的可写日志分区区间相同。
本实施例提供的分区日志队列管理方法, 主节点通过接收客户端发送的 日志记录写入请求消息, 所述主节点根据主日志分区区间的写入标志位, 确 定所述主日志分区区间为可写主日志分区区间, 并将所述客户端触发的日志 记录写入所述可写主日志分区区间对应的主日志队列; 所述主节点向备节点 发送日志记录同步请求消息, 以使所述备节点根据所述可写主日志分区区间 确定所述备节点对应的可写备日志分区区间, 并将所述日志记录写入所述可 写备日志分区区间对应的备日志队列, 主备节点之间写入相同的日志分区区 间 ,避免了主节点和备节点数据的不一致。
在图 1实施例的基础上, 当管理节点通过心跳检查发现主节点的路由表 不是最新的, 会将最新的路由表推送到该主节点上。 主节点则接收管理节点 发送的路由表更新请求消息, 所述路由表更新请求消息包括路由表, 主节点 根据路由表中的路由条目确定主节点对应的主日志分区区间的写入标志位。
本领域技术人员可以理解, 当主日志分区区间发生变化时, 必然导致路 由表中的路由条目发生变化。 其中, 路由条目包括主节点的主日志分区区间 与备节点的日志分区区间。 主节点根据所述路由表中的路由条目确定所述主 节点对应的主日志分区区间的写入标志位可如图 6所示。 图 6为本发明实施 例日志队列更新流程实施例一的示意图。
步骤 601、 主节点获取路由表中的路由条目;
主节点通过遍历的方式获取路由表中的每一个路由条目。
步骤 6 02、 所述主节点确定路由条目中的路由日志分区区间是否归属所 述主节点, 若是, 执行步骤 603 , 若否, 执行步骤 6 01 ;
本领域技术人员可以理解, 路由条目中包括节点标识和对应的路由日志 分区区间, 主节点根据节点标识确定该路由日志分区区间是否归属于该主节 点, 若是, 执行步骤 6 03 , 若否, 执行步骤 601。
步骤 6 03、 所述主节点确定所述路由日志分区区间与本地可写日志分区 区间是否存在交集, 若是, 执行步骤 604 , 若否, 执行步骤 605 ;
当路由日志分区区间与本地可写日志分区区间存在交集时, 说明对主日 志分区区间进行了切分或合并。
步骤 6 04、 所述主节点将所述本地可写日志分区区间置为不可写, 将所 述路由日志分区区间的写入标志位置为可写, 将所述路由日志分区区间作为 所述可写主日志分区区间并为所述可写主日志分区区间维护对应的主日志队 歹 |J ;
步骤 6 05、 将所述路由日志分区区间的写入标志位置为可写, 将所述路 由日志分区区间作为所述可写主日志分区区间并为所述可写主日志分区区间 维护对应的主日志队列。
本实施例通过根据更新的路由条目, 对主节点对应的主日志分区区间的 写入标志位进行了更新, 避免了日志记录可能写入主日志分区区间或本地可 写日志分区区间, 导致了日志记录的不一致的问题, 新的日志记录将写入路 由日志分区区间对应的主日志分区区间。
图 7为本发明分区日志队列同步管理方法实施例二的流程示意图, 本实 施例的执行主体为备节点, 该备节点可以通过软件和 /或硬件实现。 如图 7 所示, 本实施例的方法可以包括:
步骤 7 01、 备节点接收主节点发送的日志记录同步请求消息, 所述日志 记录同步请求消息中包括所述客户端触发的日志记录以及可写主日志分区区 间, 所述可写日志分区区间为所述主节点根据写入标志位确定的。
本实施例提供的应用场景与图 1所示实施例的应用场景类似, 该备节点 可以对主节点的数据进行备份。 其中, 可写日志分区区间为主节点根据写入 标志位确定的可写主日志分区区间, 由于备节点对主节点进行备份, 可写主 日志分区区间与可写备日志分区区间对应相同的可写日志分区区间, 即可写 主日志分区区间与可写备日志分区区间一致。
步骤 7 02、 所述备节点根据所述可写主日志分区区间确定所述备节点对 应的可写备日志分区区间, 并将所述日志记录写入所述可写备日志分区区间 对应的备日志队列;
由于可写主日志分区区间与可写备日志分区区间对应相同的可写日志 分区区间, 因此, 备节点根据可写主日志分区区间确定备节点对应的可写备 日志分区区间, 并将日志记录写入可写备日志分区区间对应的备日志队列。 在日志记录写入过程中, 日志记录先写入主节点对应的日志队列, 后写 入备节点对应的日志队列, 因此,备日志分区区间对应的日志队列存储格式, 可以不包含写标识位, 具体如图 8所示。 图 8为备日志分区对应的备日志队 列的存储格式。
步骤 7 03、 所述备节点向所述主节点发送日志同步响应消息, 以使所述 主节点将所述主日志队列中的所述日志记录写入主节点对应的提交日志緩冲 队列和内存。
当备节点将日志记录写入备日志队列之后, 向主节点发送日志同步响应 消息, 以使主节点将主日志队列中的日志记录写入主节点对应的提交日志緩 冲队列和内存。
本发明实施例提供的分区日志队列同步管理方法, 备节点通过接收主节 点发送的日志记录同步请求消息, 所述备节点根据所述可写主日志分区区间 确定所述备节点对应的可写备日志分区区间, 并将所述日志记录写入所述可 写备日志分区区间对应的备日志队列; 所述备节点向所述主节点发送日志同 步响应消息,主备节点之间写入相同的日志分区区间 ,避免了主节点和备节点 数据的不一致。
在图 7实施例的基础上, 当管理节点通过心跳检查发现备节点的路由表 不是最新的, 会将最新的路由表推送到该备节点上。 所述备节点接收管理节 点发送的路由表更新请求信息, 所述路由表更新请求消息包括路由表; 所述 备节点根据所述路由表中的路由条目, 对备日志分区区间及所述备日志分区 区间对应的备日志队列进行管理。 备节点根据所述路由表中的路由条目确定 所述备节点对应的备日志分区区间如图 9所示。
图 9为本发明实施例日志队列更新流程实施例二的示意图, 包括以下步 骤:
步骤 901、 备节点获取路由表中的路由条目; 备节点通过遍历的方式获取路由条目。
步骤 902、 所述备节点确定路由条目中的路由日志分区区间是否归属所 述备节点, 若是, 执行步骤 903, 若否, 执行步骤 901;
本领域技术人员可以理解, 路由条目中包括节点标识和对应的路由日志 分区区间,备节点根据节点标识确定该路由日志分区区间是否归属于备节点, 若是, 执行步骤 903, 若否, 执行步骤 901。
步骤 903、 所述备节点确定所述路由条目是否与本地路由条目不同, 若 是, 执行步骤 904, 若否, 执行步骤 901;
备节点上存储的路由条目与管理节点推送的路由条目不同。
步骤 904、 所述备节点确定所述路由日志分区区间与本地备日志分区区 间是否不同, 若是, 执行步骤 905, 若否, 执行步骤 901;
步骤 905、 所述备节点增加所述路由日志分区区间, 并将所述路由日志 分区区间作为可写备日志分区区间, 并为所述可写备日志分区区间创建对应 的备日志队列。
本实施例通过根据更新的路由条目, 增加了新的备日志分区区间, 保证 了备日志分区区间的正确性。
图 10 为本发明实施例主节点与备节点同步流程实施例一的示意图。 本 实施例在上述实施例的基础上,对主节点和备节点的同步流程进行详细说明。 本实施例的同步过程为异步同步过程, 图 10 所示为同步第一阶段流程示意 图, 如图 10所示, 包括以下步骤:
步骤 1001、 主节点接收客户端发送的日志记录写入请求消息;
步骤 1002、 主节点确定所述主日志分区区间为可写主日志分区区间, 并 将所述客户端触发的日志记录写入所述可写主日志分区区间对应的主日志队 歹 |J;
步骤 1003、 主节点向备节点发送日志记录同步请求消息;
步骤 1004、 备节点接收主节点发送的日志记录同步请求消息; 步骤 1005、 备节点将日志记录写入备日志分区区间对应的备日志队列; 步骤 1006、 备节点向主节点发送日志同步响应消息;
步骤 1007、 主节点确定是否接收备节点发送的日志记录同步响应消息; 若否, 执行步骤 1008, 若是, 执行步骤 1009。
本领域技术人员可以理解, 如果在预设时间内, 主节点没有接收到备节 点发送的日志记录同步请求消息,主节点会把这条日志记录和没成功的那个 备节点的信息发送到别的节点上进行备份, 以供数据恢复时使用。
步骤 1008、 主节点向其它备节点发送日志记录同步请求消息;
步骤 1009、主节点将主日志队列中的日志记录写入主节点对应的提交日 志緩冲队列和内存。
在第一同步阶段中, 主节点将主日志队列中的日志记录写入提交日志緩 冲队列和内存中, 备节点将日志记录写入备日志队列中, 备节点还未将备日 志队列中的日志记录写入备节点对应的提交日志緩冲队列和内存中。 在同步 第二阶段流程中, 备节点将被日志队列写入提交日志緩冲队列和内存中。 具 体如图 11所示, 图 11为本发明实施例主节点与备节点同步流程实施例二的 示意图, 主要包括以下步骤:
步骤 1101、 主节点向备节点发送写入请求消息;
主节点定时向备节点发送写入请求消息。
步骤 1102、 备节点接收主节点发送的写入请求消息;
步骤 1103、 备节点判断日志记录是否有缺失, 若否, 执行步骤 1108, 若是, 执行步骤 1104;
具体实现过程中, 备节点根据日志记录的日志序列号, 判断日志记录是 否有缺失, 当日志序列号不连续时, 备节点确定日志记录有缺失, 执行步骤 1104。 当日志序列号连续时,备节点确定日志记录没有缺失,执行步骤 1108。 本领域技术人员可以理解, 当备节点确定日志记录不缺失时, 主节点所执行 的步骤到此结束。 步骤 1104、 备节点向主节点发送日志记录缺失消息;
本领域技术人员可以理解, 日志记录缺失消息中可以携带缺失的日志序 列号。
步骤 1105、 主节点接收备节点发送的日志记录缺失消息;
步骤 1106、 主节点向备节点发送日志记录缺失响应消息;
当备节点确定日志记录缺失时, 主节点还会接收备节点发送的日志记录 缺失消息 , 并向备节点发送日志记录缺失响应消息 , 该日志记录缺失响应消 息中可以携带备节点缺失的日志记录。
步骤 1107、 备节点接收主节点发送的日志记录缺失响应消息, 并将缺失 日志记录写入备日志队列中;
步骤 1108、备节点将备日志队列中的日志记录写入提交日志緩冲队列和 内存。
当备节点接收到日志记录缺失响应消息之后 , 将缺失的日志记录和备日 志队列中的日志记录写入提交日志緩存队列和内存。
本实施例提供的方法, 通过同步第一阶段流程和同步第二阶段流程, 完 成了主节点和备节点的数据同步过程。特别地, 图 12为本发明实施例日志分 区区间与日志队列的对应关系示意图。 如图 12所示, R1—R3是日志分区区间 的值, L1_L5 ...、 LI' ~L5' …和 L1' , ~L5' , 分别为对应日志队列中的日 志记录。 Ll、 L1' 及 Ll, , 分别为日志队列的头, 有新数据时, 从相应日 志队列的尾部写入。 由于主日志分区区间与备日志分区区间对应相同的日志 分区区间, 因此, 本实施例提供的日志分区区间与日志队列的对应关系既适 合主日志分区区间, 也适合备日志分区区间。
本领域技术人员可以理解, 当备节点将旧区间的日志记录均写入提交日 志緩冲队列和内存之后, 需要删除旧的主日志分区区间和备日志分区区间。
图 13为本发明实施例主节点删除日志分区区间的流程示意图。 如图 13 所示, 对于主节点, 主节点删除旧的主日志分区区间。 具体过程如下: 步骤 1 301、主节点确定所述主日志分区区间对应的主日志队列中的日志 记录是否为空, 若否, 执行步骤 1 302 , 若是, 执行步骤 1 303 ;
步骤 1 302、 主节点删除满足预设条件的日志记录;
步骤 1 303、主节点确定所述主日志分区区间是否存在与路由表的路由条 目中, 若否, 执行步骤 1 304 , 若是, 执行步骤 1 305 ;
步骤 1 304、 主节点删除所述主日志分区区间;
步骤 1 305、 主节点等待下一删除周期。
在具体实现过程中, 当日志记录不为空时, 不能删除所有的日志记录, 仅删除满足预设条件的日志记录, 其中, 满足预设条件的日志记录具体为比 上次写入提交日志緩冲队列和内存的日志序列号小的日志记录。 当日志记录 为空时, 主节点确定日志分区区间是否存在与路由表的路由条目中, 若不存 在, 删除该主日志分区区间, 若存在, 等待下次删除过程。
图 14为本发明实施例备节点删除日志分区区间的流程示意图。 如图 14 所示, 对于备节点, 备节点删除旧的备日志分区区间。 具体过程如下:
步骤 1401、备节点确定所述备日志分区区间对应的备日志队列中的日志 记录是否为空, 若否, 执行步骤 1402 , 若是, 执行步骤 1403 ;
步骤 1402、 备节点删除满足预设条件的日志记录;
步骤 1403、备节点确定所述备日志分区区间是否存在与所述路由表的路 由条目中, 若否, 执行步骤 1404 , 若是, 执行步骤 1405 ;
步骤 1404、 备节点删除所述备日志分区区间;
步骤 1405、 备节点等待下一删除周期。
在具体实现过程中, 当日志记录不为空时, 不能删除所有的日志记录, 仅删除满足预设条件的日志记录, 其中, 满足预设条件的日志记录具体为比 上次写入提交日志緩冲队列和内存的日志序列号小的日志记录。 当日志记录 为空时, 备节点确定日志分区区间是否存在与路由表的路由条目中, 若不存 在, 删除该备日志分区区间, 若存在, 等待下次删除过程。 本实施提供的分区日志队列管理方法, 当备节点将旧区间的日志记录均 写入提交日志緩冲队列和内存之后, 删除旧的主日志分区区间和备日志分区 区间, 保证了日志记录的完整性, 并提高了系统资源利用率。
图 15为本发明主节点实施例一的结构示意图。如图 15所示,主节点 1 50 包括第一接收模块 1501、 第一写入模块 1502和第一发送模块 1503。
其中, 第一接收模块 1501 , 用于接收客户端发送的日志记录写入请求消 息, 所述日志记录写入请求消息包括所述客户端触发的日志记录;
第一写入模块 1502 , 用于根据主日志分区区间的写入标志位, 确定所述 主日志分区区间为可写主日志分区区间, 并将所述客户端触发的日志记录写 入所述可写主日志分区区间对应的主日志队列;
第一发送模块 1503 , 用于向备节点发送日志记录同步请求消息, 所述日 志记录同步请求消息中包括所述客户端触发的日志记录以及所述可写主曰志 分区区间, 以使所述备节点根据所述可写主日志分区区间确定所述备节点对 应的可写备日志分区区间, 并将所述日志记录写入所述可写备日志分区区间 对应的备日志队列;
其中, 所述可写主日志分区区间与所述可写备日志分区区间对应相同的 可写日志分区区间。
本发明实施例提供的主节点, 可以用于执行上述方法实施例的技术方 案, 其实现原理和技术效果类似, 此处不再赘述。
图 16为本发明主节点实施例二的结构示意图。 如图 16所示, 本发明实 施例在图 1 5实施例的基础上, 还包括:
第二接收模块 1504 , 用于接收管理节点发送的路由表更新请求信息, 所 述路由表更新请求消息包括路由表;
标志位确定模块 1505 ,用于根据所述路由表中的路由条目确定所述主节 点对应的主日志分区区间的写入标志位。
可选地, 所述标志位确定模块 1505具体用于: 确定路由条目中的路由日志分区区间归属所述主节点;
确定所述路由日志分区区间与本地可写日志分区区间是否存在交集; 若是, 则将所述本地可写日志分区区间置为不可写, 将所述路由日志分 区区间的写入标志位置为可写, 将所述路由日志分区区间作为所述可写主日 志分区区间并为所述可写主日志分区区间维护对应的主日志队列;
若否, 则将所述路由日志分区区间的写入标志位置为可写, 将所述路由 日志分区区间作为所述可写主日志分区区间并为所述可写主日志分区区间维 护对应的主日志队列。
可选地, 还包括: 区间确定模块 1 506 , 用于在根据主日志分区区间的写 入标志位判断所述主日志分区区间可写之前,
接收管理节点发送的日志分区区间变化信息, 所述日志分区区间变化信 息包括主日志分区区间的切分与合并信息, 所述主日志分区区间的切分与合 并将引起路由表中的路由条目发生变化;
根据所述日志分区区间变化信息确定所述主日志分区区间;
其中, 所述主日志分区区间为切分或合并后新的主日志分区区间时, 所 述主日志分区区间的写入标志位为可写, 所述主日志分区区间为切分或合并 前原始主日志分区区间时, 所述主日志分区区间的写入标志位为不可写。
可选地, 还包括: 第二写入模块 1 507 , 用于向备节点发送日志记录同步 请求消息之后,
接收所述备节点发送的日志记录同步响应消息, 确定所述备节点将所述 日志记录写入备日志队列;
将所述主日志队列中的所述日志记录写入提交日志緩冲队列和内存。 可选地, 还包括: 第二发送模块 1 508 , 用于将所述主日志队列中的所述 日志记录写入提交日志緩冲队列和内存之后, 向所述备节点发送写入请求消 息, 以使所述备节点将备日志緩冲队列中的日志记录写入所述备节点对应的 提交日志緩冲队列和内存。 可选地, 还包括: 处理模块 1509 , 用于向所述备节点发送写入请求消息 之后,
接收所述备节点发送的日志记录缺失消息;
向所述备节点发送日志记录缺失响应消息。
可选地, 还包括: 删除模块 151 0 , 用于确定所述主日志分区区间对应的 主曰志队列中的曰志记录是否为空;
若否, 则主节点删除满足预设条件的日志记录;
若是, 则主节点确定所述主日志分区区间是否存在与路由表的路由条目 中, 若不存在, 则删除所述主日志分区区间。
本发明实施例提供的主节点, 可以用于执行上述方法实施例的技术方 案, 其实现原理和技术效果类似, 此处不再赘述。
图 17为本发明备节点实施例一的结构示意图。 如图 17所示, 本发明实 施例提供的备节点 170包括: 第一接收模块 1701、 第一写入模块 1702和第 一发送模块 1703。
其中, 第一接收模块 1701 , 用于接收主节点发送的日志记录同步请求消 息, 所述日志记录同步请求消息中包括所述客户端触发的日志记录以及可写 主日志分区区间, 所述可写日志分区区间为所述主节点根据写入标志位确定 的;
第一写入模块 1 702 ,用于根据所述可写主日志分区区间确定所述备节点 对应的可写备日志分区区间, 并将所述日志记录写入所述可写备日志分区区 间对应的备日志队列;
第一发送模块 1703 , 用于向所述主节点发送日志同步响应消息, 以使所 述主节点将所述主日志队列中的所述日志记录写入主节点对应的提交日志緩 冲队列和内存;
其中, 所述可写主日志分区区间与所述可写备日志分区区间对应相同的 可写日志分区区间。 本发明实施例提供的备节点, 可以用于执行上述方法实施例的技术方 案, 其实现原理和技术效果类似, 此处不再赘述。
图 18为本发明备节点实施例二的结构示意图。 如图 18所示, 本发明实 施例在图 1 7实施例的基础上, 还包括:
第二接收模块 1704 , 用于接收管理节点发送的路由表更新请求信息, 所 述路由表更新请求消息包括路由表;
管理模块 1 705 , 用于根据所述路由表中的路由条目, 对备日志分区区间 及所述备日志分区区间对应的备日志队列进行管理。
可选地, 所述管理模块 1 705具体用于:
确定路由条目中的路由日志分区区间归属所述备节点;
确定所述路由条目与本地路由条目不同;
确定所述路由日志分区区间与本地备日志分区区间不同;
增加所述路由日志分区区间, 并将所述路由日志分区区间作为可写备日 志分区区间, 并为所述可写备日志分区区间创建对应的备日志队列。
可选地, 还包括: 第二写入模块 1 706 , 用于向所述主节点发送日志同步 响应消息之后,
接收所述主节点发送的写入请求消息;
将所述备日志队列中的日志记录写入备节点对应的提交日志緩冲队列 和内存。
可选地, 还包括: 处理模块 1707 , 用于将所述备日志队列中的日志记录 写入提交日志緩冲队列和内存之前,
向所述主节点发送日志记录缺失消息;
接收所述主节点发送的日志记录缺失响应消息。
可选地, 还包括: 删除模块 1708 , 用于确定所述备日志分区区间对应的 备曰志队列中的曰志记录是否为空;
若否, 则备节点删除满足预设条件的日志记录; 若是, 则备节点确定所述备日志分区区间是否存在与路由表的路由条目 中, 若不存在, 则删除所述备日志分区区间。
本发明实施例提供的备节点, 可以用于执行上述方法实施例的技术方 案, 其实现原理和技术效果类似, 此处不再赘述。
本领域普通技术人员可以理解: 实现上述各方法实施例的全部或部分步 骤可以通过程序指令相关的硬件来完成。 前述的程序可以存储于一计算机可 读取存储介质中。 该程序在执行时, 执行包括上述各方法实施例的步骤; 而 前述的存储介质包括: R0M、 RAM, 磁碟或者光盘等各种可以存储程序代码的 介质。
最后应说明的是: 以上各实施例仅用以说明本发明的技术方案, 而非对 其限制; 尽管参照前述各实施例对本发明进行了详细的说明, 本领域的普通 技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改, 或者对其中部分或者全部技术特征进行等同替换; 而这些修改或者替换, 并 不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims

权 利 要 求
1、 一种分区日志队列同步管理方法, 其特征在于, 包括:
主节点接收客户端发送的日志记录写入请求消息, 所述日志记录写入请求 消息包括所述客户端触发的日志记录;
所述主节点才艮据主日志分区区间的写入标志位, 确定所述主日志分区区间 为可写主日志分区区间, 并将所述客户端触发的日志记录写入所述可写主日志 分区区间对应的主日志队列;
所述主节点向备节点发送日志记录同步请求消息, 所述日志记录同步请求 消息中包括所述客户端触发的日志记录以及所述可写主日志分区区间, 以使所 述备节点根据所述可写主日志分区区间确定所述备节点对应的可写备日志分区 区间, 并将所述日志记录写入所述可写备日志分区区间对应的备日志队列; 其中, 所述可写主日志分区区间与所述可写备日志分区区间对应相同的可 写曰志分区区间。
2、 根据权利要求 1所述的方法, 其特征在于, 所述方法还包括: 所述主节点接收管理节点发送的路由表更新请求信息, 所述路由表更新请 求消息包括路由表;
所述主节点根据所述路由表中的路由条目确定所述主节点对应的主日志分 区区间的写入标志位。
3、根据权利要求 2所述的方法, 其特征在于, 所述主节点根据所述路由表 中的路由条目确定所述主节点对应的主日志分区区间的写入标志位, 包括: 所述主节点确定路由条目中的路由日志分区区间归属所述主节点; 所述主节点确定所述路由日志分区区间与本地可写日志分区区间是否存在 交集;
若是, 则所述主节点将所述本地可写日志分区区间置为不可写, 将所述路 由日志分区区间的写入标志位置为可写, 将所述路由日志分区区间作为所述可 写主日志分区区间并为所述可写主日志分区区间维护对应的主日志队列; 若否, 则将所述路由日志分区区间的写入标志位置为可写, 将所述路由日 志分区区间作为所述可写主日志分区区间并为所述可写主日志分区区间维护对 应的主日志队列。
4、根据权利要求 1至 3任一项所述的方法, 其特征在于, 所述主节点根据 主日志分区区间的写入标志位判断所述主日志分区区间可写之前, 还包括: 所述主节点接收管理节点发送的日志分区区间变化信息, 所述日志分区区 间变化信息包括主日志分区区间的切分与合并信息, 所述主日志分区区间的切 分与合并将引起路由表中的路由条目发生变化;
所述主节点才艮据所述日志分区区间变化信息确定所述主日志分区区间; 其中, 所述主日志分区区间为切分或合并后新的主日志分区区间时, 所述 主日志分区区间的写入标志位为可写, 所述主日志分区区间为切分或合并前原 始主日志分区区间时, 所述主日志分区区间的写入标志位为不可写。
5、根据权利要求 1至 4任一项所述的方法, 其特征在于, 所述主节点向备 节点发送日志记录同步请求消息之后, 还包括:
所述主节点接收所述备节点发送的日志记录同步响应消息, 确定所述备节 点将所述日志记录写入备日志队列;
所述主节点将所述主日志队列中的所述日志记录写入提交日志緩冲队列和 内存。
6、根据权利要求 5所述的方法, 其特征在于, 所述主节点将所述主日志队 列中的所述日志记录写入提交日志緩冲队列和内存之后, 还包括:
所述主节点向所述备节点发送写入请求消息, 以使所述备节点将备日志緩 冲队列中的日志记录写入所述备节点对应的提交日志緩冲队列和内存。
7、根据权利要求 6所述的方法, 其特征在于, 所述主节点向所述备节点发 送写入请求消息之后, 还包括:
所述主节点接收所述备节点发送的日志记录缺失消息;
所述主节点向所述备节点发送日志记录缺失响应消息。 8、根据权利要求 1至 7任一项所述的方法,其特征在于,所述方法还包括: 所述主节点确定所述主日志分区区间对应的主日志队列中的日志记录是否 为空;
若否, 则主节点删除满足预设条件的日志记录;
若是,则主节点确定所述主日志分区区间是否存在与路由表的路由条目中, 若不存在, 则删除所述主日志分区区间。
9、 一种分区日志队列同步管理方法, 其特征在于, 包括:
备节点接收主节点发送的日志记录同步请求消息, 所述日志记录同步请求 消息中包括所述客户端触发的日志记录以及可写主日志分区区间, 所述可写日 志分区区间为所述主节点才艮据写入标志位确定的;
所述备节点根据所述可写主日志分区区间确定所述备节点对应的可写备日 志分区区间, 并将所述日志记录写入所述可写备日志分区区间对应的备日志队 歹 |J ;
所述备节点向所述主节点发送日志同步响应消息, 以使所述主节点将所述 主日志队列中的所述日志记录写入主节点对应的提交日志緩冲队列和内存; 其中, 所述可写主日志分区区间与所述可写备日志分区区间对应相同的可 写曰志分区区间。
1 0、 根据权利要求 9所述的方法, 其特征在于, 所述方法还包括: 所述备节点接收管理节点发送的路由表更新请求信息, 所述路由表更新请 求消息包括路由表;
所述备节点根据所述路由表中的路由条目, 对备日志分区区间及所述备日 志分区区间对应的备日志队列进行管理。
1 1、根据权利要求 10所述的方法, 其特征在于, 所述备节点根据所述路由 表中的路由条目, 对备日志分区区间及所述备日志分区区间对应的备日志队列 进行管理, 包括:
所述备节点确定路由条目中的路由日志分区区间归属所述备节点; 所述备节点确定所述路由条目与本地路由条目不同;
所述备节点确定所述路由日志分区区间与本地备日志分区区间不同; 所述备节点增加所述路由日志分区区间, 并将所述路由日志分区区间作为 可写备日志分区区间, 并为所述可写备日志分区区间创建对应的备日志队列。
12、根据权利要求 9至 11任一项所述的方法, 其特征在于, 所述备节点向 所述主节点发送日志同步响应消息之后, 还包括:
所述备节点接收所述主节点发送的写入请求消息;
所述备节点将所述备日志队列中的日志记录写入备节点对应的提交日志緩 冲队列和内存。
1 3、根据权利要求 12所述的方法, 其特征在于, 所述备节点将所述备日志 队列中的日志记录写入提交日志緩冲队列和内存之前, 还包括:
所述备节点向所述主节点发送日志记录缺失消息;
所述备节点接收所述主节点发送的日志记录缺失响应消息。
14、根据权利要求 9至 1 3任一项所述的方法, 其特征在于, 所述方法还包 括:
所述备节点确定所述备日志分区区间对应的备日志队列中的日志记录是否 为空;
若否, 则备节点删除满足预设条件的日志记录;
若是,则备节点确定所述备日志分区区间是否存在与路由表的路由条目中, 若不存在, 则删除所述备日志分区区间。
15、 一种主节点, 其特征在于, 包括:
第一接收模块, 用于接收客户端发送的日志记录写入请求消息, 所述日志 记录写入请求消息包括所述客户端触发的日志记录;
第一写入模块, 用于才艮据主日志分区区间的写入标志位, 确定所述主日志 分区区间为可写主日志分区区间, 并将所述客户端触发的日志记录写入所述可 写主日志分区区间对应的主日志队列; 第一发送模块, 用于向备节点发送日志记录同步请求消息, 所述日志记录 同步请求消息中包括所述客户端触发的日志记录以及所述可写主日志分区区 间, 以使所述备节点根据所述可写主日志分区区间确定所述备节点对应的可写 备日志分区区间, 并将所述日志记录写入所述可写备日志分区区间对应的备日 志队列;
其中, 所述可写主日志分区区间与所述可写备日志分区区间对应相同的可 写曰志分区区间。
16、 根据权利要求 15所述的主节点, 其特征在于, 还包括:
第二接收模块, 用于接收管理节点发送的路由表更新请求信息, 所述路由 表更新请求消息包括路由表;
标志位确定模块, 用于根据所述路由表中的路由条目确定所述主节点对应 的主日志分区区间的写入标志位。
17、根据权利要求 16所述的主节点, 其特征在于, 所述标志位确定模块具 体用于:
确定路由条目中的路由日志分区区间归属所述主节点;
确定所述路由日志分区区间与本地可写日志分区区间是否存在交集; 若是, 则将所述本地可写日志分区区间置为不可写, 将所述路由日志分区 区间的写入标志位置为可写, 将所述路由日志分区区间作为所述可写主日志分 区区间并为所述可写主日志分区区间维护对应的主日志队列;
若否, 则将所述路由日志分区区间的写入标志位置为可写, 将所述路由日 志分区区间作为所述可写主日志分区区间并为所述可写主日志分区区间维护对 应的主日志队列。
18、 根据权利要求 15至 17任一项所述的主节点, 其特征在于, 还包括: 区间确定模块, 用于在才艮据主日志分区区间的写入标志位判断所述主日志分区 区间可写之前,
接收管理节点发送的日志分区区间变化信息, 所述日志分区区间变化信息 包括主日志分区区间的切分与合并信息, 所述主日志分区区间的切分与合并将 引起路由表中的路由条目发生变化;
根据所述日志分区区间变化信息确定所述主日志分区区间;
其中, 所述主日志分区区间为切分或合并后新的主日志分区区间时, 所述 主日志分区区间的写入标志位为可写, 所述主日志分区区间为切分或合并前原 始主日志分区区间时, 所述主日志分区区间的写入标志位为不可写。
19、 根据权利要求 15至 18任一项所述的主节点, 其特征在于, 还包括: 第二写入模块, 用于向备节点发送日志记录同步请求消息之后,
接收所述备节点发送的日志记录同步响应消息, 确定所述备节点将所述日 志记录写入备日志队列;
将所述主日志队列中的所述日志记录写入提交日志緩冲队列和内存。
20、根据权利要求 19所述的主节点,其特征在于,还包括: 第二发送模块, 用于将所述主日志队列中的所述日志记录写入提交日志緩冲队列和内存之后, 向所述备节点发送写入请求消息, 以使所述备节点将备日志緩冲队列中的日志 记录写入所述备节点对应的提交日志緩冲队列和内存。
21、 根据权利要求 20所述的主节点, 其特征在于, 还包括: 处理模块, 用 于向所述备节点发送写入请求消息之后,
接收所述备节点发送的日志记录缺失消息;
向所述备节点发送日志记录缺失响应消息。
11、 根据权利要求 15至 21任一项所述的主节点, 其特征在于, 还包括: 删除模块, 用于确定所述主日志分区区间对应的主日志队列中的日志记录 是否为空;
若否, 则主节点删除满足预设条件的日志记录;
若是,则主节点确定所述主日志分区区间是否存在与路由表的路由条目中, 若不存在, 则删除所述主日志分区区间。
23、 一种备节点, 其特征在于, 包括: 第一接收模块, 用于接收主节点发送的日志记录同步请求消息, 所述日志 记录同步请求消息中包括所述客户端触发的日志记录以及可写主日志分区区 间, 所述可写日志分区区间为所述主节点根据写入标志位确定的;
第一写入模块, 用于才艮据所述可写主日志分区区间确定所述备节点对应的 可写备日志分区区间, 并将所述日志记录写入所述可写备日志分区区间对应的 备曰志队列;
第一发送模块, 用于向所述主节点发送日志同步响应消息, 以使所述主节 点将所述主日志队列中的所述日志记录写入主节点对应的提交日志緩冲队列和 内存;
其中, 所述可写主日志分区区间与所述可写备日志分区区间对应相同的可 写曰志分区区间。
24、 根据权利要求 23所述的备节点, 其特征在于, 还包括:
第二接收模块, 用于接收管理节点发送的路由表更新请求信息, 所述路由 表更新请求消息包括路由表;
管理模块, 用于根据所述路由表中的路由条目, 对备日志分区区间及所述 备日志分区区间对应的备日志队列进行管理。
25、根据权利要求 24所述的备节点,其特征在于,所述管理模块具体用于: 确定路由条目中的路由日志分区区间归属所述备节点;
确定所述路由条目与本地路由条目不同;
确定所述路由日志分区区间与本地备日志分区区间不同;
增加所述路由日志分区区间, 并将所述路由日志分区区间作为可写备日志 分区区间, 并为所述可写备日志分区区间创建对应的备日志队列。
26、 根据权利要求 23至 25任一项所述的备节点, 其特征在于, 还包括: 第二写入模块, 用于向所述主节点发送日志同步响应消息之后,
接收所述主节点发送的写入请求消息;
将所述备日志队列中的日志记录写入备节点对应的提交日志緩冲队列和内 存。
27、 根据权利要求 26所述的备节点, 其特征在于, 还包括:
处理模块, 用于将所述备日志队列中的日志记录写入提交日志緩冲队列和 内存之前,
向所述主节点发送日志记录缺失消息;
接收所述主节点发送的日志记录缺失响应消息。
28、 根据权利要求 23至 27任一项所述的备节点, 其特征在于, 还包括: 删除模块, 用于确定所述备日志分区区间对应的备日志队列中的日志记录是否 为空;
若否, 则备节点删除满足预设条件的日志记录;
若是,则备节点确定所述备日志分区区间是否存在与路由表的路由条目中, 若不存在, 则删除所述备日志分区区间。
PCT/CN2014/080378 2013-07-31 2014-06-20 分区日志队列同步管理方法及设备 WO2015014170A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310329460.4 2013-07-31
CN201310329460.4A CN104346373B (zh) 2013-07-31 2013-07-31 分区日志队列同步管理方法及设备

Publications (1)

Publication Number Publication Date
WO2015014170A1 true WO2015014170A1 (zh) 2015-02-05

Family

ID=52430952

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/080378 WO2015014170A1 (zh) 2013-07-31 2014-06-20 分区日志队列同步管理方法及设备

Country Status (2)

Country Link
CN (1) CN104346373B (zh)
WO (1) WO2015014170A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110231915A (zh) * 2019-05-29 2019-09-13 南昌大学 数据管理方法、系统、装置、计算机设备及存储介质
CN110895545A (zh) * 2018-08-22 2020-03-20 阿里巴巴集团控股有限公司 共享数据同步方法及装置
CN113961378A (zh) * 2021-11-16 2022-01-21 国汽智控(北京)科技有限公司 基于共享内存的进程间通信方法、装置及电子设备
CN115486052A (zh) * 2020-05-14 2022-12-16 深圳市欢太科技有限公司 一种数据存储方法、系统及存储介质

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106899648B (zh) 2016-06-20 2020-02-14 阿里巴巴集团控股有限公司 一种数据处理方法和设备
CN107644030B (zh) * 2016-07-20 2021-05-18 华为技术有限公司 分布式数据库数据同步方法、相关装置及系统
CN107783975B (zh) * 2016-08-24 2021-02-26 北京京东尚科信息技术有限公司 分布式数据库同步处理的方法和装置
CN108009045B (zh) * 2016-10-31 2020-11-06 杭州海康威视数字技术股份有限公司 一种主备数据库故障处理方法及装置
CN108363641B (zh) * 2017-01-26 2022-01-14 华为技术有限公司 一种主备机数据传递方法、控制节点以及数据库系统
CN110019514B (zh) * 2017-11-07 2023-05-09 阿里巴巴集团控股有限公司 数据同步方法、装置以及电子设备
CN108616598B (zh) * 2018-05-10 2021-01-01 新华三技术有限公司成都分公司 数据同步方法、装置和分布式存储系统
CN110502460B (zh) * 2018-05-16 2021-03-23 华为技术有限公司 数据处理的方法和节点
CN110737716B (zh) * 2018-07-02 2022-09-23 华为技术有限公司 一种数据写入的方法和装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101809558A (zh) * 2007-07-27 2010-08-18 特文斯崔塔公司 远程异步数据复制系统和方法
CN101997902A (zh) * 2009-08-28 2011-03-30 云端容灾有限公司 基于驿站分段传输的远程在线备份系统和方法
CN102640151A (zh) * 2009-12-04 2012-08-15 国际商业机器公司 信息系统中转换后的数据的高吞吐量、可靠复制
CN103049355A (zh) * 2012-12-25 2013-04-17 华为技术有限公司 一种数据库系统恢复方法及设备

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7620659B2 (en) * 2007-02-09 2009-11-17 Microsoft Corporation Efficient knowledge representation in data synchronization systems
CN101729290A (zh) * 2009-11-04 2010-06-09 中兴通讯股份有限公司 用于实现业务系统保护的方法及装置
CN102609479B (zh) * 2012-01-20 2015-11-25 北京思特奇信息技术股份有限公司 一种内存数据库节点复制方法
CN103049527B (zh) * 2012-12-20 2016-01-20 中国电力科学研究院 一种面向大电网的并行实时数据库主备切换管理系统
CN103220183A (zh) * 2013-05-02 2013-07-24 杭州电子科技大学 一种基于双主机热备份的Hadoop高可用性系统实现方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101809558A (zh) * 2007-07-27 2010-08-18 特文斯崔塔公司 远程异步数据复制系统和方法
CN101997902A (zh) * 2009-08-28 2011-03-30 云端容灾有限公司 基于驿站分段传输的远程在线备份系统和方法
CN102640151A (zh) * 2009-12-04 2012-08-15 国际商业机器公司 信息系统中转换后的数据的高吞吐量、可靠复制
CN103049355A (zh) * 2012-12-25 2013-04-17 华为技术有限公司 一种数据库系统恢复方法及设备

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110895545A (zh) * 2018-08-22 2020-03-20 阿里巴巴集团控股有限公司 共享数据同步方法及装置
CN110895545B (zh) * 2018-08-22 2023-08-15 阿里云计算有限公司 共享数据同步方法及装置
CN110231915A (zh) * 2019-05-29 2019-09-13 南昌大学 数据管理方法、系统、装置、计算机设备及存储介质
CN110231915B (zh) * 2019-05-29 2022-04-01 南昌大学 数据管理方法、系统、装置、计算机设备及存储介质
CN115486052A (zh) * 2020-05-14 2022-12-16 深圳市欢太科技有限公司 一种数据存储方法、系统及存储介质
CN113961378A (zh) * 2021-11-16 2022-01-21 国汽智控(北京)科技有限公司 基于共享内存的进程间通信方法、装置及电子设备
CN113961378B (zh) * 2021-11-16 2024-03-26 国汽智控(北京)科技有限公司 基于共享内存的进程间通信方法、装置及电子设备

Also Published As

Publication number Publication date
CN104346373B (zh) 2017-12-15
CN104346373A (zh) 2015-02-11

Similar Documents

Publication Publication Date Title
WO2015014170A1 (zh) 分区日志队列同步管理方法及设备
US10469577B2 (en) Caching method and system based on cache cluster
EP2521037B1 (en) Geographically distributed clusters
US11893264B1 (en) Methods and systems to interface between a multi-site distributed storage system and an external mediator to efficiently process events related to continuity
WO2019085875A1 (zh) 存储集群的配置修改方法、存储集群及计算机系统
JP2019036353A (ja) 索引更新パイプライン
US7743036B2 (en) High performance support for XA protocols in a clustered shared database
WO2016070375A1 (zh) 一种分布式存储复制系统和方法
US20220318105A1 (en) Re-aligning data replication configuration of primary and secondary data serving entities of a cross-site storage solution after a failover event
CN113396407A (zh) 用于利用区块链技术扩充数据库应用的系统和方法
JP2016524750A5 (zh)
CA2550614C (en) Cluster database with remote data mirroring
WO2018014650A1 (zh) 分布式数据库数据同步方法、相关装置及系统
JP5686034B2 (ja) クラスタシステム、同期制御方法、サーバ装置および同期制御プログラム
CN102073739A (zh) 带有快照功能的分布式文件系统中的数据读与数据写方法
WO2015021828A1 (zh) 分布式数据库的数据存储方法和装置
CN112162846B (zh) 事务处理方法、设备及计算机可读存储介质
US7805503B2 (en) Capability requirements for group membership
CN113010496A (zh) 一种数据迁移方法、装置、设备和存储介质
WO2016095329A1 (zh) 一种日志记录系统及日志记录操作方法
US9563521B2 (en) Data transfers between cluster instances with delayed log file flush
CN115658245B (zh) 一种基于分布式数据库系统的事务提交系统、方法及装置
CN114925075B (zh) 一种多源时空监测信息实时动态融合方法
JP5480046B2 (ja) 分散トランザクション処理システム、装置、方法およびプログラム
WO2024051027A1 (zh) 一种大数据的数据配置方法和系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14832866

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14832866

Country of ref document: EP

Kind code of ref document: A1