Submission mode determination method and device, electronic equipment, storage medium and program product
By dynamically adjusting the data center in multi -copy cluster, the usability problem of multi -copy cluster when the data center copy fails, and realize the normal work and high availability of the system.
Patent Information
- Application Number
- CN202411611325.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-01-24
AI Technical Summary
The existing data center submission method has low availability in multi-replica clusters, especially when all replicas in a data center fail, the leader replica cannot be submitted, resulting in the multi-replica cluster being unavailable.
Through each of the data centers that are submitted to the switch in the multi -copy set, the submission mark of the data center is determined, and the submission mark is updated according to the fault detection results. The method of submitting the data center dynamically is optimized to optimize the copy of the leader's copy.
The dynamic adjustment method in multi -copy clusters is realized, ensuring the normal work of multiple copy clusters, and improving the availability of the system.
Smart Images

Figure CN119363814A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a submission mode determination method, device, electronic device, storage medium and program product. Background Art
[0002] The existing data center submission method is controlled by the data center submission switch. When the switch is turned on, if the leader needs to submit, the data to be submitted must be stored on at least one replica in the data center where the switch is turned on before the leader can submit.
[0003] This data center submission method requires that at least one replica in a data center is still functioning properly to prevent the loss of submitted data. However, if all replicas in a data center fail, the leader replica will no longer be able to submit. Even if most replicas are still functioning properly, the multi-replica cluster will still be unavailable, and the availability of the multi-replica cluster is low. Summary of the invention
[0004] The present invention provides a submission mode determination method, device, electronic device, storage medium and program product to dynamically adjust the submission mode of a data center and ensure the normal operation of a multi-copy cluster.
[0005] According to one aspect of the present invention, a submission mode determination method is provided, which is applied to an electronic device corresponding to a leader replica in a multi-replica cluster. The submission mode determination method includes:
[0006] For each data center in the multi-copy cluster with a commit switch turned on, determining a commit mark of the data center, the commit switch controlling the commit mark of the data center;
[0007] updating the submission mark of the data center according to a detection result obtained after fault detection on the data center;
[0008] A commit mode is determined according to the commit tag, where the commit mode indicates how the leader replica commits.
[0009] According to another aspect of the present invention, there is provided a data center submission device, comprising:
[0010] A first determination module is used to determine the commit mark of each data center with a commit switch turned on in the multi-copy cluster, where the commit switch controls the commit mark of the data center;
[0011] An updating module, configured to update the submission mark of the data center according to a detection result obtained after fault detection on the data center;
[0012] The second determination module is used to determine a submission method according to the submission mark, where the submission method indicates a submission method of the leader replica.
[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0014] at least one processor; and
[0015] a memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the data center submission method described in any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the data center submission method described in any embodiment of the present invention when executed.
[0018] According to another aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the data center submission method described in any embodiment of the present invention is implemented.
[0019] The technical solution of the embodiment of the present invention determines the submission mark of each data center with the submission switch turned on in the multi-copy cluster, updates the submission mark of the data center according to the detection result obtained after fault detection of the data center, and determines the submission mode according to the submission mark, and the submission mode indicates the submission mode of the leader replica. The submission mark of the data center is updated through fault detection, and the submission mode of the data center is dynamically adjusted according to the updated submission mark, so as to optimize the submission mode of the leader replica and ensure the normal operation of the multi-copy cluster.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 is a flow chart of a data center submission method provided according to Embodiment 1 of the present invention;
[0023] Figure 2 is a flowchart of a submission mark update method provided according to Embodiment 2 of the present invention;
[0024] Figure 3 This is a structural diagram of a data center submission device provided according to Embodiment 3 of the present invention;
[0025] Figure 4 It is a block diagram of an electronic device provided according to a fourth embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] Embodiment 1
[0029] Figure 1 A flowchart of a data center submission method is provided for the first embodiment of the present invention. This embodiment is applicable to the case of determining a data center submission method. The method can be executed by a data center submission device. The data center submission device can be implemented in the form of hardware and / or software. The data center submission device can be configured in an electronic device corresponding to a leader replica in a multi-replica cluster. The electronic device can be a computer device in a computer room. Figure 1 As shown, the method includes:
[0030] S110. For each data center in the multi-copy cluster with a commit switch turned on, determine a commit mark of the data center, where the commit switch controls the commit mark of the data center.
[0031] In this embodiment, the multi-copy cluster can be understood as a cluster composed of multiple copies in the database system, which is a distributed cluster. In the multi-copy cluster, the database will deploy copies to computer rooms in different regions, and the total number of copies in the multi-copy cluster is generally an odd number. The multi-copy cluster does not rely on daemons and monitors, and has the characteristics of automatic master selection, automatic fault handling, and automatic fault recovery of copies, and the failure of a few copies will not affect the normal operation of the entire database system. The submission switch can be understood as a mechanism for controlling whether the submission rules of the data center can take effect. The data center can be understood as a facility for centrally storing computer systems and related components, mainly used for data storage, processing and distribution. The data center can include servers, storage devices, network devices, etc. The data center can be an independent building or a specific area in a building. The computer room in each region can be regarded as a data center, and each data center contains one or more copies. The copy can be used to store the information and structure of the original data, stored in an independent location to prevent data loss or damage. The submission mark can be understood as a mark set according to the state of the submission switch of the data center, which can be used to mark whether the submission switch of the data center is turned on.
[0032] Specifically, a multi-copy cluster contains multiple data centers, and a data center contains one or more copies. A data center in a multi-copy cluster with a commit switch turned on is obtained, including a data center when the multi-copy cluster is first started and a data center during operation, and the commit mark of the data center with the commit switch turned on in the multi-copy cluster is obtained. When the multi-copy cluster is started for the first time, a data center with a commit switch turned on in the multi-copy cluster is selected, and the commit mark of the data center is determined according to the state of the commit switch. When the multi-copy cluster is in operation, a data center with a commit switch turned on in the multi-copy cluster is selected, and the commit mark updated in the previous detection process is obtained.
[0033] For example, assume that a multi-copy cluster contains four data centers, namely, data center 1, data center 2, data center 3, and data center 4. When the multi-copy cluster is started for the first time, the data center submission switches of data center 1 and data center 4 are not turned on, while the data center submission switches of data center 2 and data center 3 are turned on. Therefore, when the multi-copy cluster is started for the first time, the submission marks of data center 2 and data center 3 need to be determined.
[0034] S120: Update the submission mark of the data center according to a detection result obtained after fault detection on the data center.
[0035] In this embodiment, fault detection can be understood as an operation of detecting the status of the replica in the data center. The operation status of the replica can be obtained through fault detection, and the result of whether the replica can work normally can be obtained.
[0036] Specifically, a fault detection is performed on the data center with the commit switch turned on to detect whether the replicas in the data center are working properly. If the detection result shows that all the replicas in a data center are not working properly, the number of replicas in the data center needs to be determined, and the update status of the commit mark of the data center is determined based on the number of replicas. If no data center with all replicas failing is detected, the commit mark remains unchanged.
[0037] For example, assume that Data Center No. 1 contains two replicas A and B, Data Center No. 2 contains one replica C, Data Center No. 3 contains two replicas D and E, and Data Center No. 4 contains two replicas F and G, that is, the number of replicas in the multi-replica cluster is 7. Assume that during the operation of the multi-replica cluster, a fault detection is performed on the multi-replica cluster, and the detection results show that replicas C, D, and E are all faulty. Then, the sum of the number of replicas in Data Center No. 2 and the number of replicas in Data Center No. 3 needs to be compared with the number of replicas in the multi-replica cluster to determine whether to update the submission mark of Data Center No. 2 and Data Center No. 3. If during the operation of the multi-replica cluster, the detection results show that there are no faulty replicas, the submission marks of Data Center No. 2 and Data Center No. 3 remain unchanged.
[0038] S130. Determine a submission method according to the submission mark, where the submission method indicates a submission method of the leader replica.
[0039] In this embodiment, the submission method can be understood as the submission rules of the leader replica to the data center in a multi-copy cluster. In the database system, for a log entry, after it is written to the disk (written to the local disk) on most replicas in the multi-copy cluster, the log entry can be submitted on the leader replica. In the actual use of the database, logs are used to record data modification operations in the database, and the data at a certain moment can be restored or reconstructed through the logs. Therefore, in the multi-copy cluster, the log disk can be regarded as the data disk, and the submission of log entries can be regarded as the submission of data. For different data centers where the data is located, the leader replica submits to different data centers in different ways according to the different working conditions of the replicas in the data center. In the multi-copy cluster of the distributed database, the leader replica is a special replica that can be used to complete operations such as data updates in the database system. Through the data synchronization mechanism of the leader replica, the data consistency of multiple replicas in the database system can be effectively guaranteed.
[0040] Specifically, in a multi-replica cluster, a replica is first selected as the leader replica, and the leader replica submits according to the submission method. There are three submission tags, which correspond to different working states of the replicas in the data center, and the corresponding submission methods also include three cases. According to the submission tags of each data center in the multi-replica cluster, the corresponding submission method is determined for the leader replica, and the leader replica can submit according to the submission method.
[0041] For example, assume that replica A in data center 1 is used as the leader replica. During the operation of the multi-replica cluster, assume that all replicas in data center 2 and data center 3 fail. If there are no other failed replicas in the multi-replica cluster at this time, the number of failed replicas still meets the submission rules of the multi-replica cluster, and the submission marks of data center 2 and data center 3 need to be updated. And at this time, when the leader replica A submits, it does not need to consider the submission rules of data center 2 and data center 3, but only the submission rules of the multi-replica cluster.
[0042] The technical solution of the embodiment of the present invention determines the submission mark of each data center with the submission switch turned on in the multi-copy cluster, updates the submission mark of the data center according to the detection result obtained after fault detection of the data center, and determines the submission mode according to the submission mark, and the submission mode indicates the submission mode of the leader replica. The submission mark of the data center is updated through fault detection, and the submission mode of the leader replica is dynamically adjusted according to the updated submission mark, so as to optimize the submission mode of the leader replica and ensure the normal operation of the multi-copy cluster.
[0043] Based on the above embodiment, a modified embodiment of the above embodiment is proposed. It should be noted that in order to make the description concise, only the differences from the above embodiment are described in the modified embodiment.
[0044] In one embodiment, for each data center in the multi-copy cluster with a commit switch turned on, determining the commit mark of the data center includes:
[0045] When the multi-copy cluster is started for the first time, if the commit switch of the data center is turned on, the commit mark corresponding to the data center is set to the first mark;
[0046] If the submission switch of the data center is turned off, the submission mark corresponding to the data center is set to a second mark, and the first mark and the second mark are different marks.
[0047] In this embodiment, the first mark can be understood as a mark indicating the on state of the data center submission switch. The second mark can be understood as a mark indicating the off state of the data center submission switch. The first mark and the second mark respectively represent different states of the data center submission switch and need to be set to different values.
[0048] Specifically, when the multi-copy cluster is started for the first time, for each data center in the multi-copy cluster, if the commit switch is on, the commit rule of the data center is enabled, and the commit mark of the data center is set to the first mark. If the commit switch is off, the commit rule of the data center is not enabled, and the commit mark of the data center is set to the second mark.
[0049] Exemplarily, the first mark may be 1, and the second mark may be 0. When the multi-copy cluster is started for the first time, the data center submission switches of data center No. 1 and data center No. 4 are not turned on, while the data center submission switches of data center No. 2 and data center No. 3 are turned on. Then, the submission marks of data center No. 1 and data center No. 4 are set to 0, while the submission marks of data center No. 2 and data center No. 3 are set to 1.
[0050] In one embodiment, determining a submission mode according to the submission mark, wherein the submission mode indicates a submission mode of the leader replica, includes:
[0051] If the submission mark of the data center contains the first mark and does not contain the third mark, the submission mode of the leader replica is the first submission mode, and the first submission mode includes a mode for constraining submission of the data center in the multi-replica cluster;
[0052] If all the submission marks of the data center are second marks, the submission mode of the leader replica is the second submission mode, and the second submission mode includes submission modes other than the submission mode of the data center in the multi-replica cluster;
[0053] If there is a third mark in the submission mark of the data center, the submission mode of the leader copy is to enter a waiting state.
[0054] In this embodiment, the first submission method can be understood as a submission method of the leader replica in the database system. When the leader replica submits according to the first submission method, the submission rules of the data center need to be considered. The second submission method can be understood as another submission method of the leader replica in the database system. The second submission method does not need to consider the submission rules of the data center, and only needs to consider the submission rules of the multi-copy cluster. The third mark can be understood as a mark that identifies the data center submission entering the waiting state. The third mark and the first mark and the second mark respectively represent different states of the data center submission and need to be set to different values. The waiting state can be understood as the state of the leader replica submission when the data center cannot meet the submission rules. At this time, the leader replica needs to wait for the data center to recover to meet the submission rules of the multi-copy cluster before continuing to submit.
[0055] Specifically, different submission methods are set for the leader replica according to the different submission marks of the data center. When the first mark exists in the submission mark of the data center and the third mark does not exist, when the leader replica submits, it is necessary to combine the submission rules of the multi-copy cluster and the submission rules of the data center to form the first submission method, and submit according to the first submission method. When the submission marks of the data center are all the second marks, the submission rules of the data center are not enabled. When the leader replica submits, it only needs to use the submission rules of the multi-copy cluster as the second submission method and submit according to the second submission method. When the third mark exists in the submission mark of the data center, the data center does not meet the submission rules of the multi-copy cluster at this time. The submission of the leader replica enters a waiting state and needs to wait for the data center to meet the submission rules of the multi-copy cluster before submitting.
[0056] Exemplarily, the submission rule of the multi-copy cluster may be a submission rule based on the RAFT protocol. The first submission method may be a combination of the submission rule based on the RAFT protocol and the submission rule of the data center. The specific submission method is: each data center with the submission mark as the first mark has at least one replica written to the local disk, and the number of replicas written to the local disk accounts for the majority of the total number of replicas in the multi-copy cluster. The leader replica can submit. The second submission method may be a submission rule based only on the RAFT protocol. The specific submission method is: when the data to be submitted is written to the local disk on the majority of replicas, the leader replica can submit. Assuming that there are four data centers in the multi-copy cluster, the submission marks of the first data center and the fourth data center are the second mark, and the submission marks of the second data center and the third data center are the first mark, then the submission method of the leader replica is the first submission method. Assuming that the submission marks of the four data centers are all the second mark, the submission method of the leader replica is the second submission method. Assuming that there is a third mark in the submission marks of the four data centers, the leader replica enters a waiting state.
[0057] In one embodiment, updating the submission mark of the data center according to the detection result obtained after fault detection on the data center further includes:
[0058] It is detected whether one or more replicas in the data center where all replicas fail have recovered to normal, and if so, the commit mark of the data center is set to the first mark.
[0059] Specifically, if a data center is detected where all replicas are faulty, the next step of fault detection is performed on the data center. When the detection result shows that one or more replicas in the data center have recovered to normal, the leader replica can set the submission mark of the data center to the first mark. The specific operation includes: the leader replica first modifies the submission mark of the data center to the first mark, and then submits it in the first submission mode. After the submission is completed, the submission mark of the data center is determined to be the first mark.
[0060] For example, assume that during the operation of a multi-copy cluster, when replica C in data center No. 2 returns to normal, the leader replica detects that replica C has returned to normal, and the leader replica will first modify the commit tag of data center No. 2 to first tag 1, and then submit in the first submission mode. After that, the commit tag of data center No. 2 is determined to be first tag 1, and thereafter, the leader replica will submit in the first submission mode.
[0061] Embodiment 2
[0062] Figure 2This is a flowchart of a method for updating a submission mark provided in Embodiment 2 of the present invention. This embodiment is based on the method for updating the submission mark in the above embodiment. Figure 2 As shown, the method includes:
[0063] S210. For each data center with a commit switch turned on, detect whether there is a data center in which all replicas are faulty.
[0064] In this embodiment, all replicas are faulty, which can be understood as all replicas in a data center are not working and all replicas are in a faulty state.
[0065] Specifically, in a multi-copy cluster, a fault detection is performed on each data center with a commit switch turned on to determine whether all the replicas in the data center are faulty. The fault detection can be a timed detection, in which the working status of the replicas in the data center is detected at regular intervals.
[0066] S220: If so, determine the quantitative relationship between the number of failed replicas in the multi-replica cluster and the number of replicas in the multi-replica cluster, and update the commit mark of the data center according to the quantitative relationship.
[0067] In this embodiment, the quantitative relationship can be understood as a numerical value representing the relationship between the number of failed replicas in the multi-replica cluster and the number of replicas in the multi-replica cluster, which can be a ratio relationship between the two numbers.
[0068] Specifically, if it is detected that all replicas in a data center are faulty, the number of faulty replicas in the multi-replica cluster to which the data center belongs is obtained, and the number of replicas in the multi-replica cluster is obtained to determine the ratio of the number of faulty replicas to the number of replicas. The quantitative relationship can be the result of comparing the ratio with a set value, so as to determine whether the commit mark of the data center is updated.
[0069] For example, assuming that the leader replica detects that the replicas in Data Center No. 2 and Data Center No. 3 have completely failed, if there are no other failed replicas in the multi-replica cluster at this time, then the ratio of the sum of the number of failed replicas in Data Center No. 2 and Data Center No. 3 to the number of replicas in the multi-replica cluster is calculated, and the ratio is compared with the set value to determine whether the submission marks of Data Center No. 2 and Data Center No. 3 are updated.
[0070] S230: If it does not exist, keep the submission mark unchanged.
[0071] Specifically, if it is detected that all replicas in the non-existent data center fail, the commit mark of the data center remains unchanged as the first mark.
[0072] The technical solution of the embodiment of the present invention detects the data center with the submission switch turned on to determine whether there is a data center where all copies are faulty. If so, the quantitative relationship between the number of faulty copies in the multi-copy cluster to which the data center belongs and the number of copies in the multi-copy cluster is determined, and the submission mark of the data center is updated according to the quantitative relationship. If not, the submission mark remains unchanged. By detecting the number of faulty copies in the multi-copy cluster to which the data center belongs and comparing it with the number of copies in the multi-copy cluster, the method of updating the submission mark of the data center is refined to achieve dynamic adjustment of the submission mark of the data center.
[0073] Optionally, determining a quantitative relationship between the number of failed replicas in the multi-replica cluster and the number of replicas in the multi-replica cluster includes:
[0074] Determine the number of failed replicas in the multi-replica cluster as a first number;
[0075] Determine the number of replicas in the multi-replica cluster as a second number;
[0076] It is determined whether the ratio of the first quantity to the second quantity is less than a set value to obtain the quantity relationship.
[0077] In this embodiment, the first number can be understood as the number of failed replicas in the multi-replica cluster. The second number can be understood as the number of replicas in the multi-replica cluster. The second number can be the sum of the number of replicas in the data center with the data center submission switch turned on and the number of replicas in the data center without the data center submission switch turned on. The set value can be understood as a set value for determining the ratio relationship between the first number and the second number, and the set value can be 1 / 2.
[0078] Specifically, when all replicas in a data center fail, the number of failed replicas in the multi-replica cluster to which the data center belongs is taken as the first number, and the number of replicas in the multi-replica cluster to which the data center belongs is taken as the second number. The ratio of the first number to the second number is calculated to determine whether the ratio is less than the set value. If it is less, the submission mark of the data center can be updated, and the leader replica can be submitted according to the submission method corresponding to the updated submission mark; otherwise, the submission mark of the data center is updated, but at this time the data center cannot meet the submission rules of the multi-replica cluster, and the leader replica suspends submission.
[0079] For example, assume that the leader replica detects that the replicas in data center 2 and data center 3 are completely faulty. For data center 2, the number of faulty replicas is 1, and for data center 3, the number of faulty replicas is 2. If there are no other faulty replicas in the multi-replica cluster at this time, the first number is 3, and the number of replicas in the multi-replica cluster is the second number 7. Then, 3 / 7 is compared with the set value 1 / 2 to obtain a quantitative relationship.
[0080] Optionally, updating the submission mark of the data center according to the quantity relationship includes:
[0081] When the quantity relationship indicates that the ratio of the first quantity to the second quantity is less than the set value, updating the submission mark of the data center to the second mark;
[0082] When the quantity relationship indicates that the ratio of the first quantity to the second quantity is greater than the set value, the submission mark of the data center is updated to a third mark, and the third mark indicates that the leader replica suspends submission.
[0083] Specifically, when all replicas in a data center fail, the number of failed replicas in the multi-replica cluster to which the data center belongs is taken as the first number, and the number of replicas in the multi-replica cluster to which the data center belongs is taken as the second number, and the ratio relationship between the first number and the second number is obtained as the quantity relationship. When the quantity relationship indicates that the ratio of the first number and the second number is less than a set value, the data center meets the submission rule of the multi-replica cluster, the submission mark of the data center is updated from the first mark to the second mark, and the leader replica submits in accordance with the second submission method. When the quantity relationship indicates that the ratio of the first number and the second number is greater than the set value, the data center does not meet the submission rule of the multi-replica cluster, the submission mark of the data center is updated from the first mark to the third mark, the leader replica enters a waiting state, and submission is suspended.
[0084] For example, for data center No. 2, the number of faulty replicas is 1, and for data center No. 3, the number of faulty replicas is 2, then the first number is 3, and the number of replicas in the multi-replica cluster is the second number 7, then 3 / 7 is compared with the set value 1 / 2, and the result shows that the ratio of the first number to the second number is less than the set value, then the update mark of data center No. 2 and data center No. 3 is updated to the second mark 0, if at this time the submission marks of all data centers in the multi-replica cluster are the second marks, then the leader replica is submitted according to the second submission method.
[0085] Embodiment 3
[0086] Figure 3 A structural diagram of a data center submission device provided in Embodiment 3 of the present invention.
[0087] like Figure 3 As shown, the device comprises:
[0088] A first determination module 310 is used to determine the commit mark of each data center with a commit switch turned on in the multi-copy cluster, where the commit switch controls the commit mark of the data center;
[0089] An updating module 320, configured to update the submission mark of the data center according to a detection result obtained after fault detection on the data center;
[0090] The second determination module 330 is used to determine a submission method according to the submission mark, where the submission method indicates a submission method of the leader replica.
[0091] The submission mode determination device provided in the embodiment of the present invention first determines the submission mark of the data center for each data center with the submission switch turned on in the multi-copy cluster through the first determination module, then updates the submission mark of the data center according to the detection result obtained after fault detection of the data center through the update module, and finally determines the submission mode according to the submission mark through the second determination module, and the submission mode indicates the submission mode of the leader replica. Through the cooperation between the modules, the submission mark of the data center is updated according to the fault detection, and the submission mode of the data center is dynamically adjusted according to the updated submission mark, so as to optimize the submission mode of the leader replica and ensure the normal operation of the multi-copy cluster.
[0092] In one embodiment, the first determining module 310 is specifically configured to:
[0093] When the multi-copy cluster is started for the first time, if the commit switch of the data center is turned on, the commit mark corresponding to the data center is set to the first mark;
[0094] If the submission switch of the data center is turned off, the submission mark corresponding to the data center is set to a second mark, and the first mark and the second mark are different marks.
[0095] In one embodiment, the update module 320 includes:
[0096] A detection unit, configured to detect, for each data center with a commit switch turned on, whether there is a data center in which all replicas are faulty;
[0097] an updating unit, configured to determine, if any, a quantitative relationship between the number of failed replicas in the multi-replica cluster and the number of replicas in the multi-replica cluster, and update the commit mark of the data center according to the quantitative relationship;
[0098] A maintaining unit is used to keep the submission mark unchanged if it does not exist.
[0099] In one embodiment, the updating unit is specifically configured to:
[0100] Determine the number of failed replicas in the multi-replica cluster as a first number;
[0101] Determine the number of replicas in the multi-replica cluster as a second number;
[0102] It is determined whether the ratio of the first quantity to the second quantity is less than a set value to obtain the quantity relationship.
[0103] In one embodiment, the updating unit is specifically configured to:
[0104] When the quantity relationship indicates that the ratio of the first quantity to the second quantity is less than the set value, updating the submission mark of the data center to the second mark;
[0105] When the quantity relationship indicates that the ratio of the first quantity to the second quantity is greater than the set value, the submission mark of the data center is updated to a third mark, and the third mark indicates that the leader replica suspends submission.
[0106] In one embodiment, the second determining module 330 is specifically configured to:
[0107] If the submission mark of the data center contains the first mark and does not contain the third mark, the submission mode of the leader replica is the first submission mode, and the first submission mode includes a mode for constraining submission of the data center in the multi-replica cluster;
[0108] If all the submission marks of the data center are second marks, the submission mode of the leader replica is the second submission mode, and the second submission mode includes submission modes other than the submission mode of the data center in the multi-replica cluster;
[0109] If there is a third mark in the submission mark of the data center, the submission mode of the leader copy is to enter a waiting state.
[0110] In one embodiment, the update module 320 further includes a setting unit, specifically configured to:
[0111] It is detected whether one or more replicas in the data center where all replicas fail have recovered to normal, and if so, the commit mark of the data center is set to the first mark.
[0112] The data center submission device provided in the embodiment of the present invention can execute the data center submission method provided in any embodiment of the present invention, completes the submission of the data center through the mutual cooperation and collaboration between the modules, and has the functional modules and beneficial effects corresponding to the execution method.
[0113] Embodiment 4
[0114] According to an embodiment of the present invention, the present invention also provides an electronic device, a computer-readable storage medium and a computer program product.
[0115] Figure 4 It is a block diagram of an electronic device provided according to Embodiment 4 of the present invention, and the electronic device can implement the submission mode determination method described in the embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0116] like Figure 4 As shown, the electronic device 410 includes at least one processor 411, and a memory connected to the at least one processor 411 in communication, such as a read-only memory (ROM) 412, a random access memory (RAM) 413, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 411 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 412 or the computer program loaded from the storage unit 418 to the random access memory (RAM) 413. In the RAM 413, various programs and data required for the operation of the electronic device 410 can also be stored. The processor 411, the ROM 412, and the RAM 413 are connected to each other via a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.
[0117] A number of components in the electronic device are connected to the I / O interface 415, including: an input unit 416, such as a keyboard, a mouse, etc.; an output unit 417, such as various types of displays, speakers, etc.; a storage unit 418, such as a disk, an optical disk, etc.; and a communication unit 419, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 419 allows the electronic device to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0118] Processor 411 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. Processor 411 executes the various methods and processes described above, such as a submission method determination method.
[0119] In some embodiments, the submission method determination method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 418. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 410 via the ROM 412 and / or the communication unit 419. When the computer program is loaded into the RAM 413 and executed by the processor 411, one or more steps of the submission method determination method described above may be performed. Alternatively, in other embodiments, the processor 411 may be configured to perform the submission method determination method by any other appropriate means (e.g., by means of firmware).
[0120] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0121] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0122] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0123] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0124] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0125] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0126] In some embodiments, the computer program product includes a computer program, and when the computer program is executed by a processor, the submission mode determination method provided by the embodiment of the present invention is implemented.
[0127] The technical solution of the embodiment of the present invention is a submission mode determination method, device, electronic device, storage medium and program product. For each data center in a multi-copy cluster that has a submission switch turned on, the submission mark of the data center is determined, and the submission mark of the data center is updated according to the detection result obtained after fault detection of the data center. The submission mode is determined according to the submission mark, and the submission mode indicates the submission mode of the leader replica. The submission mark of the data center is updated through fault detection, and the submission mode of the data center is dynamically adjusted according to the updated submission mark, so as to optimize the submission mode of the leader replica and ensure the normal operation of the multi-copy cluster.
[0128] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0129] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for determining a submission mode, characterized in that: Applied to an electronic device corresponding to a leader replica in a multi-replica cluster, the method includes: For each data center in the multi-copy cluster with a commit switch turned on, determining a commit mark of the data center, the commit switch controlling the commit mark of the data center; updating the submission mark of the data center according to a detection result obtained after fault detection on the data center; A commit mode is determined according to the commit tag, where the commit mode indicates how the leader replica commits.
2. The method according to claim 1, characterized in that The step of determining the commit mark of each data center in the multi-copy cluster that has a commit switch turned on includes: When the multi-copy cluster is started for the first time, if the commit switch of the data center is turned on, the commit mark corresponding to the data center is set to the first mark; If the submission switch of the data center is turned off, the submission mark corresponding to the data center is set to a second mark, and the first mark and the second mark are different marks.
3. The method according to claim 1, characterized in that The updating of the submission mark of the data center according to the detection result obtained after the fault detection on the data center includes: For each data center with the commit switch turned on, detect whether there is a data center in which all replicas are faulty; If so, determining a quantitative relationship between the number of failed replicas in the multi-replica cluster and the number of replicas in the multi-replica cluster, and updating the commit mark of the data center according to the quantitative relationship; If not present, the commit marker remains unchanged.
4. The method according to claim 3, characterized in that Determining the quantitative relationship between the number of failed replicas in the multi-replica cluster and the number of replicas in the multi-replica cluster includes: Determine the number of failed replicas in the multi-replica cluster as a first number; Determine the number of replicas in the multi-replica cluster as a second number; It is determined whether the ratio of the first quantity to the second quantity is less than a set value to obtain the quantity relationship.
5. The method according to claim 3, characterized in that: The updating of the submission mark of the data center according to the quantity relationship includes: When the quantity relationship indicates that the ratio of the first quantity to the second quantity is less than the set value, updating the submission mark of the data center to the second mark; When the quantity relationship indicates that the ratio of the first quantity to the second quantity is greater than the set value, the submission mark of the data center is updated to a third mark, and the third mark indicates that the leader replica suspends submission.
6. The method according to claim 1, characterized in that The determining of the submission mode according to the submission mark, wherein the submission mode indicates the submission mode of the leader replica, includes: If the submission mark of the data center contains the first mark and does not contain the third mark, the submission mode of the leader replica is the first submission mode, and the first submission mode includes a mode for constraining submission of the data center in the multi-replica cluster; If all the submission marks of the data center are second marks, the submission mode of the leader replica is the second submission mode, and the second submission mode includes submission modes other than the submission mode of the data center in the multi-replica cluster; If there is a third mark in the submission mark of the data center, the submission mode of the leader copy is to enter a waiting state.
7. The method according to claim 1, characterized in that The updating of the submission mark of the data center according to the detection result obtained after the fault detection on the data center further includes: It is detected whether one or more replicas in the data center where all replicas fail have recovered to normal, and if so, the commit mark of the data center is set to the first mark.
8. A data center submission device, characterized in that: include: A first determination module is used to determine the commit mark of each data center with a commit switch turned on in the multi-copy cluster, where the commit switch controls the commit mark of the data center; An updating module, configured to update the submission mark of the data center according to a detection result obtained after fault detection on the data center; The second determination module is used to determine a submission method according to the submission mark, where the submission method indicates a submission method of the leader replica.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the submission mode determination method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the submission mode determination method according to any one of claims 1 to 7 when executed.
11. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the submission mode determination method according to any one of claims 1 to 7.