Log stream control method and apparatus

By creating and configuring blank log streams in the distributed database, the problem of data reference relationships between nodes during sharding migration is solved, achieving seamless load balancing and continuous read/write capabilities.

CN116804984BActive Publication Date: 2026-01-30BEIJING OCEANBASE TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310764888.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-26
Publication Date
2026-01-30
Estimated Expiration
2043-06-26

AI Technical Summary

Technical Problem

In a distributed database, how can we ensure that the external read and write capabilities of shards are not affected during shard migration, and ensure that the log streams of shard migration reside on the same node to establish local data reference relationships?

Method used

By creating a blank log stream and configuring its log stream group to be the same as the log stream group of the source log stream, shards in the source log stream are transferred to the blank log stream. The log stream group of the blank log stream is then changed to migrate the blank log stream between nodes in the distributed database, ensuring that shard transfers occur on the same node.

Benefits of technology

It achieves seamless load balancing during sharding migration, ensuring that local data references can be established between log streams after sharding migration, thus maintaining uninterrupted database read and write capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116804984B_ABST
    Figure CN116804984B_ABST
Patent Text Reader

Abstract

This specification provides a log stream control method and apparatus, relating to the field of database technology. The method includes: creating a blank log stream; configuring a log stream group for the blank log stream so that the blank log stream has the same log stream group as the source log stream, wherein the log stream group corresponds to a node in the distributed database, and log streams in the same log stream group reside on the same node; transferring at least one fragment from the source log stream to the blank log stream; and changing the log stream group of the blank log stream to migrate the blank log stream between nodes in the distributed database. The solution provided in this specification, by configuring or changing the log stream group of the log stream, can ensure that the log streams used for fragment transfer are always on the same node in the distributed database, thereby ensuring that local data reference relationships can be established between the log streams used for fragment transfer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of database technology, and more particularly to a log flow control method and apparatus. Background Technology

[0002] A database log stream can contain several shards (tablets). When the data stored in a single log stream is large, the data stored in that log stream can be transferred to a new log stream in units of shards in order to achieve load balancing among the nodes in the database.

[0003] During the sharding process, to ensure that the read and write capabilities of the shards are not affected, local data reference relationships need to be established between the log streams undergoing sharding. Since local data reference relationships can only be established between log streams located on the same node, ensuring that the log streams undergoing sharding are located on the same node becomes a pressing issue. Summary of the Invention

[0004] In view of the above, this specification provides a log flow control method and apparatus through one or more embodiments.

[0005] To achieve the above objectives, one or more embodiments of this specification provide the following technical solutions:

[0006] According to a first aspect of one or more embodiments of this specification, a log flow control method is proposed, applied to a distributed database, the method comprising:

[0007] Create an empty log stream;

[0008] Configure the log stream group for the blank log stream so that the blank log stream is in the same log stream group as the source log stream. The log stream group corresponds to the node in the distributed database, and the log streams in the same log stream group are located on the same node.

[0009] Transfer at least one fragment from the source log stream to an empty log stream;

[0010] Change the log stream group of the blank log stream to migrate the blank log stream between nodes in the distributed database.

[0011] According to a second aspect of one or more embodiments of this specification, a log flow control device is provided for use in a distributed database, the device comprising:

[0012] Create a module to create blank log streams;

[0013] The configuration module is used to configure the log stream group of the blank log stream so that the log stream group of the blank log stream is the same as that of the source log stream. The log stream group has a corresponding relationship with the nodes in the distributed database, and the log streams in the same log stream group are located on the same node.

[0014] The transfer module is used to transfer at least one fragment from the source log stream to a blank log stream;

[0015] The module is used to change the log stream group of blank log streams so that blank log streams can be migrated between nodes in a distributed database.

[0016] According to a third aspect of one or more embodiments of this specification, an electronic device is provided, comprising:

[0017] processor;

[0018] Memory used to store processor-executable instructions;

[0019] The processor implements the method described in the first aspect by running executable instructions.

[0020] According to a fourth aspect of one or more embodiments of this specification, a computer-readable storage medium is provided that stores computer instructions thereon, which, when executed by a processor, implement the steps of the method as described in the first aspect.

[0021] The log stream control method provided in this specification involves: creating a blank log stream; configuring the log stream group of the blank log stream to be the same as the log stream group of the source log stream; transferring at least one fragment from the source log stream to the blank log stream; and changing the log stream group of the blank log stream to migrate the blank log stream between nodes in the distributed database. The log stream group corresponds to a node in the distributed database, and log streams in the same log stream group reside on the same node. By configuring or changing the log stream group, the solution provided in this specification ensures that the log streams used for fragment transfer are always on the same node in the distributed database, thereby guaranteeing that local data references can be established between the log streams used for fragment transfer. Attached Figure Description

[0022] Figure 1a This is a schematic diagram of a load balancing method in the related art provided by an exemplary embodiment.

[0023] Figure 1b This is a schematic diagram of a configuration method for a log stream group provided in an exemplary embodiment.

[0024] Figure 2 This is a flowchart illustrating a log flow control method provided in an exemplary embodiment.

[0025] Figure 3 This is a flowchart illustrating another log flow control method provided in an exemplary embodiment.

[0026] Figure 4 This is a schematic flowchart of a data recovery method provided in an exemplary embodiment.

[0027] Figure 5 This is a schematic diagram of the structure of a device provided in an exemplary embodiment.

[0028] Figure 6 This is a schematic diagram of the structure of a log flow control device provided in an exemplary embodiment. Detailed Implementation

[0029] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.

[0030] It should be noted that the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification in other embodiments. In some other embodiments, the methods may include more or fewer steps than described in this specification. Furthermore, a single step described in this specification may be broken down into multiple steps in other embodiments; and multiple steps described in this specification may be combined into a single step in other embodiments.

[0031] To facilitate understanding, the terms used in this manual will be explained first.

[0032] A log stream is an entity that is automatically created and managed by the database. It represents a collection of data, including several shards and logs of transaction operations performed on them.

[0033] In a distributed environment, to ensure high availability of data read and write services, the database copies data from the same log stream to multiple nodes. In some embodiments, these copies of the same log stream across different nodes are called replicas. Multiple replicas of the same log stream can use the Paxos consensus protocol to ensure strong consistency. Each log stream and its replicas form an independent Paxos group, with one log stream as the leader and the other log streams as followers. In some embodiments, the leader replica has strong consistency read and write capabilities, while the followers have weak consistency read capabilities.

[0034] A shard (Tablet) is a data storage object corresponding to a partition. It has the ability to store data and is the smallest unit for load balancing. Each shard stores data through an ordered string table (SSTable) stored on disk and a memory table (MemTable) stored in memory.

[0035] From a data storage perspective, log streams can also be abstracted as sharded containers, supporting the addition and management of sharded data, and allowing shards to be transferred between different log streams to achieve load balancing and horizontal scaling.

[0036] Figure 1a This illustrates the implementation methods of load balancing in related technologies. To ensure that the sharding transfer process does not affect the read and write capabilities provided by the distributed database, log streams on the same node can complete the sharding transfer by establishing local data reference relationships. Please refer to... Figure 1a In order to transfer a shard of log stream A on node A to log stream B on node B, the relevant technology requires creating an empty log stream as a temporary container for the shard, and then migrating the empty log stream carrying the shard between node A and node B to complete the transfer of the shard between node A and node B, thereby ensuring that the shard transfer process does not affect the read and write capabilities provided by the distributed database.

[0037] It is evident that, during the aforementioned fragment transfer process, ensuring that the log stream used to establish local reference relationships is always on the same node becomes a pressing issue.

[0038] In view of this, the embodiments of this specification involve: creating a blank log stream; configuring the log stream group of the blank log stream so that the log stream group of the blank log stream is the same as that of the source log stream; transferring at least one fragment from the source log stream to the blank log stream; and changing the log stream group of the blank log stream to migrate the blank log stream between nodes in the distributed database. Here, the log stream group corresponds to a node in the distributed database, and log streams in the same log stream group reside on the same node. The solution provided in this specification, by configuring or changing the log stream group of the log stream, can ensure that the log streams used for fragment transfer are always on the same node in the distributed database, thereby ensuring that local data reference relationships can be established between the log streams used for fragment transfer.

[0039] Specifically, please refer to Figure 1bIn this embodiment of the specification, log stream group A can be set on node A, and log stream group B can be set on node B. Log stream group A is the log stream group of log stream A, and log stream group B is the log stream group of log stream B. In this case, by setting the log stream group of the blank log stream to log stream group A, it can be ensured that the blank log stream shares the same node as log stream A; conversely, by setting the log stream group of the blank log stream to log stream group B, it can be ensured that the blank log stream shares the same node as log stream group B.

[0040] The following will describe the exemplary implementation method in detail with reference to the accompanying drawings and embodiments.

[0041] First, this specification provides a log flow control method in its embodiments, which can be executed by any electronic device.

[0042] Figure 2 This is a flowchart illustrating a log flow control method provided in an exemplary embodiment, applied to a distributed database. For example... Figure 2 As shown, the log flow control method includes the following steps.

[0043] S201, Create an empty log stream.

[0044] It should be noted that a blank log stream can be understood as a log stream that does not contain shards or redo logs. In other words, a blank log stream is a newly added log stream in a distributed database node that has not yet been written with data. The blank log stream created in this specification can be used to receive shards from other log streams, or as a temporary shard container to pass shards from other log streams to a specific destination log stream.

[0045] S202, Configure the log stream group for the blank log stream so that the log stream group for the blank log stream is the same as that for the source log stream.

[0046] In this system, log stream groups correspond to nodes in the distributed database, and log streams in the same log stream group are located on the same node.

[0047] It's important to note that the source log stream is the log stream used to transfer shards out of the distributed database. The source log stream can be determined by the load balancing mechanism in the distributed database or manually specified by the user. By transferring some shards from the source log stream to other log streams on the same node or different nodes, load balancing can be achieved among the nodes.

[0048] It should be noted that log stream groups can be used to indicate the node where the log stream resides. Specifically, the relationship between a log stream group and a node in the distributed database can be one-to-one or many-to-one.

[0049] In other words, a node can contain log streams from one log stream group or log streams from multiple log stream groups. Log streams from the same log stream group are always located on the same node, but log streams from different log stream groups are not necessarily located on different nodes.

[0050] The embodiments in this specification configure the log stream group of the blank log stream to be the same as that of the source log stream. This ensures that the blank log stream and the source log stream are located on the same node in the distributed database, thereby enabling the blank log stream to reference data from the source log stream. This allows the shards in the source log stream to be transferred to the blank log stream without interrupting the read and write capabilities provided by the shards.

[0051] S203, transfer at least one fragment from the source log stream to the blank log stream.

[0052] It should be noted that by transferring some fragments from the source log stream to the blank log stream, the load on the node where the source log stream resides can be reduced.

[0053] The shards used for transfer in the source log stream can be implemented by the load balancing mechanism in the distributed database or can be manually specified by the user. This public instance does not limit this.

[0054] S204, Change the log stream group of the blank log stream to migrate the blank log stream between nodes in the distributed database.

[0055] It should be noted that the blank log stream can be migrated to the destination node by changing the log stream group of the blank log stream to the log stream group on the destination node.

[0056] In other words, the embodiments of this specification can control the log stream by changing the log stream group of the log stream, thereby migrating the log stream to the node corresponding to the log stream group.

[0057] The log flow control method provided in the embodiments of this specification has been introduced above. The following will illustrate the specific application of the method provided in this specification in the context of load balancing of distributed databases.

[0058] Figure 3 This is a flowchart illustrating another log flow control method provided in an exemplary embodiment. Since the principle by which this embodiment solves the problem is similar to that of the previous embodiment, the implementation of this embodiment can refer to the implementation of the previous embodiment. For the sake of brevity, the differences between this embodiment and the previous embodiment will be described in detail below, and repeated details will not be repeated.

[0059] Specifically, such as Figure 3 As shown, the log flow control method includes the following steps.

[0060] S301, in response to a load balancing command for a distributed database, creates a destination log stream group. The destination log stream group corresponds to a destination node, which is a node in the distributed database used for load balancing.

[0061] It should be noted that load balancing in this specification refers to balancing the load on each node in a distributed database based on the load conditions of each node and preset adjustment strategies, through methods such as scaling up, scaling down, and sharding migration. This improves the performance of the distributed database and ensures efficient resource utilization. Correspondingly, the destination node is the node used to receive shards during the load balancing process.

[0062] In some embodiments, during scaling up, the destination node can be a newly added node in the distributed database. By transferring sharded log stream data from existing nodes to the new node, the load pressure in the distributed data can be shared by the newly added destination node.

[0063] In some embodiments, during a scaling-down scenario, before a node is deactivated, the sharded data in its log stream can be transferred to a designated node, which is the destination node. After the sharded data is transferred to the designated node, the node can be deactivated, thereby reducing unnecessary nodes in the distributed database and saving costs and resources.

[0064] In some embodiments, when transferring shards between log streams on different nodes, the destination node is the final point of the shard transfer. By transferring shards to log streams on different nodes, the load on each node can be balanced, thereby ensuring the effective utilization of resources on each node.

[0065] Accordingly, the destination log stream group is the log stream group on the destination node. When the log stream group of a log stream is set to the destination log stream group, the log stream will be migrated to the destination node.

[0066] S302, Create an empty log stream.

[0067] S303, Configure the log stream group for the blank log stream so that the blank log stream has the same log stream group as the source log stream.

[0068] S304, transfer at least one fragment from the source log stream to the blank log stream.

[0069] S305, change the log stream group of the blank log stream to the destination log stream group so that the blank log stream can be migrated to the destination node.

[0070] In the embodiments described in this specification, by configuring and changing the log stream group of the blank log stream, the log streams used for shard migration are ensured to be on the same node, thus achieving a load balancing method that is imperceptible to the user side.

[0071] In some application scenarios, based on similar principles, the methods provided in this manual can also be used to migrate fragments between log streams on different nodes. In this case, after some fragments of the source log stream are transferred to the blank log stream, by modifying the log stream group of the blank log stream to be the same as the log stream group of the destination log stream, the blank log stream and the source log stream can be located on the same node, thereby transferring the fragments in the blank log stream to the destination log stream.

[0072] In short, a blank log stream can be used as a container for transferring shards. First, make the log stream group of the blank log stream the same as the source log stream, ensuring that the blank log stream and the source log stream share the same node. This completes the transfer of shards from the source log stream to the blank log stream. Then, make the log stream group of the blank log stream the same as the destination log stream, ensuring that the blank log stream and the destination log stream share the same node. This completes the transfer of shards from the blank log stream to the destination log stream.

[0073] The following examples, using data recovery application scenarios, illustrate the effectiveness of the methods provided in this manual within a log recovery system. A log recovery system is a system capable of data recovery by replaying redo logs. For example, a log recovery system may include at least one of a physical backup database and a physical recovery system.

[0074] Figure 4 This is a flowchart illustrating a data recovery method provided in an exemplary embodiment, applied to a distributed database. Specifically, as shown... Figure 4 As shown, the data recovery method includes the following steps.

[0075] S401, Create the first redo log. The first redo log is used to record log stream creation operations for empty log streams.

[0076] It should be noted that the redo log is a log of operations performed in a distributed database. By replaying the redo log, the operations performed in the distributed database can be reproduced, thereby achieving data recovery.

[0077] In some embodiments, the first redo log is created after the blank log stream in the distributed database is created, in order to ensure consistency between the distributed database and the log recovery system.

[0078] S402, synchronize the first redo log to the log recovery system so that the log recovery system is aware of the log stream creation operation.

[0079] In some embodiments, the first redo log can be written to a specified log stream in the distributed database first. Then, by synchronizing the specified log stream to the log recovery system, the log recovery system can become aware of the first redo log carried in the specified log stream. By replaying the first redo log, the log recovery system can synchronously execute the log stream creation operation in the distributed database, thereby ensuring that the log recovery system is consistent with the data in the distributed database.

[0080] S403, Create a second redo log. The second redo log is used to record log stream group change operations for blank log streams.

[0081] In some embodiments, a second redo log is created after the log stream group of the blank log stream in the distributed database is modified, in order to ensure consistency between the distributed database and the log recovery system.

[0082] S404, synchronize the second redo log to the log recovery system so that the log recovery system is aware of log stream group change operations.

[0083] In some embodiments, the second redo log can be first written to a specified log stream in the distributed database. Then, by synchronizing the specified log stream to the log recovery system, the log recovery system can become aware of the second redo log carried in the specified log stream. By replaying the second redo log, the log recovery system can synchronously execute log stream group change operations in the distributed database, thereby ensuring data consistency between the log recovery system and the distributed database.

[0084] It should be noted that the specified log stream in the embodiments of this specification can be the control log stream in a distributed database. The control log stream is used to record the redo logs of internal tables in the distributed database. For the same tenant, only one control log stream exists in the distributed database. Since there is only one control log stream, it cannot be added or deleted. Therefore, by carrying the first and second redo logs in the embodiments of this specification through the control log stream, the reliability and stability of log synchronization can be guaranteed.

[0085] The embodiments in this specification enable the log recovery system to detect changes in the log stream within the distributed database by synchronizing the first redo log and the second redo log between the distributed database and the log recovery system. This allows the log recovery system to schedule the log stream to the correct node during data recovery, thereby completing data referencing between the log streams and ensuring normal reading by the log recovery system.

[0086] Figure 5 This is a schematic diagram of the structure of a device provided in an exemplary embodiment. Please refer to... Figure 5At the hardware level, the device includes a processor 502, an internal bus 504, a network interface 506, memory 508, and non-volatile memory 510, and may also include other hardware required for business operations. One or more embodiments of this specification can be implemented in software, such as the processor 502 reading the corresponding computer program from the non-volatile memory 510 into memory 508 and then running it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0087] Please refer to Figure 6 , Figure 6 A log flow control device 600 is provided, which can be applied to, for example... Figure 5 The device shown implements the technical solution described in this specification. The log stream control device 600 may include:

[0088] Create module 601 to create a blank log stream.

[0089] Configuration module 602 is used to configure the log stream group of the blank log stream so that the log stream group of the blank log stream is the same as that of the source log stream. The log stream group has a corresponding relationship with the nodes in the distributed database, and the log streams in the same log stream group are located on the same node.

[0090] The transfer module 603 is used to transfer at least one fragment from the source log stream to a blank log stream.

[0091] Modify module 604 to change the log stream group of the blank log stream so that blank log streams can be migrated between nodes in a distributed database.

[0092] In some embodiments, the creation module 601 is used to create a destination log stream group in response to a load balancing instruction for a distributed database. The destination log stream group corresponds to a destination node, which is a node in the distributed database used for load balancing.

[0093] At this point, module 604 is used to change the log stream group of the blank log stream to the destination log stream group so that the blank log stream can be migrated to the destination node.

[0094] In some embodiments, the log control device 600 further includes:

[0095] The first creation module is used to create the first redo log, which records the log stream creation operation for an empty log stream.

[0096] The first synchronization module is used to synchronize the first redo log to the log recovery system so that the log recovery system can be aware of the log stream creation operation.

[0097] The second creation module creates a second redo log, which is used to record log stream group change operations for blank log streams.

[0098] The second synchronization module is used to synchronize the second redo log to the log recovery system so that the log recovery system can be aware of log stream group changes.

[0099] In some embodiments, the first synchronization module is used to write the first redo log to a specified log stream in the distributed database; and to synchronize the specified log stream to the log recovery system so that the log recovery system can perform a log stream creation operation by replaying the first redo log.

[0100] In some embodiments, the second synchronization module is used to write the second redo log to a specified log stream in the distributed database; and to synchronize the specified log stream to the log recovery system so that the log recovery system can perform log stream group change operations by replaying the first redo log.

[0101] In some embodiments, the log recovery system includes at least one of a physical backup database and a physical recovery system.

[0102] In some embodiments, the first redo log is created after the blank log stream is created, and the second redo log is created after the log stream group of the blank log stream is changed.

[0103] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which can take the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email sending and receiving device, game console, tablet computer, wearable device, or any combination of these devices.

[0104] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0105] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0106] Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0107] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0108] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0109] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of this specification. The singular forms “a,” “described,” and “the” used in one or more embodiments of this specification and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0110] It should be understood that although the terms first, second, third, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first information may also be referred to as second information without departing from the scope of one or more embodiments of this specification, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "in response to a determination," or "when," or "in the event of a determination."

[0111] The above description is merely a preferred embodiment of one or more embodiments of this specification and is not intended to limit the scope of one or more embodiments of this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of one or more embodiments of this specification should be included within the scope of protection of one or more embodiments of this specification.

Claims

1. A method for log stream control, applied to a distributed database, the method comprising: creating a blank log stream; configuring a log stream group of the blank log stream to make the blank log stream identical to a log stream group of a source log stream, wherein the log stream group has a corresponding relationship with a node in the distributed database, and the nodes where the log streams in the identical log stream group are located are identical; transferring at least one shard in the source log stream to the blank log stream; and changing the log stream group of the blank log stream to migrate the blank log stream among the nodes in the distributed database. 2.The method of claim 1, further comprising: in response to a load balancing instruction for the distributed database, creating a destination log stream group, the destination log stream group having a corresponding relationship with a destination node, the destination node being a node in the distributed database for load balancing; the changing the log stream group of the blank log stream to migrate the blank log stream among the nodes in the distributed database comprises: changing the log stream group of the blank log stream to the destination log stream group to migrate the blank log stream to the destination node. 3.The method of claim 1, further comprising: creating a first redo log for recording a log stream creation operation for the blank log stream; synchronizing the first redo log to a log recovery system to make the log recovery system aware of the log stream creation operation; creating a second redo log for recording a log stream group change operation for the blank log stream; synchronizing the second redo log to the log recovery system to make the log recovery system aware of the log stream group change operation. 4.The method of claim 3, the synchronizing the first redo log to the log recovery system to make the log recovery system aware of the log stream creation operation comprises: writing the first redo log to a specified log stream in the distributed database; and synchronizing the specified log stream to the log recovery system to make the log recovery system execute the log stream creation operation by replaying the first redo log. 5.The method of claim 3, the synchronizing the second redo log to the log recovery system to make the log recovery system aware of the log stream group change operation comprises: writing the second redo log to a specified log stream in the distributed database; and synchronizing the specified log stream to the log recovery system to make the log recovery system execute the log stream group change operation by replaying the first redo log. 6.The method of claim 3, the log recovery system comprises at least one of a physical backup and a physical recovery system. 7.The method of claim 3, the first redo log is created after the blank log stream is created, and the second redo log is created after the log stream group of the blank log stream is changed.

8. A log stream control apparatus applied to a distributed database, the apparatus comprising: a creating module configured to create a blank log stream; a configuring module configured to configure a log stream group of the blank log stream to be the same as a log stream group of a source log stream, wherein the log stream group has a corresponding relationship with a node in the distributed database, and the nodes in which the log streams in the same log stream group are located are the same; a transferring module configured to transfer at least one shard in the source log stream to the blank log stream; a changing module configured to change the log stream group of the blank log stream so as to migrate the blank log stream among the nodes in the distributed database.

9. An electronic device comprising: a processor; a memory for storing processor-executable instructions; wherein the processor implements the method of any one of claims 1 to 7 by running the executable instructions.

10. A computer-readable storage medium having stored thereon computer instructions which, when executed by a processor, implement the steps of the method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Systems, apparatus and methods for migrating database data across heterogeneous platforms

    CN102262662A

  • Data migration method and device of distributed database cluster

    CN106844510A