A savepoint processing method, device, equipment, medium and product

By receiving global savepoints from the distributed database and updating the first and second local savepoints in the local savepoint linked list, the high maintenance cost and low efficiency caused by mapping savepoints from compute nodes to all data nodes are solved, thus achieving more efficient distributed transaction processing.

CN119336453BActive Publication Date: 2025-11-28WUHAN DAMENG DATABASE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411435707.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-11-28
Estimated Expiration
2044-10-15

AI Technical Summary

Technical Problem

In distributed databases, the operation of mapping savepoints from compute nodes to all data nodes increases the maintenance cost of distributed transactions and leads to a decrease in the processing efficiency of data nodes.

Method used

By receiving the global savepoint, finding and updating the first and second local savepoints in the local savepoint linked list, the accumulation of local savepoints is avoided, reducing the maintenance cost of distributed transactions.

Benefits of technology

This effectively avoids the accumulation of local save points, reduces the maintenance cost of distributed transactions, and improves the processing efficiency of data nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336453B_ABST
    Figure CN119336453B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure disclose a save point processing method, device, equipment, medium and product, comprising: receiving a global save point, the global save point comprising a first global save point and a second global save point; finding a first local save point corresponding to the first global save point in a local save point linked list, the first local save point being a local save point with a label matching a first specific label or a local save point closest to the first specific label with a label greater than the first specific label; finding a second local save point corresponding to the second global save point in the local save point linked list, the second local save point being a local save point with a label matching a second specific label or a local save point closest to the second specific label with a label between the first specific label and the second specific label; and updating the local save point linked list according to the first local save point and the second local save point, thereby avoiding accumulation of local save points and reducing maintenance cost of distributed transactions.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present disclosure relate to the technical field of database, and particularly relate to a save point processing method and device, equipment, medium and product. BACKGROUND

[0002] In a distributed database, a client only connects a certain computing node (CN) to operate a distributed transaction, and the start, rollback, and setting of a save point of the distributed transaction are expected to be transparent to the client, that is, the client can operate the computing node in a single machine manner. To this end, a save point Sn (referred to as a global save point) on the computing node needs to be mapped to a local save point Sn_Lm of a data node (DN), and the latter means that the global save point with a label n from the computing node corresponds to a local save point with a label m on the data node.

[0003] Suppose that the distributed database has one computing node and four data nodes, and now the computing node is connected to perform a save point and a structured query language (SQL) operation, wherein each SQL may only involve part of the related data nodes, and the save point operation is broadcast to all data nodes for complete mapping. In this way, when the computing node is rolled back to the global save point Sn, each data node can certainly find the corresponding Sn_Lm, and the SQL modification under the jurisdiction of the global save point is also certainly consistent with the global save point, so that the save point partial rollback function of the distributed transaction is correctly completed. Although the above scheme can ensure the correctness of the function, the operation of the computing node to map the save point to all data nodes seriously increases the maintenance cost of the distributed transaction; at the same time, it also causes the accumulation of the local save points mapped to the data nodes, affecting the processing efficiency of the data nodes. SUMMARY

[0004] Embodiments of the present disclosure provide a save point processing method, device, equipment, medium and product, which avoid the accumulation of local save points and reduce the maintenance cost of the distributed transaction.

[0005] In a first aspect, a save point processing method is provided, comprising:

[0006] receiving a global save point, wherein the global save point includes a first global save point and a second global save point, the first global save point corresponds to a first specific label, the second global save point corresponds to a second specific label, and the first specific label of the first global save point is greater than the second specific label corresponding to the second global save point;

[0007] find a first local savepoint corresponding to the first global savepoint in a local savepoint chain table, the first local savepoint being a local savepoint with a label matching the first specific label or a local savepoint with a label greater than the first specific label and closest to the first specific label;

[0008] find a second local savepoint corresponding to the second global savepoint in the local savepoint chain table, the second local savepoint being a local savepoint with a label matching the second specific label or a local savepoint with a label between the first specific label and the second specific label and closest to the second specific label;

[0009] update the local savepoint chain table according to the first local savepoint and the second local savepoint.

[0010] In a second aspect, a savepoint processing apparatus is provided, comprising:

[0011] a savepoint receiving module configured to receive global savepoints, wherein the global savepoints comprise a first global savepoint and a second global savepoint, the first global savepoint corresponding to a first specific label, the second global savepoint corresponding to a second specific label, the first specific label of the first global savepoint being greater than the second specific label corresponding to the second global savepoint;

[0012] a first finding module configured to find a first local savepoint corresponding to the first global savepoint in a local savepoint chain table, the first local savepoint being a local savepoint with a label matching the first specific label or a local savepoint with a label greater than the first specific label and closest to the first specific label;

[0013] a second finding module configured to find a second local savepoint corresponding to the second global savepoint in the local savepoint chain table, the second local savepoint being a local savepoint with a label matching the second specific label or a local savepoint with a label between the first specific label and the second specific label and closest to the second specific label;

[0014] an updating module configured to update the local savepoint chain table according to the first local savepoint and the second local savepoint.

[0015] In a third aspect, an electronic device is provided, comprising:

[0016] one or more processors;

[0017] a storage apparatus configured to store one or more programs,

[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement the savepoint processing method as described above.

[0019] In a fourth aspect, a computer-readable storage medium is provided, and the computer-readable storage medium stores a computer program, and the computer program, when executed by a processor, implements the savepoint processing method as described above.

[0020] In a fifth aspect, a computer program product is provided, and the computer program product includes a computer program, and the computer program, when executed by a processor, implements the savepoint processing method as described above.

[0021] Embodiments of the present disclosure disclose a savepoint processing method, device, equipment, medium and product, comprising: receiving a global savepoint, wherein the global savepoint includes a first global savepoint and a second global savepoint, the first global savepoint corresponds to a first specific label, the second global savepoint corresponds to a second specific label, the first specific label of the first global savepoint is greater than the second specific label corresponding to the second global savepoint; searching for a first local savepoint corresponding to the first global savepoint in a local savepoint linked list, the first local savepoint is a local savepoint with a label matching the first specific label or a local savepoint closest to the first specific label with a label greater than the first specific label; searching for a second local savepoint corresponding to the second global savepoint in the local savepoint linked list, the second local savepoint is a local savepoint with a label matching the second specific label or a local savepoint closest to the second specific label with a label between the first specific label and the second specific label; and updating the local savepoint linked list according to the first local savepoint and the second local savepoint. The technical solution determines the first local savepoint by using the first global savepoint, determines the second local savepoint by using the second global savepoint, and updates the local savepoint linked list according to the first local savepoint and the second local savepoint, thereby avoiding the accumulation of local savepoints and reducing the maintenance cost of distributed transactions.

[0022] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor to limit the scope of the embodiments of the present disclosure. Other features of the embodiments of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the following will briefly introduce the drawings needed to be used in the embodiments description. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.

[0024] Figure 1 is a flow chart of a save point processing method provided by the first embodiment of the present disclosure;

[0025] Figure 2 is a schematic diagram of a save point processing process provided by the first embodiment of the present disclosure;

[0026] Figure 3 is a structural schematic diagram of a save point processing device provided by the second embodiment of the present disclosure;

[0027] Figure 4 is a structural schematic diagram of an electronic device provided by the third embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] In order to make the person skilled in the art better understand the technical solutions of the embodiments of the present disclosure, the following will clearly and completely describe the technical solutions in the embodiments of the present disclosure with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only some of the embodiments of the present disclosure, not all. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present disclosure.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the present disclosure described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0030] Embodiment one

[0031] Figure 1A flowchart of a saving point processing method provided by an embodiment of the present disclosure is provided. The embodiment can be applied to a case of processing a saving point. The method can be executed by a saving point processing apparatus, which can be implemented in the form of hardware and / or software. The saving point processing apparatus can be configured in an electronic device, such as a computer, a terminal, a server, and the like. Figure 1 As shown in FIG. 1, the method includes the following steps.

[0032] S110, receiving a global saving point, wherein the global saving point includes a first global saving point and a second global saving point, the first global saving point corresponds to a first specific label, and the second global saving point corresponds to a second specific label, the first specific label of the first global saving point is greater than the second specific label corresponding to the second global saving point.

[0033] In the embodiment, the computing node can broadcast the global saving point to the relevant data node. The global saving point can be a saving point created by the computing node (CN) in the context of a distributed transaction. This saving point is global because it is for the entire distributed transaction, and is not limited to a specific data node. The global saving point includes a first global saving point and a second global saving point, the first global saving point corresponds to a first specific label, and the second global saving point corresponds to a second specific label, the first specific label of the first global saving point is greater than the second specific label corresponding to the second global saving point.

[0034] It should be noted that the relevant data node can be a data node associated with the SQL instruction. The computing node can send the SQL instruction to the relevant data node when broadcasting the global saving point to the relevant data node, thereby avoiding the maintenance cost of the distributed transaction caused by the computing node mapping the saving point to all data nodes.

[0035] For example, the first global saving point can be represented as Sc, and the second global saving point can be represented as Sp, wherein the first specific label can be represented as c, and the second specific label can be represented as p, and c is greater than p. That is, the computing node can send the latest first global saving point Sc and the second global saving point Sp located before the first global saving point Sc to the relevant data node.

[0036] S120, searching for a first local saving point corresponding to the first global saving point in a local saving point chain table, the first local saving point being a local saving point with a label matching the first specific label or a local saving point with a label greater than the first specific label and closest to the first specific label.

[0037] It can be known that the relevant data node can find the first local save point corresponding to the first global save point in the local save point chain table after receiving the first global save point and the second global save point. The first local save point is a local save point with a label matching the first specific label or a local save point with a label greater than the first specific label and closest to the first specific label.

[0038] In the local save point chain table, a plurality of local save points are contained, each local save point corresponds to a label, and each label includes a label of a global save point corresponding to the local save point, an underscore, and a label of the local save point in the local save point chain table. For example, the first global save point can be represented as Sc, and the first local save point can be represented as Sc_Lm, where c is the label of the first global save point, and m can be the label of the local save point in the local save point chain table (only as a reference, not representing that the local save point labels are equal). It can be considered that Sc matches Sc_Lm.

[0039] Specifically, the first local save point corresponding to the first global save point is found in the local save point chain table. If the local save point corresponding to the first global save point exists in the local save point chain table, it is determined as the first local save point. If the local save point corresponding to the first global save point does not exist, the local save point with a label greater than the first specific label is determined as the first local save point.

[0040] For example, the first global save point can be represented as Sc. If Sc_Lm exists, Sc_Lm can be determined as the first local save point matching Sc. If Sc_Lm does not exist, the local save point Sn_Lm with a label greater than c and closest to c can be determined as the first local save point (m is only as a reference, not representing that the local save point labels are equal), where n>c.

[0041] In the local save point chain table, the second local save point corresponding to the second global save point is found. The second local save point is a local save point with a label matching the second specific label or a local save point with a label between the first specific label and the second specific label and closest to the second specific label.

[0042] In this embodiment, when the relevant data node receives the second global savepoint, the second local savepoint corresponding to the second global savepoint can be found in the local savepoint chain table. The second local savepoint is a local savepoint whose label matches the second specific label or a local savepoint whose label is between the first specific label and the second specific label and closest to the second specific label. For example, the second global savepoint can be represented as Sp. If Sp_Lm exists, Sp_Lm can be determined as the second local savepoint matching Sp. If Sp_Lm does not exist, the local savepoint Sq_Lm between the first specific label c and the second specific label p and closest to p can be determined as the second local savepoint matching Sp, where c > q > p.

[0043] S140, updating the local savepoint chain table according to the first local savepoint and the second local savepoint.

[0044] In this embodiment, after the first local savepoint and the second local savepoint are determined, the local savepoint chain table can be updated according to the first local savepoint and the second local savepoint.

[0045] Specifically, after the first local savepoint is determined, the local savepoints in the local savepoint chain table after the first local savepoint can be cleared. After the first local savepoint and the second local savepoint are determined, the other local savepoints in the local savepoint chain table between the first local savepoint and the second local savepoint can be cleared to avoid local savepoint accumulation.

[0046] The embodiment provides a savepoint processing method, including: receiving a global savepoint, wherein the global savepoint includes a first global savepoint and a second global savepoint, the first global savepoint corresponds to a first specific label, the second global savepoint corresponds to a second specific label, the first specific label of the first global savepoint is greater than the second specific label corresponding to the second global savepoint; finding a first local savepoint corresponding to the first global savepoint in a local savepoint chain table, the first local savepoint is a local savepoint whose label matches the first specific label or a local savepoint whose label is greater than the first specific label; finding a second local savepoint corresponding to the second global savepoint in the local savepoint chain table, the second local savepoint is a local savepoint whose label matches the second specific label or a local savepoint whose label is between the first specific label and the second specific label; and updating the local savepoint chain table according to the first local savepoint and the second local savepoint, which avoids local savepoint accumulation and reduces the maintenance cost of a distributed transaction.

[0047] As an optional implementation of the embodiment, the method for processing a save point provided by the embodiment comprises the following steps after updating the local save point chain table according to the first local save point and the second local save point:

[0048] 1) receiving a rollback request, wherein the rollback request comprises a target global save point, and the target global save point corresponds to a target label;

[0049] In the embodiment, when performing local rollback of a distributed transaction, the computing node can send a rollback request to a target data node, and the target data node can accept the rollback request sent by the computing node. The rollback request can comprise a target global save point, and the target global save point corresponds to a target label. The target global save point can be a global save point corresponding to the rollback request, and the target label can be a label corresponding to the target global save point. For example, the target global save point can be represented as Sr, and the target label can be r.

[0050] 2) when there is a first target local save point in the local save point chain table, the first target local save point has a label matched with the target label, and the rollback request is executed to roll back to the first target local save point;

[0051] It can be known that when there is a first target local save point in the local save point chain table, the first target local save point has a label matched with the target label, and the rollback request can be executed to roll back to the first target local save point. For example, when there is a local save point Sr_Lm in the local save point chain table, it can be considered that Sr_Lm is matched with the target label r (m is a label of a local save point in a data node in the local save point chain table, and does not participate in the process of matching the label with the target label). Therefore, Sr_Lm can be confirmed as the first target local save point. After the first target local save point is determined, local rollback can be directly performed and rolled back to the first target local save point Sr_Lm.

[0052] 3) when there is no first target local save point in the local save point chain table, a second target local save point located after the target label and closest to the target label is determined.

[0053] It needs to be explained that on a data node having a mapping relationship with a target global save point, there can be a local save point matched with the target global save point. Therefore, the local save point chain table of the data node can not have a first target local save point matched with the target global save point. Therefore, when there is no first target local save point matched with the target label in the local save point chain table, a second target local save point located after the target label and closest to the target label can be determined.

[0054] Exemplarily, the target global save point can be denoted as Sr, and the target label can be r. When Sr_Lm does not exist, the second target local save point with a label greater than r and closest to r can be confirmed. The second target local save point can be denoted as Sq_Lm. Because when Sr < Sq, rolling back Sr by the CN will definitely roll back Sq as well.

[0055] 4) After determining the second target local save point, execute the rollback request and roll back to the second target local save point.

[0056] Continuing from the above description, after the second target local save point is determined, the rollback request can be executed to roll back to the second target local save point. Specifically, when the first target local save point Sr_Lm does not exist, Sq_Lm with a label greater than r and closest to r can be determined to perform a local rollback. Because when Sr < Sq, rolling back Sr by the CN will definitely roll back Sq as well.

[0057] It should be noted that if the second target local save point does not exist, it can be considered that the first target local save point Sr and the subsequent save points are not mapped on this data node. Therefore, this data node does not need to perform a rollback.

[0058] As an optional implementation manner of this embodiment, updating the local save point linked list according to the first local save point and the second local save point further includes:

[0059] 1) After the first local save point is determined, clear the local save points in the local save point linked list that are after the first local save point;

[0060] In this embodiment, after the first local save point is determined, the local save points in the local save point linked list that are after the first local save point can be cleared. Exemplarily, because the computing node sends the first global save point as the latest global save point to the relevant data nodes, and the first global save point can be denoted as Sc. The global save points greater than Sc have been removed by the computing node. Therefore, the first local save point can be denoted as Sc_Lm, and the local save points in the local save point linked list that are after Sc_Lm can be cleared to achieve synchronous removal on the data node.

[0061] 2) After the first local save point and the second local save point are determined, clear the local save points in the local save point linked list that are between the first local save point and the second local save point.

[0062] In this embodiment, after the first local save point and the second local save point are determined, the local save points in the local save point linked list that are between the first local save point and the second local save point can be cleared.

[0063] Exemplarily, the first local save point can be denoted as Sc_Lm, and the second local save point can be denoted as Sp_Lm. Other local save points between Sc_Lm and Sp_Lm in the local save point chain table can be cleared.

[0064] In an embodiment, the searching for the first local save point corresponding to the first global save point in the local save point chain table comprises:

[0065] 1) searching for a local save point matching the first specific label in the local save point chain table;

[0066] In this embodiment, after receiving the global save point, a local save point matching the first specific label can be searched for in the local save point chain table, where the first specific label can be the label of the first global save point in the global save point.

[0067] 2) if there is a local save point matching the first specific label, the local save point matching the first specific label is taken as the first local save point;

[0068] It can be known that if there is a local save point matching the first specific label in the local save point chain table, it can be considered that the first global save point has a mapping in the local save point chain table, and the local save point matching the first specific label can be taken as the first local save point. The first local save point can be the mapping of the first global save point on the data node.

[0069] Specifically, since the labels of local save points belonging to the same data node are the same, when the label of the local save point corresponding to the global save point is consistent with the global save point, it can be considered that the local save point matches the global save point. Exemplarily, the first global save point can be denoted as Sc, the first specific label is c, and if there is Sc_Lm in the local save point chain table, it can be considered that Sc_Lm matches Sc, and Sc_Lm can be taken as the first local save point. Wherein, c is the label of the first global save point corresponding to the local save point, and m can be the label of the local save point in the local save point chain table (only for reference, not representing the same label).

[0070] 3) if there is no local save point matching the first specific label, a local save point with a label greater than the first specific label and closest to the first specific label is searched for from the local save point chain table as the first local save point.

[0071] It can be known that if there is no local save point matching the first specific label in the local save point chain table, a local save point with a label greater than the first specific label can be found in the local save point chain table. If there is a local save point with a label greater than the first specific label and closest to the first specific label in the local save point chain table, it can be taken as the first local save point.

[0072] For example, the first global save point can be represented as Sc, and the first specific label is c. If there is no Sc_Lm in the local save point chain table, a local save point Sn_Lm with a label greater than c and closest to c can be found in the local save point chain table, where n is greater than and closest to c. When it is determined that Sn_Lm exists, it can be considered that Sn on the computing node has been removed, the related SQL modification is taken over by Sc, and the corresponding data node should also remove Sn_Lm and the save points thereafter and hand over the related modification to Sc for takeover. Therefore, Sn_Lm can be directly replaced by Sc_Lm with the local save point label m unchanged, and Sn_Lm is determined as the first local save point.

[0073] Optionally, updating the local save point chain table according to the first local save point and the second local save point can further include:

[0074] If the local save point with a label greater than the first specific label and closest to the first specific label does not exist, a local save point is set in the local save point chain table as the first local save point.

[0075] It should be noted that if the local save point with a label greater than the first specific label and closest to the first specific label does not exist in the local save point chain table, a local save point (such as a new local save point) can be set in the local save point chain table, and the set local save point is taken as the first local save point.

[0076] In an embodiment, the searching for the second local save point corresponding to the second global save point in the local save point chain table includes:

[0077] 1) searching for a local save point matching the second specific label in the local save point chain table;

[0078] In this embodiment, after the first local save point is determined, a second local save point matching the second specific label can be found in the local save point chain table. The second specific label can be the label of the second global save point in the global save point.

[0079] 2) if there is a local save point matching the second specific label, the local save point matching the second specific label is taken as the second local save point;

[0080] Specifically, if there is a local savepoint matching the second specific label in the local savepoint chain list, the local savepoint matching the second specific label can be taken as the second local savepoint.

[0081] For example, the second global savepoint can be represented as Sp, and the second specific label can be represented as p. If there is Sp_Lm in the local savepoint chain list, it can be considered that Sp_Lm matches Sp, and Sp_Lm can be taken as the second local savepoint.

[0082] 3) If there is no local savepoint matching the second specific label, a local savepoint whose label is between the first specific label and the second specific label and closest to the second specific label is searched from the local chain list as the second local savepoint.

[0083] Specifically, if there is no local savepoint matching the second specific label in the local savepoint chain list, a local savepoint whose label is between the first specific label and the second specific label and closest to the second specific label can be searched from the local chain list as the second local savepoint.

[0084] For example, the first specific label can be represented as c, and the second specific label can be represented as p, and c is greater than p. If there is no Sp_Lm in the local savepoint chain list, a local savepoint Sq_Lm whose label is between c and p and closest to p can be searched from the local savepoint chain list, where c>q>p. If Sq_Lm exists, Sq_Lm can be taken as the second local savepoint.

[0085] Optionally, the searching for the second local savepoint corresponding to the second global savepoint in the local savepoint chain list can further include:

[0086] If the local savepoint whose label is between the first specific label and the second specific label and closest to the second specific label does not exist, the local savepoint does not need to be cleared.

[0087] Specifically, if there is no local savepoint whose label is between the first specific label and the second specific label and closest to the second specific label in the local savepoint chain list, it can be considered that there is no accumulation of local savepoints, and the local savepoint does not need to be cleared.

[0088] Figure 2 A schematic diagram of a savepoint processing process provided by the embodiment is shown in FIG. 1. Figure 2As shown, the data node can receive the global savepoint sent by the computing node, the global savepoint contains a first global savepoint (Sc) and a second global savepoint (Sp), the data node can also accept the SQL instruction sent by the computing node, determine whether the first local savepoint (Sc_Lm) exists in the local savepoint chain table, if the first local savepoint (Sc_Lm) exists, remove the savepoints after the first local savepoint (Sc_Lm) in the local savepoint chain table; if the first local savepoint (Sc_Lm) does not exist, it can be determined whether Sn_Lm (Sn_Lm is a local savepoint with a label greater than the first specific label (c) and closest to the first specific label (c)) exists. If Sn_Lm exists, replace the first local savepoint (Sc_Lm) with Sn_Lm, and remove the savepoints after the first local savepoint (Sc_Lm) in the local savepoint chain table; if Sn_Lm does not exist, the local savepoint can be set as the first local savepoint (Sc_Lm). After the first local savepoint (Sc_Lm) is determined, it can also be determined whether the second local savepoint (Sp_Lm) exists, if the second local savepoint (Sp_Lm) exists, the other local savepoints between the second local savepoint (Sp_Lm) and the first local savepoint (Sc_Lm) can be directly removed, and the SQL instruction sent by the computing node can be executed; if the second local savepoint (Sp_Lm) does not exist, it can be determined whether Sq_Lm (Sq_Lm is a local savepoint with a label between the first specific label (c) and the second specific label (p) and closest to the second specific label (p)) exists, if Sq_Lm exists, replace the second local savepoint (Sp_Lm) with Sq_Lm, and remove the other local savepoints between the second local savepoint (Sp_Lm) and the first local savepoint (Sc_Lm); if Sq_Lm does not exist, it is considered that no local savepoint accumulation is generated at present, and the SQL instruction sent by the computing node can be continuously executed, avoiding the phenomenon of local savepoint accumulation and reducing the maintenance cost of distributed transactions.

[0089] The embodiment also provides a technical scheme of application of the savepoint processing method, and Table 1 is an application example of a savepoint processing method provided by the embodiment, as shown in Table 1.

[0090] Table 1: Application example of savepoint processing method

[0091]

[0092] The newly set save point on the computing node CN can be recorded as Sc (the first global save point, corresponding to the first specific label r), the next newly set save point (i.e., the save point set most recently before Sc) can be recorded as Sp (the second global save point, corresponding to the second specific label p), and the next save point set after Sc can be recorded as Sn. Since the save point labels are incremental, there is p < c < n; correspondingly, the local save points to which the foregoing save points are mapped on the data node DN are respectively recorded as Sp_Lm (the second local save point), Sc_Lm (the first local save point), and Sn_Lm. Here, the local save point label m is only a placeholder and does not mean that the local labels are equal.

[0093] The overall idea of the scheme is as follows:

[0094] Step 1: When the CN broadcasts the SQL instruction to the relevant DN, the labels of Sc and Sp in the current save point chain table need to be sent to the target DN. The irrelevant DN can not map the global save point.

[0095] Step 2: When the DN receives the SQL instruction, it needs to first map the global save point [Sp, Sc] to the local according to the following steps, and then execute the SQL instruction.

[0096] a) Find Sc_Lm in the local save point chain table. If Sc_Lm is found, it means that Sc has been mapped locally and does not need to be added. However, if Sn_Lm (the local save point with a label greater than the first specific label c and closest to the first specific label c) exists, Sn_Lm and the save points after it need to be removed. Because Sc is the latest save point sent by the CN, the save point Sn that is newer than Sc has been removed by the CN and should also be removed synchronously on the DN. For example, DN1 in Table 1 executes process 8.

[0097] b) If Sc_Lm is not found.

[0098] i) However, Sn_Lm (i.e., the save point set after Sc) is found, which means that Sn has been removed on the CN, and the relevant SQL modification is taken over by Sc. Therefore, DN should also remove Sn_Lm and the save points after it and hand over the relevant modification to Sc, so that Sn_Lm can be directly replaced by Sc_Lm without changing the local save point label m. For example, DN2 in Table 1 executes process 8.

[0099] ii) If Sn_Lm is not found, a new save point Sc_Lm corresponding to the DN can be directly set. For example, DN1 in Table 1 executes process 6.

[0100] Step 3, Step 2 can ensure that the latest global savepoint Sc can always be mapped to the DN that executes the associated SQL, but it cannot guarantee that the mapping of the savepoint on the DN can be removed in time when the CN removes the savepoint. For example, when the CN in Table 1 executes processes 5-10, the DN 3 will receive the latest global savepoints S3, S4 in turn and set the local savepoints S3_L2, S4_L3, and the operation of the CN to remove S3 cannot be perceived by the DN, so that when the CN repeatedly executes processes 5-10, the savepoints on the DN 3 will be continuously accumulated. Therefore, the DN also needs to perform the cleaning work of invalid savepoints according to the sub-new savepoint Sp in the [Sp, Sc] sent by the CN, and the specific steps are as follows:

[0101] a) After adding Sc_Lm, continue to find Sp_Lm, if found, remove the savepoints between Sp_Lm and Sc_Lm. For example, DN 3 in Table 1 executes process 10.

[0102] b) If Sp_Lm is not found, but Sq_Lm (the local savepoint whose label is between the first specific label r and the second specific label q and is closest to the second specific label q) is found, where q > p, it means that Sq is also removed by the CN, and the related modification is taken over by Sp, so the DN also needs to remove Sq_Lm and the savepoints between Sq_Lm and Sc_Lm and hand over the related SQL modification to Sp, so Sq_Lm can be directly replaced by Sp_Lm while the savepoints between Sp_Lm and Sc_Lm are removed, without changing the local savepoint label m. For example, DN 4 in Table 1 executes process 10.

[0103] C) If Sq_Lm is also not found, it means that the savepoint removed by the CN is not mapped on the DN, and no cleaning needs to be performed.

[0104] Step 4, when the CN executes partial rollback of the distributed transaction, the rollback request and the target savepoint Sr of the rollback need to be broadcast to all associated DNs to execute partial rollback, and the processing steps of the DN are as follows:

[0105] a) If the DN can find the local mapping of the target global savepoint Sr (r is the target label) Sr_Lm (the first target local savepoint), the DN can directly execute partial rollback to Sr_Lm. For example, DN 1 in Table 1 rolls back to S2.

[0106] b) Since the global savepoint is only mapped on the associated DN, the DN may not have the mapping of Sr, and in this case, the Sq_Lm (the second target local savepoint) whose label is greater than r and is closest to r needs to be found to execute partial rollback, because when Sr < Sq, the CN rollback of Sr will also roll back Sq. For example, DN 1 in Table 1 rolls back to S1.

[0107] c) if Sq_Lm is not found on DN, it means that neither Sr nor the savepoint after it is mapped on this DN, and the associated SQL is not executed on this DN, so this DN does not need to perform rollback. For example, DN1 in Table 1 is rolled back to S4.

[0108] The technical scheme of the savepoint processing of the distributed transaction provided in the embodiment only needs to map the latest global savepoint for the DN that executes the associated SQL, thereby reducing the maintenance cost of the distributed transaction. In addition, the operation of removing the global savepoint on the CN needs to be notified to the associated DN, so as to prevent the local savepoints mapped to the DN from being accumulated. The local rollback operation on the CN needs to be correctly reflected on all the DNs, and the final rollback result should be the same as that of the single-machine database.

[0109] Embodiment Two

[0110] Figure 3 is a structural schematic diagram of a savepoint processing apparatus provided in Embodiment Two of the present disclosure; as shown in the figure, the apparatus comprises a savepoint receiving module 210, a first finding module 220, a second finding module 230, and an updating module 240. Figure 3

[0111] The savepoint receiving module 210 is configured to receive a global savepoint, wherein the global savepoint comprises a first global savepoint and a second global savepoint, the first global savepoint corresponds to a first specific label, the second global savepoint corresponds to a second specific label, and the first specific label of the first global savepoint is greater than the second specific label corresponding to the second global savepoint.

[0112] The first finding module 220 is configured to find, in a local savepoint linked list, a first local savepoint corresponding to the first global savepoint, wherein the first local savepoint is a local savepoint with a label matching the first specific label or a local savepoint closest to the first specific label and having a label greater than the first specific label.

[0113] The second finding module 230 is configured to find, in the local savepoint linked list, a second local savepoint corresponding to the second global savepoint, wherein the second local savepoint is a local savepoint with a label matching the second specific label or a local savepoint closest to the second specific label and having a label between the first specific label and the second specific label.

[0114] The updating module 240 is configured to update the local savepoint linked list according to the first local savepoint and the second local savepoint.

[0115] Embodiment Two of the present disclosure provides a savepoint processing apparatus, which avoids the accumulation of local savepoints and reduces the maintenance cost of the distributed transaction. ​

[0116] Further, the updating module 240 is further configured to:

[0117] after the first local save point is determined, clear the local save points in the local save point chain table after the first local save point;

[0118] after the first local save point and the second local save point are determined, clear the local save points in the local save point chain table between the first local save point and the second local save point.

[0119] Further, the first searching module 220 is further configured to:

[0120] search the local save point chain table for a local save point matching the first specific label;

[0121] if there is a local save point matching the first specific label, take the local save point matching the first specific label as the first local save point;

[0122] if there is no local save point matching the first specific label, search the local save point chain table for a local save point with a label greater than the first specific label and closest to the first specific label as the first local save point.

[0123] Further, the first searching module 220 is further configured to:

[0124] if the local save point with a label greater than the first specific label and closest to the first specific label does not exist, set a local save point in the local save point chain table as the first local save point.

[0125] Further, the second searching module 230 is further configured to:

[0126] search the local save point chain table for a local save point matching the second specific label;

[0127] if there is a local save point matching the second specific label, take the local save point matching the second specific label as the second local save point;

[0128] if there is no local save point matching the second specific label, search the local save point chain table for a local save point with a label between the first specific label and the second specific label and closest to the second specific label as the second local save point.

[0129] Further, the second searching module 230 is further configured to:

[0130] If the label is between the first particular label and the second particular label and a nearest local savepoint to the second particular label does not exist, then no local savepoint needs to be cleared.

[0131] Further, the apparatus further comprises:

[0132] a receiving module, configured to receive a rollback request, the rollback request comprising a target global savepoint, the target global savepoint corresponding to a target label;

[0133] a performing module, configured to perform the rollback request to rollback to a first target local savepoint when the first target local savepoint exists in the local savepoint linked list and the first target local savepoint has a label matching the target label;

[0134] a second target local savepoint determining module, configured to determine a second target local savepoint located after the target label and closest to the target label when the first target local savepoint does not exist in the local savepoint linked list;

[0135] a rollback module, configured to perform the rollback request and rollback to the second target local savepoint after the second target local savepoint is determined.

[0136] The savepoint processing apparatus provided in the embodiments of the present disclosure can execute the savepoint processing method provided in any of the embodiments of the present disclosure, and has the function modules and beneficial effects corresponding to the execution method.

[0137] Embodiment Three

[0138] Figure 4 A structural schematic diagram of an electronic device 10 that can be used to implement the embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit implementations of the embodiments of the present disclosure described and / or claimed in this document.

[0139] As Figure 4As shown, the electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., communicatively connected to the at least one processor 11, where the memory stores a computer program executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0140] Various components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, a speaker, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0141] The processor 11 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microprocessor, etc. The processor 11 performs various methods and processes described above, such as the savepoint processing method.

[0142] In some embodiments, the savepoint processing method can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded onto the RAM 13 and executed by the processor 11, one or more steps of the savepoint processing method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the savepoint processing method by any other appropriate means, such as by means of firmware.

[0143] The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system on a chip systems (SOCs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0144] Computer programs used to implement embodiments of the present disclosure can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer program, when executed, can cause instructions described in flow charts and / or block diagrams to be implemented on the computer. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as a standalone software package and partially on a remote machine, or entirely on a remote machine or server.

[0145] In the context of the present embodiments, a computer-readable storage medium can be a tangible medium that can contain or store computer programs for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0146] To provide for interaction with a user, the systems and techniques described here can 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 a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0147] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can 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), blockchain network, and the Internet.

[0148] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can 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 large management difficulty and weak business scalability in traditional physical host and VPS service.

[0149] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the embodiments of the present disclosure can be executed in parallel, in series, or in a different order, as long as the desired results of the technical solutions of the embodiments of the present disclosure can be achieved, and the present disclosure is not limited herein.

[0150] The specific implementation described above does not constitute a limitation on the protection scope of the embodiments of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the embodiments of the present disclosure should be included in the protection scope of the embodiments of the present disclosure.

[0151] The embodiments of the present disclosure also provide a computer program product, comprising a computer program and / or instructions, which, when executed by a processor, implement the save point processing method as provided by any of the embodiments of the present disclosure.

[0152] In the implementation process, the computer program product can be written in one or more programming languages or combinations thereof to implement computer program codes for performing the operations of the embodiments of the present disclosure, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" language or similar programming languages. The program codes can be executed entirely on a user computer, partially on a user computer, as an independent software package, partially on a user computer and partially on a remote computer, or entirely on a remote computer or server. In the case involving a remote computer, the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, through the Internet by using an Internet service provider).

[0153] Note that the above is only a preferred embodiment of the embodiments of the present disclosure and the technical principle applied. Those skilled in the art will understand that the embodiments of the present disclosure are not limited to the specific embodiments herein, and those skilled in the art can make various obvious changes, readjustments, and substitutions without departing from the protection scope of the embodiments of the present disclosure. Therefore, although the embodiments of the present disclosure have been described in more detail through the above embodiments, the embodiments of the present disclosure are not limited to the above embodiments, and can include more other equivalent embodiments without departing from the concept of the embodiments of the present disclosure, and the scope of the embodiments of the present disclosure is determined by the scope of the appended claims.

Claims

1. A method for processing savepoints, characterized in that, include: Receive global savepoints, wherein the global savepoints include a first global savepoint and a second global savepoint, the first global savepoint corresponds to a first specific label, the second global savepoint corresponds to a second specific label, and the first specific label of the first global savepoint is greater than the second specific label corresponding to the second global savepoint; Search the local savepoint list for the first local savepoint corresponding to the first global savepoint. The first local savepoint is either a local savepoint whose label matches the first specific label or a local savepoint whose label is greater than the first specific label and is closest to the first specific label. The second local save point corresponding to the second global save point is found in the local save point linked list. The second local save point is either a local save point whose label matches the second specific label or a local save point whose label is between the first specific label and the second specific label and is closest to the second specific label. Update the local savepoint list based on the first local savepoint and the second local savepoint; Updating the local savepoint linked list based on the first local savepoint and the second local savepoint includes: After the first local save point is determined, clear the local save points in the local save point linked list that are located after the first local save point; After the first local savepoint and the second local savepoint are determined, the local savepoints located between the first local savepoint and the second local savepoint in the local savepoint list are cleared.

2. The method according to claim 1, characterized in that, The step of searching the local savepoint list for the first local savepoint corresponding to the first global savepoint includes: Search the local save point list for the local save point that matches the first specific label; If a local save point exists that matches the first specific label, then the local save point that matches the first specific label shall be used as the first local save point; If no local savepoint matches the first specific label, then search the local savepoint list for the local savepoint with a label greater than the first specific label and the closest to the first specific label, and use it as the first local savepoint.

3. The method according to claim 2, characterized in that, Also includes: If the label is greater than the first specific label and the nearest local save point to the first specific label does not exist, then a local save point is set in the local save point linked list as the first local save point.

4. The method according to claim 1, characterized in that, The step of searching for the second local savepoint corresponding to the second global savepoint in the local savepoint linked list includes: Search the local savepoint list for a local savepoint that matches the second specific label; If a local save point exists that matches the second specific label, then the local save point that matches the second specific label will be used as the second local save point; If no local save point matches the second specific label, then the local save point whose label is between the first specific label and the second specific label and is closest to the second specific label is searched from the local linked list and selected as the second local save point. If the label is located between the first specific label and the second specific label and the nearest local savepoint to the second specific label does not exist, then it is not necessary to clear the local savepoint.

5. The method according to claim 1, characterized in that, After updating the local savepoint list based on the first local savepoint and the second local savepoint, the method further includes: Receive a rollback request, the rollback request including a target global savepoint, the target global savepoint corresponding to a target label; When there is a first target local save point in the local save point list whose label matches the target label, the rollback request is executed to roll back to the first target local save point. If the first target local save point does not exist in the local save point list, then the second target local save point that is located after the target label and closest to the target label is determined. After determining the second target local save point, the rollback request is executed, and the rollback is performed to the second target local save point.

6. A storage point processing device, characterized in that, include: A savepoint receiving module is used to receive global savepoints, wherein the global savepoints include a first global savepoint and a second global savepoint, the first global savepoint corresponds to a first specific label, the second global savepoint corresponds to a second specific label, and the first specific label of the first global savepoint is greater than the second specific label corresponding to the second global savepoint. The first search module is used to search for the first local save point corresponding to the first global save point in the local save point linked list. The first local save point is a local save point whose label matches the first specific label or a local save point whose label is greater than the first specific label and is closest to the first specific label. The second search module is used to search for the second local save point corresponding to the second global save point in the local save point linked list. The second local save point is a local save point whose label matches the second specific label or a local save point whose label is located between the first specific label and the second specific label and is closest to the second specific label. The update module is used to update the local save point linked list based on the first local save point and the second local save point; The update module is further configured to: After the first local save point is determined, clear the local save points in the local save point linked list that are located after the first local save point; After the first local savepoint and the second local savepoint are determined, the local savepoints located between the first local savepoint and the second local savepoint in the local savepoint list are cleared.

7. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the savepoint processing method as described in any one of claims 1-5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the savepoint processing method as described in any one of claims 1-5.

9. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the savepoint processing method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Data access method, device and equipment and storage medium

    CN110502535A

  • Flink self-starting method based on file storage system

    CN118605966A