Method and device for determining upgrade results, processor, and electronic device

By determining and prioritizing container upgrade methods, the problem of multiple master database reselection during MySQL database upgrades was resolved, reducing interruption time and improving service availability, thereby enhancing the stability and continuity of database upgrades.

CN116719796BActive Publication Date: 2025-09-30INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310739173.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-20
Publication Date
2025-09-30
Estimated Expiration
2043-06-20

AI Technical Summary

Technical Problem

In the prior art, when upgrading a MySQL database, it is necessary to reselect the master database multiple times, resulting in a long interruption of the database service and affecting the availability and continuity of the database service.

Method used

By determining the containers to be upgraded and their priorities required for the database upgrade, the containers are upgraded in order of priority. Finally, the database upgrade result is determined after all containers are upgraded, avoiding multiple re-elections of the master database.

Benefits of technology

It reduces database service interruption time, improves database service availability and continuity, and enhances the performance smoothness and stability of database upgrades.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116719796B_ABST
    Figure CN116719796B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, processor, and electronic device for determining an upgrade result. The method relates to the field of cloud computing and includes: responding to a database upgrade request, determining a container to be upgraded required for the database upgrade, wherein the container to be upgraded has an upgrade priority; upgrading the container to be upgraded according to its upgrade priority; and determining the database upgrade result after determining that all containers to be upgraded have completed the upgrade. This application solves the problem of determining the upgrade result of a database upgrade without reselecting a primary database multiple times in the related art, thereby reducing database service interruption time, improving database service availability, and enhancing database service continuity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing, and more specifically, to a method and device for determining an upgrade result, a processor, and an electronic device. Background Art

[0002] With the rapid development of cloud computing, database applications have become containerized. MySQL, a widely used database, has been containerized and can be managed through Kubernetes clusters. MySQL provides external services using a highly available master-slave architecture. The MySQL master database provides read and write operations, while the MySQL slave database backs up data from the master database. Because MySQL upgrades require restarting the master database, each restart first shuts down the original master database, selects a slave database as the new master database, and switches all data requests to the new master database. This method often requires multiple selections of new masters to complete the MySQL upgrade.

[0003] Therefore, in the related art, there is a problem of how to determine the upgrade result of the database without reselecting the master database multiple times.

[0004] In the related art, there is currently no effective solution to the problem of how to determine the upgrade result of a database upgrade without reselecting the master database multiple times. Summary of the Invention

[0005] The main purpose of this application is to provide a method and device for determining an upgrade result, a processor, and an electronic device to solve the problem in the related art of how to determine the upgrade result of a database upgrade without reselecting the main database multiple times.

[0006] To achieve the above-mentioned objective, according to one aspect of the present application, a method for determining an upgrade result is provided, comprising: in response to a database upgrade request, determining containers to be upgraded required for the database upgrade, wherein the containers to be upgraded have corresponding upgrade priorities; upgrading the containers to be upgraded according to their upgrade priorities; and after determining that the upgrade of all the containers to be upgraded is complete, determining an upgrade result for the database.

[0007] Optionally, in an exemplary embodiment, determining the container to be upgraded required for the database upgrade includes: obtaining program information of the application to be upgraded corresponding to the database from the upgrade request, wherein the program information includes at least a program name of the application to be upgraded; determining an upgrade container set corresponding to the program name of the application to be upgraded, wherein the upgrade container set includes multiple containers to be upgraded, and each of the multiple containers to be upgraded has a corresponding container number; obtaining a first container to be upgraded having the smallest container number from the multiple containers to be upgraded; and determining the first container to be upgraded as the container to be upgraded required for the database upgrade.

[0008] Optionally, in an exemplary embodiment, determining the first container to be upgraded as the container to be upgraded required for the database upgrade includes: determining a first sub-repository and a second sub-repository of the database, wherein a first container number of the container to be upgraded required for the first sub-repository is smaller than a second container number of the container to be upgraded required for the second sub-repository; and determining the first container to be upgraded as the container to be upgraded required for the database upgrade based on a comparison result between the first container number and the smallest container number.

[0009] Optionally, in an exemplary embodiment, determining the first container to be upgraded as the container to be upgraded required for upgrading the database based on a comparison result between the first container number and the minimum container number includes: if it is determined that the first container number is consistent with the minimum container number, and if it is determined that a binding relationship exists between the minimum container number and a first sub-repository of the database, determining the first container to be upgraded as the container to be upgraded required for upgrading the first sub-repository; if it is determined that the first container number is inconsistent with the minimum container number, and if it is determined that the minimum container number is consistent with the second container number and a binding relationship exists between the minimum container number and a second sub-repository of the database, determining the first container to be upgraded as the container to be upgraded required for upgrading the second sub-repository of the database.

[0010] Optionally, in an exemplary embodiment, before upgrading the container to be upgraded according to the upgrade priority of the container to be upgraded, the upgrade priority of the container to be upgraded is determined in the following manner: all sub-databases of the database are determined, wherein all the sub-databases include at least a master database for storing application programs and a slave database for backing up data of the master database; a backup order for backing up data of the slave databases is determined, and an upgrade priority of a second container to be upgraded required for upgrading the slave database is determined based on the backup order; after determining that data backup of all the slave databases is completed, an upgrade priority of a third container to be upgraded required for upgrading the master database is determined; wherein the upgrade priority of the second container to be upgraded is higher than the upgrade priority of the third container to be upgraded.

[0011] Optionally, in an exemplary embodiment, the containers to be upgraded are upgraded according to their upgrade priorities: a current container to be upgraded is obtained from all the containers to be upgraded; when it is determined that the current container to be upgraded corresponds to a first slave database, if it is determined that a first upgrade priority of the current container to be upgraded is higher than a second upgrade priority of containers to be upgraded required for upgrading other slave databases, the current container to be upgraded is upgraded, wherein all the slave databases include at least the slave database and the other slave databases; after it is determined that the current container to be upgraded is upgraded, the containers to be upgraded required for upgrading the other slave databases are upgraded.

[0012] Optionally, in an exemplary embodiment, the containers to be upgraded are upgraded according to their upgrade priorities: a current container to be upgraded is obtained from all the containers to be upgraded; and if it is determined that the current container to be upgraded corresponds to the master database and a first upgrade priority of the current container to be upgraded is lower than a third upgrade priority of all containers to be upgraded required for upgrading the slave databases, and if it is determined that the current container to be upgraded is the last container to be upgraded, the current container to be upgraded is upgraded.

[0013] To achieve the above objectives, according to another aspect of the present application, a device for determining an upgrade result is provided. The device includes: a request response module for determining, in response to a database upgrade request, containers to be upgraded required for the database upgrade, wherein the containers to be upgraded have corresponding upgrade priorities; a container upgrade module for upgrading the containers to be upgraded according to their upgrade priorities; and a result determination module for determining the database upgrade result after determining that all containers to be upgraded have been upgraded.

[0014] According to another aspect of the embodiments of the present application, a processor is further provided, which is used to run a program, and the program is configured to execute the above-mentioned method for determining the upgrade result during runtime.

[0015] According to another aspect of the embodiments of the present application, an electronic device is also provided, which includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned method for determining the upgrade results.

[0016] This application adopts the following steps: first, responding to a database upgrade request, determining the containers in the database container that need to be upgraded, then further determining the priority of the container upgrade, and upgrading the containers to be upgraded according to the priority, and finally determining the database upgrade result after the upgrade of all containers to be upgraded is completed. This solves the problem in the related art of how to determine the upgrade result of the database without reselecting the master database multiple times, thereby achieving the effect of reducing database service interruption time, improving database service availability, and enhancing database service continuity. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings, which constitute part of this application, are intended to provide a further understanding of this application. The exemplary embodiments and descriptions of this application are intended to explain this application and do not constitute an improper limitation on this application. In the accompanying drawings:

[0018] Figure 1 is a flowchart of a method for determining an upgrade result according to an embodiment of the present application;

[0019] Figure 2 is a schematic flow chart of a method for determining an upgrade result according to an embodiment of the present application;

[0020] Figure 3 is a schematic diagram of a process for determining an upgrade result according to an embodiment of the present application;

[0021] Figure 4 is a schematic diagram of a device for determining an upgrade result according to an embodiment of the present application;

[0022] Figure 5 This is a schematic diagram of an optional electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION

[0023] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0024] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in 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 this application.

[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations 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.

[0026] For ease of description, some nouns or terms involved in the embodiments of the present application are explained below:

[0027] Container: A software package that encapsulates the elements necessary to run an application.

[0028] K8s, short for Kubernetes, is a portable container orchestration and management tool designed for container services. K8s is deployed in cluster mode, including master nodes, node nodes, and etcd.

[0029] Master node: The control node of the K8s cluster, which can manage and control the entire K8s cluster.

[0030] Node: The workload node of the K8s cluster. The workload (container) on the Node is allocated by the Master node. When a Node goes down, the workload on the node will be automatically transferred to other nodes by the Master node.

[0031] Etcd: A distributed key-value database used for data storage in K8s.

[0032] Pod: The smallest unit that can be created and deployed in K8s. A Pod can contain one or more containers. A Pod is a logical host in a container environment.

[0033] Computing resources: Computing resources refer to the CPU resources, memory resources, disk resources, and network resources required when a computer program runs.

[0034] MySQL: A relational database, usually deployed in a master-slave architecture. The master architecture corresponds to the database's master database, and the slave architecture corresponds to the database's slave database. The master database is used to provide external read and write operations, and the slave database is used for hot backup. When the master database restarts or fails, a slave database will be selected to be promoted to the master database to provide external read and write operations.

[0035] The present invention will be described below in conjunction with preferred implementation steps. Figure 1 Flowchart of the method for determining the upgrade result according to the embodiment of the present application, such as Figure 1 As shown, the method includes the following steps:

[0036] Step S102: In response to the database upgrade request, determine the to-be-upgraded containers required for the database upgrade, wherein the to-be-upgraded containers have corresponding upgrade priorities;

[0037] Step S104: upgrading the container to be upgraded according to the upgrade priority of the container to be upgraded;

[0038] Step S106: After determining that all the containers to be upgraded have completed upgrading, an upgrade result of the database is determined.

[0039] The method for determining an upgrade result provided in an embodiment of the present application first responds to a database upgrade request and determines the containers to be upgraded required for the database upgrade, wherein the containers to be upgraded have corresponding upgrade priorities. The containers to be upgraded are then upgraded according to their upgrade priorities. After determining that all the containers to be upgraded have been upgraded, the upgrade result of the database is determined. This solves the problem in the related art of how to determine the upgrade result of a database upgrade without reselecting a master database multiple times, thereby achieving the effects of reducing database service interruption time, improving database service availability, and enhancing database service continuity.

[0040] Optionally, in the above steps, the process of upgrading the container to be upgraded may include: obtaining an upgrade image file of the container to be upgraded, and running the upgrade image file to upgrade the container to a new container, thereby completing the upgrade operation.

[0041] Optionally, after executing step S106 to determine that all the containers to be upgraded have completed the upgrade, but before determining the technical solution for the database upgrade result, it is determined that all the containers to be upgraded have completed the upgrade by: obtaining the upgrade status of all the containers to be upgraded; and if it is determined that the upgrade status of all the containers to be upgraded is complete, determining that all the containers to be upgraded have completed the upgrade, and in this case, the database upgrade result is successful.

[0042] Optionally, in an exemplary embodiment, in order to better understand how to determine the container to be upgraded required for the database upgrade in the above step S102, the following technical solution is specifically proposed: obtaining program information of the application to be upgraded corresponding to the database from the upgrade request, wherein the program information includes at least the program name of the application to be upgraded; determining an upgrade container set corresponding to the program name of the application to be upgraded, wherein the upgrade container set includes multiple containers to be upgraded, and each of the multiple containers to be upgraded has a container number; obtaining a first container to be upgraded with the smallest container number from the multiple containers to be upgraded; and determining the first container to be upgraded as the container to be upgraded required for the database upgrade.

[0043] The upgrade container set corresponding to the program name of the application to be upgraded includes but is not limited to a list, an array, a queue, and the like.

[0044] Optionally, in an exemplary embodiment, the process of determining the first container to be upgraded as the container to be upgraded required for the database upgrade includes: determining a first sub-repository and a second sub-repository of the database, wherein a first container number of the container to be upgraded required for the first sub-repository is smaller than a second container number of the container to be upgraded required for the second sub-repository; and determining the first container to be upgraded as the container to be upgraded required for the database upgrade based on a comparison result between the first container number and the smallest container number.

[0045] In the above embodiment, for example, the first container number may be set to "0", and the container to be upgraded required for upgrading the first sub-library may be represented as "Program Name-0", or alternatively, as "APP-0".

[0046] Optionally, in an exemplary embodiment, an implementation scheme is further proposed for determining the first container to be upgraded as the container to be upgraded required for upgrading the database based on a comparison result between the first container number and the minimum container number. The specific steps include: if it is determined that the first container number is consistent with the minimum container number, and if it is determined that the minimum container number is in a binding relationship with a first sub-repository of the database, determining that the first container to be upgraded is the container to be upgraded required for upgrading the first sub-repository; if it is determined that the first container number is inconsistent with the minimum container number, and if it is determined that the minimum container number is consistent with the second container number and the minimum container number is in a binding relationship with a second sub-repository of the database, determining that the first container to be upgraded is the container to be upgraded required for upgrading the second sub-repository of the database.

[0047] Optionally, in an exemplary embodiment, when it is determined that the minimum container number is consistent with the second container number, and the minimum container number and the second sub-inventory of the database do not exist in a binding relationship, a prompt message is sent to the user to prompt the user that the container number of the container to be upgraded is incorrect.

[0048] Optionally, in an exemplary embodiment, in executing the scheme of upgrading the container to be upgraded according to the upgrade priority of the container to be upgraded in the above-mentioned step S104, the upgrade priority of the container to be upgraded is determined in the following manner: all sub-repositories of the database are determined, wherein all the sub-repositories include at least a master database for storing application programs and a slave database for backing up data of the master database; a backup order for backing up data of the slave databases is determined, and an upgrade priority of a second container to be upgraded required for upgrading the slave database according to the backup order; after determining that data backup of all the slave databases is completed, an upgrade priority of a third container to be upgraded required for upgrading the master database is determined; wherein the upgrade priority of the second container to be upgraded is higher than the upgrade priority of the third container to be upgraded.

[0049] Optionally, in an exemplary embodiment, in the process of determining the backup order for backing up data of the slave database and determining the upgrade priority of the second to-be-upgraded container required for upgrading the slave database based on the backup order, the upgrade priority of the to-be-upgraded container with an earlier backup order may be set to be higher; alternatively, the upgrade priority of the to-be-upgraded container with an earlier backup order may be set to be lower, and this application does not impose any restrictions on this.

[0050] Optionally, in an exemplary embodiment, the technical solution of upgrading the containers to be upgraded according to their upgrade priorities in step S104 specifically includes the following implementation steps: step S11, obtaining a current container to be upgraded from all the containers to be upgraded; step S12, when it is determined that the current container to be upgraded corresponds to a first slave database, if it is determined that a first upgrade priority of the current container to be upgraded is higher than a second upgrade priority of containers to be upgraded required for upgrading other slave databases, upgrading the current container to be upgraded, wherein all the slave databases include at least the slave database and the other slave databases; step S13, after determining that the current container to be upgraded is upgraded, upgrading the containers to be upgraded required for upgrading the other slave databases.

[0051] Optionally, in an exemplary embodiment, the process of upgrading the containers to be upgraded required for upgrading the other slave databases may include: determining a fourth container to be upgraded from the containers to be upgraded required for upgrading the other slave databases; and if it is determined that the container number of the fourth container to be upgraded is inconsistent with a preset container number, and if it is determined that the fourth container to be upgraded is not the last container to be upgraded, upgrading the fourth container to be upgraded, where the preset container number represents the container number of a container corresponding to a slave database that has completed the upgrade; and if it is determined that the container number of the fourth container to be upgraded is consistent with the preset container number, deleting the fourth container to be upgraded from the containers to be upgraded required for upgrading the other slave databases, and continuing to upgrade the containers to be upgraded required for upgrading the other slave databases.

[0052] Optionally, in an exemplary embodiment, another implementation process for upgrading the containers to be upgraded according to their upgrade priorities is also proposed. The specific steps are as follows: obtaining a current container to be upgraded from all the containers to be upgraded; if it is determined that the current container to be upgraded corresponds to the master database and the first upgrade priority of the current container to be upgraded is lower than the third upgrade priority of all the containers to be upgraded required for upgrading the slave databases, and if it is determined that the current container to be upgraded is the last container to be upgraded, upgrading the current container to be upgraded.

[0053] Optionally, in an exemplary embodiment, if it is determined that the current container to be upgraded corresponds to the master database, the first upgrade priority of the current container to be upgraded is lower than the third upgrade priority of all containers to be upgraded required for upgrading the slave databases, and the current container to be upgraded is the last container to be upgraded, the current container to be upgraded is not upgraded.

[0054] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0055] In one embodiment, Figure 2 As shown, a method for determining whether to upgrade the current container obtained from the list of database containers to be upgraded is provided. The specific implementation steps are as follows:

[0056] Step S201: receiving an upgrade request of a MySQL database, where the upgrade request includes information such as the application name of the application to be upgraded.

[0057] Step S202: Obtain a list of MySQL containers to be upgraded corresponding to the application names of the applications to be upgraded. In this step, the list of MySQL containers to be upgraded can be understood as a set of upgrade containers corresponding to the program names of the applications to be upgraded, including but not limited to lists, arrays, queues, etc.

[0058] For example Figure 3 The structure of the MySQL database shown in the figure includes one master database and two slave databases, where the master database is represented as APP-0 (equivalent to the first container number mentioned above), and the slave databases are represented as APP-1 (equivalent to the second container number mentioned above) and APP-2 respectively.

[0059] Step S203: Obtain the first MySQL container to be upgraded (equivalent to the first container to be upgraded) from the list of containers to be upgraded in step S102.

[0060] Optionally, the first container to be upgraded may be, for example, the container with the smallest container number in the list of containers to be upgraded, or the container with the largest container number in the list.

[0061] Step S204: Determine whether the first MySQL database container to be upgraded in step S203 is a MySQL slave container.

[0062] The master library and the slave library are named after the program name of the application to be upgraded plus a number, such as Figure 3 As shown in the figure, the application name is "APP", the master library can be named "APP-0", and the two slave libraries can be named "APP-1" and "APP-2". If there are multiple slave libraries, the same analogy can be used.

[0063] Optionally, determine whether the name of the first container to be upgraded in step S203 is "App-0". If not, it means that the first container to be upgraded (equivalent to the container to be upgraded required for upgrading the second sub-library) corresponds to the slave library, and then execute step S206 to upgrade the first container to be upgraded. If so, it means that the first container to be upgraded (equivalent to the container to be upgraded required for upgrading the first sub-library) corresponds to the master library, and then execute step S205.

[0064] Optionally, it is also possible to determine whether the container number of the first container to be upgraded in step S203 is "0". If not, it means that the first container to be upgraded corresponds to the slave library, and the upgrade operation can be performed on the first container to be upgraded. If it is, it means that the first container to be upgraded corresponds to the master library, and the process proceeds to the next step.

[0065] Step S205: Determine whether the MySQL master container determined in step S204 is the last container in the list of MySQL containers to be upgraded. If so, it indicates that all slaves in the list of MySQL containers to be upgraded have been upgraded. Step S206 is then executed to upgrade the determined MySQL master container. If not, the process continues with step S203.

[0066] Step S206: performing an upgrade operation on the MySQL container determined in step S204 or step S205.

[0067] In this embodiment, the master database of the database is upgraded after all the slave databases are upgraded, and the master database container of the MySQL database is set as the last database container to be upgraded, thereby achieving a single master switch during the database upgrade process. This greatly reduces the database service interruption time caused by multiple master selections in the existing technology, improves the performance smoothness and stability of the database upgrade, improves the availability of the database service, and improves the continuity of the database service.

[0068] Optionally, in one embodiment, combined Figure 3 The process of determining the upgrade result of the embodiment of the present application is described. Figure 3 As shown in the figure, a MySQL high-availability group contains one master database and multiple slave databases. Before the upgrade, APP-0 serves as the MySQL database master database, processing data requests initiated by applications to the database. When data in the master database is updated, the master database data is copied to the database slave databases APP-1 and APP-2 for synchronous backup. During the MySQL database upgrade, the master database APP-0 container needs to be restarted. During the restart, APP-0 can no longer provide read and write services to the application. Therefore, a new master database is selected from the slave databases APP-1 and APP-2. The new master database APP-1 processes data requests initiated by applications to the database and continues to provide read and write services to the application. When data in the new master database APP-1 is updated, the data in the master database APP-1 is copied to the database slave database APP-2 for synchronous backup.

[0069] The present application also provides an apparatus for determining an upgrade result. It should be noted that the apparatus for determining an upgrade result in the present application can be used to execute the method for determining an upgrade result provided in the present application. The apparatus for determining an upgrade result in the present application is described below.

[0070] Figure 4 Schematic diagram of a device for determining an upgrade result according to an embodiment of the present application. Figure 4 As shown, the device includes:

[0071] A request response module 42 is configured to determine, in response to a database upgrade request, containers to be upgraded required for the database upgrade, wherein the containers to be upgraded have corresponding upgrade priorities;

[0072] A container upgrade module 44 is configured to upgrade the container to be upgraded according to the upgrade priority of the container to be upgraded;

[0073] The result determination module 46 is configured to determine the upgrade result of the database after determining that all the containers to be upgraded have completed the upgrade.

[0074] An upgrade result determination device provided in an embodiment of the present application first responds to a database upgrade request and determines containers to be upgraded required for the database upgrade, wherein the containers to be upgraded have corresponding upgrade priorities; then upgrades the containers to be upgraded according to their upgrade priorities; and after determining that all the containers to be upgraded have been upgraded, determines the database upgrade result. This solves the problem in related arts of how to determine the upgrade result of a database upgrade without reselecting a master database multiple times, thereby achieving the effect of reducing business interruption time and fully ensuring business high availability.

[0075] Optionally, the request response module 42 is further configured to obtain program information of the application to be upgraded corresponding to the database from the upgrade request, wherein the program information includes at least a program name of the application to be upgraded; determine an upgrade container set corresponding to the program name of the application to be upgraded, wherein the upgrade container set includes multiple containers to be upgraded, and each of the multiple containers to be upgraded has a corresponding container number; obtain a first container to be upgraded having the smallest container number from the multiple containers to be upgraded; and determine the first container to be upgraded as the container to be upgraded required for upgrading the database.

[0076] Optionally, the request response module 42 further includes a container determining unit, configured to determine a first sub-repository and a second sub-repository of the database, wherein a first container number of a container to be upgraded required for upgrading the first sub-repository is smaller than a second container number of a container to be upgraded required for upgrading the second sub-repository; and determine the first container to be upgraded as the container to be upgraded required for upgrading the database based on a comparison result between the first container number and the smallest container number.

[0077] Optionally, the container determining unit is further configured to, if it is determined that the first container number is consistent with the minimum container number, and if it is determined that the minimum container number is in a binding relationship with a first sub-repository of the database, determine that the first container to be upgraded is the container to be upgraded required for upgrading the first sub-repository; and, if it is determined that the first container number is inconsistent with the minimum container number, and if it is determined that the minimum container number is consistent with the second container number, and if the minimum container number is in a binding relationship with a second sub-repository of the database, determine that the first container to be upgraded is the container to be upgraded required for upgrading the second sub-repository of the database.

[0078] Optionally, the apparatus for determining an upgrade result further includes a priority determination module, which is further configured to, before upgrading the container to be upgraded according to the upgrade priority of the container to be upgraded, determine the upgrade priority of the container to be upgraded in the following manner: determining all sub-databases of the database, wherein all the sub-databases include at least a master database for storing application programs and a slave database for backing up data of the master database; determining a backup order for backing up data of the slave databases, and determining an upgrade priority of a second container to be upgraded required for upgrading the slave database according to the backup order; and after determining that all the slave databases have completed data backup, determining an upgrade priority of a third container to be upgraded required for upgrading the master database; wherein the upgrade priority of the second container to be upgraded is higher than the upgrade priority of the third container to be upgraded.

[0079] Optionally, the container upgrading module 44 is further configured to upgrade the containers to be upgraded according to their upgrade priorities: obtain a current container to be upgraded from all the containers to be upgraded; when it is determined that the current container to be upgraded corresponds to a first slave database, and if it is determined that a first upgrade priority of the current container to be upgraded is higher than a second upgrade priority of containers to be upgraded required for upgrading other slave databases, upgrade the current container to be upgraded, wherein all the slave databases include at least the slave database and the other slave databases; and after determining that the current container to be upgraded is upgraded, upgrade the containers to be upgraded required for upgrading the other slave databases.

[0080] Optionally, the container upgrading module 44 is further configured to upgrade the containers to be upgraded according to their upgrade priorities: obtain a current container to be upgraded from all the containers to be upgraded; and if it is determined that the current container to be upgraded corresponds to the master database and a first upgrade priority of the current container to be upgraded is lower than a third upgrade priority of all containers to be upgraded required for upgrading the slave databases, and if it is determined that the current container to be upgraded is the last container to be upgraded, upgrade the current container to be upgraded.

[0081] The apparatus for determining the upgrade result includes a processor and a memory. The container determination unit and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.

[0082] The processor includes a kernel, which calls the corresponding program unit from the memory. There can be one or more kernels.

[0083] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0084] An embodiment of the present invention provides a computer-readable storage medium having a program stored thereon, which implements the method for determining the upgrade result when the program is executed by a processor.

[0085] An embodiment of the present invention provides a processor, which is used to run a program, wherein the method for determining an upgrade result is executed when the program is running.

[0086] like Figure 5 As shown, an embodiment of the present invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented: first, in response to a database upgrade request, containers to be upgraded required for the database upgrade are determined, wherein the containers to be upgraded have corresponding upgrade priorities; then, the containers to be upgraded are upgraded according to their upgrade priorities; and after determining that all the containers to be upgraded have completed the upgrade, an upgrade result of the database is determined, thereby solving the problem in the related art of how to determine the upgrade result of the database upgrade without reselecting the master database multiple times, thereby achieving the effect of reducing business interruption time and fully ensuring high business availability.

[0087] Optionally, when executing the program, the processor may further implement the following steps: obtaining program information of the application to be upgraded corresponding to the database from the upgrade request, wherein the program information includes at least the program name of the application to be upgraded; determining an upgrade container set corresponding to the program name of the application to be upgraded, wherein the upgrade container set includes multiple containers to be upgraded, and each of the multiple containers to be upgraded has a corresponding container number; obtaining a first container to be upgraded having the smallest container number from the multiple containers to be upgraded; and determining the first container to be upgraded as the container to be upgraded required for upgrading the database.

[0088] Optionally, when executing the program, the processor may further implement the following steps: determining a first sub-library and a second sub-library of the database, wherein a first container number of a container to be upgraded required for upgrading the first sub-library is smaller than a second container number of a container to be upgraded required for upgrading the second sub-library; and determining the first container to be upgraded as the container to be upgraded required for upgrading the database based on a comparison result between the first container number and the smallest container number.

[0089] Optionally, when executing the program, the processor may further implement the following steps: when it is determined that the first container number is consistent with the minimum container number, if it is determined that the minimum container number is in a binding relationship with a first sub-repository of the database, determining that the first container to be upgraded is the container to be upgraded required for upgrading the first sub-repository; when it is determined that the first container number is inconsistent with the minimum container number, if it is determined that the minimum container number is consistent with the second container number, and the minimum container number is in a binding relationship with a second sub-repository of the database, determining that the first container to be upgraded is the container to be upgraded required for upgrading the second sub-repository of the database.

[0090] Optionally, when executing the program, the processor may further implement the following steps: determining all sub-libraries of the database, wherein all the sub-libraries include at least a master database for storing application programs and a slave database for backing up data of the master database; determining a backup order for backing up data of the slave databases, and determining an upgrade priority of a second container to be upgraded required for upgrading the slave databases based on the backup order; after determining that all the slave databases have completed data backup, determining an upgrade priority of a third container to be upgraded required for upgrading the master database; wherein the upgrade priority of the second container to be upgraded is higher than the upgrade priority of the third container to be upgraded.

[0091] Optionally, when executing the program, the processor may further implement the following steps: obtaining a current container to be upgraded from all the containers to be upgraded; when it is determined that the current container to be upgraded corresponds to the first slave database, if it is determined that a first upgrade priority of the current container to be upgraded is higher than a second upgrade priority of containers to be upgraded required for upgrading other slave databases, upgrading the current container to be upgraded, wherein all the slave databases include at least the slave database and the other slave databases; and after determining that the current container to be upgraded is upgraded, upgrading the containers to be upgraded required for upgrading the other slave databases.

[0092] Optionally, when executing the program, the processor may further implement the following steps: obtaining a current container to be upgraded from all the containers to be upgraded; and if it is determined that the current container to be upgraded corresponds to the master database and a first upgrade priority of the current container to be upgraded is lower than a third upgrade priority of all containers to be upgraded required for upgrading the slave databases, and if it is determined that the current container to be upgraded is the last container to be upgraded, upgrading the current container to be upgraded.

[0093] The devices in this article can be servers, PCs, PADs, mobile phones, etc.

[0094] The present application also provides a computer program product that executes the following method steps: first, in response to a database upgrade request, determining containers to be upgraded required for the database upgrade, wherein the containers to be upgraded have corresponding upgrade priorities; then, upgrading the containers to be upgraded according to their upgrade priorities; and after determining that all the containers to be upgraded have been upgraded, determining the upgrade result of the database. This solves the problem in the related art of how to determine the upgrade result of a database upgrade without reselecting a master database multiple times, thereby achieving the effect of reducing business interruption time and fully ensuring business high availability.

[0095] Optionally, the computer program product may further execute a program of the following method steps: obtaining program information of the application to be upgraded corresponding to the database from the upgrade request, wherein the program information includes at least the program name of the application to be upgraded; determining an upgrade container set corresponding to the program name of the application to be upgraded, wherein the upgrade container set includes multiple containers to be upgraded, each of the multiple containers to be upgraded corresponding to a container number; obtaining a first container to be upgraded having the smallest container number from the multiple containers to be upgraded; and determining the first container to be upgraded as the container to be upgraded required for upgrading the database.

[0096] Optionally, the computer program product may further execute the following method steps: determining a first sub-repository and a second sub-repository of the database, wherein a first container number of a container to be upgraded required for upgrading the first sub-repository is smaller than a second container number of a container to be upgraded required for upgrading the second sub-repository; and determining the first container to be upgraded as the container to be upgraded required for upgrading the database based on a comparison result between the first container number and the smallest container number.

[0097] Optionally, the computer program product may further execute a program of the following method steps: if it is determined that the first container number is consistent with the minimum container number, and if it is determined that the minimum container number is in a binding relationship with a first sub-repository of the database, determining that the first container to be upgraded is a container to be upgraded required for upgrading the first sub-repository; if it is determined that the first container number is inconsistent with the minimum container number, and if it is determined that the minimum container number is consistent with the second container number, and the minimum container number is in a binding relationship with a second sub-repository of the database, determining that the first container to be upgraded is a container to be upgraded required for upgrading the second sub-repository of the database.

[0098] Optionally, the computer program product may further determine the upgrade priority of the container to be upgraded in the following manner: determining all sub-repositories of the database, wherein all the sub-repositories include at least a master database for storing applications and a slave database for backing up data of the master database; determining a backup order for backing up data of the slave databases, and determining the upgrade priority of a second container to be upgraded required for upgrading the slave database based on the backup order; after determining that all the slave databases have completed data backup, determining the upgrade priority of a third container to be upgraded required for upgrading the master database; wherein the upgrade priority of the second container to be upgraded is higher than the upgrade priority of the third container to be upgraded.

[0099] Optionally, the computer program product may further execute a program having the following method steps: obtaining a current container to be upgraded from all the containers to be upgraded; upon determining that the current container to be upgraded corresponds to a first slave database, and if it is determined that a first upgrade priority of the current container to be upgraded is higher than a second upgrade priority of containers to be upgraded required for upgrading in other slave databases, upgrading the current container to be upgraded, wherein all the slave databases include at least the slave database and the other slave databases; and after determining that the current container to be upgraded has been upgraded, upgrading the containers to be upgraded required for upgrading in the other slave databases.

[0100] Optionally, the computer program product may further execute a program having the following method steps: obtaining a current container to be upgraded from all containers to be upgraded; upon determining that the current container to be upgraded corresponds to the master database and a first upgrade priority of the current container to be upgraded is lower than a third upgrade priority of all containers to be upgraded required for upgrading the slave databases, and if it is determined that the current container to be upgraded is the last container to be upgraded, upgrading the current container to be upgraded.

[0101] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0102] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0103] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0104] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0105] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0106] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0107] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0108] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0109] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0110] The above are merely embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.

Claims

1. A method for determining an upgrade result, characterized in that: include: In response to a database upgrade request, determining a container to be upgraded required for the database upgrade, wherein the container to be upgraded has an upgrade priority; Upgrading the container to be upgraded according to the upgrade priority of the container to be upgraded; All sub-databases of the database are determined, wherein the all sub-databases include at least a master database for storing applications and a slave database for backing up data of the master database; a backup order for backing up data of the slave databases is determined, and an upgrade priority of a second container to be upgraded required for upgrading the slave databases is determined based on the backup order; after determining that all the slave databases have completed data backup, an upgrade priority of a third container to be upgraded required for upgrading the master database is determined; wherein the upgrade priority of the second container to be upgraded is higher than the upgrade priority of the third container to be upgraded; The container to be upgraded is upgraded according to the upgrade priority of the container to be upgraded, including: obtaining a current container to be upgraded from all the containers to be upgraded; if it is determined that the current container to be upgraded corresponds to a first slave database, and if it is determined that a first upgrade priority of the current container to be upgraded is higher than a second upgrade priority of containers to be upgraded required for upgrading other slave databases, then upgrading the current container to be upgraded, wherein all the slave databases include at least the slave database and the other slave databases; After determining that the current container to be upgraded is upgraded, determining a fourth container to be upgraded from the other containers to be upgraded required for upgrading in the slave database; if it is determined that the container number of the fourth container to be upgraded is inconsistent with the preset container number, and if it is determined that the fourth container to be upgraded is not the last container to be upgraded, upgrading the fourth container to be upgraded, wherein the preset container number represents the container number of the corresponding container in the slave database that has completed the upgrade; if it is determined that the container number of the fourth container to be upgraded is consistent with the preset container number, deleting the fourth container to be upgraded from the other containers to be upgraded required for upgrading in the slave database, and continuing to upgrade the other containers to be upgraded required for upgrading in the slave database; After determining that all the containers to be upgraded have completed upgrading, an upgrade result of the database is determined.

2. The method according to claim 1, characterized in that The containers to be upgraded required for the database upgrade are determined to include: Acquire program information of the application to be upgraded corresponding to the database from the upgrade request, wherein the program information at least includes a program name of the application to be upgraded; Determine an upgrade container set corresponding to the program name of the application to be upgraded, wherein the upgrade container set includes multiple containers to be upgraded, and each of the multiple containers to be upgraded has a corresponding container number; Acquire a first container to be upgraded with the smallest container number from the multiple containers to be upgraded; The first container to be upgraded is determined as the container to be upgraded required for upgrading the database.

3. The method according to claim 2, characterized in that Determining the first container to be upgraded as the container to be upgraded required for upgrading the database includes: Determine a first sub-library and a second sub-library of the database, wherein a first container number of a container to be upgraded required for upgrading the first sub-library is smaller than a second container number of a container to be upgraded required for upgrading the second sub-library; The first container to be upgraded is determined as the container to be upgraded required for upgrading the database according to a comparison result between the first container number and the minimum container number.

4. The method according to claim 3, characterized in that Determining the first container to be upgraded as the container to be upgraded required for the database upgrade according to a comparison result between the first container number and the minimum container number includes: When it is determined that the first container number is consistent with the minimum container number, if it is determined that a binding relationship exists between the minimum container number and the first sub-library of the database, determining that the first container to be upgraded is the container to be upgraded required for upgrading the first sub-library; When it is determined that the first container number is inconsistent with the minimum container number, if it is determined that the minimum container number is consistent with the second container number, and a binding relationship exists between the minimum container number and the second sub-repository of the database, then the first container to be upgraded is determined to be the container to be upgraded required for upgrading the second sub-repository of the database.

5. The method according to claim 1, wherein Upgrading the container to be upgraded according to the upgrade priority of the container to be upgraded, further comprising: Obtain the current container to be upgraded from all the containers to be upgraded; If it is determined that the current container to be upgraded corresponds to the master database, and a first upgrade priority of the current container to be upgraded is lower than a third upgrade priority of all containers to be upgraded required for upgrading the slave databases, and if it is determined that the current container to be upgraded is the last container to be upgraded, the current container to be upgraded is upgraded.

6. A device for determining an upgrade result, characterized in that: Used to implement the method according to any one of claims 1 to 5.

7. A processor, characterized in that: The processor is configured to run a program, wherein the program executes the method according to any one of claims 1 to 5 when running.

8. An electronic device, characterized in that: The method comprises one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Distributed database upgrading method and device and medium

    CN112434008A