Database-based processing method and device, equipment, storage medium and product
By recording the set of incompatible serial numbers in the distributed database nodes and performing bidirectional verification, the problem of misjudgment of compatibility during the gray-scale upgrade is solved, ensuring accurate compatibility judgment and data consistency in the case of discontinuous and incompatible serial numbers.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-26
- Publication Date
- 2026-04-10
AI Technical Summary
During the canary upgrade process of distributed databases, existing technologies cannot accurately determine the compatibility of business operations, especially in the case of discontinuous and incompatible sequence numbers, which can easily lead to misjudgment and data inconsistency issues.
By recording the set of incompatible sequence numbers of database nodes with inconsistent version numbers in the database node, bidirectional compatibility verification is performed to ensure accurate compatibility judgment without relying on the largest incompatible sequence number, and business messages are sent to other nodes for further verification before the compatibility judgment result is compatible.
It achieves accurate compatibility judgment even in cases of discontinuous and incompatible sequence numbers, avoiding misjudgment of business messages and data inconsistency issues, and improving the accuracy of data processing during gray-scale upgrades.
Smart Images

Figure CN121833306A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of distributed storage technology, and in particular to database-based processing methods, apparatus, devices, storage media, and products. Background Technology
[0002] During a canary rollout upgrade of a distributed database, each node is upgraded sequentially. Therefore, during the upgrade, old and new version nodes may coexist within the cluster. When users perform business operations involving the collaborative processing of multiple nodes, it is crucial to accurately determine whether the operation will be affected by the version upgrade.
[0003] Currently, existing technologies typically determine whether a node is compatible with modifications involved in business operations based on the maximum incompatibility number of each node. Here, an incompatibility number represents an incompatible modification that is incompatible with certain functions of the previous server version, and the incompatibility numbers increase sequentially.
[0004] However, the above method may misjudge the compatibility of business operations when encountering situations where incompatible sequence numbers are discontinuous due to patching. Therefore, a more accurate method for judging the compatibility of business operations is urgently needed to ensure that the distributed database can still accurately handle user business operations during the gray-scale upgrade. Summary of the Invention
[0005] This invention provides a database-based processing method, apparatus, device, storage medium, and product that ensures that the distributed database can accurately determine the compatibility of user business operations during gray-scale upgrades, thereby determining whether to process the business operations.
[0006] According to one aspect of the present invention, a database-based processing method is provided, comprising:
[0007] During the upgrade process of distributed database nodes, based on the first incompatible sequence number set involved in the first business message and the first incompatible sequence recorded by the first database node, the first compatibility judgment result of the first database node for the first business message is determined, wherein the first database node is the database node that receives the first business message; the first incompatible sequence is used to record the incompatible sequence number set of the second database node that is in a connected state with the first database node and whose version number is inconsistent with the first database node.
[0008] If the first compatibility judgment result is compatible, the first service message is sent to the second database node to obtain the second compatibility judgment result of the second database node for the first service message;
[0009] Based on the second compatibility judgment result, the compatibility of the first service message is determined, and based on the compatibility of the first service message, it is determined whether to process the first service message.
[0010] According to another aspect of the present invention, a database-based processing apparatus is provided, comprising:
[0011] The first compatibility result determination module is used to determine the first compatibility judgment result of the first database node for the first service message during the distributed database node upgrade process, based on the first incompatible sequence number set involved in the first service message and the first incompatible sequence recorded by the first database node. The first database node is the database node that receives the first service message. The first incompatible sequence is used to record the incompatible sequence number set of the second database node that is connected to the first database node and whose version number is inconsistent with that of the first database node.
[0012] The second compatibility result acquisition module is used to send the first service message to the second database node when the first compatibility judgment result is compatible, so as to obtain the second compatibility judgment result of the second database node on the first service message;
[0013] The business message compatibility determination module is used to determine the compatibility of the first business message based on the second compatibility judgment result, and to determine whether to process the first business message based on the compatibility of the first business message.
[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0015] At least one processor; and
[0016] A memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the database-based processing method according to any embodiment of the present invention.
[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the database-based processing method according to any embodiment of the present invention.
[0019] According to another aspect of the present invention, a computer program product is provided, the computer program product comprising a computer program that, when executed by a processor, implements the database-based processing method described in any embodiment of the present invention.
[0020] The technical solution of this invention, during the upgrade process of a distributed database node, determines the first compatibility judgment result of the first database node for the first business message based on the first incompatible sequence number set involved in the first business message and the first incompatible sequence recorded by the first database node. Here, the first database node is the database node receiving the first business message. The first incompatible sequence is used to record the incompatible sequence number set of second database nodes that are connected to the first database node and whose version numbers are inconsistent with the first database node. By recording the incompatible sequence number set corresponding to nodes connected to the first database node and whose version numbers are inconsistent with the first database node in the first database node, the first database node, when judging the compatibility of the business message, does not rely on the largest incompatible sequence number, but rather on all incompatible sequence numbers in the incompatible sequence number set. This ensures that even when the incompatible sequence numbers are not consecutive, the compatibility of the business message can still be accurately judged, and the current database... Before sending the first business message, the node can determine its compatibility by recording the set of incompatible sequence numbers of the business message recipients, thus identifying incompatibility issues in advance. Furthermore, since incompatible modifications in the business message may not be detected in the server version corresponding to the first database node (e.g., an older version cannot detect modifications introduced in a newer version), if the first compatibility determination result is compatible, the node sends the first business message to the second database node to obtain the second database node's second compatibility determination result. Based on this second compatibility determination result, the node determines the compatibility of the first business message and whether to process it. These steps, through bidirectional verification, achieve a more comprehensive verification of incompatible sequence numbers, effectively improving the accuracy of business message compatibility verification and avoiding data inconsistency issues caused by misjudgments of business messages.
[0021] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a flowchart of a database-based processing method provided according to Embodiment 1 of the present invention;
[0024] Figure 2 This is a flowchart of a database-based processing method according to Embodiment 2 of the present invention;
[0025] Figure 3 This is a flowchart of the sending node's processing of service messages according to an embodiment of the present invention;
[0026] Figure 4 This is a flowchart of the receiving node's processing of business messages according to an embodiment of the present invention;
[0027] Figure 5 This is a schematic diagram of a data set-based processing device according to Embodiment 3 of the present invention;
[0028] Figure 6 This is a schematic diagram of the structure of an electronic device that implements the dataset-based processing method of Embodiment 4 of the present invention. Detailed Implementation
[0029] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising," "having," "including," and any variations thereof are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0031] The concepts involved in this invention are:
[0032] Canary upgrade refers to the technique of upgrading each node in a distributed database one by one in sequence until all nodes are upgraded.
[0033] Incompatible modifications can be understood as differences in the data structure or business execution logic of one or more business data in the old and new versions, resulting in different execution results for the same business instruction in the old and new versions. In this case, it can be considered that there are incompatible modifications between the old and new versions.
[0034] Incompatibility numbers can be understood as unique identifiers used during server upgrades to show functional incompatibilities between the upgraded and previous versions. Each incompatible modification corresponds to an incompatibility number, which increments sequentially. For example, server version V1.0 has an incompatible modification 1, with an incompatibility number of 1. Server version V2.0 adds another incompatible modification 2, with incompatibility numbers 1 and 2. Server version V1.1 adds a patch to V1.0 that introduces a new incompatible modification 3, so V1.1's incompatibility numbers are 1 and 3.
[0035] Patching involves updating or repairing database software to resolve vulnerabilities or improve performance. Patching may result in incompatible serial numbers being discontinuous; for example, in V1.1, incompatible serial numbers 1 and 3 are discontinuous.
[0036] Using the maximum incompatibility sequence number to determine the compatibility of business messages has limitations. For example, server version V1.0 has incompatibility sequence number 1, and server version V2.0 has incompatibility sequences 1 and 2. However, if a vulnerability is later discovered in server version V1.0 and needs to be patched, the patched server version V1.1 will have incompatibility sequences 1 and 3. If database nodes deployed with server version V1.1 need to be upgraded to V2.0 during the canary upgrade process, if the old version node receives a business message involving incompatibility changes to sequence numbers 1 and 3, then if the incompatibility of the business message is determined based on the maximum incompatibility sequence number, since the maximum incompatibility sequence number of the old version node (V1.1) is 3, while the maximum incompatibility sequence number of the new version node (V2.0) is 2, and 3 is greater than 2, the old version node will mistakenly assume that the new version node is also compatible with the business message, thus causing a misjudgment of the business message compatibility.
[0037] Example 1
[0038] Figure 1 This is a flowchart illustrating a database-based processing method according to Embodiment 1 of the present invention. This embodiment is applicable to situations where different versions of database nodes transmit messages. The method can be executed by a database-based processing device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:
[0039] S101. During the upgrade process of the distributed database node, the first compatibility judgment result of the first database node for the first business message is determined based on the first incompatible sequence number set involved in the first business message and the first incompatible sequence recorded by the first database node.
[0040] Wherein, the first database node is the database node that receives the first service message; the first incompatible sequence is used to record the set of incompatible sequence numbers of the second database node that is connected to the first database node and whose version number (which can be understood as the server version number corresponding to the database node) is inconsistent with the first database node.
[0041] In this embodiment, the first business message can be a business instruction issued by a user during a canary upgrade of the distributed database, requiring the cooperation of multiple nodes in the distributed database. For example, it could be an instruction involving multiple distributed database nodes to perform CRUD operations. The first set of incompatible sequence numbers can include each incompatible sequence number involved in the first business message. Each incompatible sequence number represents an incompatibility between a function involved in the business message and a functional module in the database node processing the first business message. For example, if functional module 1 involved in the first business message has an incompatible sequence number 1 in the first database node, then the incompatible sequence number involved in the first business message is incompatible sequence number 1. The first database node can be a node in the distributed database cluster used to receive the first business message. The first database node will initially determine the compatibility of the first business message. If the determination result is compatible, it will send the first business message to other database nodes that need to cooperate to complete the business operation corresponding to the first business message, such as a second database node. Compatibility assessment results are categorized as follows: compatible (all modules verified successfully, some modules verified successfully + some modules not verified, all modules not verified) and incompatible (some modules verified successfully + some modules failed to verify, some modules not verified + some modules failed to verify, all modules failed to verify). For example, if the first compatibility assessment result is compatible, this could mean that the first database node successfully verified all modules involved in the first business message; it could also mean that the first database node successfully verified some modules involved in the first business message, but because the server version number corresponding to the first database node is low, it cannot verify the remaining modules involved in the first business message; or it could mean that the first database node cannot verify any of the modules involved in the first business message. Therefore, to ensure accurate assessment of the compatibility of the first business message, the compatibility of the first business message can be determined by combining the second compatibility assessment result of the second database node. For example, if the second compatibility assessment result is also compatible, then the first business message can be considered compatible. If the first compatibility judgment result is incompatible, then in this case, it may mean that the first database node failed to verify some modules or all modules involved in the first business message. In either case, it means that the first database node is incompatible with the first business message. Subsequently, the first business message can be determined as incompatible directly without sending it to other database nodes, and no processing of the first business message can be performed.
[0042] The database node records a first incompatible sequence, which contains a set of incompatible sequence numbers for database nodes that are connected to the current database node but have different version numbers (the incompatible sequence number set includes multiple incompatible sequence numbers). For example, if a second database node is connected to the first database node and their version numbers are different, then both the first and second database nodes record the incompatible sequence number set of the other node. This setting ensures that before data interaction between different nodes, the incompatible sequence number set of the business message is compared to see if all incompatible sequence numbers exist in the incompatible sequence number set of the other node. This determines whether the business message is compatible with the other node, thus avoiding sending the business message to incompatible nodes, reducing invalid communication, and improving communication efficiency.
[0043] The first incompatibility judgment result can be understood as the compatibility judgment result of the first database node and the database node with a different version number (e.g., the second database node) when processing the first business message. It does not affect the compatibility judgment result of the first database node and the database node with the same version number when processing the first business message, and it does not affect the business processing flow between the first database node and the database node with the same version number. The first incompatibility judgment result can include compatibility and incompatibility.
[0044] S102. If the first compatibility judgment result is compatible, send the first service message to the second database node to obtain the second compatibility judgment result of the second database node for the first service message.
[0045] In this embodiment, the second database node is a database node that has established a connection with the first database node. The second compatibility judgment result can be understood as the compatibility of the first database node with the first business message as judged from the perspective of the second database node; the second incompatibility judgment result can include compatibility and incompatibility. The second database node judges the compatibility of the first database node with the first business message to avoid the problem of incomplete coverage of single-node judgment results. For example, the incompatibility numbers involved in the first business message are 1 and 2, where incompatibility number 1 corresponds to the modification of module 1, and incompatibility number 2 corresponds to the modification of module 2. However, the incompatibility numbers of the first database node itself are 1 and 3, and there is no incompatibility modification related to module 2. Therefore, from the perspective of the first database node, it is impossible to verify incompatibility number 2 carried in the first business message. The first database node successfully verifies module 1 but not module 2. Based on the first compatibility result, it is determined to be compatible. Then, by sending the first business message to the second database node connected to the first database node, the second database node judges the compatibility of the first business message again, thereby ensuring more comprehensive coverage of the compatibility judgment result for the first business message.
[0046] S103. Based on the second compatibility judgment result, determine the compatibility of the first service message, and determine whether to process the first service message based on its compatibility.
[0047] In this embodiment, if the second compatibility judgment result is compatible, the compatibility of the first service message is determined to be compatible, and the first service message can be processed subsequently; if the second compatibility judgment result is incompatible, the compatibility of the first service message is determined to be incompatible, the first service message will not be processed subsequently, and a prompt message can be returned to indicate that the first service message cannot be processed during the distributed database upgrade. Optionally, when determining the second compatibility judgment result in the second database node, the second database node can first determine whether its second version number is consistent with the first version number of the first database node, and select the corresponding processing method to determine the second compatibility judgment result based on the judgment result. For example, if the version numbers of the second database node and the first database node are inconsistent, it indicates that the two nodes are on different server versions. The second database node can be an upgraded node. If the second database node includes incompatible modifications related to module 2, then when judging the first business message, the second database node can find that the first business message involves incompatible modifications to module 2 corresponding to incompatible sequence number 2. However, the set of incompatible sequence numbers of the first database node recorded in the second database node only includes incompatible sequence numbers 1 and 3, indicating that the first database node is incompatible with the first business message. In this case, the second compatibility judgment result is set to incompatible. If the version numbers of the second database node and the first database node are consistent, it indicates that the two nodes are on the same server version, and the second compatibility judgment result can be directly determined as compatible.
[0048] Furthermore, if the first database node has only established connections with database nodes of the same version, then if the second compatibility judgment result is compatible, the compatibility of the first business message can be determined as compatible. If the first database node has also established connections with database nodes of different versions, then the compatibility of the first business message needs to be determined based on the compatibility judgment results of the different versions of database nodes for the first business message. For example, database nodes 1, 2, and 3 have established connections, where database nodes 1 and 2 are of the same version, and database nodes 1 and 3 are of different versions. For business message 1, if database node 1's first compatibility judgment result for business message 1 is compatible, then database node 2's second compatibility judgment result for business message 1 is also compatible. If the third compatibility judgment result of database node 3 for business message 1 is also compatible, then the compatibility of business message 1 can be determined as compatible. If the third compatibility judgment result of database node 3 for business message 1 is incompatible, then the compatibility of business message 1 needs to be determined as incompatible. This invention does not limit the processing method for incompatible business message 1. Relevant strategies can be pre-formulated according to the actual application scenario. For example, if the compatibility of business message 1 is incompatible, all three database nodes can be instructed not to process business message 1. Alternatively, if database node 1 and database node 2 have already processed business message 1, then a rollback operation relative to business message 1 can be performed in database node 1 and database node 2 to ensure data consistency among the database nodes.
[0049] This invention provides a database-based processing method. During the upgrade of a distributed database node, based on a first set of incompatible sequence numbers involved in a first business message and a first incompatible sequence recorded by the first database node, a first compatibility judgment result of the first database node for the first business message is determined. The first database node is the database node receiving the first business message. The first incompatible sequence is used to record the set of incompatible sequence numbers of second database nodes that are connected to the first database node and whose version numbers are inconsistent with the first database node. By recording the set of incompatible sequence numbers corresponding to nodes connected to the first database node and whose version numbers are inconsistent with the first database node in the first database node, the first database node, when judging the compatibility of a business message, does not rely on the largest incompatible sequence number, but rather on all incompatible sequence numbers in the incompatible sequence number set. This ensures that even when the incompatible sequence numbers are not consecutive, the compatibility of the business message can still be accurately judged. Before sending the first business message, the current database node can determine the compatibility of the first business message by recording the set of incompatible sequence numbers of the business message recipients, thus identifying incompatibility issues in advance. Furthermore, since incompatible modifications involved in the business message may not be detected in the server version corresponding to the first database node (e.g., an older version cannot detect modifications introduced in a newer version), if the first compatibility determination result is compatible, the first business message is sent to the second database node to obtain the second database node's second compatibility determination result. Based on the second compatibility determination result, the compatibility of the first business message is determined, and whether to process the first business message is determined based on its compatibility. These steps, through bidirectional verification, achieve a more comprehensive verification of incompatible sequence numbers, effectively improving the accuracy of business message compatibility verification and avoiding data inconsistency issues caused by misjudgments of business messages.
[0050] In some embodiments, the first database node also records a first connection count, wherein the first connection count represents the number of database nodes that are connected to the first database node but whose version numbers are inconsistent with those of the first database node. By setting the first connection count, the current connection status of the first database node can be quickly identified, providing a reference for other nodes to establish connections with the first database node subsequently.
[0051] For example, the initial value of the first connection count is 0. If the first database node has not established a connection with any node, and the second database node requests to establish a connection with the first database node, if the version number of the second database node is the same as that of the first database node, then after the two nodes establish a connection, the first connection count will still maintain the initial value of 0; if the version number of the second database node is different from that of the first database node, then after the two nodes establish a connection, the first connection count will increase, i.e., become 1.
[0052] Example 2
[0053] Figure 2 This is a flowchart illustrating a database-based processing method according to Embodiment 2 of the present invention. This embodiment is a refinement of the previous embodiment. This embodiment uses the example of a second database having a different version number from the first database for illustration. Figure 2 As shown, the method includes:
[0054] S201. During the upgrade of the distributed database node, in response to the fact that the first incompatible sequence number set involved in the first business message is included in the second incompatible sequence number set of the second database node, the first compatibility judgment result of the first database node for the first business message is determined to be compatible.
[0055] In this embodiment, the version numbers of the second database node and the first database node are different. Therefore, when the two nodes establish a connection, they will record the incompatible sequence number set of the other node respectively. The first incompatible sequence includes the second incompatible sequence number set of the second database node. The second incompatible sequence number set records all incompatible sequence numbers that exist in the database version corresponding to the second database node.
[0056] In this embodiment, to simplify the judgment process of the first compatibility judgment result, a first flag bit can be introduced. The first flag bit can be used to indicate the compatibility of the current database node with database nodes of different version numbers when processing the current business message. The value of the first flag bit can be determined based on the first number of connections of the first database node, the first set of incompatible sequence numbers, and the second set of incompatible sequence numbers.
[0057] For example, such as Figure 3As shown, when the first number of connections is 0, the first flag is the second preset value (e.g., TRUE); or, when the first number of connections is not 0 and the incompatible sequence number carried by the first service message does not exist in the first incompatible sequence (i.e., the incompatible sequence number in the first incompatible sequence number set does not exist in the second incompatible sequence number set), the first flag is the second preset value. This can be understood as setting the first flag to the second preset value when the first compatibility judgment result is incompatible; wherein, the default value of the first flag is the first preset value (e.g., FALSE).
[0058] For example, the server version number corresponding to the first database node is version 1, and there are two incompatible modifications, corresponding to incompatible modification numbers 1 and 3 respectively; the server version number corresponding to the second database node is version 2, and there are two incompatible modifications, corresponding to incompatible modification numbers 1 and 2 respectively; when the first database node establishes a connection with the second database node, it will record incompatible sequence numbers 1 and 2 in the first incompatible sequence; as follows: Figure 3 As shown, in this case, the number of first connections is not 0. If the incompatible sequence numbers carried in the first service message are 1 and 2, the first database node believes that both incompatible sequence numbers 1 and 2 exist in the first incompatible sequence and will not set the first flag bit to the second preset value. In this case, the version number of the receiving node (i.e. the second database node) is not the first version number and the first flag bit is not equal to the second preset value. At this time, the first database node will send a message to the second database node, which corresponds to the case where the first compatibility judgment result is compatible.
[0059] Optionally, if not all incompatible sequences in the first incompatible sequence set are included in the second incompatible sequence set, the value of the first flag bit is set to a second preset value, and the default value of the first flag bit is the first preset value. The method further includes: responding to the first flag bit being set to the second preset value, the first compatibility judgment result is incompatible; if the first compatibility judgment result is incompatible, the compatibility of the first business message is determined to be incompatible. The advantage of this setting is that the compatibility of the second database node with the first business message can be judged in advance, avoiding sending incompatible business messages to the second database node and causing data inconsistency among the nodes.
[0060] For example, if the incompatible sequence numbers carried in the first business message are 1 and 3, such as Figure 3As shown, the first database node will detect that the incompatible sequence number 3 does not exist in the first incompatible sequence, so it will set the first flag to the second preset value. In this case, the first database node will refuse to send messages to the second database node. That is, in the case where the first compatibility judgment result is incompatible, the first database node will consider the first business message to be incompatible with the second database node.
[0061] S202, if the first compatibility judgment result is compatible, send the first service message to the second database node to obtain the second compatibility judgment result of the second database node for the first service message.
[0062] In this embodiment, the second database node records the first version number of the first database node and the third incompatible sequence number set of the first database node; wherein, the third incompatible sequence number set records all incompatible sequence numbers existing in the database version corresponding to the first database node.
[0063] In this embodiment, the second database node includes a second incompatible sequence, which is used to record the set of incompatible sequence numbers of database nodes that are connected to the second database node and whose version numbers are inconsistent with those of the second database node; in this embodiment, the second incompatible sequence includes a third incompatible sequence number set of the first database node.
[0064] Optionally, if the first version number differs from the second version number of the second database node, and the first incompatible sequence number set is included in the third incompatible sequence number set, then the second compatibility judgment result is compatible; if not all incompatible sequences in the first incompatible sequence number set are included in the third incompatible sequence number set, then the second compatibility judgment result is incompatible. The advantage of this setting is that by having the second database node re-judge the compatibility of the first business message, more comprehensive scenarios can be covered, ensuring a more accurate judgment on the compatibility of the first business message.
[0065] For example, such as Figure 4The flowchart shows the processing flow of the first service message by the receiving node (second database node). Since the sender version number (i.e., the first version number) is different from the second version number, the second database node will determine whether the incompatible sequence number involved in the first service message exists in the second incompatible sequence. As can be seen from the above steps, the incompatible modification sequence numbers corresponding to the first database node are 1 and 3. Therefore, the second incompatible sequence records incompatible sequence numbers 1 and 3, while the incompatible sequence numbers involved in the first service message are 1 and 2. In this case, the second database node will consider the first database node to be incompatible with the first service message, and the second database node will report an error and output relevant prompt information, which corresponds to the second compatibility judgment result being incompatible.
[0066] Furthermore, if the incompatible sequence number involved in the first business message is only 1, the first compatibility judgment result is also compatible. Therefore, the first data node will also send the first business message to the second data node. At this time, the incompatible sequence number involved in the first business message exists in the second incompatible sequence. Therefore, the second database node will consider the first database node to be compatible with the first business message, which corresponds to the case where the second compatibility judgment result is compatible. At this time, the second database node can parse the message or return the second incompatibility judgment result to the first database node. This invention uses returning the second incompatibility judgment result to the first database node as an example for explanation, and does not limit the specific processing method.
[0067] S203. Based on the second compatibility judgment result, determine the compatibility of the first service message, and determine whether to process the first service message based on its compatibility.
[0068] If the second compatibility judgment result is compatible, the compatibility of the first service message is determined to be compatible; if the second compatibility judgment result is incompatible, the compatibility of the first service message is determined to be incompatible.
[0069] In this embodiment of the invention, when the version numbers of the second database node and the first database node are inconsistent, the method is described as follows: The first database node determines whether the first set of incompatible sequence numbers involved in the first service message is entirely included in the second set of incompatible sequence numbers of the second database node; that is, it determines whether the value of the first flag bit is a first preset value. This determines the first compatibility judgment result. If the first compatibility judgment result is incompatible, the compatibility of the first service message is directly determined to be incompatible, and no further processing is performed on the first service message. This achieves early judgment of the compatibility of the first service message, avoiding invalid communication. If the first compatibility judgment result is compatible, then the message is sent to the second database node. The compatibility of the first business message is determined based on the second compatibility judgment result, achieving two-way verification. The second compatibility judgment result is determined as follows: if the first version number and the second version number are different, and the first incompatible sequence number set is included in the third incompatible sequence number set, then the second compatibility judgment result is compatible; if not all incompatible sequence numbers in the first incompatible sequence number set are included in the third incompatible sequence number set, then the second compatibility judgment result is incompatible. This method can cover a wider range of application scenarios and can make accurate judgments on the compatibility of the first business message, thereby further ensuring data consistency between nodes during the distributed database upgrade process.
[0070] In some embodiments, the method further includes: when the second database node determines the second compatibility judgment result, if the second version number of the second database node is the same as the first version number, then the second compatibility judgment result is compatible. The advantage of this setting is that if the version numbers of the second database node and the first database node are the same, then the two nodes have consistent compatibility with the first business message. If the first compatibility judgment result is compatible, the second compatibility judgment result can be directly assumed to be compatible as well, thereby simplifying the judgment process and improving data processing efficiency.
[0071] In some embodiments, the method further includes setting the value of the first flag bit to a second preset value when the first number of connections is zero.
[0072] In this embodiment, the first connection count is zero, indicating that the database node that has established a connection with the first database node has the same version number as the first database node. Figure 3 As shown, in this case, the first database node can send messages directly. This setting simplifies the judgment process and improves data processing efficiency.
[0073] In some embodiments, the method further includes: when the first connection count is zero, if a third database node requests to establish a connection with the first database node, and if the third version number of the third database node is inconsistent with the first version number of the first database node, recording the third version number of the third database node and the fourth incompatible sequence number set of the third database node, and accumulating the first connection count; when the first connection count is not zero, if a fourth database node requests to establish a connection with the first database node, and if the fourth version number of the fourth database node is inconsistent with both the first version number and the third version number, refusing to establish a connection with the fourth database node. The advantage of this setting is that the above judgment process can limit a database node to establishing connections with at most one different version of the database node, thereby ensuring that the database node has sufficient storage space and computing resources during the database upgrade process, and avoiding upgrade failure due to exhaustion of storage or computing resources during the database upgrade process.
[0074] In this embodiment, the fourth incompatible sequence number set records all incompatible sequence numbers that exist in the database version corresponding to the third database node.
[0075] Optionally, the method further includes: if the fourth version number of the fourth database node is consistent with the third version number, then agreeing to establish a connection with the fourth database node. In this case, it is not necessary to record the fourth version number of the fourth database node or the set of incompatible sequence numbers of the fourth database node; instead, the number of the first connection needs to be accumulated. This setting can avoid the invalid occupation of storage space.
[0076] Optionally, the method further includes: when the first connection count is zero, if a fifth database node requests to establish a connection with the first database node, and the fifth version number of the fifth database node is consistent with the first version number, the fifth version number and the fifth incompatible sequence number set of the fifth database node are not recorded, and the first connection count is not accumulated. This setting ensures that nodes of the same version do not need to record each other's version information (e.g., version number and incompatible sequence number set) when establishing a connection, further optimizing storage space usage. Furthermore, nodes of the same version have the same compatibility with business messages, and this setting will not cause changes in the compatibility judgment result.
[0077] Example 3
[0078] Figure 5 This is a schematic diagram of a database-based processing device provided in Embodiment 3 of the present invention. Figure 5As shown, the device includes: a first compatibility result determination module 501, a second compatibility result acquisition module 502, and a service message compatibility determination module 503.
[0079] The first compatibility result determination module is used to determine the first compatibility judgment result of the first database node for the first service message during the distributed database node upgrade process, based on the first incompatible sequence number set involved in the first service message and the first incompatible sequence recorded by the first database node. The first database node is the database node that receives the first service message. The first incompatible sequence is used to record the incompatible sequence number set of the second database node that is connected to the first database node and whose version number is inconsistent with that of the first database node.
[0080] The second compatibility result acquisition module is used to send the first service message to the second database node when the first compatibility judgment result is compatible, so as to obtain the second compatibility judgment result of the second database node on the first service message;
[0081] The business message compatibility determination module is used to determine the compatibility of the first business message based on the second compatibility judgment result, and to determine whether to process the first business message based on the compatibility of the first business message.
[0082] This invention provides a database-based processing device. During the upgrade of a distributed database node, based on a first set of incompatible sequence numbers involved in a first business message and a first incompatible sequence recorded by the first database node, a first compatibility judgment result of the first database node for the first business message is determined. The first database node is the database node receiving the first business message. The first incompatible sequence is used to record the set of incompatible sequence numbers of database nodes connected to the first database node but with version numbers inconsistent with the first database node. By recording the set of incompatible sequence numbers corresponding to nodes connected to the first database node but with inconsistent version numbers in the first database node, the first database node, when judging the compatibility of a business message, does not rely on the largest incompatible sequence number, but rather on all incompatible sequence numbers in the incompatible sequence number set. This ensures that even when incompatible sequence numbers are discontinuous, the compatibility of the business message can still be accurately judged. Before sending the first business message, the front database node can determine the compatibility of the first business message by recording the set of incompatible sequence numbers of the business message recipients, thus identifying incompatibility issues in advance. Furthermore, since incompatible modifications involved in the business message may not be detected in the server version corresponding to the first database node (e.g., an older version cannot detect modifications introduced in a newer version), if the first compatibility determination result is compatible, the first business message is sent to the second database node to obtain the second database node's second compatibility determination result. Based on the second compatibility determination result, the compatibility of the first business message is determined, and whether to process the first business message is determined based on its compatibility. These steps, through bidirectional verification, achieve a more comprehensive verification of incompatible sequence numbers, effectively improving the accuracy of business message compatibility verification and avoiding data inconsistency issues caused by misjudgments of business messages.
[0083] Optionally, the first incompatible sequence includes the second incompatible sequence number set of the second database node; the first compatibility result determination module is specifically used for:
[0084] During the upgrade of a distributed database node, in response to the first incompatible sequence number set involved in the first business message being included in the second incompatible sequence number set of the second database node, the first compatibility judgment result of the first database node for the first business message is determined to be compatible.
[0085] Optionally, if not all incompatible numbers in the first incompatible number set are included in the second incompatible number set, the value of the first flag bit is set to a second preset value; the default value of the first flag bit is a first preset value; the device further includes:
[0086] The incompatibility judgment module is used to respond to the value of the first flag bit being a second preset value, and the first compatibility judgment result being incompatible;
[0087] The business message incompatibility determination module is used to determine the compatibility of the first business message as incompatible if the first compatibility judgment result is incompatible.
[0088] Optionally, the second database node records a first version number of the first database node and a third set of incompatible sequence numbers for the first database node; if the first version number is different from the second version number of the second database node, and the first set of incompatible sequence numbers is included in the third set of incompatible sequence numbers, then the second compatibility judgment result is compatible; if not all incompatible sequence numbers in the first set of incompatible sequence numbers are included in the third set of incompatible sequence numbers, then the second compatibility judgment result is incompatible; the business message compatibility determination module includes:
[0089] The first judgment unit is configured to determine the compatibility of the first service message as compatible if the second compatibility judgment result is compatible, and to determine the compatibility of the first service message as incompatible if the second compatibility judgment result is incompatible.
[0090] The second determination unit is used to determine whether to process the first service message based on its compatibility.
[0091] Optionally, the first database node further records a first connection count, which represents the number of database nodes that are connected to the first database node and whose version numbers are inconsistent with those of the first database node; the device further includes:
[0092] The first flag setting module is used to set the value of the first flag to the second preset value when the first number of connections is zero.
[0093] Optionally, the device further includes:
[0094] The first connection module is used to, when the first connection count is zero, if a third database node requests to establish a connection with the first database node, and the third version number of the third database node is inconsistent with the first version number of the first database node, record the third version number of the third database node and the fourth incompatible sequence number set of the third database node, and accumulate the first connection count.
[0095] The second connection module is configured to refuse to establish a connection with the fourth database node if the fourth database node requests to establish a connection with the first database node when the first connection number is not zero, provided that the fourth version number of the fourth database node is inconsistent with both the first version number and the third version number.
[0096] The database-based processing device provided in the embodiments of the present invention can execute the database-based processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.
[0097] Example 4
[0098] Figure 6 A schematic diagram of an electronic device 600 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0099] like Figure 6 As shown, the electronic device 600 includes at least one processor 601 and a memory, such as a read-only memory (ROM) 602 or a random access memory (RAM) 603, communicatively connected to the at least one processor 601. The memory stores computer programs executable by the at least one processor. The processor 601 can perform various appropriate actions and processes based on the computer program stored in the ROM 602 or loaded into the RAM 603 from storage unit 608. The RAM 603 may also store various programs and data required for the operation of the electronic device 600. The processor 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0100] Multiple components in electronic device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of displays, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows electronic device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0101] Processor 601 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 601 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, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 601 performs the various methods and processes described above, such as database-based processing methods.
[0102] In some embodiments, the database-based processing method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by processor 601, one or more steps of the database-based processing method described above may be performed. Alternatively, in other embodiments, processor 601 may be configured to perform the database-based processing method by any other suitable means (e.g., by means of firmware).
[0103] Various embodiments 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-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0104] Computer programs used to implement 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, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0105] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0106] To provide interaction with a user, the systems and techniques described herein 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 pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; 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 sound input, voice input, or tactile input).
[0107] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0108] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0109] This disclosure provides a computer program product, including a computer program that, when executed by a processor, implements the database-based processing method provided in the above embodiments.
[0110] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0111] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. 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 substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A database-based processing method, characterized in that, include: During the upgrade process of distributed database nodes, based on the first incompatible sequence number set involved in the first business message and the first incompatible sequence recorded by the first database node, the first compatibility judgment result of the first database node for the first business message is determined, wherein the first database node is the database node that receives the first business message; the first incompatible sequence is used to record the incompatible sequence number set of the second database node that is in a connected state with the first database node and whose version number is inconsistent with the first database node. If the first compatibility judgment result is compatible, the first service message is sent to the second database node to obtain the second compatibility judgment result of the second database node for the first service message; Based on the second compatibility judgment result, the compatibility of the first service message is determined, and based on the compatibility of the first service message, it is determined whether to process the first service message.
2. The database-based processing method according to claim 1, characterized in that, The first incompatible sequence includes the second incompatible sequence number set of the second database node; The step of determining the first compatibility judgment result of the first database node for the first service message based on the first incompatible sequence number set involved in the first service message and the first incompatible sequence recorded by the first database node includes: In response to the fact that the first incompatible sequence number set involved in the first service message is included in the second incompatible sequence number set of the second database node, the first compatibility judgment result of the first database node for the first service message is determined to be compatible.
3. The database-based processing method according to claim 2, characterized in that, If not all incompatible numbers in the first incompatible number set are included in the second incompatible number set, the value of the first flag bit is set to the second preset value. The default value of the first flag bit is the first preset value; The method further includes: In response to the value of the first flag bit being a second preset value, the first compatibility judgment result is incompatible; If the first compatibility judgment result is incompatible, the compatibility of the first service message is determined to be incompatible.
4. The database-based processing method according to claim 1, characterized in that, The second database node records the first version number of the first database node and the third incompatible sequence number set of the first database node; if the first version number is different from the second version number of the second database node, and the first incompatible sequence number set is included in the third incompatible sequence number set, then the second compatibility judgment result is compatible; if not all incompatible sequence numbers in the first incompatible sequence number set are included in the third incompatible sequence number set, then the second compatibility judgment result is incompatible. The step of determining the compatibility of the first service message based on the second compatibility judgment result includes: If the second compatibility judgment result is compatible, the compatibility of the first service message is determined to be compatible; if the second compatibility judgment result is incompatible, the compatibility of the first service message is determined to be incompatible.
5. The database-based processing method according to claim 3, characterized in that, The first database node also records a first connection count, which is used to represent the number of database nodes that are connected to the first database node and whose version numbers are inconsistent with those of the first database node. The method further includes: When the first number of connections is zero, the value of the first flag is set to the second preset value.
6. The database-based processing method according to claim 5, characterized in that, The method further includes: If a third database node requests to establish a connection with the first database node when the first connection count is zero, and the third version number of the third database node is inconsistent with the first version number of the first database node, the third version number of the third database node and the fourth incompatible sequence number set of the third database node are recorded, and the first connection count is accumulated. If the first number of connections is not zero, and a fourth database node requests to establish a connection with the first database node, the connection with the fourth database node will be refused if the fourth version number of the fourth database node is inconsistent with both the first version number and the third version number.
7. A database-based processing device, characterized in that, include: The first compatibility result determination module is used to determine the first compatibility judgment result of the first database node for the first service message during the distributed database node upgrade process, based on the first incompatible sequence number set involved in the first service message and the first incompatible sequence recorded by the first database node. The first database node is the database node that receives the first service message. The first incompatible sequence is used to record the incompatible sequence number set of the second database node that is connected to the first database node and whose version number is inconsistent with that of the first database node. The second compatibility result acquisition module is used to send the first service message to the second database node when the first compatibility judgment result is compatible, so as to obtain the second compatibility judgment result of the second database node on the first service message; The business message compatibility determination module is used to determine the compatibility of the first business message based on the second compatibility judgment result, and to determine whether to process the first business message based on the compatibility of the first business message.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the database-based processing method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the database-based processing method according to any one of claims 1-6.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the database-based processing method according to any one of claims 1-6.