Database partition management method, device and equipment

By storing and maintaining the fault isolation strategy of database sub-repository in the database state management system, the problem that the database application system cannot quickly adjust the fault isolation strategy is solved, and the accuracy and flexibility of fault isolation are improved.

CN120234371APending Publication Date: 2025-07-01NETSUNION CLEARING CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311865702.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-29
Publication Date
2025-07-01

AI Technical Summary

Technical Problem

In the prior art, database application systems cannot quickly adjust the fault isolation strategy according to changes in business conditions, resulting in low accuracy of fault isolation.

Method used

Through the database state management system, the fault isolation strategies of each database sub-repository are stored and maintained. The database application system can dynamically adjust the status of the database sub-repository according to exception information and fault isolation policies, and realize the function of quickly adjusting the fault isolation strategy.

Benefits of technology

It improves the accuracy of the database application system for fault isolation processing, reduces the impact of database failure on the database application system, and can quickly adjust the fault isolation strategy according to business conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120234371A_ABST
    Figure CN120234371A_ABST
Patent Text Reader

Abstract

The invention provides a database partition management method, device and equipment, and relates to the technical field of databases. The method can be applied to a database application system corresponding to a database, the database application system is in communication connection with a database state management system corresponding to the database, and the database state management system is used for storing and maintaining a fault isolation strategy corresponding to each database sub-database. The method comprises the steps that when a data storage request is received, a preset storage operation is executed, and the storage operation is used for storing to-be-stored data into a target database sub-database; detecting whether abnormal information is generated in the execution process of the storage operation; and if yes, obtaining a fault isolation strategy corresponding to the target database sub-library, and determining the state of the target database sub-library according to the generated abnormal information and the fault isolation strategy. The technical problem that a database application system cannot quickly adjust a fault isolation strategy can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of database technologies, and in particular, to a method, apparatus, and device for database sharding management. Background Art

[0002] In an application system with a distributed architecture, to meet the requirements of the system in terms of performance, availability, etc., the database is usually horizontally split into multiple shards, and the database application system stores the data in an available shard according to certain rules.

[0003] Among them, the available state of a shard is usually jointly determined by the arbitration available state maintained in the database state management system and the detection available state maintained by the database application system itself based on the fault isolation policy. When the arbitration available state and the detection available state of a certain shard are both in the available state, it indicates that the shard is available; when one of the arbitration available state and the detection available state of a certain shard is unavailable, the database application system considers that the shard has failed and performs fault isolation on the shard.

[0004] However, in the existing solution, the above-mentioned fault isolation policy is stored in the database application system. When the fault isolation policy needs to be adjusted, it is necessary to redeploy the database application system before it can take effect, so that the fault isolation policy cannot be quickly adjusted according to the changes in the business situation, and the fault isolation accuracy is relatively low. Summary of the Invention

[0005] This application provides a method, apparatus, and device for database sharding management, which can solve the technical problem that the database application system in the existing technology cannot quickly adjust the fault isolation policy according to the changes in the business situation.

[0006] In a first aspect, this application provides a method for database sharding management, which is applied to a database application system corresponding to a database. The database application system is communicatively connected to a database state management system corresponding to the database. The database includes several database shards, and the database state management system is used to store and maintain the fault isolation policy corresponding to each database shard. The method includes:

[0007] When receiving a data storage request, perform a preset storage operation, where the storage operation is used to store the data to be stored in a target database shard;

[0008] Detect whether exception information is generated during the execution of the storage operation;

[0009] If it is detected that abnormal information is generated during the execution of the storage operation, obtain the fault isolation policy corresponding to the target database sub-library, and determine the state of the target database sub-library according to the generated abnormal information and the fault isolation policy corresponding to the target database sub-library.

[0010] In some embodiments, the method further includes:

[0011] Synchronize the fault isolation policies corresponding to each database sub-library stored in the database status management system to a cache device preset in the database application system;

[0012] The obtaining the fault isolation policy corresponding to the target database sub-library includes:

[0013] Obtain the fault isolation policy corresponding to the target database sub-library stored in the cache device.

[0014] In some embodiments, the fault isolation policy includes the type of abnormal information that triggers fault isolation processing; the method further includes:

[0015] If the type of the abnormal information generated during the execution of the storage operation does not belong to the type of abnormal information, generate fault isolation policy update information based on the abnormal information generated during the execution of the storage operation;

[0016] Send the fault isolation policy update information to the database status management system so that the database status management system updates the fault isolation policy corresponding to the target database sub-library according to the fault isolation policy update information.

[0017] In some embodiments, the method further includes:

[0018] When receiving the fault isolation policy update completion indication information sent by the database status management system, perform a preset synchronization operation to synchronize the fault isolation policy update information in the database status management system to the cache device.

[0019] In some embodiments, the fault isolation policy further includes a detection duration and a threshold number of abnormal information generated within the detection duration;

[0020] The determining the state of the target database sub-library according to the generated abnormal information and the fault isolation policy corresponding to the target database sub-library includes:

[0021] If the type of the generated abnormal information belongs to the type of abnormal information, determine whether the number of the generated abnormal information within the detection duration is greater than the threshold number;

[0022] When the number of the abnormal information generated within the detection duration is greater than the number threshold, determine the status of the target database sub-library as an unavailable state.

[0023] In some embodiments, each of the database sub-libraries includes a fault recovery detection table; the method further includes:

[0024] After performing fault isolation processing on the target database sub-library, write preset detection information into the fault recovery detection table in the target database sub-library at preset time intervals.

[0025] When the detection information is successfully written into the fault recovery detection table in the target database sub-library, determine the status of the target database sub-library as an available state.

[0026] In a second aspect, the present application provides a database sub-library management device, which is applied to a database application system corresponding to a database. The database application system is communicatively connected to a database status management system corresponding to the database. The database includes a plurality of database sub-libraries, and the database status management system is used to store and maintain the fault isolation policies corresponding to each of the database sub-libraries; the device includes:

[0027] An execution module, configured to perform a preset storage operation when receiving a data storage request, where the storage operation is used to store the data to be stored into a target database sub-library.

[0028] A detection module, configured to detect whether abnormal information is generated during the execution of the storage operation.

[0029] A determination module, configured to, if it is detected that abnormal information is generated during the execution of the storage operation, obtain the fault isolation policy corresponding to the target database sub-library, and determine the status of the target database sub-library according to the generated abnormal information and the fault isolation policy corresponding to the target database sub-library.

[0030] In a third aspect, the present application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;

[0031] The memory stores computer execution instructions;

[0032] The processor executes the computer execution instructions stored in the memory to implement the database sub-library management method provided in the first aspect.

[0033] Fourthly, the present application provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the database sub-library management method provided in the first aspect when executed by a processor.

[0034] Fifthly, the present application provides a computer program product including a computer program, which implements the database sub-library management method provided in the first aspect when executed by a processor.

[0035] For the database sub-library management method, device and equipment provided by the present application, when the database application system detects abnormal information generated during the execution of a storage operation, it can determine the state of the target database sub-library based on the fault isolation policy maintained by the database state management system. Compared with setting a fixed fault isolation policy in the database application system in the prior art, the present application stores and maintains the fault isolation policies corresponding to each database sub-library by using the database state management system, and can quickly adjust the fault isolation policies corresponding to each database sub-library through the database state management system according to changes in business conditions, thereby improving the accuracy of the database application system in performing fault isolation processing and reducing the impact of database failures on the database application system. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application and used together with the specification to explain the principles of the present application.

[0037] Figure 1 It is a schematic diagram of the architecture of a database sub-library management system provided in an embodiment of the present application;

[0038] Figure 2 It is a schematic diagram of the step flow of a database sub-library management method provided in an embodiment of the present application;

[0039] Figure 3 It is a schematic diagram of the process of selecting a target database sub-library provided in an embodiment of the present application;

[0040] Figure 4 It is another schematic diagram of the step flow of a database sub-library management method provided in an embodiment of the present application;

[0041] Figure 5 It is a schematic diagram of the fault isolation policy synchronization process provided in an embodiment of the present application;

[0042] Figure 6 It is a schematic diagram of the fault recovery detection process provided in an embodiment of the present application;

[0043] Figure 7It is a schematic diagram of program modules of a database sub - database management device provided in an embodiment of the present application;

[0044] Figure 8 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.

[0045] Through the above - mentioned drawings, specific embodiments of the present application have been shown, and there will be more detailed descriptions hereinafter. These drawings and text descriptions are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. Specific Embodiments

[0046] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0047] The following explains some terms involved in the embodiments of the present application:

[0048] Database sub - database: In a relational database, in order to meet the requirements of capacity and performance, a database and its data are split, thus forming a set of database collections with the same structure and purpose.

[0049] Database exception: An exception that occurs when an application accesses a database server through a database driver and performs data operations. For example: database connection timeout, connection authentication failure, primary key duplication exception, etc.

[0050] In an application system with a distributed architecture, in order to meet the requirements of the system in terms of performance, availability, etc., the database is usually split into a set of sub - databases with the same structure and purpose by horizontal splitting, and the application system sends data to an available sub - database for storage according to certain rules.

[0051] Refer to Figure 1 , Figure 1 It is a schematic diagram of the architecture of a database sub - database management system provided in an embodiment of the present application.

[0052] In Figure 1 , the database is split into N sub - databases, namely database sub - database 1, database sub - database 2, database sub - database 3, ……, database sub - database N.

[0053] Among them, the available status of each of the above database sub-libraries is usually jointly determined by the arbitration available status maintained in the database status management system and the detection available status maintained by the database application system itself. When the arbitration available status and the detection available status of a certain sub-library are both in the available status, the database application system will send the data to be stored in this sub-library. When one of the arbitration available status and the detection available status of a certain sub-library is unavailable, the database application system considers that this sub-library has a fault and isolates the fault of this sub-library.

[0054] In some embodiments, the arbitration available status of each of the above sub-libraries is managed by the database status management system. The database application system periodically synchronizes the arbitration available status of all sub-libraries from the database status management system and stores it in the sub-library available status table in the database application system; meanwhile, the detection available status of all sub-libraries is also maintained in this sub-library available status table.

[0055] In some embodiments, when the database application system performs database operations, it will check whether the current sub-library has a database exception. If a database exception occurs, it will determine whether the fault isolation threshold is reached according to the pre-set fault isolation policy. If the fault isolation threshold is reached, the detection available status of this sub-library maintained by the database application system itself will be marked as unavailable, thus completing the fault isolation of this sub-library.

[0056] However, in the above solution, the fault isolation policy is stored in the database application system. If the fault isolation policy needs to be adjusted, it needs to be redeployed after the application system to take effect, and it is impossible to quickly adjust the fault isolation policy according to the change of the business situation, and the fault isolation accuracy is relatively low.

[0057] In the face of the above technical problems, in the embodiments of the present application, a database sub-library management method is provided, which uses the database status management system to store and maintain the fault isolation policies corresponding to each database sub-library. Therefore, according to the change of the business situation, the fault isolation policies corresponding to each database sub-library can be quickly adjusted through the database status management system, which can improve the accuracy of the database application system in performing fault isolation processing and reduce the impact of database faults on the database application system.

[0058] The technical solutions shown in the present application are described in detail below through specific embodiments. It should be noted that the following several embodiments can exist independently or be combined with each other. For the same or similar content, it will not be repeated in different embodiments.

[0059] Refer to Figure 2 , Figure 2The figure is a schematic flowchart of the steps of a database sub - database management method provided in an embodiment of this application. In some embodiments of this application, the above - mentioned database management method can be applied to a database - corresponding database application system, which is communicatively connected to a database - corresponding database status management system. The above - mentioned database includes several database sub - databases, and the database status management system is used to store and maintain the fault isolation policies corresponding to each database sub - database.

[0060] The above - mentioned database sub - database management method includes:

[0061] S201. When a data storage request is received, execute a preset storage operation, which is used to store the data to be stored into a target database sub - database.

[0062] In some embodiments, when the database application system receives a data storage request, it can first select an available database sub - database (that is, the arbitration available status and the detection available status of this database sub - database are both available status) as the target database sub - database through the sub - database available status table maintained by itself, and then execute the preset storage operation to store the data to be stored into the above - mentioned target database sub - database.

[0063] Exemplarily, refer to Figure 3 , Figure 3 which is a schematic diagram of the process of selecting a target database sub - database provided in an embodiment of this application.

[0064] In some embodiments, when the database application system receives a data storage request, the internal sub - database selection module queries the sub - database available status table to determine whether each database sub - database is currently available one by one. If the current database sub - database is determined to be available, select this database sub - database as the target database sub - database and send the data to be stored to this database sub - database for storage. If the current database sub - database is not available, continue to check other database sub - databases until an available database sub - database is found for data storage.

[0065] Exemplarily, in Figure 3 , first determine whether database sub - database 1 is available. If it is determined that database sub - database 1 is not available, skip database sub - database 1 and determine whether database sub - database 2 is available. If it is determined that database sub - database 2 is available, select database sub - database 2 as the target database sub - database.

[0066] S202. Detect whether abnormal information is generated during the execution of the above - mentioned storage operation.

[0067] In some embodiments, during the execution of the above - mentioned storage operation by the database application system, it monitors in real - time whether abnormal information is generated, such as data type exception, syntax exception, permission exception, constraint conflict exception, etc.

[0068] S203. If abnormal information is generated during the execution of the above storage operation, obtain the fault isolation policy corresponding to the target database sub-library, and determine the status of the target database sub-library according to the generated abnormal information and the fault isolation policy corresponding to the target database sub-library.

[0069] In some embodiments, if abnormal information is generated during the execution of the above storage operation, obtain the fault isolation policy corresponding to the target database sub-library maintained by the database status management system, and determine the status of the target database sub-library according to the generated abnormal information and the fault isolation policy corresponding to the target database sub-library.

[0070] In some embodiments, several fault isolation conditions are included in the above fault isolation policy. When the generated abnormal information meets the above several fault isolation conditions, the status of the target database sub-library can be determined to be unavailable, thereby triggering a fault isolation operation on the target database sub-library; when the generated abnormal information does not meet the above several fault isolation conditions, the status of the target database sub-library can be determined to be available.

[0071] Exemplarily, assume that the fault isolation policy corresponding to the above target database sub-library is that more than 2 any abnormal information is generated within 1 minute, then trigger fault isolation. Then detect whether more than 2 abnormal information is generated within 1 minute during the execution of the above storage operation. If so, determine that the status of the target database sub-library is unavailable, and trigger a fault isolation operation on the target database sub-library.

[0072] For the database sub-library management method provided by this application, when the database application system detects that abnormal information is generated during the execution of the storage operation, it can determine the status of the target database sub-library based on the fault isolation policy maintained by the database status management system; compared with setting a fixed fault isolation policy in the database application system in the prior art, this application uses the database status management system to store and maintain the fault isolation policies corresponding to each database sub-library, and can quickly adjust the fault isolation policies corresponding to each database sub-library through the database status management system according to the changes in business conditions, thereby improving the accuracy of the database application system for fault isolation processing and reducing the impact of database failures on the database application system.

[0073] Based on the content described in the above embodiments, in some embodiments, the fault isolation policies corresponding to each database sub-library stored in the database status management system can be synchronized to the preset cache device in the database application system; when it is detected that abnormal information is generated during the execution of the storage operation, the fault isolation policy corresponding to the target database sub-library can be obtained from the above cache device.

[0074] Optionally, in some embodiments, the fault isolation policies corresponding to each sub-database stored in the database state management system may be synchronized to a preset cache device in the database application system at preset time intervals.

[0075] In some embodiments, the database state management system may update the fault isolation policies corresponding to each sub-database stored in the database state management system according to the user's configuration operation, and after the update is completed, send an update message to the database application system. After receiving the update message sent by the database state management system, the database application system synchronizes and updates the fault isolation policies stored in the cache device according to the update message.

[0076] The database sub-database management method provided by this application stores the fault isolation policies of each database sub-database in the database state management system. The database application system regularly synchronizes the fault isolation policies from the database state management system and caches all the fault isolation policies in the application system, so as to dynamically adjust the fault isolation policies and improve the accuracy of fault isolation.

[0077] Based on the content described in the above embodiments, in some embodiments, the above fault isolation policy includes the type of exception information that triggers the fault isolation process, the detection duration, and the number threshold of the exception information generated within the detection duration.

[0078] In some embodiments, if it is detected that the above storage operation generates exception information during execution, and the type of the generated exception information belongs to the above type of exception information, it is determined whether the number of exception information generated within the above detection duration is greater than the above number threshold; if so, the state of the target database sub-database is determined to be an unavailable state.

[0079] In some embodiments, if the type of the exception information generated during the execution of the above storage operation does not belong to the above type of exception information, a fault isolation policy update message is generated based on the exception information generated during the execution of the above storage operation, and the fault isolation policy update message is sent to the above database state management system, so that the above database state management system updates the fault isolation policy corresponding to the above target database sub-database according to the fault isolation policy update message.

[0080] In some embodiments, after the database state management system updates the fault isolation policy corresponding to the above target database sub-database according to the above fault isolation policy update message, it may send a fault isolation policy update completion indication message to the database application system. After receiving the fault isolation policy update completion indication message, the database application system performs a preset synchronization operation to synchronize the fault isolation policy update message in the database state management system to the cache device in the database application system.

[0081] For the database sub-library management method provided in this application, the database application system can trigger the database status management system to update the fault isolation policy according to the detection results during the data storage process, so that the fault isolation policy stored in the database status management system can better fit the current data storage service.

[0082] Based on the content described in the above embodiments, in some embodiments, after the database application system isolates a certain sub-library from faults, it will regularly detect whether the connection between the database application system and the sub-library is normal. When it detects that the connection between the database application system and the sub-library resumes normal, it will restore the detection available status of the sub-library to the available status. The database application system detects the arbitration available status and the detection available status of all sub-libraries during data storage, and sends the data to the sub-libraries where both the arbitration available status and the detection available status are available for storage.

[0083] However, in some extreme cases, there is a situation where the database application system is connected to the database normally but data writing operations cannot be performed. In this case, the database has not yet been restored to an available state. By detecting the connectivity between the database application system and the database, the available state of the database cannot be accurately determined. If a fault recovery is performed at this time, the data storage sent by the database application system to this sub-library will fail, resulting in the failure of business processing.

[0084] In the face of the above technical problems, in some embodiments of this application, a fault recovery detection table can be added to all database sub-libraries first; after the target database sub-library is isolated from faults, at preset time intervals, the preset detection information is written into the fault recovery detection table in the target database sub-library; when the above detection information is successfully written into the fault recovery detection table in the target database sub-library, the state of the target database sub-library can be determined to be the available state.

[0085] Optionally, the above preset detection information may include the IP address of the database application system and the system time of this round of initiating detection.

[0086] In some embodiments, when a database fault occurs and reaches the fault isolation threshold, the database application system can mark the detection available status of the faulty sub-library as unavailable, and start detecting whether the faulty sub-library has been restored to an available state by regularly writing the IP address of the database application system and the system time of this round of initiating detection into the fault recovery detection table.

[0087] When the database application system successfully writes data to the fault recovery detection table, it indicates that the faulty sub-database has been restored and is available. The database application system marks the detection availability status of the faulty sub-database in the database availability status table as available. If the arbitration availability status of the faulty sub-database is also available at this time, the faulty sub-database is released from fault isolation.

[0088] The database sub-database management method provided by this application improves the fault recovery detection method to detect whether the database fault has been recovered by sending detection information to the fault recovery detection table in the faulty sub-database, solving the technical problem of easy misjudgment in the existing solution.

[0089] Based on the content described in the above embodiments, in some embodiments, the above database sub-database management method can be summarized into the following four parts:

[0090] Database availability status check: When storing data, the database application system decides which database sub-database to send the data to through the availability status check.

[0091] Database fault isolation strategy: When a database exception occurs, it is decided whether to isolate the sub-database from the fault by analyzing whether the exception meets the pre-set fault isolation strategy.

[0092] Database availability status management: The arbitration availability status and detection availability status of all sub-databases are managed through the sub-database availability status table inside the database application system.

[0093] Database fault recovery detection: After the database application system marks the detection availability status of a certain sub-database as unavailable due to a database fault, it will periodically perform fault recovery detection by writing detection information to the detection table of the sub-database.

[0094] Refer to Figure 4 , Figure 4 For another step process schematic diagram of the database sub-database management method provided in the embodiments of this application, in some embodiments, the above database sub-database management method includes:

[0095] S401. Receive a data storage request.

[0096] S402. Select a target database sub-database.

[0097] S403. Execute a storage operation to store the data to be stored in the target database sub-database.

[0098] S404. Detect whether exception information is generated during the execution of the storage operation. If so, execute S405; if not, end the process after the storage operation is completed.

[0099] S405. Determine whether the exception information reaches the fault isolation policy threshold. If yes, execute S406; if no, end the process after the storage operation is completed.

[0100] In some embodiments, the fault isolation policies of all database sub-libraries can be stored in the fault isolation policy table of the database state management system. The database application system periodically synchronizes the fault isolation policies from the database state management system and caches all the fault isolation policies in the database application system, so as to achieve the purpose of dynamically adjusting the fault isolation policies and improve the accuracy of fault isolation.

[0101] Referring to Table 1, Table 1 is a fault isolation policy table provided in the embodiments of the present application.

[0102] Table 1: Fault Isolation Policy Table

[0103]

[0104]

[0105] Exemplarily, referring to Figure 5 , Figure 5 is a schematic diagram of a fault isolation policy synchronization process provided in the embodiments of the present application.

[0106] S406. Perform fault isolation processing on the target database sub-library, return to execute S402, and re-select the target database sub-library.

[0107] S407. Update the status of the target database sub-library.

[0108] In some embodiments, the status of the database sub-library can be jointly determined by the arbitration available status managed by the database state management system and the detection available status managed by the database application system. When the arbitration available status and the detection available status of a certain database sub-library are both available, the available status of this database sub-library is available; when one of the arbitration available status and the detection available status of a certain database sub-library is unavailable, the available status of this database sub-library is unavailable.

[0109] Referring to Table 2, Table 2 is a database available status table provided in the embodiments of the present application.

[0110] Table 2: Database Available Status Table

[0111]

[0112] In some embodiments, the arbitration available status and the detection available status of all sub-libraries can be managed through the above database available status table.

[0113] S408. Detect the failure recovery of database sharding at regular intervals.

[0114] S408. Determine whether the failure of the database sharding has been recovered. If so, return to execute S407. If not, return to execute S408.

[0115] In some embodiments, a failure recovery detection table can be added to all database shards in advance. When a database failure occurs and reaches the failure isolation threshold, the database application system marks the detection availability status of the failed shard as unavailable and starts to detect whether the failed shard has recovered and become available by regularly writing the IP address of the database application system and the system time of this round of initiated detection into the failure recovery detection table. Among them, when the database application system successfully writes data to the failure recovery detection table, it indicates that the failed shard has recovered and become available. The application system marks the detection availability status of this shard in the database availability status table as available. If the arbitration availability status of this shard is also available at this time, the shard is released from failure isolation.

[0116] Referring to Table 3, Table 3 is a failure recovery detection table provided in the embodiments of the present application.

[0117] Table 3: Failure Recovery Detection Table

[0118]

[0119] Exemplarily, referring to Figure 6 , Figure 6 is a schematic diagram of a failure recovery detection process provided in the embodiments of the present application.

[0120] The database sharding management method provided by the present application, the database application system detects the database availability status through database write operations, solves the problem that it is impossible to effectively perform failure isolation when the database cannot be written but the database application system is normally connected to the database, improves the accuracy of database failure detection, effectively reduces the impact of database failures on the database application system, and improves the availability of the database application system; in addition, by storing and maintaining the failure isolation policies corresponding to each database shard through the database status management system, the purpose of dynamically and flexibly adjusting the failure isolation processing policy is achieved, the accuracy of the database application system's failure isolation processing is improved, and the impact of database failures on the application system is further reduced.

[0121] Based on the content described in the above embodiments, an embodiment of the present application also provides a database sharding management device. Referring to Figure 7 , Figure 7It is a schematic diagram of a program module of a database sub - database management device provided in an embodiment of the present application. In some embodiments, the above - mentioned database sub - database management device is applied to a database - corresponding database application system. The database application system is communicatively connected to a database - corresponding database status management system. The database includes several database sub - databases, and the database status management system is used to store and maintain the fault isolation policies corresponding to each of the database sub - databases.

[0122] The above - mentioned database sub - database management device 70 includes:

[0123] An execution module 701, configured to execute a preset storage operation when receiving a data storage request. The storage operation is used to store the data to be stored into a target database sub - database.

[0124] A detection module 702, configured to detect whether abnormal information is generated during the execution of the storage operation.

[0125] A determination module 703, configured to, if it is detected that abnormal information is generated during the execution of the storage operation, obtain the fault isolation policy corresponding to the target database sub - database, and determine the state of the target database sub - database according to the generated abnormal information and the fault isolation policy corresponding to the target database sub - database.

[0126] For the database sub - database management device provided in the present application, when the database application system detects that abnormal information is generated during the execution of the storage operation, it can determine the state of the target database sub - database based on the fault isolation policy maintained by the database status management system. Compared with setting a fixed fault isolation policy in the database application system in the prior art, the present application uses the database status management system to store and maintain the fault isolation policies corresponding to each database sub - database, and can quickly adjust the fault isolation policies corresponding to each database sub - database through the database status management system according to the changes in business conditions, thereby improving the accuracy of the database application system for fault isolation processing and reducing the impact of database failures on the database application system.

[0127] In some embodiments, the above - mentioned device further includes a synchronization module, configured to:

[0128] Synchronize the fault isolation policies corresponding to each of the database sub - databases stored in the database status management system to a preset cache device in the database application system.

[0129] The determination module 703 is configured to:

[0130] Obtain the fault isolation policy corresponding to the target database sub - database stored in the cache device.

[0131] In some embodiments, the fault isolation policy includes the types of exception information that trigger fault isolation processing; the determination module 703 is further configured to:

[0132] If the type of the exception information generated during the execution of the storage operation does not belong to the types of exception information, generate fault isolation policy update information based on the exception information generated during the execution of the storage operation;

[0133] Send the fault isolation policy update information to the database status management system, so that the database status management system updates the fault isolation policy corresponding to the target database sub-library according to the fault isolation policy update information.

[0134] In some embodiments, the above synchronization module is further configured to:

[0135] When receiving the fault isolation policy update completion indication information sent by the database status management system, perform a preset synchronization operation to synchronize the fault isolation policy update information in the database status management system to the cache device.

[0136] In some embodiments, the fault isolation policy further includes a detection duration and a threshold for the number of exception information generated within the detection duration; the determination module 703 is configured to:

[0137] If the type of the generated exception information belongs to the types of exception information, determine whether the number of the exception information generated within the detection duration is greater than the threshold;

[0138] When the number of the exception information generated within the detection duration is greater than the threshold, determine the status of the target database sub-library as an unavailable status.

[0139] In some embodiments, a fault recovery detection table is included in each of the database sub-libraries; the above device further includes a detection module, configured to:

[0140] After performing fault isolation processing on the target database sub-library, write preset detection information into the fault recovery detection table in the target database sub-library at preset time intervals;

[0141] When the detection information is successfully written into the fault recovery detection table in the target database sub-library, determine the status of the target database sub-library as an available status.

[0142] It should be noted that the specific operations performed by the execution module 701, the detection module 702, and the determination module 703 in the embodiments of the present application can refer to the respective steps in the database sub-library management method described in the above embodiments, which will not be elaborated here.

[0143] Further, based on the content described in the above embodiments, an electronic device is also provided in an embodiment of the present application. The electronic device includes at least one processor and a memory; wherein, the memory stores computer-executable instructions; the above at least one processor executes the computer-executable instructions stored in the memory to implement each step in the database sub-library management method described in the above embodiments.

[0144] For a better understanding of the embodiments of the present application, refer to Figure 8 , Figure 8 which is a schematic hardware structure diagram of an electronic device provided in an embodiment of the present application.

[0145] As Figure 8 shown, the electronic device 80 in this embodiment includes: a processor 801 and a memory 802; wherein:

[0146] The memory 802 is used to store computer-executable instructions;

[0147] The processor 801 is used to execute the computer-executable instructions stored in the memory to implement each step in the database sub-library management method described in the above embodiments.

[0148] Optionally, the memory 802 can be either independent or integrated with the processor 801.

[0149] When the memory 802 is independently provided, the device further includes a bus 803 for connecting the memory 802 and the processor 801.

[0150] An embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the processor executes the computer-executable instructions, each step in the database sub-library management method described in the above embodiments is implemented.

[0151] An embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, each step in the database sub-library management method described in the above embodiments is implemented.

[0152] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections between each other can be through some interfaces, indirect couplings or communication connections of devices or modules, and can be in electrical, mechanical or other forms.

[0153] The modules described as separate components may or may not be physically separated. The components shown as modules may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0154] In addition, in each embodiment of the present application, the functional modules can be integrated in a processing unit, or each module can exist physically alone, or two or more modules can be integrated in a unit. The unit formed by the above modules can be implemented in the form of hardware, or in the form of a combination of hardware and software functional units.

[0155] The integrated modules implemented in the form of software functional modules can be stored in a computer-readable storage medium. The above software functional modules are stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute some steps of the methods described in each embodiment of the present application.

[0156] It should be understood that the above processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in combination with the application can be directly implemented by the execution of the hardware processor, or can be implemented by the combination of the hardware and software modules in the processor.

[0157] The memory may include high-speed memory, and may also include non-volatile storage, such as at least one disk memory, and can also be a USB flash drive, a mobile hard disk, a read-only memory, a disk or an optical disc, etc.

[0158] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience in representation, the buses in the drawings of this application are not limited to only one bus or one type of bus.

[0159] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory, electrically erasable programmable read-only memory, erasable programmable read-only memory, programmable read-only memory, read-only memory, magnetic memory, flash memory, a magnetic disk, or an optical disc. The storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0160] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for database sub-library management, characterized in that, Applied to a database application system corresponding to a database, the database application system is communicatively connected to a database status management system corresponding to the database. The database includes a number of database sub-libraries, and the database status management system is used to store and maintain the fault isolation policies corresponding to each of the database sub-libraries; The method includes: When a data storage request is received, perform a preset storage operation, which is used to store the data to be stored into a target database sub-library; Detect whether exception information is generated during the execution of the storage operation; If it is detected that exception information is generated during the execution of the storage operation, obtain the fault isolation policy corresponding to the target database sub-library, and determine the state of the target database sub-library according to the generated exception information and the fault isolation policy corresponding to the target database sub-library.

2. The database sub-library management method according to claim 1, characterized in that The method further includes: Synchronize the fault isolation policies corresponding to each of the database sub-libraries stored in the database status management system to a preset cache device in the database application system; The obtaining the fault isolation policy corresponding to the target database sub-library includes: Obtain the fault isolation policy corresponding to the target database sub-library stored in the cache device.

3. The database sub-library management method according to claim 2, wherein The fault isolation policy includes the type of exception information that triggers fault isolation processing; the method further includes: If the type of the exception information generated during the execution of the storage operation does not belong to the type of exception information, generate fault isolation policy update information based on the exception information generated during the execution of the storage operation; Send the fault isolation policy update information to the database status management system so that the database status management system updates the fault isolation policy corresponding to the target database sub-library according to the fault isolation policy update information.

4. The database sub-library management method according to claim 3, wherein The method further includes: When receiving the fault isolation policy update completion indication information sent by the database status management system, perform a preset synchronization operation to synchronize the fault isolation policy update information in the database status management system to the cache device.

5. The database sub-library management method according to claim 3, wherein The fault isolation policy further includes a detection duration and a threshold number of exception information generated within the detection duration; The determining the state of the target database sub-library according to the generated exception information and the fault isolation policy corresponding to the target database sub-library includes: If the type of the generated exception information belongs to the type of exception information, determine whether the number of the exception information generated within the detection duration is greater than the threshold number; When the number of the exception information generated within the detection duration is greater than the threshold number, determine the state of the target database sub-library as an unavailable state.

6. The database sub-library management device according to claim 5, wherein Each of the database sub-libraries includes a fault recovery detection table; the method further includes: After performing fault isolation processing on the target database sub-library, write preset detection information into the fault recovery detection table in the target database sub-library at preset time intervals; When the detection information is successfully written into the fault recovery detection table in the target database sub-library, the state of the target database sub-library is determined to be the available state.

7. A database sub-library management device, characterized in that, Applied to a database application system corresponding to the database, the database application system is communicatively connected to a database state management system corresponding to the database. The database includes a number of database sub-libraries, and the database state management system is used to store and maintain the fault isolation policies corresponding to each of the database sub-libraries. The device includes: An execution module, configured to perform a preset storage operation when receiving a data storage request, and the storage operation is used to store the data to be stored into a target database sub-library. A detection module, configured to detect whether abnormal information is generated during the execution of the storage operation. A determination module, configured to, if it is detected that abnormal information is generated during the execution of the storage operation, obtain the fault isolation policy corresponding to the target database sub-library, and determine the state of the target database sub-library according to the generated abnormal information and the fault isolation policy corresponding to the target database sub-library.

8. An electronic device, characterized in that, Includes: A processor, and a memory communicatively connected to the processor; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory to implement the database sub-library management method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, Computer execution instructions are stored in the computer-readable storage medium, and when the computer execution instructions are executed by the processor, they are used to implement the database sub-library management method according to any one of claims 1-6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the database sub-library management method according to any one of claims 1-6.