Idempotency problem processing method, device, electronic device and storage medium

By carrying idempotent information on the client, the server uses the idempotent framework to manage idempotent signs in cache and relational databases, solving the problem of repeated execution caused by interface request timeout, ensuring the idempotence of business requests and system stability, and preventing downtime.

CN114968977BActive Publication Date: 2025-08-26HAINAN CHEZHIYITONG INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210398097.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-12
Publication Date
2025-08-26
Estimated Expiration
2042-04-12

AI Technical Summary

Technical Problem

The prior art can easily lead to repeated execution of service requests when processing interface requests timeouts, and the optimistic locking mechanism puts pressure on the database during concurrent processing, and cannot effectively prevent business downtime and idempotent failure.

Method used

The client carries idempotent information, and the server obtains and judges the idempotent sign, and uses the idempotent framework to store idempotent signs in cache and relational databases to ensure the idempotence of business requests, and automatically rollback processing in exceptions.

Benefits of technology

It realizes preventing downtime when the server executes business request exceptions, maintaining idempotent and effective, avoiding repeated execution of business requests, and improving the stability and efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114968977B_ABST
    Figure CN114968977B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, electronic device, and storage medium for handling idempotency issues. The method includes the following steps: obtaining, via a server, idempotency information carried by a client, the idempotency information including an idempotency sign; obtaining, based on the idempotency information carried by the client obtained by the server, information about the idempotency sign stored by an idempotency framework; and handling abnormal events occurring during the execution of the server based on the idempotency sign stored by the idempotency framework. This application can prevent server downtime when the server processes a client's service request, maintain idempotency, and promptly perform rollback processing when the server executes an abnormal client service request.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a method, device, electronic device and storage medium for processing idempotent problems. Background Art

[0002] When a user calls the platform's interface, if a request timeout occurs, the service request may be repeatedly executed multiple times. In the prior art, there are three main ways to handle request timeouts: First, when the caller times out while accessing the public service platform interface, a clear and unambiguous reminder is returned to the user, informing them that the execution result is unknown, allowing the user to decide whether to retry. In this method, if the user sees the timeout reminder and re-initiates an operation, such as a transfer or recharge, since both operations are initiated by the user, the server cannot determine whether the second transfer or recharge is a new operation or a retry based on the previous timeout, resulting in repeated payment. Second, the caller calls other interfaces to query the result of the timed-out operation, clarify whether the business corresponding to the timed-out operation was successful or failed, and then handles the operation based on the clear result. However, this handling method has a problem, that is, not all business operations are easy to query the operation results. Third, the caller directly initiates a retry operation after encountering an interface timeout. This requires the interface to support idempotence. Separate code must be written for each business logic that requires idempotence. On the one hand, this requires high development capabilities of programmers, and on the other hand, it also has high development costs.

[0003] To address this issue, existing technologies employ an optimistic locking mechanism, leveraging the database's redundant version number field. Optimistic locking addresses computational assignment modification scenarios. By adding a version number, these computational assignment transactions achieve idempotence. However, optimistic locking requires querying the current version before each transaction. This places significant pressure on the database during concurrent processing.

[0004] Therefore, a method is needed to handle idempotent problems so that the server can automatically roll back when a business request is executed abnormally, thereby preventing business downtime and idempotent failure. Summary of the Invention

[0005] To this end, the present invention provides a method, device, electronic device and storage medium for processing idempotency problems, in an effort to solve or at least alleviate at least one of the above problems.

[0006] According to one aspect of the present invention, a method for handling idempotence problems is provided. In this method, a client carries idempotence information, and a server handles abnormal events in the process of the server executing the client's business request based on the idempotence information of the client. The method includes the following steps: the server obtains the idempotence information carried by the client, and the idempotence information includes an idempotence sign; based on the idempotence information carried by the client obtained by the server, the server obtains the idempotence sign information stored by an idempotence framework; based on the idempotence sign information stored by the idempotence framework, handles abnormal events that occur in the execution process of the server.

[0007] Optionally, the step of the server obtaining the idempotence information carried by the client includes: the client obtains the idempotence request header information from the idempotence framework tool class; based on the client obtaining the idempotence request header information from the idempotence framework tool class, the client sends the idempotence information request it carries to the server; the server determines whether the idempotence sign of the idempotence information request exists; if yes, the server processes the idempotence information request; if not, the server executes the client's business request.

[0008] Optionally, the step of the server obtaining the idempotence number information stored in the idempotence framework based on the idempotence information carried by the client obtained by the server includes: based on the idempotence information carried by the client obtained by the server, the server transmits the idempotence information carried by the client to the interface implementer; based on the idempotence information carried by the client transmitted by the server, the interface implementer parses the idempotence number of the idempotence information; based on the idempotence number of the idempotence information parsed by the interface implementer, the interface implementer transmits the idempotence number to the idempotence framework; based on the idempotence number information received by the idempotence framework, the server obtains the idempotence number stored in the idempotence framework.

[0009] Optionally, the server obtains the situation of the idempotence sign stored in the idempotence framework, including: based on the idempotence sign information received by the idempotence framework, the idempotence framework searches the cache to see whether the idempotence sign already exists; if it already exists, sending the information that the idempotence sign already exists to the server; if it does not exist, storing the idempotence sign in the relational database of the idempotence framework.

[0010] Optionally, the step of storing the idempotence sign in the relational database of the idempotence framework includes: obtaining the storage field of the idempotence sign in the relational database; setting a unique key for the storage field of the idempotence sign in the relational database based on the storage field of the idempotence sign in the relational database; and storing the unique key and the idempotence sign in the relational database of the idempotence framework.

[0011] Optionally, the step of handling abnormal events occurring during the execution of the server based on the idempotence sign information stored in the idempotence framework includes: if the idempotence sign already exists in the cache, the server is executing the client's business request; if the idempotence sign exists in the relational database, the server executes the client's business request through the idempotence sign in the relational database; if the server executes the client's business request abnormally through the idempotence sign in the relational database, the server obtains the unique key of the idempotence sign; based on the unique key of the idempotence sign, the server rolls back the executed client's business request.

[0012] Optionally, the step of handling abnormal events occurring during the execution of the server based on the idempotence information stored in the idempotence framework also includes: after the server completes executing the client's business request through the idempotence in the relational database, the idempotence framework synchronizes the idempotence to the cache; setting the log clearing parameters of the idempotence framework to delete the idempotence log records in the relational database.

[0013] According to another aspect of the present invention, a device for handling idempotence problems is disclosed. The client carries idempotence information, and the server handles abnormal events in the process of the server executing the client's business request based on the idempotence information of the client. The device includes: an acquisition module, which is used for the server to obtain the idempotence information carried by the client, and the idempotence information includes an idempotence sign; an idempotence sign analysis module, which is used for the server to obtain the idempotence sign information stored in the idempotence framework based on the idempotence information carried by the client obtained by the server; and a handling module, which is used to handle abnormal events occurring in the execution process of the server based on the idempotence sign information stored in the idempotence framework.

[0014] According to another aspect of the present invention, a computing device is provided, comprising: one or more processors; and a memory; one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include instructions for executing any of the idempotent problem processing methods described above.

[0015] According to another aspect of the present invention, a computer-readable storage medium storing one or more programs is provided, wherein the one or more programs include instructions that, when executed by a computing device, cause the computing device to perform any of the idempotent problem processing methods described above.

[0016] According to the present invention's idempotency problem handling solution, a server obtains idempotency information from a client, including an idempotency sign. Based on the idempotency information obtained from the client, the server obtains the idempotency sign information stored by an idempotency framework. Based on the idempotency sign information stored by the idempotency framework, the server handles abnormal events that occur during execution. This application prevents server downtime when processing client service requests, maintains idempotency, and enables timely rollback when the server executes client service requests abnormally. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] To achieve the above and related purposes, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings, which indicate various ways in which the principles disclosed herein may be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The above and other objects, features, and advantages of the present disclosure will become more apparent by reading the following detailed description in conjunction with the accompanying drawings. Throughout this disclosure, the same reference numerals generally refer to the same parts or elements.

[0018] Figure 1 A schematic diagram of an application scenario according to an embodiment of the present invention is shown; and

[0019] Figure 2 A schematic diagram showing the structure of a computing device 100 according to one embodiment of the present invention; and

[0020] Figure 3 A flowchart showing a method 200 for reducing synchronization message data according to an embodiment of the present invention; and

[0021] Figure 4 A schematic structural diagram of an apparatus 300 for reducing synchronization message data according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0022] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0023] Figure 1 This is a schematic diagram of an application scenario of an embodiment of the present invention. The idempotency problem processing method provided by this application can be applied to Figure 1In the application environment shown, the idempotent problem processing method is applied to an idempotent problem processing device. The idempotent problem processing device is configured in the server 010, or partially configured in the client 020 and partially configured in the server 010, and the idempotent problem processing method is completed by the interaction between the client 020 and the server 010.

[0024] The client 020 and the server 010 can communicate via a network.

[0025] Among them, the client 020 can be but is not limited to various personal computers, laptops, smart phones, tablets and portable wearable devices. The client 020 carries idempotence information, and the server 010 handles abnormal events in the process of server 010 executing the business request of the client 020 based on the idempotence information of the client 020. The server 010 can be implemented as an independent server or a server cluster composed of multiple servers.

[0026] For client 020, it obtains idempotency information from the idempotency framework. The idempotency information includes an idempotency sign. When client 020 sends a related service request to server 010, it also sends the idempotency information. When server 010 processes client 020's service request, it first determines whether the idempotency sign exists. If it exists, it means that server 010 is processing an abnormal event. If it does not exist, it means that server 010 is successfully executing client 020's service request. After the idempotency sign is passed to the interface implementer along with client 020's request, specifically, the interface implementer in this embodiment is the interface of the third-party service called by server 010 to implement client 020's service request. For example, when client 020 repays a credit card debt owed to another bank through one bank account, the interface implementers at this time are the interface between the first bank and server 010 and the interface between the second bank and server 010 respectively. After the interface implementer parses the idempotency sign, it passes it to the idempotency framework, which searches the cache for the idempotency sign. If it exists, it means that the interface implementer has started executing client 020. 20 sends the relevant business request. At this time, there is no need to repeatedly execute the business request of client 020. If the idempotence sign does not exist in the cache, the idempotence sign needs to be stored in the relational database, and the storage field of the idempotence sign in the relational database is set to a unique key. If the corresponding interface implementer fails to process the business request of client 020, the server 010 is notified of the exception information, and the server 010 automatically rolls back to handle the exception until the relational database successfully stores the idempotence sign, and then continues to execute the business request of client 020. After the server 010 successfully completes the business request of client 020, the idempotence framework synchronizes the idempotence sign to the cache.

[0027] Figure 2is a block diagram of an example computing device 100. In a basic configuration 102, computing device 100 typically includes a system memory 106 and one or more processors 104. A memory bus 108 may be used for communication between processor 104 and system memory 106.

[0028] Depending on the desired configuration, the processor 104 can be any type of processor, including, but not limited to, a microprocessor (μP), a microcontroller (μC), a digital signal processing unit (DSP), or any combination thereof. The processor 104 can include one or more levels of cache, such as a level 1 cache 110 and a level 2 cache 112, a processor core 114, and registers 116. An example processor core 114 can include an arithmetic logic unit (ALU), a floating point unit (FPU), a digital signal processing core (DSP core), or any combination thereof. An example memory controller 118 can be used with the processor 104, or in some implementations, the memory controller 118 can be an internal part of the processor 104.

[0029] Depending on the desired configuration, the system memory 106 can be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. The system memory 106 may include an operating system 120, one or more applications 122, and program data 124. In some embodiments, the application 122 may be arranged to operate on the operating system using the program data 124. In some embodiments, the computing device 100 is configured to execute an idempotency problem handling method 200. The method 200 can be carried by the client with idempotency information, and the server handles abnormal events in the process of the server executing the client's business request based on the client's idempotency information. The program data 124 includes instructions for executing the method 200.

[0030] The computing device 100 may also include an interface bus 140 that facilitates communication from various interface devices (e.g., output devices 142, peripheral interfaces 144, and communication devices 146) to the basic configuration 102 via the bus / interface controller 130. Example output devices 142 include a graphics processing unit 148 and an audio processing unit 150. These can be configured to facilitate communication with various external devices such as a display or speakers via one or more A / V ports 152. Example peripheral interfaces 144 may include a serial interface controller 154 and a parallel interface controller 156, which can be configured to facilitate communication with external devices such as input devices (e.g., a keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., a printer, scanner, etc.) via one or more I / O ports 158. Example communication devices 146 may include a network controller 160, which can be arranged to facilitate communication with one or more other computing devices 162 via a network communication link via one or more communication ports 164.

[0031] A network communication link can be an example of a communication medium. The communication medium can generally be embodied as computer-readable instructions, data structures, program modules in a modulated data signal such as a carrier wave or other transmission mechanism, and can include any information delivery medium. A "modulated data signal" can be a signal in which one or more of its data sets or its changes can be performed in a manner that encodes information in the signal. As non-limiting examples, the communication medium can include wired media such as a wired network or a dedicated line network, and various wireless media such as sound, radio frequency (RF), microwave, infrared (IR) or other wireless media. The term computer-readable medium used herein can include both storage media and communication media. In some embodiments, one or more programs are stored in the computer-readable medium, and the one or more programs include instructions for executing certain methods, such as according to an embodiment of the present invention, the computing device 100 executes the idempotent problem processing method 200 through the instructions.

[0032] The computing device 100 may be implemented as part of a small portable (or mobile) electronic device, such as a cellular phone, a personal digital assistant (PDA), a personal media player device, a wireless network browsing device, a personal head-mounted device, an application-specific device, or a hybrid device that may include any of the above functions. The computing device 100 may also be implemented as a personal computer including desktop and notebook computer configurations.

[0033] Figure 3 FIG. 2 shows a flow chart of a method 200 for handling idempotent problems according to an embodiment of the present invention. Figure 2As shown, the method 200 method is carried by the client with idempotence information, and the server handles abnormal events in the process of the server executing the client's business request based on the client's idempotence information. The method 200 starts at step S210, and the server obtains the idempotence information carried by the client, and the idempotence information includes the idempotence sign.

[0034] Specifically, the idempotence information carried by the client is obtained by the client from the idempotence framework tool. An idempotence framework tool generally consists of an idempotence sign generation management unit, a testing unit, an idempotence protocol header unit, an idempotence operation interface unit, a high availability unit, and a data consistency management unit. The idempotence framework tool has the function of generating and managing idempotence information. The client obtains the idempotence information from the idempotence framework tool, and the idempotence information includes an idempotence sign.

[0035] Specifically, in one embodiment of the present application, the step of obtaining the time information of the user's last login to the server includes:

[0036] The step of the server obtaining the idempotence information carried by the client includes:

[0037] The client obtains idempotence request header information from the idempotence framework tool class; specifically, the client obtains the idempotence request header information by sending a request to obtain idempotence information to the idempotence framework tool class. The idempotence request header information is also the idempotence information. The idempotence request header information contains an idempotence sign, which is used to distinguish different idempotence information obtained by different clients.

[0038] According to the client, the idempotence request header information is obtained from the idempotence framework tool class, and the client sends the idempotence information request it carries to the server; specifically, when the client sends a business request to the server, in order to prevent abnormal problems from occurring and to deal with them in a timely manner without causing business logic execution problems, the client also sends the obtained idempotence information to the server, and the server determines whether the client's business request has been processed based on whether the client carries the idempotence information.

[0039] The server determines whether the idempotence sign of the idempotence information request exists;

[0040] If yes, the server processes the idempotence information request; specifically, if the idempotence sign exists, it means that the server has not processed the service request sent by the client, and at this time the server needs to first process the idempotence information of the service request sent by the client.

[0041] If not, the server executes the service request of the client. Specifically, if the idempotence sign does not exist, it means that the server has completed the execution of the idempotence information carried by the client, and can now process the service requested by the client.

[0042] Through step S220, based on the idempotence information carried by the client obtained by the server, the server obtains the idempotence sign information stored in the idempotence framework.

[0043] Specifically, for the idempotence information carried by the client, the server needs to pass the idempotence sign to the corresponding interface implementer according to the client's business request during the execution process, and the interface implementer will execute the corresponding client's business request. For example, a Taobao user purchases goods from a Taobao store through the Taobao platform. At this time, the Taobao user sends the business request for purchasing goods and the idempotence information to the Taobao server at the same time. The Taobao server sends the Taobao user's purchase request and idempotence information to the interface implementer of the Taobao store selected by the user. After the interface implementer parses the user's request information, it can obtain the idempotence sign in the request information. At this time, the interface implementer can execute the corresponding steps according to the stored situation of the idempotence sign.

[0044] Specifically, in one embodiment of the present application, the step of the server obtaining the idempotence information stored in the idempotence framework based on the idempotence information carried by the client obtained by the server includes:

[0045] Based on the idempotence information carried by the client obtained by the server, the server transmits the idempotence information carried by the client to the interface implementer; specifically, when the interface implementer obtains the idempotence information carried by the client, it also obtains the client's business request information forwarded by the server to the interface implementer.

[0046] According to the idempotence information carried by the client transmitted by the server, the interface implementer parses the idempotence sign of the idempotence information;

[0047] According to the idempotence sign of the idempotence information parsed by the interface implementer, the interface implementer transmits the idempotence sign to the idempotence framework;

[0048] According to the idempotence sign information received by the idempotence framework, the server obtains the idempotence sign storage status of the idempotence framework.

[0049] Specifically, after the interface implementer parses the idempotence sign of the idempotence information, the interface implementer will determine whether the idempotence sign is already in its cache based on the parsed idempotence sign. If there is an idempotence sign, it will execute according to the scheme stored in the cache. If there is no idempotence sign in the cache, the idempotence sign will be stored in the relational database and executed according to the scheme stored in the idempotence sign.

[0050] Specifically, in one embodiment of the present application, the server obtaining the idempotence symbol stored in the idempotence framework includes:

[0051] According to the idempotence information received by the idempotence framework, the idempotence framework searches a cache to see whether the idempotence information already exists.

[0052] If it already exists, the information that the idempotence sign already exists will be sent to the server; specifically, the idempotence sign already exists in the cache, indicating that the interface implementer has already executed the client's business request, or has completed the execution of the corresponding business request. The idempotence sign is now monitoring whether there is any abnormality in the execution of the business request by the interface implementer. If there is an abnormality, the idempotence sign will be rolled back according to the corresponding plan. If it is executed smoothly, the idempotence sign will be processed according to the completed plan.

[0053] If not, the idempotence sign is stored in the relational database of the idempotence framework. If the idempotence sign does not exist in the cache, it means that the service request sent by the client has not yet been executed by the interface implementer. The interface implementer needs to first parse the idempotence sign and store it in the relational database of the idempotence framework before executing the corresponding service request.

[0054] Specifically, in one embodiment of the present application, the step of storing the idempotence sign in the relational database of the idempotence framework includes:

[0055] Obtaining a storage field of the idempotence sign in the relational database;

[0056] According to the storage field of the idempotence sign in the relational database, a unique key is set for the storage field of the idempotence sign in the relational database; specifically, if the server fails to execute the client's business request, it may cause the synchronization of the idempotence sign in the cache to fail, which may also cause the server to be unable to roll back after the execution exception to achieve the correct execution result. By setting the unique key, it can be rolled back directly when the server executes the exception.

[0057] The unique key and the idempotence sign are stored in a relational database of the idempotence framework.

[0058] In step S230 , abnormal events occurring during the execution of the server are handled according to the idempotence information stored in the idempotence framework.

[0059] Specifically, since there are two forms of idempotence signs in the idempotence framework, one is already in the cache and the other is not in the cache, the idempotence signs are stored in a relational database and synchronized to the cache after business execution. Therefore, for the idempotence signs already in the cache, the client's business request has been executed by the server through the interface implementer. At this time, there is no need to store the idempotence sign again and implement repeated execution of the business request through calling. For the idempotence signs that are not in the cache, they need to be stored in the relational database first. In order to prevent cache synchronization failure, the field where the idempotence sign is stored in the relational database needs to be set with a unique key, so that it can be rolled back directly when the client's business request is executed abnormally.

[0060] Specifically, in one embodiment of the present application, the step of handling an abnormal event occurring during the execution of the server according to the idempotence information stored in the idempotence framework includes:

[0061] If the idempotence sign already exists in the cache, the server is executing the service request of the client;

[0062] If the idempotence sign exists in the relational database, the server executes the service request of the client through the idempotence sign in the relational database;

[0063] If the server executes the client's service request abnormally through the idempotence symbol in the relational database, the server obtains the unique key of the idempotence symbol;

[0064] According to the unique key of the idempotence sign, the server rolls back the business request of the client.

[0065] When the server completes executing the client's service request through the idempotence sign in the relational database, the idempotence framework synchronizes the idempotence sign to the cache;

[0066] Set the log clearing parameters of the idempotence framework to delete idempotence log records in the relational database.

[0067] Specifically, this method prevents business system downtime and idempotency failure during server business processing. In this application, the recording of the idempotence sign and the execution of the client's business request are placed in a single transaction. If the business request is successfully executed, the idempotence framework will automatically record the idempotence sign. If the business request fails, the idempotence sign record is automatically rolled back, allowing the server to execute the client's business request again. In the relational database that stores business data, a table is created to record the idempotence sign. The idempotence sign is first stored in the business database and then synchronized with the idempotence framework's database.

[0068] In the embodiment of the present application, the idempotent framework can ensure normal recovery when an exception occurs, and new business logic will not be executed. Because the temporary failure of the idempotent function is repeated, it will cause the business request execution to fail. For example, if the transfer is executed multiple times and too much money is transferred, the idempotent logic will fail when the exception occurs.

[0069] In order to make the idempotent framework as flexible as possible and minimize intrusion into business logic, the idempotent framework itself does not participate in the decision of whether to allow retrying business logic execution when an exception occurs. The framework only needs to provide an interface for deleting idempotent signs. It is up to the business engineer to decide whether to call this deletion interface and delete the recorded idempotent signs when an exception occurs.

[0070] According to the present invention's idempotency problem handling solution, a server obtains idempotency information from a client, including an idempotency sign. Based on the idempotency information obtained from the client, the server obtains the idempotency sign information stored by an idempotency framework. Based on the idempotency sign information stored by the idempotency framework, the server handles abnormal events that occur during execution. This application prevents server downtime when processing client service requests, maintains idempotency, and enables timely rollback when the server executes client service requests abnormally.

[0071] It should be understood that although Figure 3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, Figure 3 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0072] In one embodiment, Figure 4 As shown, an idempotence problem processing device 300 is provided. The client carries idempotence information in the device 300, and the server handles abnormal events in the process of executing the client's business request based on the client's idempotence information. The device 300 includes: an acquisition module, an idempotence analysis module, and a processing module.

[0073] An acquisition module, configured for the server to acquire idempotence information carried by the client, wherein the idempotence information includes an idempotence sign;

[0074] An idempotence analysis module, configured to obtain, from the server, the idempotence information stored in the idempotence framework based on the idempotence information carried by the client obtained by the server;

[0075] The processing module is used to process abnormal events that occur during the execution of the server according to the idempotence information stored in the idempotence framework.

[0076] Specifically, in another embodiment of the present application, the acquisition module is used by the client to obtain idempotent request header information from the idempotent framework tool class; based on the client obtaining the idempotent request header information from the idempotent framework tool class, the client sends the idempotent information request it carries to the server; the server determines whether the idempotent sign of the idempotent information request exists; if yes, the server processes the idempotent information request; if not, the server executes the client's business request.

[0077] Specifically, in another embodiment of the present application, the acquisition module is used to transmit the idempotence information carried by the client to the interface implementer based on the idempotence information carried by the client obtained by the server; the interface implementer parses the idempotence sign of the idempotence information based on the idempotence information carried by the client transmitted by the server; based on the idempotence sign of the idempotence information parsed by the interface implementer, the interface implementer transmits the idempotence sign to the idempotence framework; based on the idempotence sign information received by the idempotence framework, the server obtains the idempotence sign stored in the idempotence framework.

[0078] Specifically, in another embodiment of the present application, the acquisition module is used to search the cache for the idempotence sign information received by the idempotence framework to see whether the idempotence sign already exists; if it already exists, the information that the idempotence sign already exists is sent to the server; if it does not exist, the idempotence sign is stored in the relational database of the idempotence framework.

[0079] Specifically, in another embodiment of the present application, the idempotence sign analysis module is used to obtain the storage field of the idempotence sign in the relational database; based on the storage field of the idempotence sign in the relational database, set a unique key for the storage field of the idempotence sign in the relational database; and store the unique key and the idempotence sign in the relational database of the idempotence framework.

[0080] Specifically, in another embodiment of the present application, the handling module is used to determine that if the idempotence sign already exists in the cache, the server is executing the client's business request; if the idempotence sign exists in the relational database, the server executes the client's business request through the idempotence sign in the relational database; if the server executes the client's business request through the idempotence sign in the relational database abnormally, the server obtains the unique key of the idempotence sign; based on the unique key of the idempotence sign, the server rolls back the executed client's business request.

[0081] Specifically, in another embodiment of the present application, the disposal module is used to synchronize the idempotence sign to the cache after the server completes executing the client's business request through the idempotence sign in the relational database; set the log clearing parameters of the idempotence framework to delete the idempotence sign log records in the relational database.

[0082] According to the present invention, the idempotency problem handling solution uses an acquisition module to enable a server to obtain idempotency information from a client, including an idempotency sign. An idempotency sign analysis module is used to obtain the idempotency sign information stored by an idempotency framework based on the idempotency information obtained from the client. Finally, a handling module is used to handle abnormal events that occur during the server's execution process based on the idempotency sign information stored by the idempotency framework. This solution prevents server downtime when processing client service requests, maintains idempotency, and enables timely rollback when the server executes client service requests abnormally.

[0083] It should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Accordingly, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of the invention.

[0084] Those skilled in the art will appreciate that the modules, units, or components of the devices in the examples disclosed herein may be arranged in the device described in the embodiment, or alternatively may be located in one or more devices different from the devices in the examples. The modules in the foregoing examples may be combined into one module or further divided into multiple submodules.

[0085] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition may be divided into multiple submodules or subunits or subcomponents. All features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed herein may be combined in any combination, except that at least some of such features and / or processes or units are mutually exclusive. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0086] Furthermore, those skilled in the art will appreciate that although some embodiments described herein include certain features included in other embodiments but not other features, combinations of features from different embodiments are intended to be within the scope of the present invention and to form different embodiments. For example, in the claims below, any of the claimed embodiments may be used in any combination.

[0087] In addition, some of the embodiments are described herein as methods or combinations of method elements that can be implemented by a processor of a computer system or by other devices that perform the functions described. Thus, a processor having the necessary instructions for implementing the method or method element forms a device for implementing the method or method element. Furthermore, the elements described herein of the device embodiments are examples of devices for implementing the functions performed by the elements for the purpose of implementing the invention.

[0088] As used herein, unless otherwise specified, the use of ordinal numbers "first," "second," "third," etc. to describe common objects merely indicates that different instances of similar objects are involved and are not intended to imply that the objects so described must have a given order in time, space, ranking, or in any other manner.

[0089] Although the present invention has been described with respect to a limited number of embodiments, it will be apparent to those skilled in the art, having benefit of the foregoing description, that other embodiments are contemplated within the scope of the invention thus described. Furthermore, it should be noted that the language used in this specification has been selected primarily for readability and didactic purposes, rather than for the purpose of explaining or limiting the subject matter of the present invention. Consequently, many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is intended to be illustrative rather than restrictive of the scope of the invention, which is defined by the appended claims.

Claims

1. A method for handling idempotency issues, wherein a client carries idempotency information, and a server handles abnormal events during the server's execution of a client's service request based on the client's idempotency information. The method comprises the following steps: The server obtains the idempotence information carried by the client, wherein the idempotence information includes an idempotence sign; According to the idempotence information carried by the client obtained by the server, the server obtains the idempotence sign information stored by the idempotence framework, including according to the idempotence information carried by the client obtained by the server, the server transmits the idempotence information carried by the client to the interface implementer, according to the idempotence information carried by the client transmitted by the server, the interface implementer parses the idempotence sign of the idempotence information, according to the idempotence sign of the idempotence information parsed by the interface implementer, the interface implementer transmits the idempotence sign to the idempotence framework, according to the idempotence sign information received by the idempotence framework, the server obtains the idempotence sign stored by the idempotence framework, wherein, The server obtains the situation of the idempotence sign stored in the idempotence framework, including: based on the idempotence sign information received by the idempotence framework, the idempotence framework searches the cache for the idempotence sign to determine whether the idempotence sign already exists; if so, the idempotence sign existence information is sent to the server; if not, the idempotence sign is stored in the relational database of the idempotence framework; the step of storing the idempotence sign in the relational database of the idempotence framework includes: obtaining a storage field of the idempotence sign in the relational database; based on the storage field of the idempotence sign in the relational database, setting a unique key for the storage field of the idempotence sign in the relational database; and storing the unique key and the idempotence sign in the relational database of the idempotence framework; According to the idempotence information stored in the idempotence framework, abnormal events occurring during the execution of the server are handled, including if the idempotence information already exists in the cache, the server is executing the client's business request; if the idempotence information exists in the relational database, the server executes the client's business request through the idempotence in the relational database; if the server executes the client's business request abnormally through the idempotence in the relational database, the server obtains the unique key of the idempotence, and according to the unique key of the idempotence, the server rolls back the executed client's business request.

2. The method according to claim 1, wherein The step of the server obtaining the idempotence information carried by the client includes: The client obtains the idempotent request header information from the idempotent framework tool class; According to the client obtaining idempotence request header information from the idempotence framework tool class, the client sends the idempotence information request carried by it to the server; The server determines whether the idempotence sign of the idempotence information request exists; If yes, the server processes the idempotent information request; If not, the server executes the service request of the client.

3. The method according to claim 1, wherein The step of handling abnormal events occurring during the execution of the server according to the idempotence information stored in the idempotence framework further includes: After the server completes executing the client's service request through the idempotence sign in the relational database, the idempotence framework synchronizes the idempotence sign to the cache; Set the log clearing parameters of the idempotence framework to delete idempotence log records in the relational database.

4. A device for handling idempotency issues, wherein a client carries idempotency information, and a server handles abnormal events during the server's execution of a client's service request based on the client's idempotency information. The device comprises: An acquisition module, configured for the server to acquire idempotence information carried by the client, wherein the idempotence information includes an idempotence sign; The idempotence analysis module is used to obtain the idempotence information carried by the client obtained by the server, and the server obtains the idempotence information stored by the idempotence framework, including the following steps: according to the idempotence information carried by the client obtained by the server, the server transmits the idempotence information carried by the client to the interface implementer, according to the idempotence information carried by the client transmitted by the server, the interface implementer parses the idempotence sign of the idempotence information, according to the idempotence sign of the idempotence information parsed by the interface implementer, the interface implementer transmits the idempotence sign to the idempotence framework, according to the idempotence information received by the idempotence framework, the server obtains the idempotence sign stored by the idempotence framework, wherein the server obtains the idempotence framework The situation of storing the idempotence sign in the idempotence framework includes: according to the idempotence sign information received by the idempotence framework, the idempotence framework searches the cache for the idempotence sign to see if it already exists; if it already exists, the information that the idempotence sign already exists is sent to the server; if it does not exist, the idempotence sign is stored in the relational database of the idempotence framework; the step of storing the idempotence sign in the relational database of the idempotence framework includes: obtaining the storage field of the idempotence sign in the relational database; according to the storage field of the idempotence sign in the relational database, setting a unique key for the storage field of the idempotence sign in the relational database; and storing the unique key and the idempotence sign in the relational database of the idempotence framework; A disposal module is used to handle abnormal events that occur during the execution of the server based on the idempotence information stored in the idempotence framework, including if the idempotence already exists in the cache, the server is executing the client's business request; if the idempotence exists in the relational database, the server executes the client's business request through the idempotence in the relational database; if the server executes the client's business request abnormally through the idempotence in the relational database, the server obtains the unique key of the idempotence, and based on the unique key of the idempotence, the server rolls back the executed client's business request.

5. An electronic device comprising: one or more processors; and Memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs comprising instructions for executing any one of the methods according to claims 1-3.

6. A computer-readable storage medium storing one or more programs, the one or more programs comprising instructions, which, when executed by a computing device, cause the computing device to perform any one of the methods according to claims 1-3.

Citation Information

Patent Citations

  • Idempotent control method and device for sub-library sub-tables

    CN107193827A