Data synchronization method, device, storage medium and electronic device
By identifying and synchronizing the target data shard object and its object mapping bitmap in a distributed storage system, the problem of slow data synchronization speed is solved and more efficient data synchronization is achieved.
Patent Information
- Application Number
- CN202411863690.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2044-12-17
AI Technical Summary
In the prior art, data synchronization speed is slow, which cannot effectively solve the problem of slow data synchronization speed in distributed storage systems.
In the first storage site and the second storage site, by determining the object mapping bitmap, the target data shard object is identified and stored in the target data group and its target object mapping bitmap are synchronized to the target storage site.
By simultaneously transmitting target data sharding objects and target object mapping bitmaps, network transmission interaction is reduced, thereby improving data synchronization speed and solving the problem of slow data synchronization speed.
Smart Images

Figure CN119336850B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the computer field, and more specifically, to a data synchronization method, device, storage medium and electronic device. Background Art
[0002] In related technologies, distributed storage usually uses active-active mode to achieve data backup. After a data center fails, the service can continue to be provided remotely to avoid the loss of data loss at one site to customers. When the service data of a data center recovers from failure to normal state, the service data of another data center will be synchronized to the failed data center. During the data synchronization process, the data and data status can only be updated serially.
[0003] It can be seen from this that the related technology has the problem of slow data synchronization speed.
[0004] Currently, no effective solution has been proposed for the above-mentioned problems existing in the related technologies. Summary of the invention
[0005] The embodiments of the present application provide a data synchronization method, device, storage medium and electronic device to at least solve the problem of slow data synchronization speed existing in the related art.
[0006] According to an embodiment of the present application, a data synchronization method is provided, which is applied to a storage system, wherein the storage system includes a data group, a first storage site and a second storage site, the first storage site includes a first volume, the second storage site includes a second volume, and the first volume and the second volume are in a dual-active relationship with each other, comprising: when the state of a target storage site included in the first storage site and the second storage site is restored from a faulty state to a normal state, determining an object mapping bitmap included in a target volume belonging to other storage sites included in the first volume and the second volume, wherein the other storage sites are sites other than the target storage site included in the first storage site and the second storage site; determining a target data slicing object included in the target volume based on the object mapping bitmap, wherein the target data slicing is a data slicing object that changes when the target storage site is in a faulty state; and storing the target data slicing object and the target object mapping bitmap of the target data slicing object in a target data group included in the data group to instruct the target data group to synchronize the target data and the target object mapping bitmap to the target storage site.
[0007] According to another embodiment of the present application, a data synchronization device is provided, which is applied to a storage system, wherein the storage system includes a data group, a first storage site and a second storage site, the first storage site includes a first volume, the second storage site includes a second volume, and the first volume and the second volume are in a dual-active relationship with each other, and includes: a first determination module, which is used to determine, when the state of a target storage site included in the first storage site and the second storage site is restored from a faulty state to a normal state, an object mapping bitmap included in a target volume belonging to other storage sites included in the first volume and the second volume, wherein the other storage site is a site other than the target storage site included in the first storage site and the second storage site; a second determination module, which is used to determine a target data slicing object included in the target volume based on the object mapping bitmap, wherein the target data slicing is a data slicing object that changes when the target storage site is in a faulty state; and a storage module, which is used to store the target data slicing object and the target object mapping bitmap of the target data slicing object in a target data group included in the data group, so as to instruct the target data group to synchronize the target data and the target object mapping bitmap to the target storage site.
[0008] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0009] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0010] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0011] Through the present application, when any one of the first storage site and the second storage site recovers from a faulty state to a normal working state, the object mapping bitmap included in the target volume in the other storage sites that have not failed is determined, and the target data sharding object that has changed in the target volume when the state of the target storage site changes can be determined based on the object mapping bitmap, and the target data sharding object and the target object mapping bitmap are stored in the target data group and synchronized to the target storage site. Since the target data sharding object and the target object mapping bitmap can be transmitted to the same target data group at the same time, the interactive operation of one network transmission is reduced. Therefore, the problem of slow data synchronization speed in the related art can be solved, and the effect of improving the data synchronization speed can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 is a hardware structure block diagram of a server device according to a data synchronization method of an embodiment of the present application;
[0013] Figure 2 is a flow chart of a method for synchronizing data according to an embodiment of the present application;
[0014] Figure 3 This is a schematic diagram of active-active nearby writing according to an embodiment of the present application;
[0015] Figure 4 is a schematic diagram of failover of active-active dual according to an embodiment of the present application;
[0016] Figure 5 This is a schematic diagram of the single active mode operation according to an embodiment of the present application;
[0017] Figure 6 is a schematic diagram of active-active recovery work according to an embodiment of the present application;
[0018] Figure 7 is a schematic diagram of the storage system structure according to an embodiment of the present application;
[0019] Figure 8 This is a schematic diagram of the full amount of calculation objmap according to an embodiment of the present application;
[0020] Fig. 9 is a schematic diagram of data sharding update according to an embodiment of the present application;
[0021] Fig.10 is a schematic diagram of the KV array format according to an embodiment of the present application;
[0022] Fig.11 It is a structural block diagram of a data synchronization device according to an embodiment of the present application. DETAILED DESCRIPTION
[0023] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0025] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a server device of a data synchronization method according to an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned server device may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0026] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the data synchronization method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0027] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0028] In this embodiment, a data synchronization method is provided, which is applied to a storage system, wherein the storage system includes a data group, a first storage site, and a second storage site, the first storage site includes a first volume, the second storage site includes a second volume, the first volume and the second volume are in an active-active relationship with each other, Figure 2 is a flow chart of a method for synchronizing data according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:
[0029] Step S202: when the state of the target storage site included in the first storage site and the second storage site is restored from a fault state to a normal state, determine an object mapping bitmap included in the target volume belonging to other storage sites included in the first volume and the second volume, wherein the other storage site is a site included in the first storage site and the second storage site except the target storage site;
[0030] Step S204, determining a target data slice object included in the target volume based on the object mapping bitmap, wherein the target data slice is a data slice object that is changed while the target storage site is in a fault state;
[0031] Step S206: store the target data shard object and the target object mapping bitmap of the target data shard object in the target data group included in the data group to instruct the target data group to synchronize the target data and the target object mapping bitmap to the target storage site.
[0032] In the above embodiment, the storage system can be a distributed storage system, which aggregates the storage space in multiple storage devices into a storage system that can provide a unified access interface and management interface to the application server. A storage device or a process running on the storage device can be set as a node, and the nodes are transmitted through the network. The data group included in the distributed storage system can be a placement group PG (Placement Group), which is used to organize and manage data. It can also be understood as a logical container, containing a group of objects with similar access modes or attributes, which can be abandoned for storage and replication. PG can be divided into cluster placement group (Cluster Placement Group), spread placement group (Spread Placement Group) and partition placement group (Partition Placement Group), among which the cluster placement group is the traditional placement group, and all data must be in the same available area; the spread placement group is to distribute the data to different underlying hardware, which can be in different available areas; the partition placement group ensures that each partition in the placement group has its own network and power supply.
[0033] In the above embodiment, the first storage site and the second storage site can be data production centers, and the production center in working state processes and stores data. The first storage site can include multiple volumes, and the second storage site can also include multiple volumes. The first volume can be determined in the first storage site, and the second volume can be determined in the second storage site, and the two are set to be in an active-active relationship with each other. The active-active relationship (which can be called an active-active pair) under normal working conditions can be understood as selecting a volume in the cluster and its remote cluster through the management interface of any storage cluster in the active-active domain to establish a backup relationship with each other, and presenting a unified device identifier WWN to the outside, that is, virtualizing it as a unified volume, which can be called an active-active volume (that is, the collection of the first volume and the second volume mentioned above). Among them, the active-active domain is composed of two storage clusters that back up each other, and the active-active domain can be configured in the management interface of any storage cluster.
[0034] In the above embodiment, after the active-active relationship is set, the service host configuration can be connected to the storage cluster in the same site. Figure 3 Schematic diagram of active-active nearby writing according to an embodiment of the present application, such as Figure 3As shown in the figure, host A is connected to the active-active write module (preferred volume) nearby, and host B is connected to the active-active write module (non-preferred volume) nearby. When host A generates data A, it writes data A to the preferred volume. The preferred volume can write data A to data pool A. Data pool A can feed back the writing result to the preferred volume, and the preferred volume feeds back the writing result to host A. Data pool A also sends data A to the non-preferred volume. The non-preferred volume stores data A to data pool B. Data pool B feeds back the writing result to the preferred volume, and the preferred volume feeds back the result to data pool A. When host B generates data B, it writes data B to the non-preferred volume. The non-preferred volume can write data B to data pool B. Data pool B can feed back the writing result to the non-preferred volume, and the non-preferred volume feeds back the writing result to host B. Data pool B also sends data B to the preferred volume. The preferred volume stores data B to data pool A. Data pool A feeds back the writing result to the non-preferred volume, and the non-preferred volume feeds back the writing result to data pool B.
[0035] In the above embodiment, when a failure occurs in the active-active model, a failover will occur. Figure 4 Schematic diagram of failover in active-active mode according to an embodiment of the present application. Figure 4 As shown in the figure, when host B fails, it will not be able to provide services and the transmission with host A will be interrupted. The data generated by host A is written to the primary volume, and the primary volume writes data A to data pool A. Data pool A can feed back the writing results to the preferred volume, and the primary volume feeds back the writing results to host A.
[0036] In the above embodiment, after the failover is completed, the host will access one site, and the system will switch to single active, accepting data access only on one site. At this time, a difference log needs to be recorded to mark the changes in data during the single active state. Figure 5 is a schematic diagram of the single active mode operation according to an embodiment of the present application, such as Figure 5 As shown, when host B fails, the data generated by host B and host A are written to the primary volume. The primary volume can write data A and data B to data pool A and the dual-write difference log memory. Data pool A can feed back the writing results to the primary volume, and the dual-write difference log pool can also feed back the writing results to the dual-write difference log memory. The primary volume then feeds back the writing results to hosts A and B.
[0037] In the above embodiment, after the fault is recovered, a switch from a single active system to a dual active system will be performed. During this period, data recovery will be performed at the fault site, and the newly changed data will be sent to the remote cluster, so that both sites have the latest data and can provide data services. When the fault state of a storage site is restored to a normal working state, a switch from a single active system to a dual active system will be performed, during which data recovery operations at the fault site will be performed simultaneously. The newly changed data between the master volume (i.e., the volume included in the above-mentioned other storage sites) and the slave volume (i.e., the volume included in the above-mentioned target storage site) is transmitted to the remote cluster through the remote replication module (corresponding to the process of the bold transmission mark in the figure), so that the two sites have the latest data and can provide services.
[0038] In the above embodiment, Figure 6 Schematic diagram of active-active recovery work according to an embodiment of the present application. Figure 6 As shown in the figure, when host B resumes normal working state, the primary volume stops writing data to the dual write differential log, the dual write differential log reads the differential data stored in the dual write differential log pool, writes the data to the remote replication module, and deletes the differential data from the memory. Storage pool A can read the data in the remote replication module, and the remote replication module can write the differential data to storage pool B, so that host B has the latest data.
[0039] In the above embodiment, the data synchronization method can be applied in the process of switching from a single active to a dual active process data recovery after failure recovery, and efficient data synchronization can be achieved through the data synchronization method.
[0040] In the above embodiment, the target storage site may be any storage site in the first storage site or the second storage site that recovers from a fault state to a normal state. Other storage sites may be sites in the first storage site other than the target storage site. For example, when the first storage site fails, the data generated by the host can only be stored in the second storage site. When the first storage site fails, the second storage site can synchronize the data that has changed in the second storage site during the process from the failure of the first storage site to the recovery of the normal state to the first storage site. At this time, the first storage site is the target storage site, and the second storage site is the other storage site. On the contrary, when the second storage site fails, the data generated by the host can only be stored in the first storage site. When the second storage site fails, the first storage site can synchronize the data that has changed in the first storage site during the process from the failure of the second storage site to the recovery of the normal state to the second storage site. At this time, the second storage site is the target storage site, and the first storage site is the other storage site. The object mapping bitmap of the target volume may be ObjectMap. Since the volume will be divided into multiple shard objects for storage in the storage system according to the data shard size set by the system, ObjectMap can record the status of each shard. When you need to query which part of the volume data has changed, you only need to traverse and process the data shard objects marked as having changed using ObjectMap.
[0041] In the above embodiment, ObjectMap is used to record the status of each shard in the volume. If the data of the part of the volume that needs to be queried has changed, according to ObjectMap, only the data shard objects marked as changed need to be traversed and processed, thereby improving processing efficiency, especially when the number of changed data shard objects is relatively small. ObjectMap can adopt the bitmap format, and each data shard object is fixed to correspond to 2 bits in the bitmap (referred to as obj_bits in this article). When a data shard object is created, modified, written, deleted, etc., its obj_bits value will be modified to mark the data change of the data shard object, including: 0 (does not exist), 1 (exists and has been modified), 2 (deleting), 3 (exists and has not been modified).
[0042] In the above embodiment, the data shard objects corresponding to bitmaps 1 and 2 in the object mapping bitmap can be determined as the target data shard objects. After determining the target data shard object, the target data shard object and the target object mapping bitmap of the target data shard object can be stored in the same target data group. In this way, the ObjectMap modification operation can be sent to the same PG for processing together with the data write operation, and can even be completed in the same transaction, which can reduce one network transmission interaction and operation queue scheduling.
[0043] In the above embodiment, the local cluster and remote cluster dual active mechanism are used to achieve remote redundant backup of volumes. At the same time, the backup volume can also provide business functions to increase the business capabilities of the volume, thereby improving storage performance and the security of stored data. Figure 7 ,like Figure 7 As shown in the figure, the storage system includes: host A, host B, storage cluster A, and storage cluster B. Under normal circumstances, host A and host B form a dual-active system. The storage clusters in the dual-active domain work normally and provide business services at the same time. When host B fails for some reason (such as power outage, network failure, etc.), Figure 4 As shown in the figure, host B no longer provides services to the outside world, and only host A provides services to the outside world. After the failover is completed, all hosts will access one site. At this time, the system switches to single-active mode, and data access is only accepted on one site. At this time, it is necessary to record difference logs to mark the changes in data during the single-active mode. The active-active system switches to a single-active system, such as Figure 5 As shown in the figure, when the single-active host A provides services to the outside, the data of a certain volume changes due to business input. At this time, the program will record the changes in the data of the data shard through ObjectMap. When host B returns to normal, there are data differences between hosts A and B, and host B, which has not received the latest data, cannot provide services to the outside immediately. Therefore, host A needs to synchronize the changed data to host B. Host B can only work normally after receiving the updated transmission data. At this point, the dual-active system is fully restored to normal working state. Through the local cluster and remote cluster dual-active mechanism, remote redundant backup of volumes is realized. At the same time, the backup volume can also provide business functions to increase the business capabilities of the volume, thereby improving storage performance and storage data security. In addition, according to the data information recorded in the full cache KV array, the speed of traversing ObjectMap can be accelerated, and the speed and efficiency of data synchronization when switching from single-active to dual-active can be improved. That is, during the process of switching from single-active to dual-active, host B has transmitted the changed data to host A, shortening the duration of the synchronization process and greatly reducing the impact on online business performance.
[0044] Through the present application, when any one of the first storage site and the second storage site recovers from a faulty state to a normal working state, the object mapping bitmap included in the target volume in the other storage sites that have not failed is determined, and the target data sharding object that has changed in the target volume when the state of the target storage site changes can be determined based on the object mapping bitmap, and the target data sharding object and the target object mapping bitmap are stored in the target data group and synchronized to the target storage site. Since the target data sharding object and the target object mapping bitmap can be transmitted to the same target data group at the same time, the interactive operation of one network transmission is reduced. Therefore, the problem of slow data synchronization speed in the related art can be solved, and the effect of improving the data synchronization speed can be achieved.
[0045] The execution subject of the above steps may be a server, such as a third-party arbitration server, a processor, etc., but is not limited thereto.
[0046] In an exemplary embodiment, storing the target data shard object and the target object mapping bitmap of the target data shard object in the target data group included in the data group includes: determining a target identifier of the data group used to synchronize the target data shard object; adjusting the attribution information of the target object mapping bitmap to the target identifier, wherein the attribution information is used to indicate the data group in which the target object mapping bitmap is stored; and storing the target data shard object and the target object mapping bitmap of the target data shard object in the target data group identified as the target identifier.
[0047] In the above embodiment, the target identifier of the target data slice object data group can be understood as pg id:<pool_id> .<pg_id> .<pg.num> Since the size of the storage pool determines the number of data group PGs contained in it, we introduce<pool_id> Indicates the id of the storage pool.<pg_id> Indicates the id of the data group PG,<pg.num> Indicates the number of PGs. For example, a storage pool contains two PGs and six object volumes. Figure 8 ,like Figure 8 As shown: Since there is only one storage pool,<pool_id> is 1; two PGs,<pg_id> Can be 0, 1,<pg.num> is 2, so the target identifier can be expressed as pg0 (1.0.2), pg1 (1.1.2). The ownership information of the target object mapping bitmap can be understood as objmap (rbd_objmap.1.0.pg id), which can be adjusted according to the pg id. Since the objmap object is split according to the pg granularity, it can be guaranteed that the data shard objects and objmap belonging to the same PG are stored in the same PG.
[0048] In an exemplary embodiment, determining the target identifier of the data group used to synchronize the target data shard object includes: calculating the target calculation value of the target data shard object; obtaining the correspondence between the calculation value and the identifier; and determining the target identifier corresponding to the target calculation value from the correspondence.
[0049] In the above embodiment, the target calculation value of the target data shard object may be a calculation value obtained after performing target calculation on the target data shard object. The target calculation may include addition, subtraction, multiplication, division, convolution, hashing, etc. By determining the correspondence between the calculation value of the data shard object and the PG identifier, the target calculation value matching the target identifier is determined. Figure 8 As shown, the hash values of the data shard objects oid0, oid3, and oid4 correspond to PG0, and oid1, oid2, and oid5 correspond to PG1. Therefore, the target calculated values oid0, oid3, and oid4 of the data shard objects can be stored in PG0, and oid1, oid2, and oid5 can be stored in PG1. By determining the target identifier corresponding to the target calculated value based on the correspondence between the calculated value and the data group identifier, the speed of determining the target data group can be increased, thereby increasing the speed of data synchronization.
[0050] In an exemplary embodiment, the calculating the target calculated value of the target data shard object includes: calculating a hash value of the target data shard object; and determining the hash value as the target calculated value.
[0051] In the above embodiment, the correspondence between the hash value calculated by the hash algorithm and the PG array can be determined. The hash algorithm can be understood as a mapping rule that converts an input value of any length into an output of a fixed length. For two arbitrary different data blocks, the possibility that their hash values are the same is extremely small, so the uniqueness of the array can be guaranteed.
[0052] In an exemplary embodiment, storing the target data shard object and the target object mapping bitmap of the target data shard object in the target data group included in the data group includes: when the target data shard object includes multiple data shard sub-objects, dividing the target data shard object and the target object mapping bitmap into multiple target combinations, each of the target combinations including a target data shard sub-object and a target object mapping sub-bitmap of the target data shard sub-object, and the target data shard sub-objects included in each combination are different; determining a first data group corresponding to each of the target combinations; and storing the target combination in the first data group, wherein the target data group includes the first data group.
[0053] In the above embodiment, due to the different storage pool sizes and the number of OSDs contained therein, the number of PGs in a storage pool may be more or less. Usually, an OSD process (generally corresponding to a disk) needs to be controlled to belong to about 100 PGs, that is, each volume will generate about 100 objmap objects on each OSD.
[0054] In the above embodiment, the content of the ObjectMap object can be divided into three parts: header, body (ie, payload), and footer, wherein the body part can be divided into one or more fragments according to the 4KB size alignment. The header stores metadata information such as the size of the bitmap object, and the footer stores the CRC32 checksum of the header and the CRC32 checksum of each fragment in sequence, such as Fig. 9 As shown, when there are multiple data shard sub-objects in the target data shard, each target data shard sub-object and the corresponding target object mapping sub-bitmap are determined as a data group (i.e., the first data group mentioned above) and stored. This can realize that the ObjectMap object and all the data shard objects it manages belong to the same PG, which can reduce one network transmission interaction and operation queue scheduling.
[0055] In an exemplary embodiment, determining the target data slicing object included in the target volume based on the object mapping bitmap includes: determining a target sub-bitmap included in the object mapping bitmap whose status is a changed status; and determining the data slicing object indicated by the target sub-bitmap as the target data slicing object.
[0056] In the above embodiment, when a data shard object is created, modified, written, deleted, etc., the data change of the data shard object will be marked, and the mark may include: 0 (does not exist), 1 (exists and has been modified), 2 (deleting), 3 (exists and has not been modified). The data shard object with the existing table change behavior is determined by the state of the ObjectMap mark, and this data shard object is determined as the target data shard object. By marking the data change of the ObjectMap, the target data shard object can be directly and quickly located, which improves the efficiency and accuracy of data synchronization.
[0057] In an exemplary embodiment, before storing the target data shard object and the target object mapping bitmap of the target data shard object in the target data group included in the data group, the method also includes: determining the object identifier of the target data shard object; determining the object status identifier of the target data shard object; and combining the object identifier and the object status identifier in a predetermined manner to obtain the target object mapping bitmap.
[0058] In the above embodiment, the object identifier of the target data slice object can be represented by obj_idx. Since ObjectMap can adopt the bitmap format, each data slice object is fixedly corresponding to 2 bits in the bitmap (which can be represented as obj_bits), so the object status identifier can be marked with the value of obj_bits. The object identifier of the target data slice object and the object status identifier are combined to obtain the target object mapping bitmap ObjectMap. Through the object identifier and the status identifier, the changed data slice can be queried more accurately, so as to ensure the stability of the transmitted data.
[0059] In an exemplary embodiment, the target identifier and the target state identifier are combined in a predetermined manner to obtain the target object mapping bitmap, including: combining the object identifier and the object state identifier in the form of a target array to obtain the target object mapping bitmap, wherein the object identifier is a key included in the target array, and the object state identifier is a value included in the target array.
[0060] In the above embodiment, the target array can be a KV (key value) array, which is used to record the status of each data shard object, where key (i.e. the above key) represents the order of the data shard object index (obj_idx), and value (i.e. the above value) is the obj_bits of the corresponding data shard object. The KV array is sorted and stored in the order of obj_idx size, and each KV stored occupies 4 bytes. The format can be referred to Fig.10 , the KV array can be fully initialized. When creating a volume, all obj_idxs are traversed, the full amount is calculated once, and the objmap objects of all PGs are created and initialized based on the one-time full calculation. The objmap object of each PG contains the obj_bits information of all data shard objects belonging to the PG, thereby avoiding the waste of resources caused by repeated traversal process.
[0061] In an exemplary embodiment, storing the target object mapping bitmap of the target data slice object in the target data group included in the data group comprises: determining an actual storage unit corresponding to the target data group; and storing the target object mapping bitmap in the actual storage unit.
[0062] In the above embodiment, the storage system uses the data group PG to determine which OSD (Object Storage Device) the data is stored in, so as to optimize data distribution and access efficiency, wherein the OSD is the actual storage unit in the above storage cluster, responsible for storing and retrieving data objects. Through PG, since the storage system is the basic unit of the CRUSH algorithm (Controlled Replication Under Scalable Hashing) operation, it can more efficiently manage and balance the storage load. Among them, the CRUSH algorithm determines the storage location of the data based on the PG ID, so that the data is evenly distributed among the OSDs, and a good balance can be maintained even when the cluster size changes.
[0063] In an exemplary embodiment, storing the target object mapping bitmap in the actual storage unit includes: determining a primary actual storage unit and a backup actual storage unit included in the actual storage unit; storing the target object mapping bitmap in the primary actual storage unit; and controlling the backup actual storage unit to obtain the target object mapping bitmap from the primary actual storage unit.
[0064] In the above embodiment, OSD can be divided into a primary actual storage unit and a backup actual storage unit, but objmap information only needs to be cached on the primary OSD of PG, and memory consumption is substantially proportional to the total number of data shard objects. In the KV array mode, full caching of objmap information will consume more memory, and the memory capacity required for full caching of objmap information on a single node can be calculated according to the following formula: (((number of data disk slots per node*size of single data disk) / 4MB) * 4Bytes) * space efficiency. For example, the memory capacity of the largest capacity node (60 disk slots), a single disk of 16TB, three-copy scenario and 4+2 erasure scenario is calculated as follows: (((60*16TB) / 4MB) * 4Bytes) * (1 / 3) = 320MB; (((60*16TB) / 4MB) *4Bytes) * (4 / 6) = 640MB. Although it takes up some more memory, this data slice and the bitmap slice corresponding to this data slice can be placed in the same PG. When there is a data update, it only needs to send a data update and perform a network interaction once, which reduces the number of network interactions and improves the update efficiency.
[0065] In an exemplary embodiment, storing the target object mapping bitmap in the main actual storage unit includes: storing the target object mapping bitmap in the cache of the main actual storage unit. In the above embodiment, the objmap information is stored in the cache of the main OSD actual storage unit, thereby realizing data backup. In an exemplary embodiment, storing the target data shard object and the target object mapping bitmap of the target data shard object in the target data group included in the data group includes: determining the target storage capacity and used storage capacity of each data group included in the storage system, determining the capacity utilization of each data group based on the target storage capacity and the used storage capacity, determining the processor usage of each data group, determining the target performance of the data group based on the capacity utilization and the processor usage of each data group, and determining the data group with the maximum target performance as the target data group. Wherein, determining the target performance of the data group based on the capacity utilization and processor usage of each data group includes: determining a first weight of the capacity utilization, determining a second weight of the processor usage, determining a first product of the capacity utilization and the first weight, determining a second product of the processor usage and the second weight, and determining the inverse of the sum of the first product and the second product as the target performance. In this embodiment, when the storage system includes multiple data groups, the target performance of each data group can be determined, and the data group with the best performance can be determined as the target data group. Such a setting can enable the target data group to quickly process the received target data sharding object and the target object mapping bitmap, thereby improving the efficiency of data synchronization.
[0066] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0067] In this embodiment, a data synchronization device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0068] Fig.11 is a structural block diagram of a data synchronization device according to an embodiment of the present application, such as Fig.11 As shown, the device comprises:
[0069] The first determining module 1102 is configured to determine, when the state of the target storage site included in the first storage site and the second storage site is restored from a fault state to a normal state, an object mapping bitmap included in the target volume belonging to other storage sites included in the first volume and the second volume, wherein the other storage site is a site included in the first storage site and the second storage site except the target storage site;
[0070] A second determination module 1104 is configured to determine a target data slice object included in the target volume based on the object mapping bitmap, wherein the target data slice is a data slice object that is changed while the target storage site is in a fault state;
[0071] The storage module 1106 is used to store the target data shard object and the target object mapping bitmap of the target data shard object in the target data group included in the data group to instruct the target data group to synchronize the target data and the target object mapping bitmap to the target storage site.
[0072] In an exemplary embodiment, the storage module 1106 can implement the storage of the target data shard object and the target object mapping bitmap of the target data shard object in the target data group included in the data group by: determining a target identifier of the data group used to synchronize the target data shard object; adjusting the attribution information of the target object mapping bitmap to the target identifier, wherein the attribution information is used to indicate the data group storing the target object mapping bitmap; storing the target data shard object and the target object mapping bitmap of the target data shard object in the target data group identified as the target identifier.
[0073] In an exemplary embodiment, the device can be used to determine the target identifier of the data group used to synchronize the target data shard object: calculate the target calculation value of the target data shard object; obtain the correspondence between the calculation value and the identifier; and determine the target identifier corresponding to the target calculation value from the correspondence.
[0074] In an exemplary embodiment, the device may also be used for calculating the target calculation value of the target data shard object: calculating a hash value of the target data shard object; and determining the hash value as the target calculation value.
[0075] In an exemplary embodiment, the storage module 1106 can implement the storage of the target data shard object and the target object mapping bitmap of the target data shard object in the target data group included in the data group in the following manner: when the target data shard object includes multiple data shard sub-objects, the target data shard object and the target object mapping bitmap are divided into multiple target combinations, each of the target combinations includes a target data shard sub-object and a target object mapping sub-bitmap of the target data shard sub-object, and the target data shard sub-objects included in each combination are different; determine the first data group corresponding to each of the target combinations; store the target combination in the first data group, wherein the target data group includes the first data group.
[0076] In an exemplary embodiment, the second determination module 1104 can implement the determination of the target data shard object included in the target volume based on the object mapping bitmap in the following manner: determine the target sub-bitmap included in the object mapping bitmap whose status is a changed status; and determine the data shard object indicated by the target sub-bitmap as the target data shard object.
[0077] In an exemplary embodiment, the device can also be used to, before storing the target data shard object and the target object mapping bitmap of the target data shard object in the target data group included in the data group: determine the object identifier of the target data shard object; determine the object status identifier of the target data shard object; and combine the object identifier and the object status identifier in a predetermined manner to obtain the target object mapping bitmap.
[0078] In an exemplary embodiment, the device can also be used to combine the object identifier and the object status identifier in a predetermined manner to obtain the target object mapping bitmap: combine the object identifier and the object status identifier in the form of a target array to obtain the target object mapping bitmap, wherein the object identifier is a key included in the target array, and the object status identifier is a value included in the target array.
[0079] In an exemplary embodiment, the storage module 1106 can implement storing the target object mapping bitmap of the target data shard object in the target data group included in the data group in the following manner: determining the actual storage unit corresponding to the target data group; and storing the target object mapping bitmap in the actual storage unit.
[0080] In an exemplary embodiment, the device can also be used to store the target object mapping bitmap in the actual storage unit: determine the main actual storage unit and the backup actual storage unit included in the actual storage unit; store the target object mapping bitmap in the main actual storage unit; control the backup actual storage unit to obtain the target object mapping bitmap from the main actual storage unit.
[0081] In an exemplary embodiment, the apparatus may also be configured to store the target object mapping bitmap in the primary actual storage unit by storing the target object mapping bitmap in a cache of the primary actual storage unit.
[0082] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0083] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0084] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0085] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0086] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0087] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0088] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0089] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0090] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A data synchronization method, characterized in that: Applied to a storage system, wherein the storage system includes a data group, a first storage site, and a second storage site, the first storage site includes a first volume, the second storage site includes a second volume, the first volume and the second volume are in an active-active relationship with each other, include: In a case where the state of the target storage site included in the first storage site and the second storage site is restored from a fault state to a normal state, determining an object mapping bitmap included in the target volume included in the first volume and the second volume and belonging to other storage sites, wherein the other storage sites are sites included in the first storage site and the second storage site except the target storage site; Determining a target data slice object included in the target volume based on the object mapping bitmap, wherein the target data slice is a data slice object that is changed while the target storage site is in a fault state; The target data shard object and the target object mapping bitmap of the target data shard object are stored in a target data group included in the data group to instruct the target data group to synchronize the target data and the target object mapping bitmap to the target storage site.
2. The method according to claim 1, characterized in that Storing the target data slice object and the target object mapping bitmap of the target data slice object into the target data group included in the data group comprises: Determining a target identifier for synchronizing a data group of the target data shard object; Adjusting the attribution information of the target object mapping bitmap to the target identifier, wherein the attribution information is used to indicate a data group storing the target object mapping bitmap; The target data slice object and the target object mapping bitmap of the target data slice object are stored in the target data group identified as the target identifier.
3. The method according to claim 2, characterized in that The determining of a target identifier of a data group for synchronizing the target data shard object comprises: Calculate the target calculation value of the target data slice object; Get the correspondence between the calculated value and the identifier; The target identifier corresponding to the target calculated value is determined from the corresponding relationship.
4. The method according to claim 3, characterized in that The calculating the target calculated value of the target data slice object includes: Calculate the hash value of the target data shard object; The hash value is determined as the target calculation value.
5. The method according to claim 1, characterized in that The storing the target data slice object and the target object mapping bitmap of the target data slice object into the target data group included in the data group comprises: In the case where the target data slice object includes multiple data slice sub-objects, the target data slice object and the target object mapping bitmap are divided into multiple target combinations, each of the target combinations includes a target data slice sub-object and a target object mapping sub-bitmap of the target data slice sub-object, and the target data slice sub-objects included in each combination are different; Determine a first data group corresponding to each target combination; The target combination is stored in the first data set, wherein the target data set includes the first data set.
6. The method according to claim 1, characterized in that The determining the target data slice object included in the target volume based on the object mapping bitmap includes: Determine a target sub-bitmap whose state included in the object mapping bitmap is a changed state; The data slice object indicated by the target sub-bitmap is determined as the target data slice object.
7. The method according to claim 1, characterized in that Before storing the target data slice object and the target object mapping bitmap of the target data slice object in the target data group included in the data group, the method further includes: Determine the object identifier of the target data slice object; Determine the object state identifier of the target data slice object; The object identifier and the object state identifier are combined in a predetermined manner to obtain the target object mapping bitmap.
8. The method according to claim 7, characterized in that The step of combining the object identifier and the object state identifier in a predetermined manner to obtain the target object mapping bitmap includes: The object identifier and the object state identifier are combined in a target array form to obtain the target object mapping bitmap, wherein the object identifier is a key included in the target array, and the object state identifier is a value included in the target array.
9. The method according to claim 1, characterized in that: Storing the target object mapping bitmap of the target data slice object into the target data group included in the data group comprises: Determining an actual storage unit corresponding to the target data group; The target object mapping bitmap is stored in the actual storage unit.
10. The method according to claim 9, characterized in that The storing the target object mapping bitmap into the actual storage unit comprises: Determine a primary actual storage unit and a backup actual storage unit included in the actual storage unit; Storing the target object mapping bitmap in the primary actual storage unit; The standby actual storage unit is controlled to obtain the target object mapping bitmap from the primary actual storage unit.
11. The method according to claim 10, characterized in that The storing the target object mapping bitmap into the main actual storage unit comprises: The target object mapping bitmap is stored in a cache of the primary real storage unit.
12. A data synchronization device, characterized in that: Applied to a storage system, wherein the storage system includes a data group, a first storage site, and a second storage site, the first storage site includes a first volume, the second storage site includes a second volume, the first volume and the second volume are in an active-active relationship with each other, include: a first determining module, configured to determine, when the state of a target storage site included in the first storage site and the second storage site is restored from a fault state to a normal state, an object mapping bitmap included in a target volume belonging to other storage sites included in the first volume and the second volume, wherein the other storage sites are sites included in the first storage site and the second storage site except the target storage site; A second determination module is configured to determine a target data slice object included in the target volume based on the object mapping bitmap, wherein the target data slice is a data slice object that is changed while the target storage site is in a fault state; A storage module is used to store the target data shard object and the target object mapping bitmap of the target data shard object in the target data group included in the data group to instruct the target data group to synchronize the target data and the target object mapping bitmap to the target storage site.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 11 when executed by a processor.
14. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 11 are implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Dual-active storage system design method based on dual-active logical volumes
CN104331254A
Data recovery method, apparatus, and computer-readable storage medium
CN109086169A