Data transmission, node startup method, device, equipment and computer readable medium

By replicating metadata in node memory and generating log sequences in a distributed database cluster with shared storage, the problem of metadata recovery relies on disk when node restarts or adds is solved, achieving faster node startup speed.

CN114637468BActive Publication Date: 2025-05-16XIAN TONGXING HENGYAO INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210234360.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-10
Publication Date
2025-05-16
Estimated Expiration
2042-03-10

AI Technical Summary

Technical Problem

In a distributed database cluster with shared storage, when a node is restarted or added, metadata recovery depends on the disk that stores data uniformly, resulting in slower node startup.

Method used

By determining the current log point and recording the log starting from the log point when a data copy request is received, copying the metadata in memory, generating a log sequence and serializing metadata information, and then sending this information to the target node, avoiding reading data from disk.

Benefits of technology

Shorten the data recovery time, speed up the startup speed of restart nodes and new nodes, and avoid startup delays caused by slow disk data reading speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114637468B_ABST
    Figure CN114637468B_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure disclose data transmission, node startup methods, devices, equipment and computer-readable media. A specific implementation method of data transmission includes: in response to receiving a data replication request sent by a target node, determining the current log point; recording the log generated from the current log point, and replicating each metadata in the memory; in response to determining that the replication of each metadata in the memory is completed, stopping the recording of the log to obtain a log sequence; serializing each metadata obtained by replication to obtain serialized metadata information; and sending the serialized metadata information and the log sequence to the target node. This implementation method can speed up the replication of data when the node is started, thereby achieving fast startup of the node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to data transmission, node startup methods, devices, equipment, and computer-readable media. Background Art

[0002] For a distributed database cluster with shared storage, when a node in the cluster is restarted or a new node is added to the cluster, the corresponding data needs to be read from the disk that stores the data uniformly to restore the metadata of the restarted node or the newly added node. Only after the restarted node or the newly added node restores the metadata can it be started and provide external services.

[0003] However, when the above method is used to restore metadata in a restarted node or a newly added node, the following technical problems often occur:

[0004] The recovery of metadata in restarted nodes or newly added nodes depends on the disk that uniformly stores data. When the amount of data stored in the disk is large, the process of reading data from the disk and recovering metadata is slow, resulting in slow startup of restarted nodes or newly added nodes, making it difficult to start quickly and provide external services. Summary of the invention

[0005] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.

[0006] Some embodiments of the present disclosure propose data transmission, node startup methods, devices, equipment and computer-readable media to solve the technical problems mentioned in the above background technology section.

[0007] In a first aspect, some embodiments of the present disclosure provide a data sending method, the method comprising: in response to receiving a data replication request sent by a target node, determining a current log point; recording logs generated starting from the above-mentioned current log point, and replicating each metadata in the memory; in response to determining that the replication of each metadata in the above-mentioned memory is completed, stopping the recording of logs to obtain a log sequence; serializing each metadata obtained by replication to obtain serialized metadata information; and sending the above-mentioned serialized metadata information and the above-mentioned log sequence to the above-mentioned target node.

[0008] Optionally, the copying of each metadata in the memory includes: reading and copying the metadata from the memory.

[0009] Optionally, the reading and copying of the metadata from the memory includes: in response to starting to read the metadata, locking the metadata; and in response to completion of copying the metadata, unlocking the metadata.

[0010] Optionally, the reading and copying of the metadata from the memory includes: reading and copying the metadata from the memory through atomic operations.

[0011] In a second aspect, some embodiments of the present disclosure provide a node startup method, the method comprising: in response to determining that a target node starts to start, determining a replication node corresponding to the target node, wherein the replication node is a node in a database cluster to which the target node belongs, and the database cluster is a shared storage cluster; sending a data replication request to the replication node, and obtaining serialized metadata information and a log sequence returned by the replication node, wherein the serialized metadata information and the log sequence are generated according to any one of the methods in the first aspect; deserializing the serialized metadata information to obtain each metadata item, and storing each metadata item in the memory of the target node; using each log in the log sequence to update each metadata item stored in the memory; in response to determining that the update of each metadata item stored in the memory is completed, determining that the target node has completed startup.

[0012] Optionally, the above-mentioned use of each log in the above-mentioned log sequence to update the above-mentioned metadata stored in the above-mentioned memory includes: for each of the above-mentioned metadata stored in the above-mentioned memory, playing back each log in the above-mentioned log sequence.

[0013] Optionally, the above-mentioned updating of the above-mentioned metadata stored in the above-mentioned memory by using each log in the above-mentioned log sequence also includes: in response to detecting an addition operation for metadata already existing in the above-mentioned memory during the playback of each log in the above-mentioned log sequence, ignoring the above-mentioned addition operation; in response to detecting a deletion operation for metadata that does not exist in the above-mentioned memory during the playback of each log in the above-mentioned log sequence, ignoring the above-mentioned deletion operation.

[0014] Optionally, the above-mentioned response to determining that the target node starts to start, determining the replication node corresponding to the above-mentioned target node, includes: according to the physical location of the above-mentioned target node and the physical location of each remaining node in the above-mentioned database cluster, selecting a node that meets preset conditions from the above-mentioned database cluster as the replication node.

[0015] Optionally, after deserializing the serialized metadata information to obtain each metadata item, the method further includes: generating and storing statistical information of each metadata item.

[0016] In a third aspect, some embodiments of the present disclosure provide a data sending device, comprising: a current log point determination unit, configured to determine the current log point in response to receiving a data replication request sent by a target node; a recording and replication unit, configured to record the logs generated starting from the above-mentioned current log point, and to replicate each metadata in the memory; a replication unit, configured to stop recording the logs in response to determining that the replication of each metadata in the above-mentioned memory is completed, and obtain a log sequence; a serialization unit, configured to serialize each metadata obtained by replication, and obtain serialized metadata information; a sending unit, configured to send the above-mentioned serialized metadata information and the above-mentioned log sequence to the above-mentioned target node.

[0017] Optionally, the recording and copying unit includes a reading subunit configured to read and copy the metadata from a memory.

[0018] Optionally, the reading subunit includes a locking module and an unlocking module, wherein the locking module is configured to lock the metadata in response to starting to read the metadata, and the unlocking module is configured to unlock the metadata in response to completion of copying the metadata.

[0019] Optionally, the reading subunit includes a reading and copying module configured to read and copy the metadata from the memory through atomic operations.

[0020] In a fourth aspect, some embodiments of the present disclosure provide a data sending device, the device comprising: a replication node determination unit, configured to determine the replication node corresponding to the target node in response to determining that a target node starts to start, wherein the replication node is a node in a database cluster to which the target node belongs, and the database cluster is a shared storage cluster; a sending and obtaining unit, configured to send a data replication request to the replication node, and to obtain serialized metadata information and a log sequence returned by the replication node, wherein the serialized metadata information and the log sequence are generated according to any one of the methods in the first aspect; a deserialization unit, configured to deserialize the serialized metadata information to obtain each metadata, and store each metadata in the memory of the target node; an updating unit, configured to update each metadata stored in the memory using each log in the log sequence; a startup determination unit, configured to determine that the target node has completed startup in response to determining that the update of each metadata stored in the memory is completed.

[0021] Optionally, the updating unit includes a playback subunit configured to play back each log in the log sequence for each metadata item stored in the memory.

[0022] Optionally, the update unit further includes a first ignoring subunit and a second ignoring subunit. The first ignoring subunit is configured to ignore the adding operation in response to detecting the adding operation for metadata already existing in the memory during the playback of each log in the log sequence; the second ignoring subunit is configured to ignore the deleting operation in response to detecting the deleting operation for metadata not existing in the memory during the playback of each log in the log sequence.

[0023] Optionally, the above-mentioned copy node determination unit is further configured to select a node that meets preset conditions from the above-mentioned database cluster as a copy node based on the physical location of the above-mentioned target node and the physical locations of each remaining node in the above-mentioned database cluster.

[0024] Optionally, after the above-mentioned deserialization unit, the above-mentioned device also includes a generation and storage unit, which is configured to generate and store statistical information of the above-mentioned metadata.

[0025] In a fifth aspect, some embodiments of the present disclosure provide an electronic device, comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of the implementation methods in the first aspect or the second aspect above.

[0026] In a sixth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any one of the implementation modes of the first aspect or the second aspect is implemented.

[0027] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the data transmission method of some embodiments of the present disclosure, the data recovery time can be shortened, and the startup speed of the restart node and the newly added node can be accelerated. Specifically, the reason for the slow startup speed of the restart node or the newly added node is that when the data stored in the disk for unified data storage is large, the process of reading data from the disk and restoring metadata is slow, thereby extending the startup time of the node. Based on this, the data transmission method of some embodiments of the present disclosure uses the node that receives the data replication request as the replication node, and avoids reading and copying data from the disk for unified data storage by replicating each metadata in the memory of the replication node. Since the speed of reading data from the memory is much faster than the speed of reading data from the disk. Therefore, the data replication speed can be accelerated. At the same time, in order to avoid locking the replication node while reading the metadata, the normal reading and writing of the data is ensured. When starting to copy the metadata, the current log point is determined, and the log generated from the current log point is recorded until the metadata replication ends, and a log sequence is obtained. The data operation in the replication node after the metadata replication starts is recorded through the log sequence. This makes it easier to replay the logs in the log sequence and synchronize the metadata obtained by replication with the metadata in the replication node. This not only speeds up the data replication and shortens the startup time of the target node, but also ensures normal reading and writing of the replication node while replicating the data. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.

[0029] Figure 1 is a schematic diagram of an application scenario of the data sending method of some embodiments of the present disclosure;

[0030] Figure 2 is a schematic diagram of an application scenario of a node startup method in some embodiments of the present disclosure;

[0031] Figure 3 is a flow chart of some embodiments of the data sending method according to the present disclosure;

[0032] Figure 4 is a flowchart of some embodiments of the node startup method according to the present disclosure;

[0033] Figure 5 is a flowchart of other embodiments of the node startup method according to the present disclosure;

[0034] Figure 6 is a schematic diagram of the structure of some embodiments of the data sending device disclosed in the present invention;

[0035] Figure 7 It is a structural schematic diagram of some embodiments of the node startup device disclosed in the present invention;

[0036] Figure 8 It is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION

[0037] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0038] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.

[0039] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0040] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0041] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0042] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

[0043] Figure 1 It is a schematic diagram of an application scenario of the data sending method of some embodiments of the present disclosure.

[0044] exist Figure 1In the application scenario, first, the computing device 101 can determine the current log point 104 in response to receiving the data replication request 103 sent by the target node 102. Then, the computing device 101 can record the log generated starting from the above current log point 104, and copy each metadata 106 in the memory 105. Then, in response to determining that the replication of each metadata 106 in the above memory 105 is completed, the computing device 101 can stop recording the log and obtain a log sequence 107. Then, the computing device 101 can serialize each metadata obtained by replication to obtain serialized metadata information 108. Finally, the computing device 101 can send the above serialized metadata information 108 and the above log sequence 107 to the above target node 102.

[0045] It should be noted that the computing device 101 can be hardware or software. When the computing device is hardware, it can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or it can be implemented as a single server or a single terminal device. When the computing device is embodied as software, it can be installed in the hardware devices listed above. It can be implemented as multiple software or software modules for providing distributed services, or it can be implemented as a single software or software module. No specific limitation is made here.

[0046] It should be understood that Figure 1 The number of computing devices in the embodiment is only illustrative. Any number of computing devices may be provided according to implementation requirements.

[0047] Figure 2 It is a schematic diagram of an application scenario of the node startup method of some embodiments of the present disclosure.

[0048] exist Figure 2In the application scenario, first, the computing device 201 can determine the replication node 203 corresponding to the target node 202 in response to determining that the target node 202 starts to start, wherein the replication node 203 is a node in the database cluster 204 to which the target node 202 belongs, and the database cluster 204 is a shared storage cluster. Then, the computing device 201 can send a data replication request 205 to the replication node 203, and obtain the serialized metadata information 206 and the log sequence 207 returned by the replication node 203. Then, the computing device 201 can deserialize the serialized metadata information 206 to obtain each metadata 208, and store each metadata 208 in the memory of the target node 202. Then, the computing device 201 can use each log in the log sequence 207 to update each metadata 208 stored in the memory. Finally, the computing device 201 may determine that the target node 202 has completed startup in response to determining that the metadata 208 stored in the memory has been updated.

[0049] It should be noted that the computing device 102 can be hardware or software. When the computing device is hardware, it can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or it can be implemented as a single server or a single terminal device. When the computing device is embodied as software, it can be installed in the hardware devices listed above. It can be implemented as multiple software or software modules for providing distributed services, or it can be implemented as a single software or software module. No specific limitation is made here.

[0050] It should be understood that Figure 2 The number of computing devices in the embodiment is only illustrative. Any number of computing devices may be provided according to implementation requirements.

[0051] Continue to refer Figure 3 , shows a process 300 of some embodiments of the data sending method according to the present disclosure. The process 300 of the data sending method includes the following steps:

[0052] Step 301: In response to receiving a data replication request sent by a target node, determine a current log point.

[0053] In some embodiments, the execution subject of the data sending method (such as Figure 1The computing device 101 shown in the figure can determine the current log point in response to receiving a data replication request sent by a target node. The execution subject can be a replication node corresponding to the target node in a shared storage database cluster. The replication node can be a node that receives the data replication request sent by the target node. The target node can be a newly added node or a restarted node in the database cluster. When receiving the data replication request, the log point of the database in the replication node can be determined as the current log point. The current log point is the time point represented by the timestamp in the latest log in the database.

[0054] Step 302, recording the logs generated from the current log point, and copying each metadata in the memory.

[0055] In some embodiments, the execution entity may record the logs generated starting from the current log point, and copy the metadata in the memory one by one.

[0056] In some optional implementations of some embodiments, the execution entity may read and copy the metadata from the memory.

[0057] Optionally, the execution subject reading and copying the metadata from the memory may include the following steps:

[0058] The first step is to lock the metadata in response to starting to read the metadata, wherein a lightweight lock may be added to the metadata.

[0059] In the second step, in response to the metadata copying being completed, the metadata is unlocked.

[0060] Therefore, it is possible to lock a piece of metadata only when a piece of metadata is read. Unlock it after reading and copying. This avoids copying data in an intermediate state due to read and write operations on the metadata by other businesses. At the same time, it is not necessary to lock all metadata. Thus, the normal reading and writing of data in the replication node is ensured to the greatest extent.

[0061] Optionally, the execution subject may also read and copy the metadata from the memory through an atomic operation, wherein the atomic operation may be an operation that will not be interrupted by a thread scheduling mechanism.

[0062] Therefore, atomic operations can be used to prevent other threads from reading and writing the metadata being read and copied, thereby avoiding copying intermediate state data.

[0063] Step 303 , in response to determining that the copying of each metadata in the memory is completed, the recording of the log is stopped to obtain a log sequence.

[0064] In some embodiments, the execution subject may stop recording logs in response to determining that the copying of each metadata in the memory is completed, and obtain a log sequence, wherein each log in the log sequence is a log generated starting from the current log point.

[0065] Step 304: serialize each of the copied metadata to obtain serialized metadata information.

[0066] In some embodiments, the execution subject may perform serialization processing on each metadata obtained by copying to obtain serialized metadata information. The serialization processing may convert each metadata obtained by copying into a form that can be stored or transmitted. Thus, it is convenient to transmit each metadata obtained by copying.

[0067] Step 305: Send the serialized metadata information and the log sequence to the target node.

[0068] In some embodiments, the execution entity may send the serialized metadata information and the log sequence to the target node via network transmission or a shared disk.

[0069] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the data transmission method of some embodiments of the present disclosure, the data recovery time can be shortened, and the startup speed of the restart node and the newly added node can be accelerated. Specifically, the reason for the slow startup speed of the restart node or the newly added node is that when the data stored in the disk for unified data storage is large, the process of reading data from the disk and restoring metadata is slow, thereby extending the startup time of the node. Based on this, the data transmission method of some embodiments of the present disclosure uses the node that receives the data replication request as the replication node, and avoids reading and copying data from the disk for unified data storage by replicating each metadata in the memory of the replication node. Since the speed of reading data from the memory is much faster than the speed of reading data from the disk. Therefore, the data replication speed can be accelerated. At the same time, in order to avoid locking the replication node while reading the metadata, the normal reading and writing of the data is ensured. When starting to copy the metadata, the current log point is determined, and the log generated from the current log point is recorded until the metadata replication ends, and a log sequence is obtained. The data operation in the replication node after the metadata replication starts is recorded through the log sequence. This makes it easier to replay the logs in the log sequence and synchronize the metadata obtained by replication with the metadata in the replication node. This not only speeds up the data replication and shortens the startup time of the target node, but also ensures normal reading and writing of the replication node while replicating the data.

[0070] Continue to refer Figure 4, shows a process 400 of some embodiments of the node startup method according to the present disclosure. The node startup method comprises the following steps:

[0071] Step 401, in response to determining that a target node starts to start, determining a replication node corresponding to the target node.

[0072] In some embodiments, the execution body of the node startup method (such as Figure 2 The computing device 201 shown in the figure can determine the replication node corresponding to the target node in response to determining that the target node starts to start. The replication node is a node in the database cluster to which the target node belongs. The database cluster is a cluster of shared storage. The target node can be a newly added node or a restarted node in the database cluster. A started node can be randomly selected in the database cluster as a replication node.

[0073] In some optional implementations of some embodiments, the execution subject may select a node that meets a preset condition from the database cluster as a replication node according to the physical location of the target node and the physical locations of the remaining nodes in the database cluster. The preset condition may be that the physical location of the node is closest to the physical location of the target node.

[0074] As an example, node A is the target node. Node B and node C are other nodes in the above database cluster. Node A and node B are located in the same computer room. Node A and node C are located in different computer rooms. Then the physical locations of node A and node B are closest. Therefore, node B can be determined as a replication node.

[0075] Therefore, the node with the closest physical location is used as the copy node of the target node, thereby shortening the distance and time of data transmission between the copy node and the target node, and further accelerating the startup speed of the target node.

[0076] Step 402: Send a data replication request to the replication node, and obtain serialized metadata information and log sequence returned by the replication node.

[0077] In some embodiments, the execution subject may send a data replication request to the replication node via a wired connection or a wireless connection, and obtain the serialized metadata information and log sequence returned by the replication node. The generation of the serialized metadata information and the log sequence may refer to Figure 3 The corresponding steps 301-305 in the embodiments are not described in detail here.

[0078] Step 403: Deserialize the serialized metadata information to obtain each metadata item, and store each metadata item in the memory of the target node.

[0079] In some embodiments, the execution entity may deserialize the serialized metadata information to obtain each metadata item, and store each metadata item in the memory of the target node.

[0080] In some optional implementations of some embodiments, after the execution subject deserializes the serialized metadata information to obtain each metadata, it can also generate and store statistical information of each metadata. Each node in the database cluster stores statistical information.

[0081] Statistics are used to indicate the overall information of all metadata up to the current moment. Statistics will change as the metadata in memory changes. When the replica node serializes metadata, all metadata in the replica node memory has been copied. However, when the replica node serializes metadata, the metadata in the replica node memory may change at any time due to read and write operations. Therefore, the statistics of the metadata in the replica node memory may not match the individual metadata copied. Therefore, after the target node deserializes the serialized metadata information and then generates the statistics, it can be ensured that the statistics correspond to the individual metadata in the target node.

[0082] Step 404: Use each log in the log sequence to update each metadata stored in the memory.

[0083] In some embodiments, the execution subject may use each log in the log sequence to update each metadata stored in the memory. The metadata stored in the memory may be updated by redoing each log in the log sequence.

[0084] Thus, the metadata stored in the memory can be updated through the log sequence, so that the data in the target node is consistent with other nodes in the database cluster.

[0085] Step 405, in response to determining that each metadata stored in the memory is updated, determining that the target node is started.

[0086] In some embodiments, the execution subject may determine that the target node has completed startup in response to determining that the update of each of the metadata items stored in the memory has been completed.

[0087] The above-mentioned various embodiments of the present disclosure have the following beneficial effects: through the node startup method of some embodiments of the present disclosure, the startup speed of the restart node and the newly added node can be accelerated. Specifically, the reason for the slow startup of the restart node or the newly added node is that when the data stored in the disk for unified data storage is large, the process of reading data from the disk and restoring metadata is slow, thereby extending the startup time of the node. Based on this, in the node startup method of some embodiments of the present disclosure, when the target node starts to start, a node is determined from the database cluster to which the target node belongs as a copy node. And the serialized metadata information and log sequence obtained from the memory of the copy node are obtained. Thus, reading and copying data from the disk for unified data storage is avoided. The data replication speed is accelerated, and the startup time of the target node is shortened to a certain extent. After obtaining the serialized metadata information and log sequence returned by the copy node, the serialized metadata information is deserialized to obtain each metadata. Then, the log sequence is replayed to update each metadata. Thus, the data in the target node is consistent with other nodes in the database cluster. In turn, the target node is quickly started and provides services to the outside.

[0088] Further references Figure 5 , which shows a process 500 of another embodiment of a node startup method. The process 500 of the node startup method includes the following steps:

[0089] Step 501, in response to determining that a target node starts to start, determining a replication node corresponding to the target node.

[0090] Step 502: Send a data replication request to the replication node, and obtain serialized metadata information and log sequence returned by the replication node.

[0091] Step 503: Deserialize the serialized metadata information to obtain each metadata item, and store each metadata item in the memory of the target node.

[0092] In some embodiments, the specific implementation of steps 501-503 and the technical effects brought about can be referred to Figure 4 The corresponding steps 401-403 in the embodiments are not described in detail here.

[0093] Step 504: Play back each log in the log sequence for each metadata stored in the memory.

[0094] In some embodiments, the execution body of the node startup method (such as Figure 2 The computing device 201 shown can replay each log in the above log sequence for the above metadata stored in the above memory.

[0095] Therefore, the above metadata stored in the memory can be updated through log playback, so that the data in the target node is consistent with other nodes in the database cluster.

[0096] Step 505: In response to detecting an add operation for metadata already existing in the memory during the process of playing back each log in the log sequence, the add operation is ignored.

[0097] In some embodiments, the execution subject may ignore the adding operation in response to detecting an adding operation for metadata already existing in the memory during the playback of each log in the log sequence.

[0098] Step 506: In response to detecting a deletion operation for metadata that does not exist in the memory during the playback of each log in the log sequence, the deletion operation is ignored.

[0099] In some embodiments, the execution subject may ignore the deletion operation in response to detecting a deletion operation on metadata that does not exist in the memory during the playback of each log in the log sequence.

[0100] Thus, by ignoring the above-mentioned adding and deleting operations, a fault-tolerant mechanism can be implemented during the log playback process, so that the above-mentioned metadata stored in the above-mentioned memory can be quickly updated.

[0101] Step 507, in response to determining that each metadata stored in the memory is updated, determining that the target node is started.

[0102] In some embodiments, the specific implementation of step 507 and the technical effects brought about can be referred to Figure 4 The corresponding step 405 in the embodiments will not be described in detail here.

[0103] from Figure 5 It can be seen that Figure 4 Compared with the description of some corresponding embodiments, Figure 5 The process 500 of the node startup method in some corresponding embodiments reflects that in the process of updating metadata using the log sequence, the deletion operation for metadata that does not exist in the memory and the addition operation for metadata that already exists in the memory are ignored to implement a fault tolerance mechanism. Thus, the above-mentioned metadata stored in the above-mentioned memory can be quickly updated.

[0104] Further references Figure 6 As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a data sending device, and these device embodiments are Figure 3Corresponding to the method embodiments shown, the device can be specifically applied to various electronic devices.

[0105] like Figure 6 As shown, the data sending device 600 of some embodiments includes: a current log point determination unit 601, a recording and copying unit 602, a copying unit 603, a serialization unit 604 and a sending unit 605. Among them, the current log point determination unit 601 is configured to determine the current log point in response to receiving a data copy request sent by the target node; the recording and copying unit 602 is configured to record the log generated from the above current log point, and copy each metadata in the memory; the copying unit 603 is configured to stop recording the log in response to determining that the copying of each metadata in the above memory is completed, and obtain a log sequence; the serialization unit 604 is configured to serialize each metadata obtained by copying to obtain serialized metadata information; the sending unit 605 is configured to send the above serialized metadata information and the above log sequence to the above target node.

[0106] In an optional implementation of some embodiments, the recording and copying unit 602 of the data sending device 600 includes a reading subunit configured to read and copy the metadata from a memory.

[0107] In an optional implementation of some embodiments, the reading subunit includes a locking module and an unlocking module, wherein the locking module is configured to lock the metadata in response to starting to read the metadata, and the unlocking module is configured to unlock the metadata in response to completion of copying the metadata.

[0108] In an optional implementation of some embodiments, the reading subunit includes a reading and copying module configured to read and copy the metadata from the memory through atomic operations.

[0109] It is understood that the units described in the device 600 are similar to those described in the reference Figure 3 Therefore, the operations, features and beneficial effects described above for the method are also applicable to the device 600 and the units included therein, and will not be described in detail here.

[0110] Further references Figure 7 As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a node startup device. These device embodiments are similar to Figure 4 Corresponding to the method embodiments shown, the device can be specifically applied to various electronic devices.

[0111] like Figure 7As shown, the node startup device 700 of some embodiments includes: a copy node determination unit 701, a sending and obtaining unit 702, a deserialization unit 703, an updating unit 704 and a startup determination unit 705. Among them, the replication node determination unit 701 is configured to determine the replication node corresponding to the above target node in response to determining that the target node starts to start, wherein the above replication node is a node in the database cluster to which the above target node belongs, and the above database cluster is a shared storage cluster; the sending and obtaining unit 702 is configured to send a data replication request to the above replication node, and obtain the serialized metadata information and log sequence returned by the above replication node, wherein the above serialized metadata information and the above log sequence are generated according to any method in the above first aspect; the deserialization unit 703 is configured to deserialize the above serialized metadata information to obtain each metadata, and store the above metadata in the memory of the above target node; the updating unit 704 is configured to use each log in the above log sequence to update the above metadata stored in the above memory; the startup determination unit 705 is configured to determine that the above target node has completed startup in response to determining that the above metadata stored in the above memory has been updated.

[0112] In an optional implementation of some embodiments, the updating unit 704 of the node startup device 700 includes a playback subunit configured to play back each log in the log sequence for each metadata item stored in the memory.

[0113] In an optional implementation of some embodiments, the update unit 704 of the node startup device 700 further includes a first ignoring subunit and a second ignoring subunit. The first ignoring subunit is configured to ignore the adding operation in response to detecting the adding operation for the metadata already existing in the memory during the playback of each log in the log sequence; the second ignoring subunit is configured to ignore the deleting operation in response to detecting the deleting operation for the metadata not existing in the memory during the playback of each log in the log sequence.

[0114] In an optional implementation of some embodiments, the copy node determination unit 701 of the node startup device 700 is further configured to select a node that meets preset conditions from the database cluster as a copy node based on the physical location of the target node and the physical locations of the remaining nodes in the database cluster.

[0115] In an optional implementation of some embodiments, after the deserialization unit 703 of the node startup device 700, the node startup device 700 further includes a generation and storage unit configured to generate and store statistical information of the above-mentioned metadata.

[0116] It is understood that the units described in the device 700 are similar to those described in the reference Figure 4 Therefore, the operations, features and beneficial effects described above for the method are also applicable to the device 700 and the units included therein, and will not be described in detail here.

[0117] Reference below Figure 8 , which shows a structural schematic diagram of an electronic device 800 suitable for implementing some embodiments of the present disclosure. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0118] like Figure 8 As shown, the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 are also stored. The processing device 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0119] Typically, the following devices may be connected to the I / O interface 805: input devices 806 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; and communication devices 809. The communication devices 809 may allow the electronic device 800 to communicate with other devices wirelessly or by wire to exchange data. Figure 8 The electronic device 800 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 8 Each block shown in the figure may represent one device, or may represent multiple devices as required.

[0120] In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 809, or installed from the storage device 808, or installed from the ROM 802. When the computer program is executed by the processing device 801, the above-mentioned functions defined in the method of some embodiments of the present disclosure are executed.

[0121] It should be noted that the computer-readable medium recorded in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0122] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0123] The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: determines the current log point in response to receiving a data replication request sent by the target node; records the log generated from the current log point, and replicates each metadata in the memory; in response to determining that the replication of each metadata in the memory is completed, stops recording the log to obtain a log sequence; serializes each metadata obtained by replication to obtain serialized metadata information; and sends the serialized metadata information and the log sequence to the target node. Or the electronic device is caused to: in response to determining that the target node starts to start, determine the replication node corresponding to the above target node, wherein the above replication node is a node in the database cluster to which the above target node belongs, and the above database cluster is a shared storage cluster; send a data replication request to the above replication node, and obtain serialized metadata information and log sequence returned by the above replication node, wherein the above serialized metadata information and the above log sequence are generated according to any one of the methods in the above first aspect; deserialize the above serialized metadata information to obtain each metadata, and store the above metadata in the memory of the above target node; use each log in the above log sequence to update the above metadata stored in the above memory; in response to determining that the update of the above metadata stored in the above memory is completed, determine that the above target node has completed startup.

[0124] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0125] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0126] The units described in some embodiments of the present disclosure may be implemented by software or by hardware. The described units may also be set in a processor, for example, may be described as: a processor includes a current log point determination unit, a recording and replication unit, a replication unit, a serialization unit, and a sending unit. In which, the names of these units do not constitute a limitation on the unit itself in certain circumstances, for example, the replication unit may also be described as a "metadata replication unit". It may also be described as: a processor includes a replication node determination unit, a sending and acquisition unit, a deserialization unit, an update unit, and a startup determination unit. In which, the names of these units do not constitute a limitation on the unit itself in certain circumstances, for example, the update unit may also be described as a "metadata update unit".

[0127] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

Claims

1. A data transmission method, comprising: In response to receiving a data replication request sent by a target node, determining a current log point, wherein the target node is a newly added node or a restarted node in the database cluster; Record the logs generated from the current log point, and copy each metadata in the memory; In response to determining that the copying of each metadata in the memory is completed, stopping the recording of the log to obtain a log sequence; Serializing each piece of metadata obtained by copying to obtain serialized metadata information; The serialized metadata information and the log sequence are sent to the target node.

2. The method according to claim 1, wherein: The step of copying each metadata in the memory includes: The metadata is read from memory and copied.

3. The method according to claim 2, wherein: The reading and copying of the metadata from the memory includes: In response to starting to read the metadata, locking the metadata; In response to the metadata copying being completed, the metadata is unlocked.

4. The method according to claim 2, wherein: The reading and copying of the metadata from the memory includes: The metadata is read and copied from memory via atomic operations.

5. A node startup method, comprising: In response to determining that the target node starts to start, determining a replication node corresponding to the target node, wherein the replication node is a node in a database cluster to which the target node belongs, and the database cluster is a shared storage cluster; Sending a data replication request to the replication node, and obtaining serialized metadata information and a log sequence returned by the replication node, wherein the serialized metadata information and the log sequence are generated according to one of the methods of claims 1-4; Deserialize the serialized metadata information to obtain each metadata item, and store each metadata item in the memory of the target node; Using each log in the log sequence, updating each metadata stored in the memory; In response to determining that the update of each metadata stored in the memory is completed, it is determined that the target node has completed startup.

6. The method according to claim 5, wherein: The updating of each metadata stored in the memory by using each log in the log sequence includes: For each piece of metadata stored in the memory, each log in the log sequence is played back.

7. The method according to claim 6, wherein: The updating of each metadata stored in the memory by using each log in the log sequence further includes: In response to detecting an add operation for metadata already existing in the memory during playback of each log in the log sequence, ignoring the add operation; In response to detecting a deletion operation on metadata that does not exist in the memory during playback of each log in the log sequence, ignoring the deletion operation.

8. The method according to claim 5, wherein: In response to determining that the target node starts to start, determining the replication node corresponding to the target node includes: According to the physical location of the target node and the physical locations of the remaining nodes in the database cluster, a node that meets a preset condition is selected from the database cluster as a replication node.

9. The method according to claim 5, wherein: After deserializing the serialized metadata information to obtain each metadata, the method further includes: Generate and store statistical information of each piece of metadata.

10. A data sending device, comprising: a current log point determination unit, configured to determine a current log point in response to receiving a data replication request sent by a target node, wherein the target node is a newly added node or a restarted node in the database cluster; a recording and copying unit, configured to record the logs generated from the current log point, and to copy each metadata in the memory; The replication unit is configured to, in response to determining that the replication of each metadata in the memory is completed, stop recording the log and obtain a log sequence; A serialization unit is configured to perform serialization processing on each of the copied metadata to obtain serialized metadata information; A sending unit is configured to send the serialized metadata information and the log sequence to the target node.

11. A node startup device, comprising: a replication node determination unit, configured to determine, in response to determining that a target node starts to start, a replication node corresponding to the target node, wherein the replication node is a node in a database cluster to which the target node belongs, and the database cluster is a shared storage cluster; a sending and obtaining unit, configured to send a data replication request to the replication node, and obtain serialized metadata information and a log sequence returned by the replication node, wherein the serialized metadata information and the log sequence are generated according to the method according to any one of claims 1 to 4; A deserialization unit is configured to perform deserialization processing on the serialized metadata information to obtain each metadata, and store each metadata into the memory of the target node; an updating unit, configured to update each piece of metadata stored in the memory using each log in the log sequence; The startup determination unit is configured to determine that the target node has completed startup in response to determining that the update of each metadata stored in the memory is completed.

12. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-4 or 5-9.

13. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 4 or 5 to 9 is implemented.

Citation Information

Patent Citations

  • Data processing method and system

    CN109165117A

  • Shared data synchronization method and device

    CN110895545A