Branch library exception processing method and device under high availability, equipment and storage medium
By monitoring log information in real time in the library architecture, analyzing the status of the library application, and adjusting the routing strategy according to the abnormal status, routing new order data to the second library, the problem of insufficient high availability in the library architecture is solved and efficient business continuity.
Patent Information
- Application Number
- CN202411410688.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-02-18
AI Technical Summary
The current library architecture system uses double write or master-slip to deal with the problem of high availability deficiency when high availability is encountered.
By determining the aggregate error code information based on the monitoring log information, analyzing the application status of the sub-store, and determining the processing strategy when determining the first sub-store is an abnormal state. When the processing policy is a highly available mechanism, a distributed coordination task is triggered to update the database resource record, and the routing policy is adjusted based on the current database resource record, routing the target user's new order data to the second branch library.
It realizes real-time monitoring and status analysis in the library architecture to ensure high availability, avoid business interruptions caused by insufficient high availability, and ensure normal customer business.
Smart Images

Figure CN119473760A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for handling exceptions in a high-availability sub-library. Background Art
[0002] Currently, for the distributed database architecture system on the market, dual writing or master-slave mode is generally used for high availability processing, but both methods have the problem of insufficient high availability.
[0003] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of this application is to provide a method, device, equipment and storage medium for handling sub-library exceptions under high availability, aiming to solve the technical problem of insufficient high availability when the current sub-library architecture system adopts dual writing or master-slave mode to handle high availability.
[0005] To achieve the above purpose, the present application proposes a method for handling exceptions in a sub-library under high availability, and the method for handling exceptions in a sub-library under high availability includes:
[0006] Determine the aggregate error code information based on the monitoring log information;
[0007] Analyze the sub-library application status according to the aggregated error code information;
[0008] When the first sub-library is determined to be in an abnormal state according to the sub-library application state, a processing strategy is determined; when the processing strategy is a high availability mechanism, a distributed coordination task is triggered to update the database resource record;
[0009] The current routing strategy is adjusted according to the current database resource record, so as to route the first new order data of the target user to the second sub-database according to the current routing strategy.
[0010] In one embodiment, the step of determining the aggregated error code information according to the monitoring log information includes:
[0011] Get monitoring log information;
[0012] Preprocessing the monitoring log information to obtain target monitoring log information;
[0013] A stream processing framework is used to perform windowed real-time analysis and aggregate statistics on the target monitoring log information to generate aggregate error code information.
[0014] In one embodiment, when the first sub-library is determined to be in an abnormal state according to the sub-library application state, after the step of determining a processing strategy, the step further includes:
[0015] When the processing strategy is an early warning mechanism, abnormal warning is performed through a preset early warning method;
[0016] When the processing strategy is a manual processing mechanism, relevant operation and maintenance personnel are notified in a preset manner so that the relevant operation and maintenance personnel respond according to the established process after receiving the notification.
[0017] In one embodiment, after the step of adjusting the current routing strategy according to the current database resource record to route the first new order data of the target user to the second sub-database according to the current routing strategy, the step further includes:
[0018] Use probes to regularly check the application status of database sub-databases;
[0019] After checking that the sub-library application state of the first sub-library in the database sub-libraries changes from an abnormal state to a healthy state, triggering a distributed coordination task to update the database resource record;
[0020] The current routing strategy is adjusted according to the current database resource record, so as to route the second new order data of the target user to the first sub-database according to the current routing strategy.
[0021] In one embodiment, after the step of adjusting the current routing strategy according to the current database resource record to route the second new order data of the target user to the first sub-database according to the current routing strategy, the step further includes:
[0022] Before migrating the customer data of the target customer, the target user is locked at the sub-database routing level;
[0023] Determining whether the target user is in a locked state;
[0024] When it is detected that the target user is not in a locked state, triggering an early warning notification;
[0025] When it is detected that the target user is in a locked state, the first new order data of the target user is migrated from the second sub-database to the first sub-database.
[0026] In one embodiment, the step of migrating the first new order data of the target user from the second sub-database to the first sub-database includes:
[0027] Creating a temporary table in the second sub-database, and inserting the first new order data into the temporary table;
[0028] Creating a target table and an archive table in the first sub-database, and inserting the first new order data in the temporary table into the target table;
[0029] After the first new order data is successfully migrated from the second sub-database to the first sub-database, the first new order data in the temporary table is inserted into the archive table, and the target user is unlocked at the sub-database routing level.
[0030] In one embodiment, the method further comprises:
[0031] When the target user is in a locked state, determining whether a related order operation for the target user is received;
[0032] If a relevant order operation for the target user is received, a busy prompt is sent to the operating user.
[0033] In addition, to achieve the above purpose, the present application also proposes a sub-library exception handling device under high availability, and the sub-library exception handling device under high availability includes:
[0034] A determination module, used to determine aggregate error code information based on monitoring log information;
[0035] An analysis module, used for analyzing the sub-library application status according to the aggregated error code information;
[0036] A determination module, configured to determine a processing strategy when the first sub-library is determined to be in an abnormal state according to the sub-library application state;
[0037] A trigger module, used for triggering a distributed coordination task to update a database resource record when the processing strategy is a high availability mechanism;
[0038] The adjustment module is used to adjust the current routing strategy according to the current database resource record, so as to route the first new order data of the target user to the second sub-database according to the current routing strategy.
[0039] In addition, to achieve the above-mentioned purpose, the present application also proposes a sub-library exception handling device under high availability, the device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the sub-library exception handling method under high availability as described above.
[0040] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the sub-library exception handling method under high availability are implemented as described above.
[0041] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the sub-library exception handling method under high availability as described above.
[0042] One or more technical solutions proposed in this application have at least the following technical effects:
[0043] The sub-library exception handling method, device, equipment and storage medium under high availability proposed in the present application determine the aggregate error code information according to the monitoring log information; analyze the sub-library application status according to the aggregate error code information; determine the processing strategy when the first sub-library is judged to be in an abnormal state according to the sub-library application status; when the processing strategy is a high availability mechanism, trigger the distributed coordination task to update the database resource record; adjust the current routing strategy according to the current database resource record to route the first new order data of the target user to the second sub-library according to the current routing strategy, which solves the technical problem of insufficient high availability when the current sub-library architecture system adopts dual writing or master-slave mode to handle high availability. Compared with the prior art, the present application can analyze the sub-library application status through the log information monitored in real time, and then route the new order data to the second sub-library after judging that the first sub-library is in an abnormal state according to the sub-library application status, thereby ensuring the normal operation of customer business. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0046] Figure 1 A flowchart of the first embodiment of the method for handling sub-database exceptions under high availability of this application is provided;
[0047] Figure 2 A schematic diagram of generating an aggregate error code provided in Example 1 of the method for handling exceptions in sub-databases under high availability of this application;
[0048] Figure 3 A schematic diagram of the strategy configuration provided in Example 1 of the method for handling sub-database exceptions under high availability of this application;
[0049] Figure 4 A specific flow chart of the first embodiment of the method for handling exceptions in a sub-database under high availability of the present application is provided;
[0050] Figure 5 A schematic diagram of sub-database status flow provided in Embodiment 1 of the method for handling sub-database exceptions under high availability of this application;
[0051] Figure 6 A flowchart diagram of the second embodiment of the method for handling sub-database exceptions under high availability of this application is provided;
[0052] Figure 7 A schematic diagram of the migration process provided in Example 2 of the method for handling sub-database exceptions under high availability of this application;
[0053] Figure 8 A schematic diagram of a data recovery process provided in Example 2 of the method for handling sub-database exceptions under high availability of this application;
[0054] Fig. 9 A general table flow diagram provided for Example 2 of the method for handling sub-database exceptions under high availability of this application;
[0055] Fig.10 This is a schematic diagram of the module structure of the sub-library exception handling device under high availability of an embodiment of the present application;
[0056] Fig.11 The device structure diagram of the hardware operating environment involved in the high availability sub-library exception handling method in the embodiment of the present application.
[0057] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0058] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0059] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0060] The main solution of the embodiment of the present application is: determine the aggregate error code information based on the monitoring log information; analyze the sub-library application status based on the aggregate error code information; when the first sub-library is judged to be in an abnormal state according to the sub-library application status, determine the processing strategy; when the processing strategy is a high availability mechanism, trigger the distributed coordination task to update the database resource record; adjust the current routing strategy according to the current database resource record, so as to route the first new order data of the target user to the second sub-library according to the current routing strategy.
[0061] It can be seen from the above embodiments that by determining the aggregate error code information according to the monitoring log information; analyzing the sub-library application status according to the aggregate error code information; determining the processing strategy when the first sub-library is judged to be in an abnormal state according to the sub-library application status; when the processing strategy is a high availability mechanism, triggering the distributed coordination task to update the database resource record; adjusting the current routing strategy according to the current database resource record to route the first new order data of the target user to the second sub-library according to the current routing strategy, the technical problem of insufficient high availability when the current sub-library architecture system adopts dual writing or master-slave mode to handle high availability is solved. Compared with the prior art, the present application can analyze the sub-library application status through the log information monitored in real time, and then route the new order data to the second sub-library after determining that the first sub-library is in an abnormal state according to the sub-library application status, thereby ensuring the normal operation of customer business.
[0062] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a sub-library exception handling device under high availability, etc. The following takes a sub-library exception handling device under high availability as an example to illustrate this embodiment and the following embodiments.
[0063] Based on this, the embodiment of the present application provides a method for handling exceptions in a high-availability sub-library. Figure 1 , Figure 1 This is a flow chart of the first embodiment of the method for handling sub-library exceptions under high availability of the present application.
[0064] In this embodiment, the method for handling sub-database exceptions under high availability includes steps S10 to S40:
[0065] Step S10, determining aggregate error code information according to monitoring log information;
[0066] It should be noted that Flink CDC can be used to capture database change events in real time and generate monitoring log information.
[0067] In a feasible implementation, the step of determining aggregate error code information based on monitoring log information includes: obtaining monitoring log information; preprocessing the monitoring log information to obtain target monitoring log information; using a streaming processing framework to perform windowed real-time analysis and aggregate statistics on the target monitoring log information to generate aggregate error code information.
[0068] In the specific implementation, Figure 2As shown in the figure, the error log (i.e., monitoring log information) can be preprocessed through Kafka to obtain the target monitoring log information, and then the target monitoring log information can be processed by the Flink streaming processing framework, such as real-time analysis and aggregation statistics through windowing, and finally, the intermediate aggregation data of the error code (i.e., aggregated error code information) can be generated through various methods such as Session window, Tumbling window, Sliding window, etc., including application and database related return codes.
[0069] Step S20, analyzing the sub-library application status according to the aggregated error code information;
[0070] In the specific implementation, the application status of the sub-database is determined by real-time monitoring log information. For example, if there are 50 consecutive (configured) request exceptions and the error code is as expected, or if the errors are all within the configuration rules within 5 minutes, the first sub-database can be determined to be in an abnormal state.
[0071] Step S30, when it is determined that the first sub-library is in an abnormal state according to the sub-library application state, determining a processing strategy;
[0072] In a feasible implementation, when the first sub-library is determined to be in an abnormal state according to the application status of the sub-library, the step of determining the processing strategy also includes: when the processing strategy is an early warning mechanism, an abnormal early warning is performed through a preset early warning method; when the processing strategy is a manual processing mechanism, relevant operation and maintenance personnel are notified through a preset method, so that the relevant operation and maintenance personnel respond according to the established process after receiving the notification.
[0073] It should be noted that the processing strategy is a pre-configured strategy, such as Figure 3 As shown, the processing strategies include manual processing mechanism (Strategy.manual), early warning processing mechanism (Strategy.alarm) and high availability mechanism (strategy.HA, high available).
[0074] Step S40, when the processing strategy is a high availability mechanism, triggering a distributed coordination task to update database resource records;
[0075] It should be noted that in the high availability mechanism mode, when it is determined that the abnormal rule of the sub-database is triggered, the zk task (i.e. zk task, distributed coordination task) will be directly triggered to automatically modify the RR (i.e. database resource record) remote database resource status (sub-database [1~n]: false (abnormal state), false (not available)), that is, the data is in an abnormal state and the availability is also unavailable. At this time, the sub-database routing will automatically transfer the abnormal sub-database data to other sub-databases temporarily, so as not to affect new customer orders.
[0076] Step S50, adjusting the routing strategy according to the database resource record, so as to route the new order data of the target user to the second sub-database according to the routing strategy.
[0077] In the specific implementation, the sub-database routing parses the routing key according to the rules, determines the sub-database rules, and analyzes the target sub-database status. If it is determined that the sub-database or sub-database application status is abnormal, then for the new order data, multiple active routes are used to other sub-database applications to ensure the normal operation of customer business.
[0078] It should be noted that the second sub-library refers to a normal database sub-library other than the first sub-library.
[0079] In the specific implementation, Figure 4 As shown, it is possible to determine whether there is an abnormality in the database sub-database based on log analysis. When there is an abnormality in the database sub-database, the first new order data of the target user needs to be routed to other normal second sub-databases.
[0080] In the specific implementation, Figure 5 As shown, database sharding includes three states. The first state is (true, true), the completeness and availability are normal; the second state is (false, false), the sharding is down and in high availability state; the third state is (false, true), the sharding is OK, but the completeness state is still abnormal because the data has not been restored. The mechanism of the overall high availability process can be controlled through the database state (whether the sharding is abnormal, whether the sharding is available).
[0081] This embodiment determines aggregate error code information based on monitoring log information; analyzes sub-library application status based on the aggregate error code information; determines a processing strategy when the first sub-library is determined to be in an abnormal state based on the sub-library application status; when the processing strategy is a high availability mechanism, triggers a distributed coordination task to update database resource records; adjusts the current routing strategy based on the current database resource record to route the first new order data of the target user to the second sub-library based on the current routing strategy, thereby solving the technical problem of insufficient high availability when the current sub-library architecture system adopts dual writing or master-slave mode to handle high availability. Compared with the prior art, the present application can analyze the sub-library application status through real-time monitored log information, and then route the new order data to the second sub-library after determining that the first sub-library is in an abnormal state based on the sub-library application status, thereby ensuring the normal operation of customer business.
[0082] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 6 , after step S50, steps S60 to S80 are also included:
[0083] Step S60, periodically checking the application status of the database sub-library through the probe;
[0084] It should be noted that the health status of the database sub-database is regularly checked through probes, including but not limited to connection status, query response time, error rate and other indicators.
[0085] Step S70, when it is detected that the sub-library application state of the first sub-library in the database sub-libraries changes from an abnormal state to a healthy state, triggering a distributed coordination task to update the database resource record;
[0086] It should be noted that if the probe finds that a sub-database (the first sub-database) has recovered from a faulty state to a normal state, zktask is triggered to modify the database resource availability.
[0087] Step S80, adjusting the current routing strategy according to the current database resource record, so as to route the second new order data of the target user to the first sub-database according to the current routing strategy.
[0088] It should be noted that when the first sub-database is in an abnormal state, it will enter the sub-database multi-active stage. In this stage, all multi-active orders are misplaced orders, that is, the data originally belonging to the A database (document number routing) is routed to the B database by the high-availability multi-active route. The data routed to the B database is the order customer that needs to be migrated, and the mark is as follows ("is_floating": true):
[0089] {
[0090] "_id":"511601199102066786",
[0091] "target":"sdddb03",
[0092] "is_floating":true, / Drifting data, must be restored
[0093] "timestamp":ISODate("2022-08-09T07:35:23.273Z"),
[0094] "_class":"com.cmbp.lp.ha.support.model.MongoRoutingInfo"
[0095] }
[0096] In a feasible implementation manner, after the step of adjusting the current routing policy according to the current database resource record to route the target user's second new order data to the first sub-database according to the current routing policy, the step also includes: locking the target user at the sub-database routing level before migrating the target customer's customer data; determining whether the target user is in a locked state; triggering an early warning notification when it is detected that the target user is not in a locked state; and migrating the target user's first new order data from the second sub-database to the first sub-database when it is detected that the target user is in a locked state.
[0097] It should be noted that if Figure 7 As shown in the figure, since we are restoring data for a single customer, that is, the atomic granularity is all the data of a customer, either success or rollback. When we need to migrate a customer's data, we will lock it at the sub-database routing level, {customer: xxx, lock: true}. In this migration state, if there are any order operations (CRUD) related to the customer, you will receive a friendly reminder of the system's busy retry.
[0098] It should be noted that because we lock a single customer, under normal circumstances the migration of a single customer is completed within seconds, and the lock is automatically released immediately after the migration is completed. Therefore, the overall process is basically imperceptible, lossless and friendly to customers.
[0099] In the specific implementation, Figure 8As shown, the probe is used to detect whether the first sub-database in an abnormal state continues to be normal. When the state of the first sub-database continues to be normal, customer data recovery is performed for a single customer dimension. The routing key is first locked at the sub-database routing level. If the locking is successful, the first new order data in the second sub-database is directly migrated to the first sub-database. Otherwise, an early warning notification is issued.
[0100] In a feasible implementation manner, the step of migrating the first new order data of the target user from the second sub-library to the first sub-library includes: creating a temporary table in the second sub-library and inserting the first new order data into the temporary table; creating a target table and an archive table in the first sub-library and inserting the first new order data in the temporary table into the target table; after successfully migrating the first new order data from the second sub-library to the first sub-library, inserting the first new order data in the temporary table into the archive table, and unlocking the target user at the sub-library routing level.
[0101] In the specific implementation, Fig. 9 As shown, all customer data is retrieved from the second sub-database, data integrity and consistency are checked, a temporary table is created in the second sub-database to store the data to be migrated, and the customer data is inserted into the temporary table to migrate the customer data to the target table of the first sub-database: an archive table is created in the first sub-database. After the customer data is successfully migrated to the first sub-database, the data in the temporary table can be moved to the archive table.
[0102] It should be noted that in order to cope with table changes caused by subsequent business development and ensure scalability, our data backup adopts a general table design, which converts the overall data into a whole field, obtains the data type by reading the table metadata, and then performs overall migration or recovery. The general table structure is as follows:
[0103]
[0104] It should be noted that table rules are configurable, extensible, and parallelizable (multi-threaded processing).
[0105] In a feasible implementation, the method further includes: when the target user is in a locked state, determining whether a relevant order operation for the target user is received; if a relevant order operation for the target user is received, sending a busy prompt to the operating user.
[0106] It should be noted that when the target customer is in a locked state, if there are any order operations (CRUD) related to the customer, a friendly reminder of a busy retry will be received from the system. This can prevent data inconsistencies from occurring after the customer data of the target user is migrated.
[0107] This embodiment uses a probe to regularly check the application status of the database sub-libraries; when the application status of the first sub-library in the database sub-libraries is checked to change from an abnormal state to a healthy state, a distributed coordination task is triggered to update the database resource record; the current routing policy is adjusted according to the current database resource record to route the second new order data of the target user to the first sub-library according to the current routing policy. Through monitoring and status control, when the abnormal sub-library is restored, it is restored to the source database without loss, and the customer is not affected by it, and there is no downtime, thus ensuring a mechanism for business continuity.
[0108] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the sub-library exception handling method under high availability of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0109] This application also provides a high availability sub-library exception handling device, please refer to Fig.10 The high availability sub-library exception handling device includes:
[0110] A determination module 10, configured to determine aggregate error code information according to monitoring log information;
[0111] An analysis module 20, configured to analyze the sub-library application status according to the aggregated error code information;
[0112] A determination module 30, configured to determine a processing strategy when the first sub-library is determined to be in an abnormal state according to the sub-library application state;
[0113] A trigger module 40, used to trigger a distributed coordination task to update a database resource record when the processing strategy is a high availability mechanism;
[0114] The adjustment module 50 is used to adjust the current routing strategy according to the current database resource record, so as to route the first new order data of the target user to the second sub-database according to the current routing strategy.
[0115] The sub-library exception handling device under high availability provided by the present application adopts the sub-library exception handling method under high availability in the above-mentioned embodiment, which can solve the technical problem of insufficient high availability when the current sub-library architecture system adopts dual writing or master-slave mode to handle high availability. Compared with the prior art, the beneficial effects of the sub-library exception handling device under high availability provided by the present application are the same as the beneficial effects of the sub-library exception handling method under high availability provided by the above-mentioned embodiment, and the other technical features of the sub-library exception handling device under high availability are the same as the features disclosed in the above-mentioned embodiment method, which will not be repeated here.
[0116] The present application provides a sub-library exception handling device under high availability, and the sub-library exception handling device under high availability includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the sub-library exception handling method under high availability in the above-mentioned embodiment one.
[0117] Reference below Fig.11 , which shows a schematic diagram of the structure of a sub-library exception handling device suitable for implementing the high availability of the embodiment of the present application. The sub-library exception handling device under high availability in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.11 The high-availability sub-library exception handling device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0118] like Fig.11As shown, the sub-library exception handling device under high availability may include a processing device 1001 (such as a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. Various programs and data required for the operation of the sub-library exception handling device under high availability are also stored in RAM1004. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the sub-library exception handling device under high availability to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a sub-library exception handling device under high availability with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.
[0119] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0120] The high-availability sub-library exception handling device provided by the present application adopts the high-availability sub-library exception handling method in the above-mentioned embodiment, which can solve the technical problem of insufficient high availability when the current sub-library architecture system adopts dual-write or master-slave mode to handle high availability. Compared with the prior art, the beneficial effects of the high-availability sub-library exception handling device provided by the present application are the same as the beneficial effects of the high-availability sub-library exception handling method provided by the above-mentioned embodiment, and the other technical features of the high-availability sub-library exception handling device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0121] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0122] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0123] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, the computer-readable program instructions being used to execute the method for handling exceptions in a sub-library under high availability in the above-mentioned embodiment.
[0124] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0125] The computer-readable storage medium may be included in the sub-library exception handling device under high availability; or may exist independently without being assembled into the sub-library exception handling device under high availability.
[0126] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the sub-library exception handling device under high availability, the sub-library exception handling device under high availability: determines the aggregated error code information based on the monitoring log information; analyzes the sub-library application status based on the aggregated error code information; when the first sub-library is determined to be in an abnormal state based on the sub-library application status, determines a processing strategy; when the processing strategy is a high availability mechanism, triggers a distributed coordination task to update the database resource record; adjusts the current routing strategy based on the current database resource record, so as to route the first new order data of the target user to the second sub-library according to the current routing strategy.
[0127] Computer program code for performing the operations of the present application may 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 may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0128] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0129] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0130] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned sub-library exception handling method under high availability, and can solve the technical problem of insufficient high availability when the current sub-library architecture system adopts dual-write or master-slave mode to handle high availability. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the sub-library exception handling method under high availability provided by the above-mentioned embodiment, and will not be repeated here.
[0131] The present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned method for handling sub-library exceptions under high availability.
[0132] The computer program product provided by this application can solve the technical problem that the current sub-database architecture system has insufficient high availability when using dual-write or master-slave mode to handle high availability. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the sub-database exception handling method under high availability provided by the above embodiment, and will not be repeated here.
[0133] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A method for handling exceptions in a high-availability sub-database, characterized in that: The method comprises: Determine the aggregate error code information based on the monitoring log information; Analyze the sub-library application status according to the aggregated error code information; When the first sub-library is determined to be in an abnormal state according to the sub-library application state, determining a processing strategy; When the processing strategy is a high availability mechanism, a distributed coordination task is triggered to update database resource records; The current routing strategy is adjusted according to the current database resource record, so as to route the first new order data of the target user to the second sub-database according to the current routing strategy.
2. The method according to claim 1, characterized in that The step of determining the aggregated error code information according to the monitoring log information includes: Get monitoring log information; Preprocessing the monitoring log information to obtain target monitoring log information; A stream processing framework is used to perform windowed real-time analysis and aggregate statistics on the target monitoring log information to generate aggregate error code information.
3. The method according to claim 1, characterized in that After the step of determining a processing strategy when the first sub-library is determined to be in an abnormal state according to the sub-library application state, the step further includes: When the processing strategy is an early warning mechanism, abnormal warning is performed through a preset early warning method; When the processing strategy is a manual processing mechanism, relevant operation and maintenance personnel are notified in a preset manner so that the relevant operation and maintenance personnel respond according to the established process after receiving the notification.
4. The method according to claim 1, characterized in that After the step of adjusting the current routing strategy according to the current database resource record to route the first new order data of the target user to the second sub-database according to the current routing strategy, the step further includes: Use probes to regularly check the application status of database sub-databases; After checking that the sub-library application state of the first sub-library in the database sub-libraries changes from an abnormal state to a healthy state, triggering a distributed coordination task to update the database resource record; The current routing strategy is adjusted according to the current database resource record, so as to route the second new order data of the target user to the first sub-database according to the current routing strategy.
5. The method according to claim 4, characterized in that After the step of adjusting the current routing strategy according to the current database resource record to route the second new order data of the target user to the first sub-database according to the current routing strategy, the step further includes: Before migrating the customer data of the target customer, the target user is locked at the sub-database routing level; Determining whether the target user is in a locked state; When it is detected that the target user is not in a locked state, triggering an early warning notification; When it is detected that the target user is in a locked state, the first new order data of the target user is migrated from the second sub-database to the first sub-database.
6. The method according to claim 5, characterized in that The step of migrating the first new order data of the target user from the second sub-database to the first sub-database includes: Creating a temporary table in the second sub-database, and inserting the first new order data into the temporary table; Creating a target table and an archive table in the first sub-database, and inserting the first new order data in the temporary table into the target table; After the first new order data is successfully migrated from the second sub-database to the first sub-database, the first new order data in the temporary table is inserted into the archive table, and the target user is unlocked at the sub-database routing level.
7. The method according to claim 5, characterized in that The method further comprises: When the target user is in a locked state, determining whether a related order operation for the target user is received; If a relevant order operation for the target user is received, a busy prompt is sent to the operating user.
8. A high-availability sub-database exception handling device, characterized in that: The device comprises: A determination module, used to determine aggregate error code information based on monitoring log information; An analysis module, used for analyzing the sub-library application status according to the aggregated error code information; A determination module, configured to determine a processing strategy when the first sub-library is determined to be in an abnormal state according to the sub-library application state; A trigger module, used for triggering a distributed coordination task to update a database resource record when the processing strategy is a high availability mechanism; The adjustment module is used to adjust the current routing strategy according to the current database resource record, so as to route the first new order data of the target user to the second sub-database according to the current routing strategy.
9. A high-availability sub-library exception handling device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the method for handling sub-library exceptions under high availability as described in any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the sub-library exception handling method under high availability are implemented as described in any one of claims 1 to 7.