Transaction hosting method and apparatus based on shared storage database cluster
By determining the managed instance in the shared storage database cluster and forwarding the transaction access request, the problem of blocking and resource occupation caused by abnormal fault instances in distributed transaction management is solved, the normal processing of transactions and the release of resources are realized, and the stability of the database business is ensured. Stable operation.
Patent Information
- Application Number
- PCT/CN2023/081693
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-22
- Filing Date
- 2023-03-15
- Publication Date
- 2024-08-29
AI Technical Summary
In a shared storage database cluster, when a faulty instance is abnormal in distributed transaction management, other instances' access to the faulty instance's transactions will be blocked, affecting the business, and unfinished transaction resources on the faulty instance will be occupied for a long time, affecting the operation of the database business.
By determining the managed instance of the database cluster in the server, when a faulty instance occurs, the transaction access request is forwarded to the managed instance, and unfinished transactions are initialized and rolled back in the managed instance to ensure the normal end of the transaction status and the release of resources. .
This enables normal access and processing of transactions even when faulty instances exist, avoiding the problem of long-term blocking of transactions and resource occupation, and ensuring the continuous operation of database services.
Smart Images

Figure CN2023081693_29082024_PF_FP_ABST
Abstract
Description
A transaction hosting method and device based on shared storage database cluster Technical Field
[0001] The present application relates to the field of transaction hosting, and in particular to a transaction hosting method and device based on a shared storage database cluster. Background Art
[0002] As data and throughput increase, the performance of traditional single database architectures is unable to meet the demands of fast client query responses. Consequently, clustered databases are emerging as a new development direction for database systems. Database clustering utilizes multiple servers to create a virtual, single logical image of data, providing services to clients in the same way as a standalone database system. This technology not only outperforms standalone database systems, meeting the demands of large data volumes and high concurrency, but also conserves server resources.
[0003] There are two main architectures for database clustering: shared storage and shared nothing. In a shared storage database cluster, multiple server nodes share the same storage medium, allowing each node to access data stored in the shared storage and provide external services. In a shared nothing database cluster, each node maintains its own data storage, with no nodes sharing data with each other. The data in the database is distributed across multiple nodes.
[0004] In database cluster technology with shared storage architecture, we will face the problem of transaction management. Generally, there are two ways to manage transactions: centralized transaction management and distributed transaction management.
[0005] Centralized transaction management means that transactions for all instances are managed centrally on one instance. Transaction distribution, synchronization, and startup and shutdown have a significant impact on performance. However, when an instance fails, the transactions of the failed instance can be directly managed by the transaction management instance.
[0006] Distributed transaction management means that transactions are managed independently on each instance, and transactions managed by each instance are globally unique across the cluster. This has the advantage of reducing the performance overhead of distributing and synchronizing transactions across instances.
[0007] Similarly, distributed transaction management also has some problems. When an instance in the cluster fails abnormally, if other instances in the cluster access transactions managed on the failed instance, the access will be blocked, affecting their business. Other instances must wait until the failed instance is restarted before normal access can be made.
[0008] Summary of the Invention
[0009] In view of the above problems, the present application is proposed to provide a transaction hosting method and apparatus based on a shared storage database cluster that overcomes the above problems or at least partially solves the above problems, including:
[0010] A transaction hosting method based on a shared storage database cluster, the method involving a server and a database cluster; wherein the database cluster includes a plurality of databases, each of which includes at least one instance; the method comprising:
[0011] When the server detects that there is a fault instance in the database cluster, it determines a managed instance of the database cluster;
[0012] When the server receives the transaction access request of the faulty instance, it forwards the transaction access request to the hosting instance; wherein the hosting instance is used to host the transaction of the faulty instance.
[0013] Furthermore, the instance includes a primary instance and a non-primary instance; and the method further includes:
[0014] When a target instance is started, the server determines whether the target instance is the primary instance;
[0015] If so, the target instance hosts the transaction of the non-primary instance;
[0016] If not, the master instance cancels the transaction hosting the target instance.
[0017] Furthermore, the step of the target instance hosting the transaction of the non-primary instance includes:
[0018] The target instance initializes the transaction memory of the non-master instance;
[0019] The target instance imports the transaction page of the non-master instance.
[0020] Furthermore, the step of the master instance cancelling the transaction of the target instance includes:
[0021] The primary instance releases the transaction memory of the target instance.
[0022] Furthermore, the step of determining the managed instance of the database cluster includes:
[0023] When the master instance is idle, the master instance becomes the managed instance;
[0024] When the primary instance is busy, the online status and idle status of the non-primary instance are determined, and the managed instance is determined based on the online status and the idle status.
[0025] A transaction hosting method based on a shared storage database cluster, the method involving a server and a database cluster; wherein the database cluster includes a plurality of databases, each of which includes at least one instance; the method comprising:
[0026] When the managed instance receives the transaction access request of the faulty instance, it sends the access result corresponding to the transaction access request to the server.
[0027] Furthermore, before the step of the managed instance receiving the transaction access request, the step includes:
[0028] The managed instance initializes the transaction memory of the fault instance;
[0029] The hosting instance loads the transaction page of the fault instance;
[0030] The managed instance rolls back the unfinished transaction on the failed instance.
[0031] Furthermore, the step of sending the access result corresponding to the transaction access request to the server includes:
[0032] The managed instance reads the transaction memory of the fault instance, and determines the transaction state corresponding to the transaction access request according to the transaction memory of the fault instance;
[0033] The hosting instance sends the transaction status to the server.
[0034] A transaction hosting device based on a shared storage database cluster, the device involving a server and a database cluster; wherein the database cluster includes a plurality of databases, each of which includes at least one instance; the device comprising:
[0035] A hosting selection module, configured to determine a hosting instance of the database cluster when the server detects that a fault instance exists in the database cluster;
[0036] A transaction forwarding module is used to forward the transaction access request of the fault instance to the hosting instance when the server receives the transaction access request of the fault instance; wherein the hosting instance is used to host the transaction of the fault instance.
[0037] A transaction hosting device based on a shared storage database cluster, the device involving a server and a database cluster; wherein the database cluster includes a plurality of databases, each of which includes at least one instance; the device comprising:
[0038] The access processing module is configured to send an access result corresponding to the transaction access request to the server when the hosting instance receives the transaction access request of the faulty instance.
[0039] A transaction hosting system based on a shared storage database cluster, the system involving a server and a database cluster;
[0040] The system comprises:
[0041] The server is configured to determine a managed instance of the database cluster when the server detects that a fault instance exists in the database cluster;
[0042] The server is further configured to forward the transaction access request to the hosting instance when the server receives the transaction access request of the fault instance;
[0043] The database cluster is configured to send an access result corresponding to the transaction access request to the server when the managed instance receives the transaction access request of the faulty instance.
[0044] A computer device comprises a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the transaction hosting method based on a shared storage database cluster are implemented as described above.
[0045] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the transaction hosting method based on a shared storage database cluster as described above.
[0046] This application has the following advantages:
[0047] In an embodiment of the present application, relative to the problem in the prior art of being unable to normally access transactions of a faulty instance, the present application provides a solution to a transaction hosting mechanism that can normally access a faulty instance, specifically: when the server detects that a faulty instance exists in the database cluster, it determines the hosting instance of the database cluster; when the server receives a transaction access request for the faulty instance, it forwards the transaction access request to the hosting instance; wherein the hosting instance is used to host transactions of the faulty instance. The transaction hosting mechanism of the present application overcomes the problem of long-term blocking of online instances accessing transactions on faulty instances, and also overcomes the problem of long-term occupation of unfinished transaction resources on the faulty instance. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for the description of the present application. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0049] FIG1 is a first flow chart of a transaction hosting method based on a shared storage database cluster provided by an embodiment of the present application;
[0050] FIG2 is a second flow diagram of a transaction hosting method based on a shared storage database cluster provided in one embodiment of the present application;
[0051] FIG3 is a third flow diagram of a transaction hosting method based on a shared storage database cluster provided in one embodiment of the present application;
[0052] FIG4 is a flow chart of an example startup scenario provided by an embodiment of the present application;
[0053] FIG5 is a flow chart of an example fault scenario provided by an embodiment of the present application;
[0054] FIG6 is a schematic diagram of an example startup scenario provided by an embodiment of the present application;
[0055] FIG7 is a schematic diagram of an example fault scenario provided by an embodiment of the present application;
[0056] FIG8 is a first structural block diagram of a transaction hosting device based on a shared storage database cluster provided by an embodiment of the present application;
[0057] FIG9 is a second structural block diagram of a transaction hosting device based on a shared storage database cluster provided by an embodiment of the present application;
[0058] FIG10 is a schematic structural diagram of a computer device provided in accordance with an embodiment of the present invention. DETAILED DESCRIPTION
[0059] To make the objectives, features, and advantages of this application more readily apparent, the present application is further described below in conjunction with the accompanying drawings and specific embodiments. It is apparent that the embodiments described are only a portion of the embodiments of this application, not all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments in this application without inventive effort are also within the scope of protection of this application.
[0060] The inventors discovered through analysis of prior art that the invention with publication number CN112256656A provides a method for quickly rolling back transactions, which is as follows: generating a transaction rollback log by parsing the native transaction log file, then generating a transaction rollback log file in reverse order, and executing the transaction rollback log file; rolling back unrelated transactions in parallel, and rolling back related transactions in serial. The disadvantages of this solution are that the invention does not necessarily improve transaction rollback performance to a certain extent. There are two main reasons for this. First, the operation of the transaction rollback log file will inevitably generate a certain amount of file IO. Second, it will only roll back unrelated transactions in parallel. At the same time, the invention does not involve transaction access to fault instances in fault scenarios.
[0061] In a shared storage cluster using distributed transaction management, if an instance in the cluster experiences an abnormal failure, any other instances attempting to access transactions that completed normally on the failed instance will be blocked, impacting database operations. Furthermore, if unfinished transactions on the failed instance are not rolled back, the global resources associated with these transactions will be occupied for a long time, blocking access to these resources by other instances, similarly impacting database operations. Therefore, the present invention aims to provide a transaction escrow mechanism that allows for normal access to transactions that completed normally on the failed instance and facilitates the rollback of unfinished transactions on the failed instance.
[0062] 1 , a transaction hosting method based on a shared storage database cluster provided by an embodiment of the present application is shown;
[0063] The method comprises:
[0064] S110. When the server detects that a faulty instance exists in the database cluster, determining a managed instance of the database cluster;
[0065] S120. When the server receives the transaction access request of the faulty instance, the server forwards the transaction access request to the hosting instance; wherein the hosting instance is used to host the transaction of the faulty instance.
[0066] In an embodiment of the present application, relative to the problem in the prior art of being unable to normally access transactions of a faulty instance, the present application provides a solution to a transaction hosting mechanism that can normally access a faulty instance, specifically: when the server detects that a faulty instance exists in the database cluster, it determines the hosting instance of the database cluster; when the server receives a transaction access request for the faulty instance, it forwards the transaction access request to the hosting instance; wherein the hosting instance is used to host transactions of the faulty instance. The transaction hosting mechanism of the present application overcomes the problem of long-term blocking of online instances accessing transactions on faulty instances, and also overcomes the problem of long-term occupation of unfinished transaction resources on the faulty instance.
[0067] Next, a transaction hosting method based on a shared storage database cluster in this exemplary embodiment will be further described.
[0068] It should be noted that the present application relates to servers and database clusters. The database cluster utilizes at least two or more database servers to form a virtual single database logical image, providing transparent data services to clients like a single database system. The database cluster includes several databases, each of which includes at least one instance, and each instance includes a primary instance and a non-primary instance.
[0069] 2 and 4 , a schematic diagram of the process of the instance startup scenario is shown:
[0070] In one embodiment of the present application, the transaction entrustment method further includes:
[0071] S210: When the target instance is started, the server determines whether the target instance is the primary instance;
[0072] S220: If yes, the target instance hosts the transaction of the non-primary instance;
[0073] S230: If not, the master instance cancels the transaction of hosting the target instance.
[0074] As described in step S210 , when the target instance is started, the server determines whether the target instance is the primary instance.
[0075] As an example, the startup of the database is carried out in steps, including instance startup, database loading (opening the control file for the instance) and database opening. Therefore, the database can be in three states: instance is turned on (nomount), database is loaded (mount) and database is opened (open). In the instance of the database cluster configuration, when a certain instance is started, it is necessary to determine whether it is the main instance. If the target instance is the first instance started, then the database cluster will use the target instance as the main instance according to a certain algorithm and configuration strategy, and the remaining instances in the database cluster as non-main instances. In a cluster database, the first instance started will be the main instance. An important task of the main instance is to perform a full recovery of the database. During the recovery process, it may be necessary to access the transaction status of other instances. Before performing a full recovery, if the transactions of other instances are not hosted, then the transaction status on other instances cannot be accessed. The present invention can solve the technical problem of being unable to access the transaction status of other instances during a full recovery.
[0076] As described in step S220, if yes, the target instance hosts the transaction of the non-primary instance.
[0077] In an embodiment of the present invention, the specific process of "if yes, then the target instance hosts the transaction of the non-primary instance" in step S220 can be further explained in combination with the following description.
[0078] As an example, during startup, the master instance, in addition to initializing its own transaction memory and importing transaction pages, also needs to sequentially initialize the transaction memory of unstarted instances in the database cluster and import transaction pages of unstarted instances.
[0079] As described in the following steps, the target instance initializes the transaction memory of the non-primary instance;
[0080] In one specific implementation, starting an instance includes the following tasks:
[0081] 1) Read the database parameter file;
[0082] 2) Allocate SGA memory based on the configuration information read from the parameter file;
[0083] 3) Start the background process and open the alert file and trace file.
[0084] During instance startup, only the initialization parameter file is used. Whether the database exists has no effect on instance startup. If the initialization parameters are set incorrectly, the instance will fail to start.
[0085] As described in the following steps, the target instance imports the transaction page of the non-master instance.
[0086] In one specific implementation, loading the database includes the following tasks:
[0087] 1) Associate the database with the previously started instance;
[0088] 2) Locate and open all current control files specified in the parameter file;
[0089] 3) Read the control file to obtain the name and status of the data file and redo log file to prepare for opening the database;
[0090] 4) When loading a database, the instance will open the control file. If the control file is damaged, the instance will not be able to load the database. During the loading phase, the instance does not open the database's physical files - data files and redo log files.
[0091] As described in step S230, if not, the master instance cancels the transaction of hosting the target instance.
[0092] In one embodiment of the present invention, the specific process of "if not, the primary instance cancels the transaction of hosting the target instance" in step S230 can be further explained in combination with the following description.
[0093] As described in the following steps, the primary instance releases the transaction memory of the target instance.
[0094] In one specific implementation, when the target instance being started is a non-primary instance, the target instance will notify the primary instance during startup. Upon receiving the notification, the primary instance will revoke transaction custody for the target instance and release the target instance's transaction memory. This application enables the primary instance to normally access transactions on non-started instances in the cluster during instance startup.
[0095] 1 and 5 , a schematic diagram of a process flow of an example fault scenario is shown:
[0096] As described in step S110 , when the server detects that a faulty instance exists in the database cluster, the server determines a managed instance of the database cluster.
[0097] In an embodiment of the present invention, the specific process of “determining the hosting instance of the database cluster” in step S110 may be further explained in combination with the following description.
[0098] As described in the following steps, when the primary instance is idle, the primary instance becomes the managed instance;
[0099] As described in the following steps, when the primary instance is busy, the online status and idle status of the non-primary instance are determined, and the managed instance is determined based on the online status and the idle status.
[0100] As an example, the database, as the core of an information system, plays a very important role. A single device cannot guarantee the continuous operation of the system. If a system failure occurs, it will seriously affect the normal operation of the system and even cause huge economic losses. By forming a database cluster, high availability of the database can be achieved. When an instance fails, the server will automatically detect and host the transactions of the failed instance to ensure the continuous operation of the database. In a shared storage cluster, transaction management adopts distributed transaction management. The transaction ID of each instance is globally unique, and the instance management of the current transaction can be located based on the transaction ID. When an instance in the cluster fails abnormally, the cluster will select one or more online instances based on a certain algorithm, called hosted instances. The hosted instance will take over all transactions on the failed instance. The hosted instance initializes the transaction memory area of the failed instance, loads the transaction page of the failed instance, and rolls back the unfinished transactions on the failed instance.
[0101] In one specific implementation, if an instance in the database cluster experiences an exception and fails, the server detects the instance failure and selects the instance as a managed instance based on a specific algorithm. Typically, the primary instance is selected as the managed instance. If the primary instance becomes busy or fails, the primary instance changes, and the server reselects the primary instance. The primary instance selects an idle instance from among the already running instances as the new primary instance.
[0102] As described in step S120, when the server receives the transaction access request of the faulty instance, it forwards the transaction access request to the hosting instance; wherein the hosting instance is used to host the transaction of the faulty instance.
[0103] In a specific implementation, when an instance in the database cluster accesses a transaction, the server locates the transaction access request as belonging to the faulty instance based on the transaction identifier. At this time, the faulty instance has been hosted by the hosted instance, and the access request is forwarded to the hosted instance. The hosted instance returns the result after receiving the transaction access request.
[0104] 3 , a transaction hosting method based on a shared storage database cluster is shown in accordance with another embodiment of the present application;
[0105] The method comprises:
[0106] S310: When the managed instance receives the transaction access request of the faulty instance, the managed instance sends the access result corresponding to the transaction access request to the server.
[0107] Next, a transaction hosting method based on a shared storage database cluster in this exemplary embodiment will be further described.
[0108] As described in step S310, when the managed instance receives the transaction access request of the faulty instance, the managed instance sends the access result corresponding to the transaction access request to the server.
[0109] In one embodiment of the present invention, the specific process before "the managed instance receives the transaction access request of the faulty instance" can be further explained in combination with the following description.
[0110] As described in the following steps, the managed instance initializes the transaction memory of the faulty instance;
[0111] As described in the following steps, the managed instance loads the transaction page of the faulty instance;
[0112] As described in the following steps, the managed instance rolls back the unfinished transactions on the failed instance.
[0113] As an example, when an instance fails abnormally, the server selects one or more online instances as managed instances based on a certain algorithm. After receiving notification from the server, the managed instance will host the transactions of the failed instance. Similar to the instance startup scenario, after the managed instance hosts the failed instance, it first initializes the transaction memory area of the failed instance. During the instance startup process, only the initialization parameter file is used. Whether the database exists has no effect on the instance startup. If the initialization parameters are set incorrectly, the instance will fail to start; then the transaction page of the failed instance is loaded, and finally the unfinished transactions on the failed instance are rolled back, undoing the database update operations that have been completed by the transaction to ensure the integrity of the restored database after application, database, or system errors. The unfinished transactions on the failed instance are effectively rolled back, releasing transaction-related resources.
[0114] In an embodiment of the present invention, the specific process of "sending the access result corresponding to the transaction access request to the server" in step S310 can be further explained in combination with the following description.
[0115] As described in the following steps, the managed instance reads the transaction memory of the fault instance, and determines the transaction state corresponding to the transaction access request based on the transaction memory of the fault instance;
[0116] As described in the following steps, the managed instance sends the transaction status to the server.
[0117] In a specific implementation, when an instance in the database cluster accesses a transaction, the server locates, based on the transaction identifier, that the transaction access request belongs to the faulty instance. At this time, the faulty instance has been hosted by the hosting instance. After receiving the transaction access request, the hosted instance reads the transaction memory of the faulty instance on the local instance, obtains the transaction status of the transaction access request, and then returns the transaction status to the server.
[0118] Example 1
[0119] Referring to Figure 6, assume that a cluster has three instances configured: inst0, inst1, and inst2. Inst0 is started as the first instance, and the cluster uses a specific algorithm and configuration policy to make inst0 the master instance. During startup, inst0 initializes its own transaction memory and imports transaction pages. It also initializes the transaction memory of inst1 and inst2, and imports their transaction pages.
[0120] When instance inst1 is subsequently started, since the master instance inst0 already exists in the cluster, the instance inst1 started at this time will be started as a non-master instance. During the startup process, instance inst1 will notify the master instance inst0. After receiving the notification, the master instance inst0 revokes the transaction hosting for instance inst1 and releases the transaction memory of instance inst1.
[0121] The startup process of instance inst2 is the same as that of instance inst1. At this time, instance inst2 will be started as a non-master instance. During the startup process, instance inst2 will notify the master instance inst0. After receiving the notification, the master instance inst0 revokes the transaction trusteeship of instance inst2 and releases the transaction memory of instance inst2.
[0122] The transaction hosting method above allows you to access the transaction status of other instances normally when the instance is started for full recovery. This is because the primary instance hosts the transactions of the unstarted instances when it is started.
[0123] Example 2
[0124] Referring to Figure 7, assume that there are three instances in the cluster: inst0, inst1, and inst2. At some point, inst2 experiences an exception and fails. The cluster detects the failure of inst2 and selects inst0 as the managed instance based on a specific algorithm.
[0125] After receiving the notification from the cluster, instance inst0 will host the transaction of instance inst2, initialize the transaction memory area of instance inst2, load the transaction page of instance inst2, and roll back the unfinished transaction on instance inst2.
[0126] At a certain moment, instance inst1 accesses a transaction xid. The server locates the transaction based on the transaction identifier and finds that the transaction originally belongs to instance inst2. However, instance inst2 is already hosted by instance inst0. Therefore, the access request will be forwarded to instance inst0.
[0127] Instance inst0 receives a transaction access request, reads the transaction memory of instance inst2 on this instance, and returns the result.
[0128] The transaction hosting method overcomes the problem of long-term blocking of transactions on online instances accessing faulty instances, and overcomes the problem of long-term occupation of unfinished transaction resources on faulty instances.
[0129] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0130] 8 , a transaction hosting device based on a shared storage database cluster according to an embodiment of the present application is shown; the device involves a server and a database cluster; wherein the database cluster includes a plurality of databases, each of which includes at least one instance;
[0131] Specifically include:
[0132] A hosting selection module 810 is configured to determine a hosting instance of the database cluster when the server detects that a faulty instance exists in the database cluster;
[0133] The transaction forwarding module 820 is configured to forward the transaction access request of the fault instance to the hosting instance when the server receives the transaction access request of the fault instance; wherein the hosting instance is configured to host the transaction of the fault instance.
[0134] In one embodiment of the present invention, the instance includes a master instance and a non-master instance; the apparatus further includes:
[0135] an instance startup module, configured to, when a target instance is started, cause the server to determine whether the target instance is the primary instance;
[0136] a transaction hosting module, configured to: if yes, the target instance hosting the transaction of the non-primary instance;
[0137] The hosting cancellation module is used for, if not, the master instance to cancel the transaction of hosting the target instance.
[0138] In one embodiment of the present invention, the transaction hosting module includes:
[0139] An initialization submodule, configured for the target instance to initialize the transaction memory of the non-master instance;
[0140] The page import submodule is used for the target instance to import the transaction page of the non-master instance.
[0141] In one embodiment of the present invention, the escrow revocation module includes:
[0142] The memory release submodule is used for the master instance to release the transaction memory of the target instance.
[0143] In one embodiment of the present invention, the hosting selection module 810 includes:
[0144] A first selection submodule, configured to select the master instance as the managed instance when the master instance is idle;
[0145] The second selection submodule is configured to determine the online status and idle status of the non-primary instance when the primary instance is busy, and determine the managed instance based on the online status and the idle status.
[0146] 9 , a transaction hosting device based on a shared storage database cluster according to an embodiment of the present application is shown; the device involves a server and a database cluster; wherein the database cluster includes several databases, each of which includes at least one instance;
[0147] Specifically include:
[0148] The access processing module 910 is configured to send an access result corresponding to the transaction access request to the server when the managed instance receives the transaction access request of the faulty instance.
[0149] In one embodiment of the present invention, it further includes:
[0150] An initialization module, used by the managed instance to initialize the transaction memory of the fault instance;
[0151] A page loading module, used for the hosting instance to load the transaction page of the fault instance;
[0152] The rollback module is used for the managed instance to roll back the unfinished transaction on the faulty instance.
[0153] In one embodiment of the present invention, the access processing module 910 includes:
[0154] a transaction status determination submodule, configured for the managed instance to read the transaction memory of the fault instance and determine the transaction status corresponding to the transaction access request based on the transaction memory of the fault instance;
[0155] The access result returning submodule is used for the hosting instance to send the transaction status to the server.
[0156] The present application also provides a transaction hosting system based on a shared storage database cluster, the system involving a server and a database cluster;
[0157] The system comprises:
[0158] The server is configured to determine a managed instance of the database cluster when the server detects that a fault instance exists in the database cluster;
[0159] The server is further configured to forward the transaction access request to the hosting instance when the server receives the transaction access request of the fault instance;
[0160] The database cluster is configured to send an access result corresponding to the transaction access request to the server when the managed instance receives the transaction access request of the faulty instance.
[0161] 10 , a computer device of a transaction hosting method and apparatus based on a shared storage database cluster of the present invention is shown, which may specifically include the following:
[0162] The computer device 12 is a general-purpose computing device. The components of the computer device 12 may include but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 connecting different system components (including the system memory 28 and the processing unit 16).
[0163] The bus 18 represents one or more of several types of bus 18 structures, including a memory bus 18 or memory controller, a peripheral bus 18, an accelerated graphics port, a processor, or a local bus 18 that utilizes any of a variety of bus 18 architectures. Examples of such architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus 18, a Micro Channel Architecture (MAC) bus 18, an Enhanced ISA bus 18, an Audio Video Electronics Standards Association (VESA) local bus 18, and a Peripheral Component Interconnect (PCI) bus 18.
[0164] The computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including volatile and non-volatile media, removable and non-removable media.
[0165] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be configured to read and write to non-removable, non-volatile magnetic media (commonly referred to as a "hard drive"). Although not shown in FIG. 10 , a magnetic disk drive may be provided for reading and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), as well as an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media). In these cases, each drive may be connected to bus 18 via one or more data media interfaces. The memory may include at least one program product having a set (e.g., at least one) of program modules 42 configured to perform the functions of various embodiments of the present invention.
[0166] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in a memory. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules 42, and program data, each of which, or some combination thereof, may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0167] The computer device 12 can also communicate with one or more external devices 14 (e.g., a keyboard, pointing device, display 24, camera, etc.), one or more devices that enable an operator to interact with the computer device 12, and / or any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., a network card, modem, etc.). Such communication can occur via an input / output (I / O) interface 22. Furthermore, the computer device 12 can communicate with one or more networks (e.g., a local area network (LAN)), a wide area network (WAN), and / or a public network (e.g., the Internet) via a network adapter 20. As shown in FIG10 , the network adapter 20 communicates with the other modules of the computer device 12 via a bus 18. It should be understood that, although not shown in FIG10 , other hardware and / or software modules can be used in conjunction with the computer device 12, including, but not limited to, microcode, device drivers, redundant processing units 16, external disk drive arrays, RAID systems, tape drives, and data backup storage systems 34.
[0168] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing a transaction hosting method based on a shared storage database cluster provided by an embodiment of the present invention.
[0169] That is, when the processing unit 16 executes the program, the following is achieved: when the server detects that there is a fault instance in the database cluster, it determines the managed instance of the database cluster; when the server receives a transaction access request of the fault instance, it forwards the transaction access request to the managed instance; wherein, the managed instance is used to host the transaction of the fault instance.
[0170] In an embodiment of the present invention, the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the method for transaction hosting based on a shared storage database cluster as provided in all embodiments of the present application is implemented:
[0171] That is, when the program is executed by the processor, it is implemented as follows: when the server detects that there is a fault instance in the database cluster, it determines the managed instance of the database cluster; when the server receives a transaction access request of the fault instance, it forwards the transaction access request to the managed instance; wherein the managed instance is used to host the transaction of the fault instance.
[0172] Any combination of one or more computer-readable media may be employed. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having 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 thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0173] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0174] The computer program code for performing the operations of the present invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the operator's computer, partially on the operator's computer, as a separate software package, partially on the operator's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer can be connected to the operator's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, using an Internet service provider to connect through the Internet). The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referenced to each other.
[0175] Although preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic inventive concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0176] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.
[0177] The above is a detailed introduction to the transaction hosting method and device based on a shared storage database cluster provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present application.
Claims
1. A transaction hosting method based on a shared storage database cluster, the method involving a server and a database cluster; in, The database cluster includes a plurality of databases, and the database includes at least one instance; the method includes: When the server detects that there is a faulty instance in the database cluster, it determines a managed instance of the database cluster; When the server receives the transaction access request of the faulty instance, the server forwards the transaction access request to the hosting instance; wherein the hosting instance is used to host the transaction of the faulty instance.
2. The method according to claim 1, It is characterized in that The instance includes a primary instance and a non-primary instance; the method further includes: When the target instance is started, the server determines whether the target instance is the primary instance; If so, the target instance hosts the transaction of the non-primary instance; If not, the master instance cancels the transaction hosting the target instance.
3. The method according to claim 2, It is characterized in that The step of the target instance hosting the transaction of the non-primary instance comprises: The target instance initializes the transaction memory of the non-primary instance; The target instance imports the transaction page of the non-primary instance.
4. The method according to claim 2, It is characterized in that The step of the master instance cancelling the transaction of the target instance includes: The primary instance releases the transaction memory of the target instance.
5. The method according to claim 2, It is characterized in that The step of determining the managed instance of the database cluster includes: When the master instance is idle, the master instance becomes the managed instance; When the primary instance is busy, the online status and idle status of the non-primary instance are determined, and the managed instance is determined based on the online status and the idle status.
6. A transaction hosting method based on a shared storage database cluster, the method involving a server and a database cluster; in, The database cluster includes a plurality of databases, and the database includes at least one instance; the method includes: When the managed instance receives the transaction access request of the faulty instance, the managed instance sends the access result corresponding to the transaction access request to the server.
7. The method according to claim 6, It is characterized in that Before the step of the managed instance receiving the transaction access request, the method includes: The managed instance initializes the transaction memory of the faulty instance; The hosting instance loads the transaction page of the fault instance; The managed instance rolls back the unfinished transaction on the failed instance.
8. The method according to claim 6, It is characterized in that The step of sending the access result corresponding to the transaction access request to the server includes: The managed instance reads the transaction memory of the faulty instance, and determines the transaction state corresponding to the transaction access request according to the transaction memory of the faulty instance; The hosting instance sends the transaction status to the server.
9. A transaction hosting device based on a shared storage database cluster, It is characterized in that The device involves a server and a database cluster; wherein the database cluster includes a plurality of databases, and the database includes at least one instance; and is characterized in that the device includes: A hosting selection module, configured to determine a hosting instance of the database cluster when the server detects that a faulty instance exists in the database cluster; A transaction forwarding module is used to forward the transaction access request of the fault instance to the hosting instance when the server receives the transaction access request of the fault instance; wherein the hosting instance is used to host the transaction of the fault instance.
10. A transaction hosting device based on a shared storage database cluster, It is characterized in that The device involves a server and a database cluster; wherein the database cluster includes a plurality of databases, and the database includes at least one instance; and is characterized in that the device includes: The access processing module is used to send the access result corresponding to the transaction access request to the server when the managed instance receives the transaction access request of the faulty instance.
11. A transaction hosting system based on a shared storage database cluster, It is characterized in that The system involves a server and database cluster; The system comprises: The server is used to determine the managed instance of the database cluster when the server detects that there is a faulty instance in the database cluster; The server is further configured to forward the transaction access request to the hosting instance when the server receives the transaction access request of the faulty instance; The database cluster is used for sending the access result corresponding to the transaction access request to the server when the hosting instance receives the transaction access request of the faulty instance.
12. A computer device, It is characterized in that The invention comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the transaction hosting method based on a shared storage database cluster as claimed in any one of claims 1 to 8 is implemented.
13. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the transaction hosting method based on a shared storage database cluster according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Fault database switching method and system used for distributive database cluster
CN106126652A
High availability method based on server cluster
CN112181660A
Multi-tenant provider network database connection management and dominance
CN114667513A
Memory-aware joins based in a database cluster
US20160026667A1
