Distributed database upgrading method and device, electronic equipment and storage medium

Through an automated distributed database upgrade method, an upgrade script is constructed based on the comparison of topology files and system information, which solves the low efficiency problem caused by manual script writing in the existing technology and realizes efficient database version upgrade.

CN120723286AActive Publication Date: 2025-09-30TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511220855.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-29
Publication Date
2025-09-30
Estimated Expiration
2045-08-29

AI Technical Summary

Technical Problem

The existing distributed database version upgrade method relies on manually written upgrade scripts, resulting in low upgrade efficiency and requiring a lot of testing.

Method used

By determining system information based on the topology file of the distributed database, and building an upgrade script based on the comparison results, the upgrade of the distributed database can be automatically configured.

Benefits of technology

It reduces labor costs, reduces the complexity of version upgrades, and improves the upgrade efficiency of distributed databases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120723286A_ABST
    Figure CN120723286A_ABST
Patent Text Reader

Abstract

The invention discloses a distributed database upgrading method and device, electronic equipment and a storage medium. The method comprises the steps of determining first system information of a first node based on a topological file of a first distributed database; the first distributed database is a to-be-upgraded distributed database, and the first distributed database is in a normal operation state; operating a second node of the second distributed database, and determining second system information of the second node; the second distributed database is an upgrading target of the first distributed database; determining a comparison result of the first system information and the second system information; the comparison result is used for describing the system configuration difference between the first distributed database and the second distributed database; and constructing script information of the second distributed database based on a comparison result, and upgrading the first distributed database based on the script information. According to the method, the upgrading script for upgrading the distributed database is automatically configured, and the upgrading efficiency of the distributed database is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database technology, and in particular to a method, device, electronic device and storage medium for upgrading a distributed database. Background Art

[0002] Distributed database version upgrades are a critical function in database system management. Their significance lies not only in acquiring new features but also in optimizing core aspects such as performance, security, and stability. Automating version upgrades quickly and stably is particularly important in database development and maintenance.

[0003] The current method for upgrading distributed databases typically involves selecting the required scripts from a library of upgrade scripts based on the current and target database versions. These scripts are then executed on the distributed database to modify incompatible configurations, achieving the upgrade. However, this method requires the upgrade script library to be prepared in advance and manually written by developers. Furthermore, upgrading between any two versions requires extensive testing, significantly impacting the efficiency of distributed database upgrades. Summary of the Invention

[0004] The present invention provides a distributed database upgrade method, device, electronic device and storage medium to realize automatic configuration of distributed database upgrade scripts and improve the upgrade efficiency of the distributed database.

[0005] According to one aspect of the present invention, a method for upgrading a distributed database is provided, the method comprising:

[0006] Determining first system information of a first node based on a topology file of a first distributed database; the first distributed database is a distributed database to be upgraded, and the first distributed database is in a normal operating state; the first node is one of all nodes in the first distributed database;

[0007] Running a second node of a second distributed database and determining second system information of the second node; the second distributed database is an upgrade target of the first distributed database; the second node is one of all nodes in the second distributed database;

[0008] Determine a comparison result between the first system information and the second system information; the comparison result is used to describe a system configuration difference between the first distributed database and the second distributed database;

[0009] Script information of the second distributed database is constructed based on the comparison result, and the first distributed database is upgraded based on the script information.

[0010] According to another aspect of the present invention, there is provided a distributed database upgrade device, the device comprising:

[0011] A first information determination module is configured to determine first system information of a first node based on a topology file of a first distributed database; the first distributed database is a distributed database to be upgraded, and the first distributed database is in a normal operating state; the first node is one of all nodes in the first distributed database;

[0012] a second information determination module, configured to operate a second node of a second distributed database and determine second system information of the second node; the second distributed database being an upgrade target of the first distributed database; and the second node being one of all nodes in the second distributed database;

[0013] A result determination module is configured to determine a comparison result between the first system information and the second system information; the comparison result is used to describe a system configuration difference between the first distributed database and the second distributed database;

[0014] An upgrading module is used to construct script information of the second distributed database based on the comparison result, and upgrade the first distributed database based on the script information.

[0015] According to another aspect of the present invention, an electronic device is provided, comprising:

[0016] at least one processor; and

[0017] a memory communicatively connected to the at least one processor; wherein,

[0018] The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can execute the distributed database upgrade method described in any embodiment of the present invention.

[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the distributed database upgrade method described in any embodiment of the present invention when executed.

[0020] The technical solution of an embodiment of the present invention is to determine the first system information of the first node based on the topology file of the first distributed database; the first distributed database is the distributed database to be upgraded, and the first distributed database is in normal operating state; the first node is one of all nodes in the first distributed database; the second node of the second distributed database is run to determine the second system information of the second node; the second distributed database is the upgrade target of the first distributed database; the second node is one of all nodes in the second distributed database; so as to accurately determine the comparison results for describing the system configuration differences between the first distributed database and the second distributed database based on the first system information and the second system information, thereby constructing the script information of the second distributed database based on the comparison results, realizing automatic configuration of the upgrade script for the distributed database upgrade, saving labor costs, and further upgrading the first distributed database based on the script information, reducing the complexity of the version upgrade operation, and improving the upgrade efficiency of the distributed database.

[0021] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0023] Figure 1 is a flow chart of a distributed database upgrade method provided according to an embodiment of the present invention;

[0024] Figure 2 is a schematic diagram of the operation of a first distributed database and a second distributed database applicable to an embodiment of the present invention;

[0025] Figure 3 is a flowchart of another distributed database upgrade method provided according to an embodiment of the present invention;

[0026] Figure 4 1 is a schematic structural diagram of a distributed database upgrade device provided according to an embodiment of the present invention;

[0027] Figure 5 3 is a schematic structural diagram of an electronic device for implementing the distributed database upgrade method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0029] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0030] Example 1

[0031] Figure 1 This is a flow chart of a distributed database upgrade method provided by an embodiment of the present invention. This embodiment is applicable to the case of upgrading a distributed database. The method can be executed by a distributed database upgrade device. The distributed database upgrade device can be implemented in the form of hardware and / or software. The distributed database upgrade device can be configured in any electronic device with network communication function. Figure 1 As shown, the distributed database upgrade method of the present invention includes the following process:

[0032] S110. Determine first system information of a first node based on a topology file of a first distributed database; the first distributed database is a distributed database to be upgraded, and the first distributed database is in a normal operating state; the first node is one of all nodes in the first distributed database.

[0033] The first system information may be understood as information of all system objects contained in the first distributed database.

[0034] Specifically, based on the topology file of the first distributed database, determining the first system information of the first node may include: parsing the topology file of the first distributed database to obtain a parsing result; the parsing result includes multiple nodes and node system information; selecting a node from the parsing result as the first node, and determining the node system information associated with the first node as the first system information of the first node.

[0035] For example, Figure 2 As shown, the distributed database to be upgraded is the first distributed database of the present invention, and the multiple nodes may include CN nodes, DN nodes, DN standby nodes, DN master nodes and GTM standby nodes; the CN node can be selected as the first node from the multiple nodes.

[0036] S120: Run a second node of a second distributed database and determine second system information of the second node; the second distributed database is an upgrade target of the first distributed database; the second node is one of all nodes in the second distributed database.

[0037] The second system information can be understood as the information of all system objects contained in the second distributed database. The second node can be understood as a special state after the second distributed database is initialized. For example, Figure 2 As shown, the minimalist distributed database is the second distributed database of the present invention, and the minimalist node is the second node of the present invention.

[0038] Specifically, the second distributed database is run in a minimalist manner. The minimalist manner can be understood as a manner of running one of all nodes in the second distributed database, and the node of the second distributed database run in the minimalist manner is used as the second node, and the second system information of the second node is obtained at the same time.

[0039] S130: Determine a comparison result between the first system information and the second system information; the comparison result is used to describe the system configuration difference between the first distributed database and the second distributed database.

[0040] Specifically, the same type of data in the first system information and the second system information are compared to determine the system configuration differences between the first distributed database and the second distributed database, and the system configuration differences between the first distributed database and the second distributed database are used as the comparison results of the first system information and the second system information, so as to facilitate the subsequent construction of the script information of the second distributed database based on the comparison results.

[0041] Furthermore, the first system information may be used to describe first object information of a system object of the first distributed database. The second system information may be used to describe second object information of a system object of the second distributed database. System objects may include system namespaces, system types, system functions, system tables, and system views.

[0042] Optionally, determining the comparison result of the first system information and the second system information may include: associating and comparing the first object information and the second object information to determine the comparison result of the first system information and the second system information; each associating and comparing process is to compare the same system objects of the first distributed database and the second distributed database.

[0043] Specifically, by comparing the object information of the same system objects in the first distributed database and the second distributed database, the system configuration differences of each system object between the first distributed database and the second distributed database can be effectively distinguished, and the system configuration differences between the first distributed database and the second distributed database can be better determined, thereby ensuring the accuracy of the comparison results.

[0044] S140: Construct script information of the second distributed database based on the comparison result, and upgrade the first distributed database based on the script information.

[0045] Specifically, based on the system configuration differences between the first distributed database and the second distributed database in the comparison results, script description data is determined; and the script data configuration tool is guided to construct script information for the second distributed database based on the script description data. The script description data is used to describe the descriptive information used by the script data configuration tool to construct various script information.

[0046] Optionally, constructing the script information of the second distributed database based on the comparison results may include: constructing the script information of the second distributed database for each system object in the comparison results according to preset rules; the preset rules are to construct the script information of the second distributed database one by one according to the preset order of each type of system object, and to construct the script information of the second distributed database system object for the same type of system object according to the identification information or parameter information corresponding to the system object.

[0047] Specifically, since various system objects may have dependencies with each other, they need to be sorted according to the following preset rules when constructing script information. The preset rules can be:

[0048] A. Construct the script information of the second distributed database one by one according to the preset order of each type of system object. The preset order can be system namespace, system type, system function, system table and system view.

[0049] B. For the same type of system object, construct the script information of the second distributed database system object according to the identification information or parameter information corresponding to the system object.

[0050] 1. If the system object is a system namespace, you can sort it in alphabetical order according to the name of the system namespace as the order of constructing script information for each system namespace.

[0051] 2. If the system object is a system function, the order of constructing the script information of each system function can be sorted according to the number of parameter information of the system function.

[0052] 3. The identification information of the system objects can be sorted, and the sorting results can be used as the order of the system object construction script information.

[0053] In addition, after the above sorting process is completed, if it is detected that there is a dependency relationship between system objects, the script information of the dependent system objects is constructed first.

[0054] In an embodiment of the present invention, each system object in the comparison result is constructed into the script information of the second distributed database according to preset rules; and the preset rules are to construct the script information of the second distributed database one by one according to the preset order of each type of system object, and to construct the script information of the second distributed database system object according to the identification information or parameter information corresponding to the system object of the same type of system object, thereby ensuring the accuracy of the script information during the construction process, and further ensuring the accuracy of the complete script information of the second distributed database finally determined.

[0055] Further, optionally, upgrading the first distributed database based on the script information may include: uninstalling the started second distributed database, and performing a configuration smooth upgrade on the first distributed database according to the topology file of the first distributed database and the script information of the second distributed database. The specific smooth upgrade may include the following process:

[0056] Step 1. Prepare before upgrading

[0057] a) Check the health status of the first distributed database.

[0058] b) Analyze the topology file of the first distributed database and identify each node.

[0059] c) Analyze the dependencies between nodes.

[0060] d) Build a smooth upgrade strategy and key path. The smooth upgrade strategy is primarily based on the node sequence principle (CN->DN->GTM), the key business principle (low-load business first), and the principle of backup nodes first and active nodes later.

[0061] Step 2. Smooth upgrade

[0062] a) Step 1: Upgrade one CN node and one DN node to verify basic functions.

[0063] b) Step 2: Upgrade all remaining CN nodes.

[0064] c) Step 3: Upgrade all remaining DN nodes in batches, using a checkerboard-style upgrade approach.

[0065] d) Step 4: Upgrade the GTM node.

[0066] Step 3. Verify after the upgrade. If the verification is successful, the upgrade is confirmed to be successful.

[0067] The technical solution of an embodiment of the present invention is to determine the first system information of the first node based on the topology file of the first distributed database; the first distributed database is the distributed database to be upgraded, and the first distributed database is in normal operating state; the first node is one of all nodes in the first distributed database; the second node of the second distributed database is run to determine the second system information of the second node; the second distributed database is the upgrade target of the first distributed database; the second node is one of all nodes in the second distributed database; so as to accurately determine the comparison results for describing the system configuration differences between the first distributed database and the second distributed database based on the first system information and the second system information, thereby constructing the script information of the second distributed database based on the comparison results, realizing automatic configuration of the upgrade script for the distributed database upgrade, saving labor costs, and further upgrading the first distributed database based on the script information, reducing the complexity of the version upgrade operation, and improving the upgrade efficiency of the distributed database.

[0068] Example 2

[0069] Figure 3 This is a flow chart of another distributed database upgrade method provided by an embodiment of the present invention. The technical solution of this embodiment further optimizes the process of the distributed database upgrade method in the above embodiment on the basis of the above embodiment. This embodiment can be combined with various optional solutions in one or more of the above embodiments. Figure 3 As shown, the upgrade method of the distributed database includes the following process:

[0070] S210. Based on the topology file of the first distributed database, determine the first system information of the first node; the first distributed database is a distributed database to be upgraded, and the first distributed database is in normal operating state; the first node is one of all nodes in the first distributed database; the first system information is used to describe the first object information of the system object of the first distributed database; the system object is a system function.

[0071] S220. Run the second node of the second distributed database and determine the second system information of the second node; the second distributed database is the upgrade target of the first distributed database; the second node is one of all nodes in the second distributed database; the second system information is used to describe the second object information of the system object of the second distributed database; the system object is a system function.

[0072] S230. Correlate and compare the first object information and the second object information to determine the comparison result of the first system information and the second system information; the first object information of the system function is the system configuration information of the object identifier of the system function of the first distributed database within the first preset identifier; the second object information of the system function is the system configuration information of the object identifier of the system function of the second distributed database within the first preset identifier; the object identifier of the system function within the first preset identifier is fixed.

[0073] The first preset identifier is determined according to configuration information of the system function of the distributed database. For example, the first preset identifier may be 10000.

[0074] Specifically, correlating and comparing the first object information and the second object information to determine the comparison result of the first system information and the second system information may include steps A1-A4:

[0075] Step A1: For the same system function, if the object identifier of the first object information is different from the object identifier of the second object information, a first comparison result is determined. The first comparison result is used to describe the change in the object identifier of the system function of the first distributed database and the system function of the second distributed database, which belong to the same system function.

[0076] Specifically, whether it is the same system function can be determined through the definition information of the system function, because the object identifier of the system function within the first preset identifier is fixed. Therefore, for different distributed systems, the same system function may have different object identifiers, and the first comparison result is determined based on the different object identifiers.

[0077] Step A2: For the same system function, if the object identifier of the first object information is the same as the object identifier of the second object information, but the function information of the same system function is different, then determine the second comparison result; the second comparison result is used to describe the function information change of the system function of the first distributed database and the system function of the second distributed database belonging to the same system function.

[0078] Specifically, for the same system function, the object identifier of the first object information is the same as the object identifier of the second object information, but for different distributed databases, the function information of the same system function may be different, and the second comparison result is determined based on the different function information of the same system function.

[0079] Step A3: If the first system function exists in the first object information but does not exist in the second object information, determine a third comparison result; the third comparison result is used to describe deleting the first system function from the first distributed database.

[0080] Specifically, if the first system function exists in the first object information but not in the second object information, it means that the first system function does not exist in the second distributed database. Therefore, it is necessary to delete the first system function in the first distributed database and determine the third comparison result.

[0081] Step A4: If the second system function exists in the second object information but does not exist in the first object information, a fourth comparison result is determined; the third comparison result is used to describe adding the second system function to the first distributed database.

[0082] Specifically, if the second system function exists in the second object information but not in the first object information, it means that the second system function exists in the second distributed database. Therefore, it is necessary to add the second system function in the first distributed database and determine the fourth comparison result.

[0083] S240. Correlate and compare the first object information and the second object information to determine the comparison result of the first system information and the second system information; the first object information of the system function is system configuration information in which the object identifier of the system function of the first distributed database is between the first preset identifier and the second preset identifier; the second object information of the system function is system configuration information in which the object identifier of the system function of the second distributed database is between the first preset identifier and the second preset identifier.

[0084] The second preset identifier is determined according to configuration information of the system function of the distributed database. For example, the second preset identifier may be 16384. The preset identifier between the first preset identifier and the second preset identifier may be randomly modified.

[0085] Specifically, correlating and comparing the first object information and the second object information to determine the comparison result of the first system information and the second system information may include steps B1-B3:

[0086] Step B1: If the function information of the same system function is different, determine a fifth comparison result; the fifth comparison result is used to describe the function information change of the system function of the first distributed database and the system function of the second distributed database belonging to the same system function.

[0087] Specifically, the function information of the same system function is different, which means that the second distributed database modifies the function information of the same system function compared with the first distributed database, so the system function of the first distributed database needs to be modified.

[0088] Step B2: If the third system function exists in the first object information but does not exist in the second object information, determine a sixth comparison result; the sixth comparison result is used to describe deleting the third system function from the first distributed database.

[0089] Specifically, if the third system function exists in the first object information but not in the second object information, it means that the third system function does not exist in the second distributed database. Therefore, it is necessary to delete the third system function in the first distributed database and determine the sixth comparison result.

[0090] Step B3: If the fourth system function exists in the second object information but not in the first object information, determine a seventh comparison result; the seventh comparison result is used to describe adding the fourth system function to the first distributed database.

[0091] Specifically, if the fourth system function exists in the second object information but not in the first object information, it means that the fourth system function exists in the second distributed database. Therefore, it is necessary to add the fourth system function in the first distributed database and determine the seventh comparison result.

[0092] S250: Construct script information of the second distributed database based on the comparison result, and upgrade the first distributed database based on the script information.

[0093] Specifically, for system functions, constructing the script information of the second distributed database based on the comparison results may include constructing the script information of the system function in the second distributed database based on the first comparison result, the second comparison result, the third comparison result and the fourth comparison result; and constructing the script information of the system function in the second distributed database based on the fifth comparison result, the sixth comparison result and the seventh comparison result.

[0094] The specific process of constructing the script information of the system function in the second distributed database based on the first comparison result, the second comparison result, the third comparison result, and the fourth comparison result may include: constructing a script statement for the object identifier of the system function corresponding to the first comparison result, constructing script statements for the system functions corresponding to the second and fourth comparison results, and constructing a script statement for deleting the first system function, based on the third comparison result.

[0095] The script information of the system function in the second distributed database is constructed based on the fifth, sixth, and seventh comparison results. The specific process may include: constructing script statements of the system functions corresponding to the fifth and seventh comparison results for the fifth and seventh comparison results; and constructing a script statement for deleting the third system function for the sixth comparison result.

[0096] The technical solution of the embodiment of the present invention is a process for constructing script information in which the system object is a system function. On the one hand, the first object information of the system function is system configuration information in which the object identifier of the system function of the first distributed database is within the first preset identifier; the second object information of the system function is system configuration information in which the object identifier of the system function of the second distributed database is within the first preset identifier; the object identifier of the system function within the first preset identifier is fixed, and on this basis, the first object information and the second object information are correlated and compared to determine the comparison result of the first system information and the second system information. On the other hand, the first object information of the system function is system configuration information in which the object identifier of the system function of the first distributed database is between the first preset identifier and the second preset identifier; the second object information of the system function is system configuration information in which the object identifier of the system function of the second distributed database is between the first preset identifier and the second preset identifier, and on this basis, the first object information and the second object information are correlated and compared to determine the comparison result of the first system information and the second system information. That is, the present invention divides the system functions by the first preset identifier and the second preset identifier, thereby preparing to compare the differences in system functions between the first distributed database and the second distributed database, so as to construct the script information of the second distributed database based on the comparison results, upgrade the first distributed database based on the script information, and realize automatic configuration of the upgrade script for the distributed database upgrade, saving labor costs, reducing the complexity of version upgrade operations, and improving the upgrade efficiency of the distributed database.

[0097] Example 3

[0098] Figure 4This is a schematic diagram of the structure of a distributed database upgrade device provided by an embodiment of the present invention. This embodiment is applicable to the case of upgrading a distributed database. The distributed database upgrade device can be implemented in the form of hardware and / or software. The distributed database upgrade device can be configured in any electronic device with network communication function. Figure 4 As shown, the upgrade device of the distributed database of the present invention includes:

[0099] A first information determination module 310 is configured to determine first system information of a first node based on a topology file of a first distributed database; the first distributed database is a distributed database to be upgraded and is in a normal operating state; and the first node is one of all nodes in the first distributed database;

[0100] A second information determination module 320 is configured to operate a second node of a second distributed database and determine second system information of the second node; the second distributed database is an upgrade target of the first distributed database; the second node is one of all nodes in the second distributed database;

[0101] A result determination module 330 is configured to determine a comparison result between the first system information and the second system information; the comparison result is used to describe a system configuration difference between the first distributed database and the second distributed database;

[0102] The upgrading module 340 is configured to construct script information of the second distributed database based on the comparison result, and upgrade the first distributed database based on the script information.

[0103] Based on the above embodiment, optionally, determining the first system information of the first node based on the topology file of the first distributed database includes:

[0104] Parsing the topology file of the first distributed database to obtain a parsing result; the parsing result includes multiple nodes and node system information;

[0105] A node is selected from the analysis result as a first node, and node system information associated with the first node is determined as first system information of the first node.

[0106] Based on the above embodiment, optionally, the first system information is used to describe first object information of a system object of the first distributed database; the second system information is used to describe second object information of a system object of the second distributed database;

[0107] Accordingly, determining a comparison result between the first system information and the second system information includes:

[0108] The first object information and the second object information are correlated and compared to determine the comparison result of the first system information and the second system information; each correlation and comparison process is to compare the same system objects of the first distributed database and the second distributed database.

[0109] Based on the above embodiment, optionally, the system objects include a system namespace, a system type, a system function, a system table, and a system view.

[0110] Based on the above embodiment, optionally, the system object is a system function, and the first object information of the system function is system configuration information of an object identifier of the system function of the first distributed database within a first preset identifier; the second object information of the system function is system configuration information of an object identifier of the system function of the second distributed database within the first preset identifier; the object identifier of the system function within the first preset identifier is fixed;

[0111] Accordingly, correlating and comparing the first object information and the second object information to determine a comparison result between the first system information and the second system information includes:

[0112] For the same system function, if the object identifier of the first object information is different from the object identifier of the second object information, determining a first comparison result, where the first comparison result is used to describe a change in the object identifier of the system function of the first distributed database and the system function of the second distributed database, which belong to the same system function;

[0113] For the same system function, if the object identifier of the first object information is the same as the object identifier of the second object information, but the function information of the same system function is different, then a second comparison result is determined; the second comparison result is used to describe the function information change of the system function of the first distributed database and the system function of the second distributed database belonging to the same system function;

[0114] If the first system function exists in the first object information and does not exist in the second object information, determining a third comparison result; the third comparison result is used to describe deleting the first system function from the first distributed database;

[0115] If the second system function exists in the second object information but does not exist in the first object information, a fourth comparison result is determined; and the third comparison result is used to describe adding a second system function to the first distributed database.

[0116] Based on the above embodiment, optionally, constructing the script information of the second distributed database based on the comparison result includes:

[0117] For the first comparison result, construct a script statement of an object identifier of a system function corresponding to the first comparison result;

[0118] For the second comparison result and the fourth comparison result, construct a script statement of the system function corresponding to the second comparison result and the fourth comparison result;

[0119] Based on the third comparison result, a script statement for deleting the first system function is constructed.

[0120] Based on the above embodiment, optionally, the system object is a system function, and the first object information of the system function is system configuration information in which the object identifier of the system function of the first distributed database is between the first preset identifier and the second preset identifier; the second object information of the system function is system configuration information in which the object identifier of the system function of the second distributed database is between the first preset identifier and the second preset identifier;

[0121] Accordingly, correlating and comparing the first object information and the second object information to determine a comparison result between the first system information and the second system information includes:

[0122] If the function information of the same system function is different, determining a fifth comparison result; the fifth comparison result is used to describe a change in function information of the system function of the first distributed database and the system function of the second distributed database belonging to the same system function;

[0123] If the third system function exists in the first object information and does not exist in the second object information, determining a sixth comparison result; the sixth comparison result is used to describe deleting the third system function from the first distributed database;

[0124] If the fourth system function exists in the second object information but not in the first object information, a seventh comparison result is determined; the seventh comparison result is used to describe adding a fourth system function to the first distributed database.

[0125] Based on the above embodiment, optionally, constructing the script information of the second distributed database based on the comparison result includes:

[0126] For the fifth comparison result and the seventh comparison result, constructing script statements of system functions corresponding to the fifth comparison result and the seventh comparison result;

[0127] Based on the sixth comparison result, a script statement for deleting the third system function is constructed.

[0128] Based on the above embodiment, optionally, constructing the script information of the second distributed database based on the comparison result includes:

[0129] Construct the script information of the second distributed database for each system object in the comparison result according to preset rules; the preset rules are to construct the script information of the second distributed database one by one according to the preset order of each type of system object, and to construct the script information of the second distributed database system object for the same type of system object according to the identification information or parameter information corresponding to the system object.

[0130] The distributed database upgrade device provided in the embodiment of the present invention can execute the distributed database upgrade method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0131] Example 4

[0132] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0133] Figure 5 The following is a schematic diagram of the structure of an electronic device that can be used to implement the method for upgrading a distributed database according to an embodiment of the present invention. 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 electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0134] like Figure 5As shown, electronic device 10 includes at least one processor 11 and memory, such as read-only memory (ROM) 12 and random access memory (RAM) 13, communicatively connected to at least one processor 11. The memory stores computer programs executable by the at least one processor. Processor 11 can perform various appropriate actions and processes based on the computer programs stored in ROM 12 or loaded from storage unit 18 into RAM 13. RAM 13 can also store various programs and data required for the operation of electronic device 10. Processor 11, ROM 12, and RAM 13 are interconnected via bus 14. An input / output (I / O) interface 15 is also connected to bus 14.

[0135] Multiple 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, speakers, 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 via a computer network such as the Internet and / or various telecommunication networks.

[0136] Processor 11 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors that run machine learning model algorithms, a digital signal processor (DSP), and any other suitable processor, controller, microcontroller, etc. Processor 11 executes the various methods and processes described above, such as the method for upgrading a distributed database.

[0137] In some embodiments, the distributed database upgrade method can be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the distributed database upgrade method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to execute the distributed database upgrade method in any other suitable manner (e.g., via firmware).

[0138] Various embodiments of the systems and techniques described 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), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0139] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0140] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or apparatus. A computer-readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0141] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device that has: 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 can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the 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 input, voice input, or tactile input).

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

[0143] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0144] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.

[0145] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A method for upgrading a distributed database, characterized in that: The method comprises: Determining first system information of a first node based on a topology file of a first distributed database; the first distributed database is a distributed database to be upgraded, and the first distributed database is in a normal operating state; the first node is one of all nodes in the first distributed database; Running a second node of a second distributed database and determining second system information of the second node; the second distributed database is an upgrade target of the first distributed database; the second node is one of all nodes in the second distributed database; Determine a comparison result between the first system information and the second system information; the comparison result is used to describe a system configuration difference between the first distributed database and the second distributed database; Constructing script information of the second distributed database for each system object in the comparison result according to a preset rule, and upgrading the first distributed database based on the script information; the preset rule is constructing the script information of the second distributed database one by one according to a preset order of each type of system object, and constructing the script information of the second distributed database system object according to the identification information or parameter information corresponding to the same type of system object; The first system information is used to describe first object information of a system object of the first distributed database; the second system information is used to describe second object information of a system object of the second distributed database; and determining a comparison result between the first system information and the second system information includes: The first object information and the second object information are correlated and compared to determine the comparison result of the first system information and the second system information; each correlation and comparison process is to compare the same system objects of the first distributed database and the second distributed database.

2. The method according to claim 1, characterized in that Determining first system information of the first node based on the topology file of the first distributed database includes: Parsing the topology file of the first distributed database to obtain a parsing result; the parsing result includes multiple nodes and node system information; A node is selected from the analysis result as a first node, and node system information associated with the first node is determined as first system information of the first node.

3. The method according to claim 1, characterized in that The system objects include system namespace, system types, system functions, system tables and system views.

4. The method according to claim 3, characterized in that The system object is a system function, the first object information of the system function is the system configuration information of the object identifier of the system function of the first distributed database within the first preset identifier; the second object information of the system function is the system configuration information of the object identifier of the system function of the second distributed database within the first preset identifier; the object identifier of the system function within the first preset identifier is fixed; Accordingly, correlating and comparing the first object information and the second object information to determine a comparison result between the first system information and the second system information includes: For the same system function, if the object identifier of the first object information is different from the object identifier of the second object information, determining a first comparison result, where the first comparison result is used to describe a change in the object identifier of the system function of the first distributed database and the system function of the second distributed database, which belong to the same system function; For the same system function, if the object identifier of the first object information is the same as the object identifier of the second object information, but the function information of the same system function is different, then a second comparison result is determined; the second comparison result is used to describe the function information change of the system function of the first distributed database and the system function of the second distributed database belonging to the same system function; If the first system function exists in the first object information and does not exist in the second object information, determining a third comparison result; the third comparison result is used to describe deleting the first system function from the first distributed database; If the second system function exists in the second object information but does not exist in the first object information, a fourth comparison result is determined; and the third comparison result is used to describe adding a second system function to the first distributed database.

5. The method according to claim 4, characterized in that Constructing script information of the second distributed database based on the comparison result includes: For the first comparison result, construct a script statement of an object identifier of a system function corresponding to the first comparison result; For the second comparison result and the fourth comparison result, construct a script statement of the system function corresponding to the second comparison result and the fourth comparison result; Based on the third comparison result, a script statement for deleting the first system function is constructed.

6. The method according to claim 3, characterized in that The system object is a system function, the first object information of the system function is system configuration information in which the object identifier of the system function of the first distributed database is between the first preset identifier and the second preset identifier; the second object information of the system function is system configuration information in which the object identifier of the system function of the second distributed database is between the first preset identifier and the second preset identifier; Accordingly, correlating and comparing the first object information and the second object information to determine a comparison result between the first system information and the second system information includes: If the function information of the same system function is different, determining a fifth comparison result; The fifth comparison result is used to describe function information changes of the system function of the first distributed database and the system function of the second distributed database belonging to the same system function; If the third system function exists in the first object information and does not exist in the second object information, determining a sixth comparison result; the sixth comparison result is used to describe deleting the third system function from the first distributed database; If the fourth system function exists in the second object information but not in the first object information, a seventh comparison result is determined; the seventh comparison result is used to describe adding the fourth system function to the first distributed database.

7. The method according to claim 6, characterized in that Constructing script information of the second distributed database based on the comparison result includes: For the fifth comparison result and the seventh comparison result, constructing script statements of system functions corresponding to the fifth comparison result and the seventh comparison result; Based on the sixth comparison result, a script statement for deleting the third system function is constructed.

8. A distributed database upgrade device, characterized in that: The device comprises: A first information determination module is configured to determine first system information of a first node based on a topology file of a first distributed database; the first distributed database is a distributed database to be upgraded, and the first distributed database is in a normal operating state; the first node is one of all nodes in the first distributed database; a second information determination module, configured to operate a second node of a second distributed database and determine second system information of the second node; the second distributed database being an upgrade target of the first distributed database; and the second node being one of all nodes in the second distributed database; A result determination module is configured to determine a comparison result between the first system information and the second system information; the comparison result is used to describe a system configuration difference between the first distributed database and the second distributed database; an upgrading module, configured to construct script information of the second distributed database according to preset rules for each system object in the comparison result, and upgrade the first distributed database based on the script information; the preset rules are: constructing the script information of the second distributed database one by one according to a preset order of each type of system object, and constructing the script information of the second distributed database system object according to the identification information or parameter information corresponding to the same type of system object; Among them, the first system information is used to describe the first object information of the system object of the first distributed database; the second system information is used to describe the second object information of the system object of the second distributed database; the determination of the comparison result of the first system information and the second system information includes: correlating and comparing the first object information and the second object information to determine the comparison result of the first system information and the second system information; each time the correlating and comparing process is to compare the same system objects of the first distributed database and the second distributed database.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to perform the distributed database upgrade method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the distributed database upgrade method according to any one of claims 1 to 7 when executed.

Citation Information

Patent Citations

  • Database upgrading method, system and device and storage medium

    CN110865829A

  • Method and device for upgrading shared storage cluster of database all-in-one machine

    CN115562811A

  • Database deployment method and device, electronic equipment and storage medium

    CN117591134A

  • Database updating method and device, electronic device and storage medium

    CN118733604A

  • Distributed database node online upgrading system and method

    CN119356719A