Database task processing method and device, electronic equipment and computer storage medium

By detecting the master-slip switching events in the distributed database system, temporarily storing and re-executing task requests, the business interruption caused by the failure of the distributed database system is solved, and high availability and unawareness of the customer are achieved.

CN119902935APending Publication Date: 2025-04-29JINZHUAN INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411990504.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

The main and standby switching of distributed database systems in the event of a failure may lead to business interruption and economic losses, and the existing technology lacks effective solutions.

Method used

By detecting whether the data master node triggers the master-support switch event, temporarily store the current task request, wait for the master-support switch to complete, re-execute the task request in the new data node, and return the processing result.

Benefits of technology

It realizes that when a distributed database cluster fails, transactions are not interrupted, business is not affected, and customers are unaware of it, improving system availability and customer experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119902935A_ABST
    Figure CN119902935A_ABST
Patent Text Reader

Abstract

The invention discloses a database task processing method and device, electronic equipment and a computer storage medium, and belongs to the field of distributed databases. The method comprises the following steps: detecting whether a first data main node triggers a main-standby switching event or not; when it is detected that the first data main node triggers the main-standby switching event, determining a current task request associated with the first data main node; the current task request is temporarily stored through the corresponding computing node, after the first data main node completes main-standby switching, the current task request is re-executed in the second data main node after main-standby switching, and a processing result of the current task request is returned. According to the method and the device, when the distributed database cluster is subjected to master-slave switching due to the fault, the current task request associated with the fault data node is temporarily stored, and the current task request is re-executed in the new data node after the fault data node finishes master-slave switching, so that the current transaction is not interrupted and the service is not influenced; and customers do not perceive.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of distributed databases, and in particular to a database task processing method, device, electronic device and computer storage medium. Background Art

[0002] Distributed database systems are clustered by multiple hosts, with numerous internal components and complex structures. When a database failure occurs and triggers a master-slave switch, it may cause business interruption, loss of customer resources, productivity and economic losses, and even other inestimable negative effects.

[0003] With respect to the above-mentioned problems existing in the related technologies, no effective solutions have been found so far. Summary of the invention

[0004] The present application provides a database task processing method, device, electronic device and computer storage medium to solve the above-mentioned technical problems existing in the related technology.

[0005] According to an embodiment of the present application, a database task processing method is provided, including: detecting whether a first data master node triggers a master-slave switching event; when detecting that the first data master node triggers a master-slave switching event, determining a current task request associated with the first data master node; temporarily storing the current task request through a corresponding computing node, waiting for the first data master node to complete the master-slave switching, and then re-executing the current task request in the second data master node after the master-slave switching, and returning the processing result of the current task request.

[0006] According to another embodiment of the present application, a database task processing device is provided, including: a detection module, used to detect whether a first data master node triggers a master-slave switching event; a determination module, used to determine a current task request associated with the first data master node when it is detected that the first data master node triggers a master-slave switching event; an execution module, used to temporarily store the current task request through a corresponding computing node, wait for the first data master node to complete the master-slave switching, re-execute the current task request in the second data master node after the master-slave switching, and return the processing result of the current task request.

[0007] Optionally, the execution module includes an acquisition unit for acquiring a preset time threshold; a first detection unit for detecting whether the first data master node completes the master-slave switching within the preset time threshold; and a first execution unit for re-executing the current task request in the second data master node after the master-slave switching if the first data master node completes the master-slave switching within the preset time threshold, and returning the processing result of the current task request.

[0008] Optionally, the execution module further includes a returning unit, configured to return a processing result indicating that the current task request processing has failed if the first data master node has not completed the master-slave switching within the preset time threshold.

[0009] Optionally, the execution module includes a second detection unit, used to detect the remaining available resources of the computing node; a first judgment unit, used to judge whether the required resources of the current task request exceed the remaining available resources; a second execution unit, used to obtain the first task request in the current task request that exceeds the remaining available resources if the required resources of the current task request exceed the remaining available resources, and return the processing result of the failure of processing the first task request; obtain the second task request in the current task request except the first task request, re-execute the current task request in the second data master node after the master-slave switching, and return the processing result of the current task request.

[0010] Optionally, the execution module also includes a third detection unit, which is used to detect the task execution upper limit of the second data node after the master-slave switching; a second judgment unit, which is used to judge whether the task amount of the current task request temporarily stored in the computing node exceeds the task execution upper limit; and a third execution unit, which is used to send the current task request in batches to the second data master node if the task amount of the current task request temporarily stored in the computing node exceeds the task execution upper limit, re-execute the current task request in the second data master node, and return the processing result of the current task request.

[0011] Optionally, the database task processing device also includes an identification module for identifying the attributes of the current task request; an analysis module for analyzing the response time sensitivity of the attributes; the execution module is also used to, if the response time sensitivity is lower than a preset threshold, temporarily store the current task request through the corresponding computing node, wait for the first data master node to complete the master-slave switching, re-execute the current task request in the second data master node after the master-slave switching, and return the processing result of the current task request; if the response time sensitivity is higher than the preset threshold, return the processing result of the failure of the current task request processing.

[0012] According to another embodiment of the present application, a computer storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned device embodiments when running.

[0013] According to another embodiment of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein: the memory is used to store computer programs; the processor is used to execute the steps in the above method by running the program stored in the memory.

[0014] According to yet another embodiment of the present application, a computer program product comprising instructions is also provided, which enables the computer to execute the steps in the above method when the computer program product is executed on the computer.

[0015] Through the embodiments of the present application, when a distributed database cluster undergoes a master-slave switch due to a failure, the current task request associated with the failed data node is temporarily stored, and after the failed data node completes the master-slave switch, the current task request is re-executed in the new data node, so that the current transaction is not interrupted, the business is not affected, and the customer is not aware of it. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0017] Figure 1 is a hardware structure block diagram of a computer according to an embodiment of the present application;

[0018] Figure 2 is a flowchart of a database task processing method according to an embodiment of the present application;

[0019] Figure 3 is a schematic diagram of a first application scenario of an embodiment of the present application;

[0020] Figure 4 is a schematic diagram of a second application scenario of an embodiment of the present application;

[0021] Figure 5 It is a structural block diagram of a database task processing device according to an embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

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

[0024] Example 1

[0025] The method embodiment provided in the first embodiment of the present application can be executed in a mobile phone, a computer, a tablet or a similar computing device. Taking running on a computer as an example, Figure 1 is a hardware structure block diagram of a computer in an embodiment of the present application. Figure 1 As shown, the computer may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the computer may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0026] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a database task processing method in an embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0027] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0028] In this embodiment, a database task processing method is provided. Figure 2 is a flowchart of a database task processing method according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:

[0029] Step S10, detecting whether the first data master node triggers a master-slave switching event;

[0030] In the database, the data node DN (Data Node) is responsible for storing and managing data. Each DN node contains the storage of part of the data, which is usually stored in the database in the form of tables. If needed, multiple DN nodes can be combined to achieve data distribution and load balancing. The compute node CN (Compute Node) is responsible for processing business logic and user requests. The CN node can optimize SQL queries, generate execution plans, and integrate data. Through the CN node, users can access data and submit query requests.

[0031] Related technology When a data node fails and a high-availability switch (master-slave switch) occurs, the task currently executed in the failed node fails, and the computing node directly returns an error message to the user end, causing the current task to be interrupted, affecting business processing efficiency.

[0032] In this regard, in this embodiment, first, the first data master node (such as Figure 3 DN1 master in the example is used to perform fault detection. Once a fault is detected in the first data master node and a master-slave switching event between data nodes is triggered, the corresponding subsequent task processing strategy is performed. In this embodiment, the master-slave switching event is that the first data master node switches to the corresponding backup node, and the backup node is used as the new master node (recorded as the second data master node, such as Figure 3 DN1 in the backup), after the second data master node completes data balancing with the first data master node, it indicates that the first data master node completes the master-slave switching.

[0033] Step S20, when it is detected that the first data master node triggers a master-slave switching event, determining a current task request associated with the first data master node;

[0034] Step S30, temporarily storing the current task request through the corresponding computing node, waiting for the first data master node to complete the active-standby switching, re-executing the current task request in the second data master node after the active-standby switching, and returning the processing result of the current task request.

[0035] In this embodiment, when a failure of the first data master node is detected and a master-slave switching event is triggered, the current task request associated with the first data master node is determined, and the current task request is temporarily stored by the corresponding computing node. After waiting for the first data master node to complete the master-slave switching, the computing node sends the current task request to the second data master node, re-executes the current task request in the second data master node, and returns the processing result of the current task request.

[0036] Through this embodiment, when a data node switches from active to standby due to a fault, the current user request connection is first held (no error response is returned to the user end), the current task request associated with the faulty data node is temporarily stored, and after the faulty data node completes the active-standby switch, the held connection is released, the current task request is re-executed in the new data node, and the task processing result is returned. When a distributed database cluster switches from active to standby due to a fault, the current transaction can be kept intact, the business is not affected, and the customer is unaware.

[0037] To improve the reliability of task processing, in one implementation of this embodiment, temporarily storing the current task request, waiting for the first data master node to complete the active-standby switching, re-executing the current task request in the second data master node after the active-standby switching, and returning the processing result of the current task request includes:

[0038] A31, obtaining a preset time threshold;

[0039] A32, detecting whether the first data master node completes the master-slave switching within the preset time threshold;

[0040] A33: If the first data master node completes the master-slave switching within the preset time threshold, the current task request is re-executed in the second data master node after the master-slave switching, and the processing result of the current task request is returned; if the first data master node fails to complete the master-slave switching within the preset time threshold, the processing result of the failure of the current task request is returned.

[0041] In this embodiment, a preset time threshold is set for the task to wait for the data node to complete the active-standby switching. The preset time threshold can be set according to the actual application situation. The total time for fault judgment and switching service recovery is in seconds, generally controlled within 5 seconds.

[0042] If the first data master node completes the active / standby switch within the preset time threshold, and the second data master node after the active / standby switch completes data balancing, the current task request is resent to the second data master node (new master) for execution; if the first data master node fails to complete the active / standby switch within the preset time threshold, the result of the current task request processing failure is returned to the user end. This avoids long and invalid waiting and improves the reliability of task processing.

[0043] In another implementation of this embodiment, after waiting for the first data master node to complete the active-standby switching, re-executing the current task request in the second data master node after the active-standby switching, and returning the processing result of the current task request includes:

[0044] B31, detecting the remaining available resources of the computing node;

[0045] B32, determining whether the required resources requested by the current task exceed the remaining available resources;

[0046] B33, if the required resources of the current task request exceed the remaining available resources, obtain the first task request in the current task request that exceeds the remaining available resources, and return the processing result of the failure to process the first task request; obtain the second task request in the current task request except the first task request, re-execute the current task request in the second data master node after the master-slave switching, and return the processing result of the current task request.

[0047] When the first data master node switches between the primary and standby nodes due to a fault, the corresponding computing node holds the current access connection of the user end (or application end APP). In order to prevent the task request held by the computing node from exceeding the instantaneous processing capacity of the computing node and thus overwhelming the database, in this embodiment, the remaining available resources of the computing node are detected, including key resource indicators such as CPU usage, memory usage, disk IO, and network bandwidth. According to the resource requirements of the current task request and the remaining available resources, it is determined whether all the currently held requests exceed the carrying capacity of the computing node. Once the carrying capacity is exceeded, the part of the connection that exceeds the carrying capacity is directly returned to the application task execution failure information. That is, if the required resources of the current task request exceed the remaining available resources, the first task request that exceeds the resource limit is identified and separated. For the first task request, the processing failure information is immediately returned to the user end, and the failure reason and suggestions (such as insufficient resources, retry later, etc.) can also be attached. For the second task request other than the first task request in the current task request, it is re-executed on the second data master node after the primary and standby switch, and the processing result is returned normally.

[0048] In this implementation, the database system monitors the load of the computing nodes and makes intelligent judgments, rejecting overloaded task connection requests when necessary (directly returning transaction execution failure without temporarily storing overloaded connections), to ensure that the computing nodes can provide services continuously and normally.

[0049] In another implementation of this embodiment, re-executing the current task request in the second data master node after the master-slave switch and returning the processing result of the current task request includes:

[0050] C31, detecting the upper limit of task execution of the second data master node after the master-slave switch;

[0051] C32, determining whether the task amount of the current task request temporarily stored in the computing node exceeds the task execution upper limit;

[0052] C33, if the task amount of the current task request temporarily stored in the computing node exceeds the task execution upper limit, the current task request is sent to the second data master node in batches, the current task request is re-executed in the second data master node, and the processing result of the current task request is returned.

[0053] In this embodiment, the task execution upper limit refers to the maximum number of tasks that the second data master node can process simultaneously under the current host resource (such as CPU, memory, disk I / O, etc.) restrictions. This upper limit can be set based on the current load of the second data master node and the expected performance. The task volume of the current task request temporarily stored in the computing node is compared with the task execution upper limit. If the task volume exceeds the upper limit, batch processing is adopted. A reasonable batching strategy can be formulated based on the task execution upper limit, task urgency, and resource conditions. This can be achieved by limiting the sending rate, setting the sending interval, etc. For example, batching can be performed based on the priority, size, or type of the task to ensure that critical tasks are processed first.

[0054] This embodiment implements a safety valve flow control mechanism when sending task requests in batches to avoid overloading the second data master node due to sending too many tasks at one time.

[0055] In this embodiment, for task requests temporarily stored within the carrying capacity of the computing node, after the first data master node completes the active-standby switching and the second data master node completes the data balancing after the active-standby switching, it is evaluated whether the temporarily stored task requests can be sent to the second data master node for processing at one time, that is, it is determined whether it exceeds the instantaneous transaction carrying capacity of the second data master node, and a batch sending method is adopted to ensure that the data node can provide services continuously and normally.

[0056] In another implementation of this embodiment, considering that different types of tasks have different response requirements for the database, based on this, in this implementation, before temporarily storing the current task request through the corresponding computing node, the method further includes:

[0057] A31, identifying the attributes of the current task request;

[0058] A32, analyzing the response time sensitivity of the attribute;

[0059] A331, if the response time sensitivity is lower than the preset threshold, the current task request is temporarily stored through the corresponding computing node, and after the first data master node completes the master-slave switching, the current task request is re-executed in the second data master node after the master-slave switching, and the processing result of the current task request is returned.

[0060] After analyzing the response time sensitivity of the attribute, the method further includes:

[0061] A332: If the response time sensitivity is higher than a preset threshold, a processing result indicating that the current task request has failed to process is returned.

[0062] In this embodiment, different task processing strategies can be configured in advance for the attributes such as the user terminal, IP, module to which the task code belongs, SQL type, and SQL features corresponding to the task request according to the actual application situation: Task processing strategy 1: immediately return the response information of the failure of the current task request processing. Task processing strategy 2: temporarily store the current task request through the corresponding computing node, wait for the first data master node to complete the master-slave switch, re-execute the current task request in the second data master node after the master-slave switch, and return the processing result of the current task request.

[0063] Some user terminals or modules to which task codes belong are sensitive to database response time requirements. For example, the instructions issued by the user terminal require a response message indicating success or failure of the instruction execution to be received in a very short time. The user terminal itself has a related reconnection mechanism, and the failure of instruction execution has little impact on reconnection. In this case, task processing strategy 1 is used. For large-scale tasks that require a long execution time, such as a set of SQL execution instructions executed in sequence, if one of the SQLs is interrupted in the middle, if the task processing failure is directly returned, all SQLs need to be re-executed, and the failure of instruction execution has a greater impact on reconnection. In this case, task processing strategy 2 is used.

[0064] This implementation method determines the current task request associated with the first data master node. The current task request corresponds to an SQL instruction. The SQL instruction includes adding, deleting, querying, modifying, etc. The current task request includes the task request when the data node failure occurs, and the task request newly added during the failure period. For the task request newly added during the master-slave switching and associated with the first data master node, the task processing strategy can also be set: immediately return an error message or wait for the master-slave switching.

[0065] Identify the attributes of the current task request, including but not limited to the user end, IP, module to which the task code belongs, SQL type and SQL features, and analyze the response time sensitivity of the attributes; if the response time sensitivity is lower than the preset threshold, it means that the current task request can wait for a certain period of time, then temporarily store the current task request, wait for the first data master node to complete the master-slave switch, re-execute the current task request, and return the task processing result. If the response time sensitivity is higher than the preset threshold, it means that the current task request requires a quick return of the processing result, then directly return the processing result of the current task request processing failure.

[0066] This embodiment uses a configurable active-standby switching related task processing strategy to set corresponding processing strategies for current tasks and application requests for newly added related transactions according to connection properties and SQL characteristics during active-standby switching, thereby improving the flexibility of database task processing.

[0067] Reference Figure 4The solution of this embodiment provides a specific application example of a database task processing method, including:

[0068] 1. The application connects to the computing node CN1 to access the database. CN1 sends SQL to the primary node DN1 for processing. At this time, the primary node DN1 and the backup node DN1 are in good health and can provide various services normally.

[0069] 2. When the DN1 master node fails, the database cluster senses the failure of the DN1 master node through the algorithm.

[0070] 3. The CN1 master node determines the current transaction and the newly added related transaction based on the pre-configured switching transaction processing strategy: the strategy configured here is to hold the application access connection and wait for the DN1 master node to complete the master-slave switch and completely catch up with the data.

[0071] 4. When the data of the standby node DN1 catches up with the data of the primary node DN1, CN1 sends SQL requests to the new primary node DN1 (the original standby node DN1) again.

[0072] 5. The new master node of DN1 executes the SQL sent by CN1 and returns data. CN1 processes the returned data and returns it to the application. The exception handling time of the whole process does not exceed the set switching time threshold, and the user end is unaware of the whole process.

[0073] When a distributed database cluster undergoes high-availability switching due to a DN failure, the current transaction will not be interrupted, the business will not be affected, and the customer will not be aware of it. This embodiment can greatly improve system availability, enhance customer experience and satisfaction, and minimize production and economic losses for customers when a DN failure occurs.

[0074] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0075] Example 2

[0076] In the present embodiment, a database task processing device is also provided to implement the above-mentioned embodiments and preferred implementation modes, which have been described and will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.

[0077] Figure 5 is a structural block diagram of a database task processing device according to an embodiment of the present application, such as Figure 5 As shown, the device comprises:

[0078] A detection module 51, used to detect whether the first data master node triggers a master-slave switching event;

[0079] A determination module 52, configured to determine a current task request associated with the first data master node when detecting that the first data master node triggers a master-slave switching event;

[0080] The execution module 53 is used to temporarily store the current task request through the corresponding computing node, wait for the first data master node to complete the master-slave switching, re-execute the current task request in the second data master node after the master-slave switching, and return the processing result of the current task request.

[0081] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0082] Example 3

[0083] An embodiment of the present application further provides a computer storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0084] Optionally, in this embodiment, the computer storage medium may be configured to store a computer program for performing the following steps:

[0085] S1, detecting whether the first data master node triggers a master-slave switching event;

[0086] S2, when detecting that the first data master node triggers a master-slave switching event, determining a current task request associated with the first data master node;

[0087] S3, temporarily storing the current task request through the corresponding computing node, waiting for the first data master node to complete the master-slave switching, re-executing the current task request in the second data master node after the master-slave switching, and returning the processing result of the current task request.

[0088] Optionally, in this embodiment, the above-mentioned computer storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0089] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0090] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0091] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0092] S1, detecting whether the first data master node triggers a master-slave switching event;

[0093] S2, when detecting that the first data master node triggers a master-slave switching event, determining a current task request associated with the first data master node;

[0094] S3, temporarily storing the current task request through the corresponding computing node, waiting for the first data master node to complete the master-slave switching, re-executing the current task request in the second data master node after the master-slave switching, and returning the processing result of the current task request.

[0095] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0096] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0097] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0098] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

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

[0100] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0101] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a computer storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned computer storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or CD-ROM and other media that can store program codes.

[0102] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A database task processing method, characterized in that: The method comprises: Detecting whether the first data master node triggers a master-slave switching event; When detecting that the first data master node triggers a master-slave switching event, determining a current task request associated with the first data master node; The current task request is temporarily stored by the corresponding computing node, and after the first data master node completes the active-standby switching, the current task request is re-executed in the second data master node after the active-standby switching, and the processing result of the current task request is returned.

2. The method according to claim 1, characterized in that After waiting for the first data master node to complete the active / standby switching, re-executing the current task request in the second data master node after the active / standby switching, and returning the processing result of the current task request includes: Get the preset time threshold; Detecting whether the first data master node completes the master-slave switching within the preset time threshold; If the first data master node completes the active-standby switching within the preset time threshold, the current task request is re-executed in the second data master node after the active-standby switching, and the processing result of the current task request is returned.

3. The method according to claim 2, characterized in that After detecting whether the first data master node completes the master-slave switching within the preset time threshold, the method further includes: If the first data master node fails to complete the master-slave switching within the preset time threshold, a processing result indicating that the current task request processing has failed is returned.

4. The method according to claim 1, characterized in that: After waiting for the first data master node to complete the active / standby switching, re-executing the current task request in the second data master node after the active / standby switching, and returning the processing result of the current task request includes: Detecting remaining available resources of the computing node; Determining whether the required resources of the current task request exceed the remaining available resources; If the required resources of the current task request exceed the remaining available resources, obtain the first task request in the current task request that exceeds the remaining available resources, and return the processing result of the failure of processing the first task request; obtain the second task request in the current task request except the first task request, re-execute the current task request in the second data master node after the master-slave switching, and return the processing result of the current task request.

5. The method according to claim 1, characterized in that Re-executing the current task request in the second data master node after the master-slave switch and returning the processing result of the current task request includes: Detect the task execution upper limit of the second data node after the active / standby switch; Determine whether the task amount of the current task request temporarily stored in the computing node exceeds the task execution upper limit; If the task amount of the current task request temporarily stored in the computing node exceeds the task execution upper limit, the current task request is sent to the second data master node in batches, the current task request is re-executed in the second data master node, and the processing result of the current task request is returned.

6. The method according to claim 1, characterized in that Before temporarily storing the current task request through the corresponding computing node, the method further includes: Identifying attributes of the current task request; analyzing response time sensitivity of said attributes; If the response time sensitivity is lower than a preset threshold, the current task request is temporarily stored through the corresponding computing node, and after the first data master node completes the master-slave switching, the current task request is re-executed in the second data master node after the master-slave switching, and the processing result of the current task request is returned.

7. The method according to claim 6, characterized in that After analyzing the response time sensitivity of the attribute, the method further includes: If the response time sensitivity is higher than a preset threshold, a processing result indicating that the current task request has failed to be processed is returned.

8. A database task processing device, characterized in that: include: A detection module, used to detect whether the first data master node triggers a master-slave switching event; A determination module, configured to determine a current task request associated with the first data master node when detecting that the first data master node triggers a master-slave switching event; The execution module is used to temporarily store the current task request through the corresponding computing node, wait for the first data master node to complete the master-slave switching, re-execute the current task request in the second data master node after the master-slave switching, and return the processing result of the current task request.

9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; wherein: Memory, used to store computer programs; A processor, configured to execute the database task processing method according to any one of claims 1 to 7 by running a program stored in a memory.

10. A computer storage medium, characterized in that: The computer storage medium includes a stored program, wherein the program executes the database task processing method according to any one of claims 1 to 7 when running.