Data writing method, product, equipment and storage medium
By using the object-wide locking mechanism in the live-active system, the problem of inconsistency in the live-active system is solved, data consistency writing is realized, and the system reliability and business security are improved.
Patent Information
- Application Number
- CN202411266503.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2025-01-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The dual-active system cannot control the consistency of data written by the two data centers when writing data, resulting in inconsistent data written.
By introducing an object-wide lock mechanism in the dual-live system, the client applies for object-wide lock, the main storage unit and the slave storage unit to generate and manage the lock before writing data, to ensure that the data is consistent in the data corresponding to the object-wide lock. sexual writing.
It realizes data consistency when writing data in a dual-active system, ensures the atomicity of the write operation, avoids the problem of data inconsistency, and improves the security of the business and the reliability of the system.
Smart Images

Figure CN119292517A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of data storage technology, and more specifically, to a data writing method, product, device, and storage medium. Background Art
[0002] An active-active system is a system that writes data corresponding to the same business into two data centers at the same time. The active-active system in the related art can write the same data in two data centers through parallel writing or serial writing.
[0003] When writing data, the active-active system in the related art cannot control the consistency of the written data in the two data centers, whether it is parallel writing or serial writing, resulting in the problem of inconsistent written data. Summary of the invention
[0004] The embodiments of the present application provide a data writing method, product, device and storage medium, which are intended to ensure the consistency of data written to a dual-active system.
[0005] A first aspect of an embodiment of the present application provides a data writing method, the method comprising:
[0006] When the first client writes data in parallel in the active-active system, the first client sends a data write request to the active-active system;
[0007] The corresponding master storage unit and slave storage unit in the active-active system generate corresponding object range locks according to the data write request, the master storage unit belongs to the first storage cluster, and the slave storage unit belongs to the second storage cluster;
[0008] The master storage unit and the slave storage unit respectively write the data corresponding to the data write request into the object area corresponding to the object range lock.
[0009] Optionally, the method further comprises:
[0010] When the primary storage unit and the secondary storage unit have completed writing the data, sending a request execution success message to the first client;
[0011] When receiving the request execution success message, the first client applies to the active-active system for releasing the object range lock.
[0012] Optionally, the method further comprises:
[0013] In the active-active system, when the object range lock is released, a release request execution success message is sent to the first client.
[0014] Optionally, before the master storage unit and the slave storage unit write the data corresponding to the data write request into the object area corresponding to the object range lock, the method further includes:
[0015] The main storage unit and the slave storage unit each detect whether the object range lock already exists in the object area;
[0016] In a case where there is no object range lock in the object area, a write operation for the object area is recorded in an operation record log.
[0017] Optionally, the method further comprises:
[0018] In a case where an object range lock already exists in the object area, a write failure message is sent to the first client.
[0019] Optionally, the main storage unit and the slave storage unit each detect whether the object range lock already exists in the object area, including:
[0020] The main storage unit and the slave storage unit respectively call their own operation record logs;
[0021] The primary storage unit and the secondary storage unit search for the operation record corresponding to the object area from their respective operation record logs;
[0022] According to the operation record, it is determined whether the object range lock already exists in the object area.
[0023] Optionally, determining whether the object range lock already exists in the object area according to the operation record includes:
[0024] In a case where a corresponding object range lock exists in any area included in the object area, determining that the object range lock already exists in the object area;
[0025] In a case where none of the regions included in the object region has the corresponding object range lock, it is determined that no object range lock exists in the object region.
[0026] Optionally, recording the write operation for the object area in the operation record log includes:
[0027] The main storage unit and the slave storage unit respectively call the operation record log;
[0028] The data writing operation for the object area is recorded in the operation record log.
[0029] Optionally, the corresponding primary storage unit and the secondary storage unit in the active-active system generate corresponding object range locks according to the data write request, including:
[0030] The main storage unit and the slave storage unit determine, according to the data write request, object range lock request information corresponding to the data write request;
[0031] The corresponding object-scope lock is generated according to the object-scope lock request information.
[0032] Optionally, upon receiving the request execution success message, the client applies to the active-active system for releasing the object range lock, including:
[0033] When receiving the request execution success message, the first client sends an object range lock release request to the primary storage unit and the secondary storage unit in the active-active system respectively;
[0034] The master storage unit and the slave storage unit delete the object range lock corresponding to the object area when receiving the object range lock release request.
[0035] Optionally, the method further comprises:
[0036] The second client sends a data write request to the active-active system;
[0037] The master storage unit and the slave storage unit of the active-active system determine whether the object range lock already exists in the corresponding object area corresponding to the data write request;
[0038] When the object range lock already exists in the object area, the master storage unit and the slave storage unit send data write error information to the second client.
[0039] Optionally, the method further comprises:
[0040] When the first client writes data serially in the active-active system, the first client sends an object range lock acquisition request to the primary storage unit in the active-active system;
[0041] The main storage unit generates the corresponding object range lock when receiving the object range lock acquisition request;
[0042] The main storage unit sends object range lock acquisition success information to the first client.
[0043] Optionally, the method further comprises:
[0044] When receiving the object range lock acquisition success information, the first client sends an object range lock acquisition request to a slave storage unit in the active-active system;
[0045] The slave storage unit generates the corresponding object range lock when receiving the object range lock acquisition request;
[0046] The slave storage unit sends the object range lock acquisition success information to the first client.
[0047] Optionally, the method further comprises:
[0048] The first client sends a data write request to the main storage unit when receiving the object range lock acquisition success information sent by the slave storage unit;
[0049] When receiving the data write request, the main storage unit writes the data into the object area corresponding to the object range lock;
[0050] The main storage unit sends data writing success information to the first client;
[0051] When receiving the data write success information, the first client applies to the main storage unit for releasing the object range lock.
[0052] Optionally, the method further comprises:
[0053] When the object range lock is released, the first client sends a data write request to the slave storage unit;
[0054] The slave storage unit writes the data into the object area corresponding to the object range lock when receiving the data write request;
[0055] The slave storage unit sends data writing success information to the first client;
[0056] When receiving the data write success information, the first client applies to the secondary storage unit for releasing the object range lock.
[0057] Optionally, the method further comprises:
[0058] The second client sends an object scope lock acquisition request to the main memory;
[0059] When the object area corresponding to the object range lock has been occupied by the first client, the main storage unit puts the object range lock acquisition request into a waiting queue;
[0060] The main storage unit generates the object range lock corresponding to the second client when the object range lock corresponding to the first client is completely released.
[0061] Optionally, when the object range lock corresponding to the first client is completely released, the main storage unit generates the object range lock corresponding to the second client, including:
[0062] When the object range lock corresponding to the first client is completely released, the main storage unit takes out the object range lock acquisition request from the waiting queue;
[0063] The main storage unit generates the corresponding object-scope lock according to the object-scope lock acquisition request.
[0064] A second aspect of an embodiment of the present application provides a computer program product, including a computer program / instructions, characterized in that when the computer program / instructions are executed by a processor, the steps in the method described in the first aspect of the present application are implemented.
[0065] A third aspect of an embodiment of the present application provides a data writing device, the device comprising:
[0066] A first write request sending module, configured to send a data write request to the active-active system when a first client writes data in parallel in the active-active system;
[0067] A first object range lock generation module, used for a corresponding master storage unit and a slave storage unit in the active-active system to generate a corresponding object range lock according to the data write request, the master storage unit belongs to a first storage cluster, and the slave storage unit belongs to a second storage cluster;
[0068] The first data writing module is used for the main storage unit and the slave storage unit to write the data corresponding to the data writing request into the object area corresponding to the object range lock respectively.
[0069] Optionally, the device further comprises:
[0070] A first execution success message sending module, configured to send a request execution success message to the first client when the primary storage unit and the secondary storage unit have completed writing the data;
[0071] The first release request sending module is used for the first client to apply to the active-active system for releasing the object range lock when receiving the request execution success message.
[0072] Optionally, the device further comprises:
[0073] The second execution success message sending module is used to send a release request execution success message to the first client when the object range lock is released in the active-active system.
[0074] Optionally, the device further comprises:
[0075] A first detection module, configured for the main storage unit and the slave storage unit to detect whether the object range lock already exists in the object area;
[0076] The first recording module is configured to record a write operation on the object area in an operation record log when no object range lock exists in the object area.
[0077] Optionally, the device further comprises:
[0078] A first failure message sending module is configured to send a write failure message to the first client when an object range lock already exists in the object area.
[0079] Optionally, the first detection module includes:
[0080] A first calling submodule, used for the main storage unit and the slave storage unit to call their respective operation record logs respectively;
[0081] A record search submodule, configured for the primary storage unit and the secondary storage unit to search the operation record corresponding to the object area from the respective operation record logs;
[0082] The object range lock determination submodule is used to determine whether the object range lock already exists in the object area according to the operation record.
[0083] Optionally, the object range lock determination submodule includes:
[0084] A first determining submodule, configured to determine that the object range lock already exists in the object area when a corresponding object range lock exists in any area included in the object area;
[0085] The second determining submodule is configured to determine that the object area does not have an object range lock when none of the areas included in the object area have the corresponding object range lock.
[0086] Optionally, the first recording module includes:
[0087] A second calling submodule is used for the main storage unit and the slave storage unit to call the operation record log respectively;
[0088] The first recording submodule is used to record the data writing operation for the object area in the operation record log.
[0089] Optionally, the first object scope lock generation module includes:
[0090] A request information determination submodule, used for the main storage unit and the slave storage unit to determine the object range lock request information corresponding to the data write request according to the data write request;
[0091] The first object-scope lock generation submodule is configured to generate the corresponding object-scope lock according to the object-scope lock request information.
[0092] Optionally, the first releasing module includes:
[0093] A first release request sending submodule, configured to, when the first client receives the request execution success message, send an object range lock release request to the primary storage unit and the secondary storage unit in the active-active system respectively;
[0094] The object range lock deletion submodule is used for the main storage unit and the slave storage unit to delete the object range lock corresponding to the object area when receiving the object range lock release request.
[0095] Optionally, the device further comprises:
[0096] A second request sending module, used for a second client to send a data write request to the active-active system;
[0097] A second checking module, used for the master storage unit and the slave storage unit of the active-active system to determine whether the object range lock already exists in the corresponding object area corresponding to the data write request;
[0098] A second failure message sending module is configured to cause the primary storage unit and the secondary storage unit to send data write error information to the second client when the object range lock already exists in the object area.
[0099] Optionally, the device further comprises:
[0100] A first acquisition request sending module, configured to send an object range lock acquisition request to a primary storage unit in the active-active system when the first client serially writes data in the active-active system;
[0101] A second object range lock generation module, configured for the main storage unit to generate the corresponding object range lock when receiving the object range lock acquisition request;
[0102] The second success message sending module is used for the main storage unit to send object range lock acquisition success information to the first client.
[0103] Optionally, the device further comprises:
[0104] A second acquisition request sending module, configured to send an object range lock acquisition request to a slave storage unit in the active-active system when the first client receives the object range lock acquisition success information;
[0105] A third object range lock generation module, configured to generate the corresponding object range lock when the slave storage unit receives the object range lock acquisition request;
[0106] The third success message sending module is used to send the object range lock acquisition success information from the storage unit to the first client.
[0107] Optionally, the device further comprises:
[0108] A second write request sending module, configured to send a data write request to the main storage unit when the first client receives the object range lock acquisition success information sent by the slave storage unit;
[0109] A second writing module, configured for the main storage unit to write the data into the object area corresponding to the object range lock when receiving the data writing request;
[0110] A fourth success message sending module, used for the main storage unit to send data writing success information to the first client;
[0111] The second releasing module is used for the first client to apply to the main storage unit for releasing the object range lock when receiving the data writing success information.
[0112] Optionally, the device further comprises:
[0113] A third write request sending module, configured for sending a data write request to the slave storage unit when the object range lock is released by the first client;
[0114] A third writing module, configured for, when the slave storage unit receives the data writing request, to write the data into the object area corresponding to the object range lock;
[0115] A fifth success message sending module, used for sending data writing success information from the storage unit to the first client;
[0116] The third releasing module is used for the first client to apply to the secondary storage unit for releasing the object range lock when receiving the data writing success information.
[0117] Optionally, the device further comprises:
[0118] A third acquisition request sending module, configured for the second client to send an object range lock acquisition request to the main memory;
[0119] a queue placing module, configured for the main storage unit to place the object range lock acquisition request into a waiting queue when the object area corresponding to the object range lock has been occupied by the first client;
[0120] The fourth object range lock generation module is used for the main storage unit to generate the object range lock corresponding to the second client when the object range lock corresponding to the first client is released.
[0121] Optionally, the fourth object scope lock generation module includes:
[0122] a queue fetching submodule, configured for the main storage unit to fetch the object range lock acquisition request from the waiting queue when the object range lock corresponding to the first client is released completely;
[0123] The fifth object range lock generation submodule is used for the main storage unit to generate the corresponding object range lock according to the object range lock acquisition request.
[0124] A fourth aspect of an embodiment of the present application provides a readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps in the method described in the first aspect of the present application are implemented.
[0125] A fifth aspect of an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method described in the first aspect of the present application are implemented.
[0126] Using the data writing method proposed in the application, when the first client writes data in parallel in the active-active system, a data write request is sent to the active-active system; the corresponding master storage unit and slave storage unit in the active-active system generate corresponding object range locks according to the data write request, the master storage unit belongs to the first storage cluster, and the slave storage unit belongs to the second storage cluster; the master storage unit and the slave storage unit respectively write the data corresponding to the data write request in the object area corresponding to the object range lock.
[0127] In this application, when the client writes data in the active-active system, it must first apply for the corresponding object range lock from the active-active system. The active-active system generates the corresponding object range lock based on the data write request, and writes the corresponding data in the primary storage unit and the slave storage unit. The object area where the data is written is the area corresponding to the object range lock. Since the object range lock is added to this area, only the data corresponding to the current data write request can be written. This ensures the data consistency of the active-active system when writing data. BRIEF DESCRIPTION OF THE DRAWINGS
[0128] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0129] Figure 1 is a flow chart of a data writing method proposed in one embodiment of the present application;
[0130] Figure 2 is a schematic diagram of a dual-active write model proposed in an embodiment of the present application;
[0131] Figure 3 is a schematic diagram of an active-active system proposed in an embodiment of the present application;
[0132] Figure 4 is a flow chart of a parallel write operation proposed in an embodiment of the present application;
[0133] Figure 5 This is a schematic diagram of a parallel write operation lock conflict handling process proposed in an embodiment of the present application;
[0134] Figure 6 This is a schematic diagram of a serial write operation process proposed in an embodiment of the present application;
[0135] Figure 7 This is a schematic diagram of a serial write operation lock conflict handling process proposed in an embodiment of the present application;
[0136] Figure 8 is a schematic diagram of a data writing device proposed in an embodiment of the present application;
[0137] Fig. 9 It is a schematic diagram of an electronic device proposed in an embodiment of the present application. DETAILED DESCRIPTION
[0138] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0139] refer to Figure 1 , Figure 1 1 is a flow chart of a data writing method proposed in one embodiment of the present application. Figure 1 As shown, the method comprises the following steps:
[0140] S11: When the first client writes data in parallel in the active-active system, the first client sends a data write request to the active-active system.
[0141] In this embodiment, the active-active system is a data storage system composed of two storage clusters. When storing business data, any one of the two storage clusters can operate the two clusters. The active-active system is also called an active-active domain. The active-active domain consists of two storage clusters that back up each other. You can enter the management interface of any of the two storage clusters to configure the active-active domain.
[0142] Through the management interface of any storage cluster in the active-active domain, select a volume in the cluster and its remote cluster, establish an active-active relationship with mutual backup (called an active-active pai r), and present a unified device identifier (WWN) to the outside, that is, virtualize it as a volume, called an active-active volume. An active-active pai r has multiple states, including: normal, synchronizing, waiting for synchronization, forced start, invalid, etc. The first client is the first client that currently needs to write data in the active-active system. The data write request is a request sent by the first client to the active-active system for writing data. Parallel writing refers to writing data to each cluster of the active-active system at the same time.
[0143] refer to Figure 2 , Figure 2 is a schematic diagram of a dual-active write model proposed in an embodiment of the present application, such as Figure 2 As shown, there are two data centers, and data is written to the two data centers simultaneously to complete active-active writing.
[0144] refer to Figure 3 , Figure 3 Schematic diagram of a dual-active system proposed in an embodiment of the present application. Figure 3As shown in the figure, there are two sites, site A and site B, each with a storage cluster, where node is a data node, PGmap is a placement group map, M is an object range lock, and S is an OSD (Object Storage Device), which is the actual storage unit in the storage cluster and is responsible for storing and retrieving data objects. Each OSD usually corresponds to a physical storage device (such as a hard disk drive or solid-state drive) and is managed by an OSD process. PG (Placement Group) is the basic unit used to organize and manage data. It is a logical container that contains a group of objects (Object) that have similar access modes or attributes and are stored and replicated together. The storage system uses PG to determine which OSDs the data is stored on, thereby optimizing data distribution and access efficiency. Through PG, the storage system can manage and balance the storage load more efficiently because it is the basic unit of the CRUSH algorithm (Controlled Replication Under Scaled Hashing) operation. 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. In the dual-write system, the data written by the first client is data1, and the data written by the second client is data2. Data1 is first written to the same location of PG1 and PG2. Due to the existence of the object range lock, data2 needs to apply for the object range lock and write after data1 is written. This ensures the atomicity of the write operation, and data2 will not be written to the same location in the OSD before data1 is written.
[0145] In this embodiment, when the first client writes data in parallel in the active-active system, it generates a data write request, which also includes an object range lock acquisition request for acquiring an object range lock, and sends the data write request to the active-active system.
[0146] S12: The corresponding master storage unit and slave storage unit in the active-active system generate corresponding object range locks according to the data write request, the master storage unit belongs to the first storage cluster, and the slave storage unit belongs to the second storage cluster.
[0147] In this embodiment, the master storage unit is the master OSD, which is a storage unit in the first storage cluster, and the slave storage unit is the slave OSD, which is a storage unit in the second storage cluster. The distributed object range lock of a data shard object of the active-active volume consists of two data shard object range locks, one is the object range lock of PG1 in the first storage cluster, and the other is the object range lock of PG2 in the second storage cluster. Before writing the same data, you need to apply for this range lock first. You can apply and hold these two data shard object range locks in parallel, serial, or a combination of parallel and serial. The object range lock is essentially used to mark the object area in the storage unit. Only the client that has the object range lock can write data to the marked object area.
[0148] In this embodiment, when the first client needs to write data, the target location for writing is the master storage unit in the first storage cluster and the slave storage unit in the second storage cluster. After receiving the data write request, the master storage unit and the slave storage unit generate a corresponding object range lock for the location according to the location that the received data write request wants to write.
[0149] In this embodiment, the specific steps of the corresponding master storage unit and the slave storage unit in the active-active system generating the corresponding object range lock according to the data write request include:
[0150] S12 - 1 : The primary storage unit and the secondary storage unit determine object range lock request information corresponding to the data write request according to the data write request.
[0151] In this embodiment, the object range lock request information includes an object area for data writing, and the object area is a target area of the storage unit where the client needs to write data.
[0152] In this embodiment, after receiving the data write request, the primary storage unit and the secondary storage unit obtain the object range lock request information included in the data write request.
[0153] S12-2: Generate the corresponding object-scope lock according to the object-scope lock request information.
[0154] In this embodiment, after obtaining the object range lock request information, the object area is determined, and after the object area is determined, the corresponding object range lock is generated.
[0155] For example, if the object range lock request information states that the object area to which data needs to be written is 0-1K, the primary storage unit and the secondary storage unit generate an object range lock of 0-1K in their respective storage units.
[0156] S13: The master storage unit and the slave storage unit respectively write the data corresponding to the data write request into the object area corresponding to the object range lock.
[0157] In this embodiment, after generating the object range lock, the master storage unit and the slave storage unit respectively write the data corresponding to the data write request into the object area corresponding to their respective object range locks.
[0158] In this embodiment, the method further includes:
[0159] S14: When the primary storage unit and the secondary storage unit have completed writing the data, a request execution success message is sent to the first client.
[0160] In this embodiment, when the data writing of the main storage unit is completed and the data writing of the slave storage unit is completed, the main storage unit and the slave storage unit respectively send a message indicating that the request is successfully executed to the first client.
[0161] S15: When receiving the request execution success message, the first client applies to the active-active system for releasing the object range lock.
[0162] In this embodiment, when the first client receives the request execution success message, it applies to the active-active system for releasing the object range lock, and the application is sent to the primary storage unit and the secondary storage unit respectively.
[0163] In this embodiment, when the first client receives the request execution success message, the specific steps of applying to the active-active system to release the object range lock include:
[0164] S15 - 1 : When receiving the request execution success message, the first client sends an object range lock release request to the primary storage unit and the secondary storage unit in the active-active system respectively.
[0165] In this embodiment, when the first client receives the request execution success message, it sends an object range lock release request to the primary storage unit and the secondary storage unit in the active-active system respectively.
[0166] S15 - 2 : Upon receiving the object range lock release request, the master storage unit and the slave storage unit delete the object range lock corresponding to the object area.
[0167] In this embodiment, after receiving the object range lock release request, the master storage unit and the slave storage unit delete the object range lock corresponding to the object area. After the object area is free of the object range lock, data can be rewritten.
[0168] In this embodiment, the method further includes:
[0169] S16: When the object range lock is released, the active-active system sends a release request execution success message to the first client.
[0170] In this embodiment, when the active-active system completes the release of the object range lock, it sends a release request execution success message to the first client, and the client learns that the object range lock has been released.
[0171] In this embodiment, before the master storage unit and the slave storage unit write the data corresponding to the data write request into the object area corresponding to the object range lock, the method further includes:
[0172] S21: The master storage unit and the slave storage unit each detect whether the object range lock already exists in the object area.
[0173] In this embodiment, before writing data into the object area, the master storage unit and the slave storage unit will each detect whether an object range lock already exists in the object area of the storage unit. The specific steps include:
[0174] S21 - 1 : The primary storage unit and the secondary storage unit respectively call their own operation record logs.
[0175] In this embodiment, the operation log is used to record the operations performed by each storage unit, and also records which areas have object range locks.
[0176] In this embodiment, each storage unit has a corresponding operation record log. If you want to see which object area has an object range lock, you need to call the operation record log to view the corresponding record.
[0177] S21 - 2 : The primary storage unit and the secondary storage unit search for the operation record corresponding to the object area from their respective operation record logs.
[0178] In this embodiment, the primary storage unit and the secondary storage unit search for the operation record corresponding to the object area from their respective operation record logs, and check whether there is a record in the operation record corresponding to the object area to add an object range lock to the object area.
[0179] S21 - 3 : Determine, based on the operation record, whether the object range lock already exists in the object area.
[0180] In this embodiment, according to the operation record, it is determined whether an object range lock already exists in the object area. The specific steps include:
[0181] S21-3-1: When a corresponding object range lock exists in any area included in the object area, determine that the object range lock already exists in the object area.
[0182] In this embodiment, when an object range lock exists in any area included in the object area, it means that the object area to which data is to be written has been locked by operation instructions from other clients, and other clients are writing data in the storage area including the object area. At this time, it is determined that an object range lock already exists in the object area.
[0183] For example, if data needs to be written in the object area of 0-4K, if the object range lock already exists in the 2K-3K or 3K-5K area, it is determined that the object area already has an object range lock. Here, regardless of whether the area with the object range lock completely covers the object area, as long as it includes any part of the object area, it is determined that the object area already has an object range lock.
[0184] S21-3-2: When none of the areas included in the object area has the corresponding object range lock, determine that no object range lock exists in the object area.
[0185] In this embodiment, when no object range lock exists in all areas included in the object area, it means that the object area is idle and no other client writes data in the object area. At this time, it is determined that no object range lock exists in the object area.
[0186] S22: If there is no object range lock in the object area, record the write operation for the object area in an operation record log.
[0187] In this embodiment, the write operation for the object area is recorded in the operation record log, and the specific steps include:
[0188] S22-1: The primary storage unit and the secondary storage unit respectively call the operation record log.
[0189] S22 - 2 : Recording the data writing operation for the target area in the operation record log.
[0190] In this embodiment, when there is no object range lock on the object area, the main storage unit and the slave storage unit respectively call their respective operation record logs, record the write operation on the object area in their respective operation record logs, and then execute the data write operation to complete the parallel writing of data.
[0191] In this embodiment, the method further includes:
[0192] S23: If an object range lock already exists in the object area, send a write failure message to the first client.
[0193] In this embodiment, when data is written concurrently, if an object range lock already exists in the object area, a write failure message is sent to the first client.
[0194] For example, refer to Figure 4 , Figure 4 is a flow chart of a parallel write operation proposed in an embodiment of the present application, such as Figure 4 As shown, during the parallel write operation, the first client simultaneously sends a data write request to the main OSD of cluster A, i.e., the main storage unit, and the main OSD of cluster B, i.e., the slave storage unit, which also includes an object range lock acquisition request (ICFS_OSD_OP_RANGE_LOCK_TRY_GET&ICFS_OSD_OP_WRITE). After receiving the request, the main storage unit puts the object range lock request information into req_lock_range_i nfo in init_op_f l ags(), and then calls get_range lock() in handle_range lock(). At this time, the complete object range lock is generated. After the object range lock is generated, it is detected whether the object area of the proxy operation has been recorded in the operation record log. If not, the information of this operation is recorded, including the object area corresponding to the object range lock and the operation time, and then the write operation is performed. The slave storage unit synchronously executes these steps to complete the data writing. After the data is written, the main storage unit sends a request execution success message (ICFS_OSD_OP_WRITE) to the first client, and the first client sends an object range lock release request (ICFS_OSD_OP_RANGE_LOCK_RELEASE) to the main storage unit to apply for releasing the object range lock. The main storage unit puts the object range lock request information into req_lock_range_ifo in init_op_flags(). Then, release_range lock() is called in handle_range lock() to delete the locked object area from the record, and a request execution success receipt is sent to the client. The first client receives the object range lock release success message sent by the main storage end, and completes the object range lock release operation. The slave storage unit also executes the above steps in parallel to release the object range lock.
[0195] In another embodiment of the present application, the method further includes:
[0196] S31: The second client sends a data write request to the active-active system.
[0197] In this embodiment, when the second client needs to write data into the active-active system, a data write request is sent to the active-active system.
[0198] S32: The master storage unit and the slave storage unit of the active-active system determine whether the object range lock already exists in the object area corresponding to the data write request.
[0199] In this embodiment, the primary storage unit and the secondary storage unit of the active-active system retrieve the operation record log to check whether an object range lock already exists in the object area corresponding to the data write request.
[0200] S33: When the object range lock already exists in the object area, the master storage unit and the slave storage unit send data write error information to the second client.
[0201] In this embodiment, when the main storage unit and the slave storage unit already have object range locks in the object area, it means that clients other than the second client have acquired the object range lock of the object area. At this time, the main storage unit and the slave storage unit send data write error information to the second client.
[0202] refer to Figure 5 , Figure 5 : is a schematic diagram of a parallel write operation lock conflict handling process proposed in an embodiment of the present application, such as Figure 5 As shown, when client 1 has obtained the object range lock of object area X and client 2 attempts to obtain the object range lock of object area X, client 2 sends an object range lock application request to the primary PG of cluster A. Since the object range lock is already held by client 1, the object range lock application request returns a data write error message (OBJECT_RANGE_LOCK_CONFL ICT) to the upper layer.
[0203] In another embodiment of the present application, the method further includes:
[0204] S41: When the first client writes data serially in the active-active system, the first client sends an object range lock acquisition request to a primary storage unit in the active-active system.
[0205] In this embodiment, when the first client serially writes data in the active-active system, the first client sends an object range lock acquisition request to the primary storage unit in the active-active system.
[0206] S42: When receiving the object-scope lock acquisition request, the main storage unit generates the corresponding object-scope lock.
[0207] In this embodiment, when receiving the object-range lock acquisition request, the main storage unit determines the object area where data needs to be written according to the object-range lock information in the object-range lock acquisition request, and then generates a corresponding object-range lock.
[0208] S43: The main storage unit sends object range lock acquisition success information to the first client.
[0209] In this embodiment, after generating the object range lock, the main storage unit sends object range lock acquisition success information to the first client.
[0210] In this embodiment, the method further includes:
[0211] S44: When the first client receives the object range lock acquisition success information, it sends an object range lock acquisition request to the secondary storage unit in the active-active system.
[0212] In this embodiment, upon receiving the object range lock acquisition success information, the first client sends an object range lock acquisition request to the slave storage unit in the active-active system to acquire the object range lock in the slave storage unit.
[0213] S45: Upon receiving the object-scope lock acquisition request, the slave storage unit generates the corresponding object-scope lock.
[0214] In this embodiment, after receiving the object-scope lock acquisition request from the storage unit, a corresponding object-scope lock is generated according to the object-scope lock information included in the object-scope lock acquisition request.
[0215] S46: The slave storage unit sends the object range lock acquisition success information to the first client.
[0216] In this embodiment, after generating the object-scope lock, the slave storage unit sends object-scope lock acquisition success information to the first client.
[0217] In this embodiment, the method further includes:
[0218] S47: When the first client receives the object range lock acquisition success information sent by the slave storage unit, the first client sends a data write request to the main storage unit.
[0219] In this embodiment, when the first client receives the object range lock acquisition success information sent from the storage unit, the first client sends a data write request to the main storage unit.
[0220] S48: When receiving the data write request, the main storage unit writes the data into the object area corresponding to the object range lock.
[0221] In this embodiment, when receiving a data write request, the main storage unit writes the data into the object area corresponding to the object range lock.
[0222] S49: The main storage unit sends data writing success information to the first client.
[0223] In this embodiment, after the data writing is completed, the main storage unit sends data writing success information to the first client.
[0224] S410: Upon receiving the data write success information, the first client applies to the main storage unit for releasing the object range lock.
[0225] In this embodiment, when the first client receives the data write success information, it applies to the main storage unit for releasing the object range lock.
[0226] In this embodiment, the method further includes:
[0227] S411: When the object range lock is completely released, the first client sends a data write request to the secondary storage unit.
[0228] In this embodiment, when the object range lock is released, the first client sends a data write request to the secondary storage unit.
[0229] S412: When receiving the data write request, the slave storage unit writes the data into the object area corresponding to the object range lock.
[0230] In this embodiment, when receiving a data write request, the slave storage unit writes the corresponding data into the object area corresponding to the object range lock.
[0231] S413: The slave storage unit sends data write success information to the first client.
[0232] In this embodiment, after the data writing is completed, the slave storage unit sends data writing success information to the first client.
[0233] S414: Upon receiving the data write success information, the first client applies to the secondary storage unit for releasing the object range lock.
[0234] In this embodiment, when the first client receives the data write success information, it applies to the secondary storage unit for releasing the object range lock.
[0235] refer to Figure 6 , Figure 6: is a schematic diagram of a serial write operation process proposed in an embodiment of the present application. Figure 6 As shown, the first client sends an object range lock acquisition request (ICFS_OSD_OP_RANGE_LOCK_GET) to the primary OSD to apply for an object range lock. After receiving the request, the primary storage unit puts the object range lock request information into req_lock_range_i nfo in init_op_flags(). Then, handle_rangelock() is called in handle_rangelock() to check whether the object area to be operated has been recorded. If it is not recorded, the information of this operation is recorded, and a receipt of successful acquisition of the object range lock is returned to the first client. The first client receives the successful acquisition information of the object range lock. Through the above steps, the first client obtains the object range lock of the slave storage unit. After the first client obtains two object range locks, it sends a data write request (ICFS_OSD_OP_RANGE_LOCK_CHECK&ICFS_OSD_OP_WRITE) to the main storage unit. After receiving the data write request, the main storage unit puts the object range lock request information into req_lock_range_i nfo in init_op_f l ags(). Then, check_range lock() is called in handle_range lock() to check whether the range lock of the requested area has been acquired. If it has been obtained, the write operation is then performed. When the first client receives the data write success information sent by the main storage unit, it applies to release the object range lock. After the main storage unit releases the object range lock, the first client sends a data write request to the slave storage unit, and then executes the data write process in the slave storage unit until the data writing of the slave storage unit is completed and the object range lock is released.
[0236] In another embodiment of the present application, the method further includes:
[0237] S51: The second client sends an object scope lock acquisition request to the main memory.
[0238] In this embodiment, when the second client needs to write data in the active-active system, an object range lock acquisition request is sent to the main memory.
[0239] S52: When the object area corresponding to the object range lock has been occupied by the first client, the main storage unit puts the object range lock acquisition request into a waiting queue.
[0240] In this embodiment, when the object area corresponding to the object range lock has been occupied by the first client, the main storage unit puts the object range lock acquisition request sent by the second client into a waiting queue. The waiting queue contains all pending requests, which are sorted according to the time when the requests were sent. The earlier the requests are received, the higher the queue will be.
[0241] S53: When the object range lock corresponding to the first client is completely released, the main storage unit generates the object range lock corresponding to the second client.
[0242] In this embodiment, when the object range corresponding to the first client is released, the main storage unit generates an object range lock corresponding to the second client.
[0243] In this embodiment, when the object range lock corresponding to the first client is released, the specific steps of the main storage unit generating the object range lock corresponding to the second client include:
[0244] S53-1: When the object-scope lock corresponding to the first client is completely released, the main storage unit takes out the object-scope lock acquisition request from the waiting queue.
[0245] In this embodiment, when the object range lock corresponding to the first client is completely released, the main storage unit takes out the object range acquisition request sent by the second client from the waiting queue.
[0246] S53-2: The main storage unit generates the corresponding object range lock according to the object range lock acquisition request.
[0247] In this embodiment, the main storage unit generates an object-range lock corresponding to the second client according to the object-range lock acquisition request.
[0248] refer to Figure 7 , Figure 7 : is a schematic diagram of a serial write operation lock conflict handling process proposed in an embodiment of the present application, such as Figure 7 As shown, when client 1 has obtained the object range lock of object area X and client 2 attempts to obtain the object range lock of object area X, client 2 first sends an object range lock request application to the main storage unit. Since the object range lock has been occupied by client 1, the object range lock application will enter the conflict waiting queue and wait. When client 1 completes the write operation and releases the object range lock of object area X, the object range lock application request in the conflict waiting queue will be dequeued for execution, and an attempt will be made to obtain the range lock of object area X. If the acquisition is successful, the request execution success information is returned to client 2.
[0249] In the above embodiment of the present application, a method for distributed storage of active-active data dual-write distributed range lock is proposed, which is applied to the scenario of dual-write of multiple client data, and solves the problem of data inconsistency in the scenario of multi-client write. In the active-active system, when multiple clients write concurrently, users can read and write services normally, business continuity is not affected, and the data written to cluster A and cluster B are consistent, which increases the security of the business and reduces the consumption of network resources. The method has high compatibility.
[0250] Based on the same inventive concept, an embodiment of the present application provides a data writing device. Figure 8 , Figure 8 FIG. 8 is a schematic diagram of a data writing device 800 proposed in an embodiment of the present application. Figure 8 As shown, the device comprises:
[0251] A first write request sending module 801 is used to send a data write request to the active-active system when a first client writes data in parallel in the active-active system;
[0252] A first object range lock generation module 802, configured to generate a corresponding object range lock for a corresponding master storage unit and a slave storage unit in the active-active system according to the data write request, wherein the master storage unit belongs to a first storage cluster and the slave storage unit belongs to a second storage cluster;
[0253] The first data writing module 803 is used for the main storage unit and the slave storage unit to write the data corresponding to the data writing request into the object area corresponding to the object range lock respectively.
[0254] Optionally, the device further comprises:
[0255] A first execution success message sending module, configured to send a request execution success message to the first client when the primary storage unit and the secondary storage unit have completed writing the data;
[0256] The first release request sending module is used for the first client to apply to the active-active system for releasing the object range lock when receiving the request execution success message.
[0257] Optionally, the device further comprises:
[0258] The second execution success message sending module is used to send a release request execution success message to the first client when the object range lock is released in the active-active system.
[0259] Optionally, the device further comprises:
[0260] A first detection module, configured for the main storage unit and the slave storage unit to detect whether the object range lock already exists in the object area;
[0261] The first recording module is configured to record a write operation on the object area in an operation record log when no object range lock exists in the object area.
[0262] Optionally, the device further comprises:
[0263] A first failure message sending module is configured to send a write failure message to the first client when an object range lock already exists in the object area.
[0264] Optionally, the first detection module includes:
[0265] A first calling submodule, used for the main storage unit and the slave storage unit to call their respective operation record logs respectively;
[0266] A record search submodule, configured for the primary storage unit and the secondary storage unit to search the operation record corresponding to the object area from the respective operation record logs;
[0267] The object range lock determination submodule is used to determine whether the object range lock already exists in the object area according to the operation record.
[0268] Optionally, the object range lock determination submodule includes:
[0269] A first determining submodule, configured to determine that the object range lock already exists in the object area when a corresponding object range lock exists in any area included in the object area;
[0270] The second determining submodule is configured to determine that the object area does not have an object range lock when none of the areas included in the object area have the corresponding object range lock.
[0271] Optionally, the first recording module includes:
[0272] A second calling submodule is used for the main storage unit and the slave storage unit to call the operation record log respectively;
[0273] The first recording submodule is used to record the data writing operation for the object area in the operation record log.
[0274] Optionally, the first object scope lock generation module includes:
[0275] A request information determination submodule, used for the main storage unit and the slave storage unit to determine the object range lock request information corresponding to the data write request according to the data write request;
[0276] The first object-scope lock generation submodule is configured to generate the corresponding object-scope lock according to the object-scope lock request information.
[0277] Optionally, the first releasing module includes:
[0278] A first release request sending submodule, configured to, when the first client receives the request execution success message, send an object range lock release request to the primary storage unit and the secondary storage unit in the active-active system respectively;
[0279] The object range lock deletion submodule is used for the main storage unit and the slave storage unit to delete the object range lock corresponding to the object area when receiving the object range lock release request.
[0280] Optionally, the device further comprises:
[0281] A second request sending module, used for a second client to send a data write request to the active-active system;
[0282] A second checking module, used for the master storage unit and the slave storage unit of the active-active system to determine whether the object range lock already exists in the corresponding object area corresponding to the data write request;
[0283] A second failure message sending module is configured to cause the primary storage unit and the secondary storage unit to send data write error information to the second client when the object range lock already exists in the object area.
[0284] Optionally, the device further comprises:
[0285] A first acquisition request sending module, configured to send an object range lock acquisition request to a primary storage unit in the active-active system when the first client serially writes data in the active-active system;
[0286] A second object range lock generation module, configured for the main storage unit to generate the corresponding object range lock when receiving the object range lock acquisition request;
[0287] The second success message sending module is used for the main storage unit to send object range lock acquisition success information to the first client.
[0288] Optionally, the device further comprises:
[0289] A second acquisition request sending module, configured to send an object range lock acquisition request to a slave storage unit in the active-active system when the first client receives the object range lock acquisition success information;
[0290] A third object range lock generation module, configured to generate the corresponding object range lock when the slave storage unit receives the object range lock acquisition request;
[0291] The third success message sending module is used to send the object range lock acquisition success information from the storage unit to the first client.
[0292] Optionally, the device further comprises:
[0293] A second write request sending module, configured to send a data write request to the main storage unit when the first client receives the object range lock acquisition success information sent by the slave storage unit;
[0294] A second writing module, configured for the main storage unit to write the data into the object area corresponding to the object range lock when receiving the data writing request;
[0295] A fourth success message sending module, used for the main storage unit to send data writing success information to the first client;
[0296] The second releasing module is used for the first client to apply to the main storage unit for releasing the object range lock when receiving the data writing success information.
[0297] Optionally, the device further comprises:
[0298] A third write request sending module, configured for sending a data write request to the slave storage unit when the object range lock is released by the first client;
[0299] A third writing module, configured for, when the slave storage unit receives the data writing request, to write the data into the object area corresponding to the object range lock;
[0300] A fifth success message sending module, used for sending data writing success information from the storage unit to the first client;
[0301] The third releasing module is used for the first client to apply to the secondary storage unit for releasing the object range lock when receiving the data writing success information.
[0302] Optionally, the device further comprises:
[0303] A third acquisition request sending module, configured for the second client to send an object range lock acquisition request to the main memory;
[0304] a queue placing module, configured for the main storage unit to place the object range lock acquisition request into a waiting queue when the object area corresponding to the object range lock has been occupied by the first client;
[0305] The fourth object range lock generation module is used for the main storage unit to generate the object range lock corresponding to the second client when the object range lock corresponding to the first client is released.
[0306] Optionally, the fourth object scope lock generation module includes:
[0307] a queue fetching submodule, configured for the main storage unit to fetch the object range lock acquisition request from the waiting queue when the object range lock corresponding to the first client is released completely;
[0308] The fifth object range lock generation submodule is used for the main storage unit to generate the corresponding object range lock according to the object range lock acquisition request.
[0309] Based on the same inventive concept, another embodiment of the present application provides a readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the method described in any of the above embodiments of the present application.
[0310] Based on the same inventive concept, another embodiment of the present application provides an electronic device, Fig. 9 It is a schematic diagram of an electronic device 900 proposed in one embodiment of the present application, including a memory 902, a processor 901 and a computer program stored in the memory and executable on the processor, wherein when the processor is executed, the steps in the dual-site data storage method described in any of the above embodiments of the present application are implemented.
[0311] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0312] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0313] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the embodiments of the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0314] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0315] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0316] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0317] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0318] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0319] The data writing method, device, equipment and storage medium provided by the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data writing method, characterized in that: The method comprises: When the first client writes data in parallel in the active-active system, the first client sends a data write request to the active-active system; The corresponding master storage unit and slave storage unit in the active-active system generate corresponding object range locks according to the data write request, the master storage unit belongs to the first storage cluster, and the slave storage unit belongs to the second storage cluster; The master storage unit and the slave storage unit respectively write the data corresponding to the data write request into the object area corresponding to the object range lock.
2. The data writing method according to claim 1, characterized in that: The method further comprises: When the primary storage unit and the secondary storage unit have completed writing the data, sending a request execution success message to the first client; When receiving the request execution success message, the first client applies to the active-active system for releasing the object range lock.
3. The data writing method according to claim 2, characterized in that: The method further comprises: In the active-active system, when the object range lock is released, a release request execution success message is sent to the first client.
4. The data writing method according to claim 1, characterized in that: Before the master storage unit and the slave storage unit write the data corresponding to the data write request in the object area corresponding to the object range lock, the method further includes: The main storage unit and the slave storage unit each detect whether the object range lock already exists in the object area; In a case where there is no object range lock in the object area, a write operation for the object area is recorded in an operation record log.
5. The data writing method according to claim 4, characterized in that: The method further comprises: In a case where an object range lock already exists in the object area, a write failure message is sent to the first client.
6. The data writing method according to claim 4, characterized in that: The main storage unit and the slave storage unit each detect whether the object range lock already exists in the object area, including: The main storage unit and the slave storage unit respectively call their own operation record logs; The primary storage unit and the secondary storage unit search for the operation record corresponding to the object area from their respective operation record logs; According to the operation record, it is determined whether the object range lock already exists in the object area.
7. The data writing method according to claim 6, characterized in that: The determining, according to the operation record, whether the object range lock already exists in the object area includes: In a case where a corresponding object range lock exists in any area included in the object area, determining that the object range lock already exists in the object area; In a case where none of the regions included in the object region has the corresponding object range lock, it is determined that no object range lock exists in the object region.
8. The data writing method according to claim 4, characterized in that: The recording of the write operation for the object area in the operation record log includes: The main storage unit and the slave storage unit respectively call the operation record log; The data writing operation for the object area is recorded in the operation record log.
9. The data writing method according to claim 1, characterized in that: The corresponding master storage unit and slave storage unit in the active-active system generate corresponding object range locks according to the data write request, including: The main storage unit and the slave storage unit determine, according to the data write request, object range lock request information corresponding to the data write request; The corresponding object-scope lock is generated according to the object-scope lock request information.
10. The data writing method according to claim 2, characterized in that: When receiving the request execution success message, the client applies to the active-active system for releasing the object range lock, including: When receiving the request execution success message, the first client sends an object range lock release request to the primary storage unit and the secondary storage unit in the active-active system respectively; The master storage unit and the slave storage unit delete the object range lock corresponding to the object area when receiving the object range lock release request.
11. The data writing method according to claim 1, characterized in that: The method further comprises: The second client sends a data write request to the active-active system; The master storage unit and the slave storage unit of the active-active system determine whether the object range lock already exists in the corresponding object area corresponding to the data write request; When the object range lock already exists in the object area, the master storage unit and the slave storage unit send data write error information to the second client.
12. The data writing method according to claim 1, characterized in that: The method further comprises: When the first client writes data serially in the active-active system, the first client sends an object range lock acquisition request to the primary storage unit in the active-active system; The main storage unit generates the corresponding object range lock when receiving the object range lock acquisition request; The main storage unit sends object range lock acquisition success information to the first client.
13. The data writing method according to claim 12, characterized in that: The method further comprises: When receiving the object range lock acquisition success information, the first client sends an object range lock acquisition request to a slave storage unit in the active-active system; The slave storage unit generates the corresponding object range lock when receiving the object range lock acquisition request; The slave storage unit sends the object range lock acquisition success information to the first client.
14. The data writing method according to claim 13, characterized in that: The method further comprises: The first client sends a data write request to the main storage unit when receiving the object range lock acquisition success information sent by the slave storage unit; When receiving the data write request, the main storage unit writes the data into the object area corresponding to the object range lock; The main storage unit sends data writing success information to the first client; When receiving the data write success information, the first client applies to the main storage unit for releasing the object range lock.
15. The data writing method according to claim 14, characterized in that: The method further comprises: When the object range lock is released, the first client sends a data write request to the slave storage unit; The slave storage unit writes the data into the object area corresponding to the object range lock when receiving the data write request; The slave storage unit sends data writing success information to the first client; When receiving the data write success information, the first client applies to the secondary storage unit for releasing the object range lock.
16. The data writing method according to claim 15, characterized in that: The method further comprises: The second client sends an object scope lock acquisition request to the main memory; When the object area corresponding to the object range lock has been occupied by the first client, the main storage unit puts the object range lock acquisition request into a waiting queue; The main storage unit generates the object range lock corresponding to the second client when the object range lock corresponding to the first client is completely released.
17. The data writing method according to claim 16, characterized in that: When the object range lock corresponding to the first client is completely released, the main storage unit generates the object range lock corresponding to the second client, including: When the object range lock corresponding to the first client is completely released, the main storage unit takes out the object range lock acquisition request from the waiting queue; The main storage unit generates the corresponding object-scope lock according to the object-scope lock acquisition request.
18. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps in the method according to any one of claims 1 to 17 are implemented.
19. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the method according to any one of claims 1 to 17 are implemented.
20. 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 according to any one of claims 1 to 17 are implemented.
Citation Information
Patent Citations
Method and device for writing data, and system
CN107209733A
Active-active storage system management method and equipment and storage medium
CN113721857A
Data double-writing method and device, computer equipment and program product
CN118093730A
