CN114968977A - Idempotent problem processing method, idempotent problem processing device, electronic equipment and storage medium - Google Patents

Idempotent problem processing method, idempotent problem processing device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114968977A
CN114968977A CN202210398097.0A CN202210398097A CN114968977A CN 114968977 A CN114968977 A CN 114968977A CN 202210398097 A CN202210398097 A CN 202210398097A CN 114968977 A CN114968977 A CN 114968977A
Authority
CN
China
Prior art keywords
idempotent
server
client
information
power
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210398097.0A
Other languages
Chinese (zh)
Inventor
田强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hainan Chezhiyi Communication Information Technology Co ltd
Original Assignee
Hainan Chezhiyi Communication Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hainan Chezhiyi Communication Information Technology Co ltd filed Critical Hainan Chezhiyi Communication Information Technology Co ltd
Priority to CN202210398097.0A priority Critical patent/CN114968977A/en
Publication of CN114968977A publication Critical patent/CN114968977A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses an idempotent problem processing method, an idempotent problem processing device, electronic equipment and a storage medium, wherein the method comprises the following steps: the method comprises the steps that power information carried by a client is obtained through a server, wherein the power information comprises power signs; according to the idempotent information carried by the client side acquired by the server, the server acquires the idempotent information condition stored by the idempotent frame; and handling abnormal events which occur in the execution process of the server according to the situation of the idempotent sign information stored by the idempotent framework. The method and the device can prevent the server from being down when the server processes the service request of the client, can keep validity such as power, and can timely perform rollback processing when the server executes the service request of the client to be abnormal.

Description

Idempotent problem processing method, idempotent problem processing device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to an idempotent problem processing method, apparatus, electronic device, and storage medium.
Background
When a user calls an interface of a platform, if a request is overtime, a problem of repeatedly executing a service request for many times may occur, and in the prior art, the processing mode for the request overtime mainly includes the following three types: firstly, when a calling party accesses a public service platform interface and times out, clear and definite reminding is returned to a user to inform that an execution result is unknown, and the user judges whether to retry or not, if the user sees the overtime reminding, the user initiates operations again, such as transfer, recharging and the like, and because the two operations are initiated by the user actively, the server cannot judge whether the transfer and recharging for the second time are new operations or are based on the last overtime retry behavior, the occurrence of repeated payment is caused; secondly, the calling party calls other interfaces to inquire the result of the overtime operation, determines whether the execution of the business corresponding to the overtime operation is successful or failed, and then processes the business based on the determined result, and the processing method has a problem that the operation result is convenient to inquire for not all business operations; thirdly, after the calling party encounters the interface overtime, the calling party directly initiates retry operation, so that the interface is required to support idempotent, and the code is independently written for each service logic which needs idempotent, so that the requirements on the development capability of programmers are high on one hand, and the development cost is high on the other hand.
In order to solve the above problems, the prior art adopts an optimistic lock mechanism, and uses a database redundancy version number field. The optimistic lock solves the problem of modifying scenes of calculation assignment type, and enables the calculation assignment type service to have idempotent property after the version number is added, but before the operation of the service, the optimistic lock needs to inquire the current vers ion version each time. Concurrent processing places tremendous pressure on the database.
Therefore, there is a need for a method for automatically rolling back when a server executes a service request abnormally by processing an idempotent problem, so as to prevent the problems of service downtime and idempotent failure.
Disclosure of Invention
To this end, the present invention provides an idempotent problem handling method, apparatus, electronic device and storage medium, which seek to solve, or at least alleviate, at least one of the problems identified above.
According to one aspect of the invention, an idempotent problem processing method is provided, in which a client carries idempotent information, and a server handles abnormal events in a process of executing a service request of the client by the server according to the idempotent information of the client, and the method includes the following steps: the server acquires idempotent information carried by the client, wherein the idempotent information comprises idempotent signs; according to the idempotent information carried by the client side acquired by the server, the server acquires the idempotent information condition stored by the idempotent frame; and handling abnormal events which occur in the execution process of the server according to the situation of the idempotent information stored by the idempotent framework.
Optionally, the step of the server obtaining the idempotent information carried by the client includes: a client acquires the idempotent request header information from an idempotent framework tool class; acquiring idempotent request header information from an idempotent tool class according to the client, and sending an idempotent information request carried by the client to a server; the server judges whether the idempotent sign of the idempotent information request exists or not; if yes, the server processes the idempotent information request; and if not, the server executes the service request of the client.
Optionally, the step of, according to the idempotent information carried by the client acquired by the server, acquiring, by the server, the idempotent information condition stored in the idempotent frame includes: according to the idempotent information carried by the client side, which is obtained by the server, the server transmits the idempotent information carried by the client side to an interface realizing party; according to the idempotent information carried by the client side and transmitted by the server, the interface realizing party analyzes the idempotent signs of the idempotent information; according to the idempotent signs of the idempotent information analyzed by the interface realizing party, the interface realizing party transmits the idempotent signs to an idempotent frame; and according to the idempotent information received by the idempotent frame, the server acquires the idempotent frame storage idempotent condition.
Optionally, the obtaining, by the server, the case that the idempotent frame stores the idempotent includes: according to the idempotent information received by the idempotent frame, the idempotent frame searches whether the idempotent exists from a cache; if the idempotent exists, sending the information that the idempotent exists to a server; if not, the power equivalent sign is stored in a relational database of the power framework.
Optionally, the step of storing the idempotent signs in the relational database of the idempotent frame includes: acquiring a storage field of the power equal sign in the relational database; setting a unique key for the storage field of the power-equal number in the relational database according to the storage field of the power-equal number in the relational database; storing the unique key and the power-idempotent into a relational database of the power-idempotent framework.
Optionally, the step of handling an abnormal event occurring in the execution process of the server according to the situation of the idempotent information stored in the idempotent frame includes: if the power-equal number already exists in the cache, the server is executing the service request of the client; if the power-equal number exists in the relational database, the server executes the service request of the client through the power-equal number in the relational database; if the server executes the business request of the client through the power-equal number in the relational database, the server acquires the unique key of the power-equal number; and rolling back the executed service request of the client by the server according to the unique key of the power equal number.
Optionally, the step of handling an abnormal event occurring in the execution process of the server according to the situation of the idempotent information stored in the idempotent frame further includes: after the server executes the service request of the client through the idempotent in the relational database, the idempotent frame synchronizes the idempotent to a cache; and setting a log clearing parameter of the idempotent frame, and deleting the idempotent log record in the relational database.
According to another aspect of the present invention, an idempotent problem processing apparatus is disclosed, in which a client carries idempotent information, and a server handles an abnormal event in a process of executing a service request of the client by the server according to the idempotent information of the client, the apparatus includes: the server comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring idempotent information carried by the client by the server, and the idempotent information comprises idempotent signs; the power idempotent analysis module is used for acquiring the power idempotent information condition stored in the power idempotent frame by the server according to the power idempotent information carried by the client acquired by the server; and the handling module is used for handling abnormal events which occur in the execution process of the server according to the situation of the idempotent information stored in the idempotent frame.
According to yet another aspect of the present invention, there is provided a computing device 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, the one or more programs including instructions for performing any of the idempotent problem processing methods described above.
According to yet another aspect of the invention, there is provided 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 of the above idempotent problem processing methods.
According to the power-idempotent problem processing scheme, power-idempotent information carried by a client is obtained through a server, and the power-idempotent information comprises power-idempotent signs; according to the idempotent information carried by the client side acquired by the server, the server acquires the idempotent information condition stored by the idempotent frame; and handling abnormal events which occur in the execution process of the server according to the situation of the idempotent information stored by the idempotent framework. The method and the device can prevent the server from being down when the server processes the service request of the client, can keep validity such as power, and can timely perform rollback processing when the server executes the service request of the client to be abnormal.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.
FIG. 1 shows a schematic diagram of an application scenario according to an embodiment of the invention; and
FIG. 2 shows a schematic block diagram of a computing device 100, according to an embodiment of the invention; and
FIG. 3 illustrates a flow diagram of a method 200 of reducing synchronization message data according to one embodiment of the invention; and
fig. 4 shows a schematic structural diagram of an apparatus 300 for reducing synchronization message data according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Fig. 1 is a schematic application scenario diagram of an embodiment of the present invention, and the idempotent problem processing method provided by the present application may be applied to the application environment shown in fig. 1. The idempotent problem processing method is applied to an idempotent problem processing device. The idempotent problem processing device is arranged in the server 010, or is partially arranged in the client 020 and is partially arranged in the server 010, and the client 020 and the server 010 interact with each other to complete the idempotent problem processing method.
The client 020 and the server 010 can communicate with each other through a network.
The client 020 can be but not limited to various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, idempotent information is carried by the client 020, the server 010 handles abnormal events in the process that the server 010 executes service requests of the client 020 according to the idempotent information of the client 020, and the server 010 can be realized by an independent server or a server cluster consisting of a plurality of servers.
The client 020 acquires idempotent information from an idempotent frame, the idempotent information comprises idempotent numbers, when the client 020 sends a related service request to the server 010, the client 020 sends the idempotent information at the same time, when the server 010 processes the service request of the client 020, the server 010 firstly judges whether the idempotent numbers exist, if so, the server 010 processes the abnormal event, and if not, the server 010 smoothly executes the service request of the client 020. After the idempotent number is transmitted to the interface implementer along with the request of the client 020, specifically, the interface implementer in this embodiment is an interface of a third-party service called by the server 010 for implementing the service request of the client 020, for example, when the client 020 makes a credit card arrearage through one bank account and another bank, the interface implementer at this time is an interface between the first bank and the server 010 and an interface between the second bank and the server 010, the interface implementer analyzes the idempotent number and transmits the analyzed idempotent number to the idempotent frame, the idempotent frame is used for searching whether the idempotent number exists in the cache, if the analyzed idempotent number exists, the interface implementer starts to execute the relevant service request sent by the client 020, at this time, the service request of the client 020 does not need to be executed repeatedly, if the idempotent number does not exist in the cache, the idempotent number needs to be stored in the relational database, and a unique key is set in a storage field of the idempotent number in the relational database, if the corresponding interface implementation party fails to process the service request of the client 020, the server 010 is informed of the abnormal information, the server 010 automatically rolls back to handle the abnormality, the service request of the client 020 is continuously executed until the relational database successfully stores the idempotent number, and after the server 010 successfully completes the service request of the client 020, the idempotent frame synchronizes the idempotent number into a cache.
Fig. 2 is a block diagram of an example computing device 100. In a basic configuration 102, computing device 100 typically includes system memory 106 and one or more processors 104. A memory bus 108 may be used for communication between the processor 104 and the system memory 106.
Depending on the desired configuration, the processor 104 may be any type of processing, including but not limited to: a microprocessor (μ P), a microcontroller (μ C), a Digital Signal Processor (DSP), or any combination thereof. The processor 104 may include one or more levels of cache, such as a level one cache 110 and a level two cache 112, a processor core 114, and registers 116. The example processor core 114 may include an Arithmetic Logic Unit (ALU), a Floating Point Unit (FPU), a digital signal processing core (DSP core), or any combination thereof. The example memory controller 118 may be used with the processor 104, or in some implementations the memory controller 118 may be an internal part of the processor 104.
Depending on the desired configuration, system memory 106 may 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. System memory 106 may include an operating system 120, one or more applications 122, and program data 124. In some embodiments, application 122 may be arranged to operate with program data 124 on an operating system. In some embodiments, the computing device 100 is configured to perform an idempotent problem processing method 200, where the method 200 can be carried by a client, and a server handles an abnormal event in a process of executing a service request of the client by the server according to the idempotent information of the client, and the program data 124 includes instructions for executing the method 200.
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. The example output device 142 includes a graphics processing unit 148 and an audio processing unit 150. They may 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 may be configured to facilitate communication with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 158. An example communication device 146 may include a network controller 160, which may be arranged to facilitate communications with one or more other computing devices 162 over a network communication link via one or more communication ports 164.
A network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media, such as carrier waves or other transport mechanisms, in a modulated data signal. A "modulated data signal" may be a signal that has one or more of its data set or its changes made in such a manner as to encode information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or private-wired network, and various wireless media such as acoustic, Radio Frequency (RF), microwave, Infrared (IR), or other wireless media. The term computer readable media as used herein may include both storage media and communication media. In some embodiments, one or more programs are stored in a computer-readable medium, the one or more programs including instructions for performing certain methods, such as the method 200 for idempotent problem processing by which the computing device 100 performs the method according to embodiments of the present invention.
Computing device 100 may be implemented as part of a small-form factor portable (or mobile) electronic device such as a cellular telephone, a Personal Digital Assistant (PDA), a personal media player device, a wireless web-watch device, a personal headset device, an application specific device, or a hybrid device that include any of the above functions. Computing device 100 may also be implemented as a personal computer including both desktop and notebook computer configurations.
Figure 3 illustrates a flow diagram of an idempotent problem processing method 200 according to one embodiment of the invention. As shown in fig. 2, in the method 200, a client carries idempotent information, a server handles an abnormal event in a process of executing a service request of the client according to the idempotent information of the client, the method 200 starts in step S210, and the server obtains the idempotent information carried by the client, where the idempotent information includes idempotent signs.
Specifically, the idempotent information carried by the client is acquired by the client from an idempotent tool, one idempotent tool generally comprises an idempotent generation management unit, a test unit, an idempotent protocol header unit, an idempotent operation interface unit, a high availability unit and a data consistency management unit, the idempotent tool has the functions of generating and managing the idempotent information, the client acquires the idempotent information from the idempotent tool, and the idempotent information comprises the idempotent.
Specifically, in an embodiment of the present application, the step of obtaining time information of a last login of a user to a server includes:
the server acquiring idempotent information carried by the client comprises the following steps:
a client acquires the idempotent request header information from an idempotent framework tool class; specifically, the client sends a request for obtaining the idempotent information to the idempotent framework tool class to obtain the idempotent request header information, the idempotent request header information is also the idempotent information, the idempotent request header information includes idempotent signs, and the idempotent signs are used for distinguishing different pieces of idempotent information obtained by different clients.
Acquiring idempotent request header information from an idempotent tool class according to the client, and sending an idempotent information request carried by the client to a server; specifically, when the client sends a service request to the server, in order to prevent abnormal problems from occurring and to deal with the abnormal problems in time and avoid the problem of service logic execution, the client simultaneously sends the acquired idempotent information to the server, and the server judges whether the service request of the client is processed according to whether the client carries the idempotent information.
The server judges whether the idempotent number of the idempotent information request exists or not;
if yes, the server processes the idempotent information request; specifically, if the idempotent sign exists, it indicates that the service request server sent by the client has not processed yet, and at this time, the server needs to process the idempotent information for the service request sent by the client first.
And if not, the server executes the service request of the client. Specifically, if the idempotent sign does not exist, it indicates that the server has completed executing the idempotent information carried by the client, and at this time, the service requested by the client may be processed.
Through step S220, according to the idempotent information carried by the client acquired by the server, the server acquires the idempotent information condition stored in the idempotent frame.
Specifically, for the idempotent information carried by the client, in the execution process of the server, the server needs to transmit the idempotent number to the corresponding interface implementation party according to the service request of the client, and the interface implementation party executes the service request of the corresponding client, for example, a panning user purchases a commodity from a panning store through a panning platform, at this time, the panning user simultaneously transmits the service request for purchasing the commodity and the information of the idempotent number to the panning server, and the panning server transmits the purchasing request for the panning user and the information of the idempotent number to the interface implementation party of the panning store according to the panning store selected by the user.
Specifically, in an embodiment of the present application, the step of, according to the idempotent information carried by the client acquired by the server, acquiring, by the server, the idempotent information condition stored in the idempotent frame includes:
according to the idempotent information carried by the client side, which is acquired by the server, the server transmits the idempotent information carried by the client side to an interface realizing side; specifically, the interface implementing party obtains the idempotent information carried by the client and also obtains the service request information of the client forwarded by the server to the interface implementing party.
According to the idempotent information carried by the client side and transmitted by the server, the interface realizing party analyzes the idempotent signs of the idempotent information;
according to the idempotent signs of the idempotent information analyzed by the interface realizing party, the interface realizing party transmits the idempotent signs to an idempotent frame;
and according to the idempotent information received by the idempotent frame, the server acquires the idempotent frame storage idempotent condition.
Specifically, after the interface implementation party analyzes the idempotent signs of the idempotent information, the interface implementation party judges whether the cache of the interface implementation party has the idempotent signs or not according to the analyzed idempotent signs, if the cache has the idempotent signs, the interface implementation party executes the interface implementation according to a scheme that the idempotent signs are stored in the cache, and if the cache does not have the idempotent signs, the interface implementation party stores the idempotent signs into a relational database and executes the interface implementation party according to the scheme that the idempotent signs are stored.
Specifically, in an embodiment of the present application, the obtaining, by the server, the case that the idempotent frame stores the idempotent includes:
according to the idempotent sign information received by the idempotent frame, the idempotent frame searches whether the idempotent sign already exists or not from a cache;
if the idempotent exists, sending the information that the idempotent exists to a server; specifically, the idempotent already exists in the cache, which indicates that the interface implementation party has already performed the execution of the service request of the client, or has completed the execution of the corresponding service request, and the idempotent is monitoring whether the service request executed by the interface implementation party is abnormal at this time, if so, the idempotent rolls back according to the corresponding scheme, and if so, the idempotent is processed according to the executed scheme.
If not, the power equivalent sign is stored in a relational database of the power framework. If the power-equal number does not exist in the cache, the service request sent by the client is not executed at the interface implementation party, and the interface implementation party needs to analyze the power-equal number, store the power-equal number in a relational database of the power-equal frame and execute the corresponding service request.
Specifically, in an embodiment of the present application, the step of storing the idempotent signs in the relational database of the idempotent frame includes:
acquiring a storage field of the power equal sign in the relational database;
setting a unique key for the storage field of the power-equal number in the relational database according to the storage field of the power-equal number in the relational database; specifically, if the server fails to execute the service request of the client, synchronization of the power-equal number in the cache may fail, and the server may not be rolled back after executing the exception, so as to achieve a correct execution result.
Storing the unique key and the power-idempotent into a relational database of the power-idempotent framework.
Through step S230, the abnormal event occurring during the execution of the server is handled according to the information of the idempotent sign stored in the idempotent frame.
Specifically, because the idempotent numbers in the idempotent frame have two forms, one is already in the cache, and the other is not in the cache, the idempotent numbers are stored in the relational database and synchronized into the cache after the business execution, for the idempotent numbers already in the cache, the business request of the client is executed by the server through an interface implementation party at the moment, the repeated execution of the business request is realized by calling through storing the idempotent numbers again, the idempotent numbers not in the cache need to be stored in the relational database firstly, and in order to prevent the cache synchronization failure, a field of the idempotent numbers stored in the relational database needs to be provided with a unique key, so that the client can roll back directly when the business request is executed abnormally.
Specifically, in an embodiment of the present application, the step of handling an abnormal event occurring in the execution process of the server according to the idempotent information stored in the idempotent framework includes:
if the power-equal number already exists in the cache, the server is executing the service request of the client;
if the power-equal number exists in the relational database, the server executes the service request of the client through the power-equal number in the relational database;
if the server executes the business request of the client through the power-equal number in the relational database, the server acquires the unique key of the power-equal number;
and rolling back the executed service request of the client by the server according to the unique key of the power equal number.
After the server executes the service request of the client through the idempotent in the relational database, the idempotent frame synchronizes the idempotent to a cache;
and setting a log clearing parameter of the idempotent frame, and deleting the idempotent log record in the relational database.
Specifically, in the process of service processing, the server can prevent a service system from being down and the power equal numbers from failing, in the application, records of the power equal numbers and execution of a service request of the client are put into one transaction, if the service request is successfully executed, the power equal numbers are inevitably recorded by a power equal frame, and if the service request is unsuccessfully executed, the power equal number records are automatically rolled back, so that the server executes the service request of the client again. In a relational database storing business data, a table is created to record power-equal numbers. The idempotent numbers are stored in a service database and then synchronized to the database of the idempotent framework.
In the embodiment of the application, when the idempotent framework is abnormal, normal recovery can be guaranteed, new business logic which cannot be executed can not be executed, because the idempotent function is temporarily failed and is repeatedly executed, errors can be caused to be executed on business requests, for example, the transfer is executed for multiple times, money is rotated for multiple times, and abnormal logic is executed on the idempotent framework
In order to make the idempotent framework as flexible as possible, make the business logic low-invasive, whether the abnormal occurrence allows the business logic to be retried and executed again, and the idempotent framework does not participate in the determination, the framework only needs to provide an interface for deleting the idempotent, and a business engineer determines whether to call the deleting interface and delete the recorded idempotent when the abnormal occurrence is encountered.
According to the power-idempotent problem processing scheme, power-idempotent information carried by a client is obtained through a server, and the power-idempotent information comprises power-idempotent signs; according to the idempotent information carried by the client side acquired by the server, the server acquires the idempotent information condition stored by the idempotent frame; and handling abnormal events which occur in the execution process of the server according to the situation of the idempotent information stored by the idempotent framework. The method and the device can prevent the server from being down when the server processes the service request of the client, can keep validity such as power, and can timely perform rollback processing when the server executes the service request of the client to be abnormal.
It should be understood that, although the steps in the flowchart of fig. 3 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in fig. 3 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 4, there is provided an idempotent issue processing apparatus 300, where the apparatus 300 carries idempotent information by a client, and a server handles an abnormal event in a process of executing a service request of the client according to the idempotent information of the client, and the apparatus 300 includes: the device comprises an acquisition module, an idempotent analysis module and a treatment module.
The server comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring idempotent information carried by the client by the server, and the idempotent information comprises idempotent signs;
the power-idempotent analysis module is used for acquiring the power-idempotent information condition stored in the power-idempotent frame by the server according to the power-idempotent information carried by the client acquired by the server;
and the handling module is used for handling abnormal events which occur in the execution process of the server according to the situation of the idempotent sign information stored in the idempotent frame.
Specifically, in another embodiment of the present application, the obtaining module is configured to obtain, by a client, an idempotent request header from an idempotent framework tool class; acquiring idempotent request header information from an idempotent tool class according to the client, and sending an idempotent information request carried by the client to a server; the server judges whether the idempotent number of the idempotent information request exists or not; if yes, the server processes the idempotent information request; and if not, the server executes the service request of the client.
Specifically, in another embodiment of the present application, the obtaining module is configured to, according to idempotent information carried by a client obtained by the server, transmit the idempotent information carried by the client to an interface implementing party by the server; according to the idempotent information carried by the client and transmitted by the server, the interface implementation party analyzes the idempotent sign of the idempotent information; according to the idempotent signs of the idempotent information analyzed by the interface realizing party, the interface realizing party transmits the idempotent signs to an idempotent frame; and according to the idempotent information received by the idempotent frame, the server acquires the idempotent frame storage idempotent condition.
Specifically, in another embodiment of the present application, the obtaining module is configured to, according to the information about the idempotent number received by the idempotent frame, find, by the idempotent frame, whether the idempotent number already exists in a cache; if the idempotent sign already exists, sending the idempotent sign already existing information to a server; if not, the power equivalent sign is stored in a relational database of the power framework.
Specifically, in another embodiment of the present application, the power-equivalent number analysis module is configured to obtain a storage field of the power-equivalent number in the relational database; setting a unique key for the storage field of the power-equal number in the relational database according to the storage field of the power-equal number in the relational database; storing the unique key and the power-idempotent into a relational database of the power-idempotent framework.
Specifically, in another embodiment of the present application, the handling module is configured to determine that the server is executing a service request of the client if the power-equal number already exists in the cache; if the idempotent number exists in the relational database, the server executes the service request of the client through the idempotent number in the relational database; if the server executes the business request of the client through the power-equal number in the relational database, the server acquires the unique key of the power-equal number; and rolling back the executed service request of the client by the server according to the unique key of the power equal number.
Specifically, in another embodiment of the present application, the handling module is configured to synchronize an idempotent frame to a cache after the server completes a service request of the client through the idempotent in the relational database; and setting a log clearing parameter of the idempotent frame, and deleting the idempotent log record in the relational database.
According to the power problem processing scheme, the server is used for acquiring power information carried by a client through an acquisition module, wherein the power information comprises power signs; the power equal sign analysis module is used for acquiring the power equal sign information condition stored in the power equal frame by the server according to the power equal sign information carried by the client acquired by the server; and the handling module is used for handling abnormal events which occur in the execution process of the server according to the situation of the idempotent sign information stored in the idempotent frame. The method and the device can prevent the server from being down when the server processes the service request of the client, can keep validity such as power, and can timely perform rollback processing when the server executes the service request of the client to be abnormal.
It should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, 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 this invention.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the device in this example. The modules in the foregoing examples may be combined into one module or may be further divided into multiple sub-modules.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
Furthermore, some of the described embodiments are described herein as a method or combination of method elements that can be performed by a processor of a computer system or by other means of performing the described functions. A processor having the necessary instructions for carrying out the method or method elements thus forms a means for carrying out the method or method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.
As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this description, will appreciate that other embodiments can be devised which do not depart from the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The present invention has been disclosed in an illustrative rather than a restrictive sense, and the scope of the present invention is defined by the appended claims.

Claims (10)

1. An idempotent problem processing method, the client carries idempotent information, and a server handles abnormal events in the process of executing business requests of the client according to the idempotent information of the client, the method comprises the following steps:
the server acquires idempotent information carried by the client, wherein the idempotent information comprises idempotent signs;
according to the idempotent information carried by the client side acquired by the server, the server acquires the idempotent information condition stored by the idempotent frame;
and handling abnormal events which occur in the execution process of the server according to the situation of the idempotent information stored by the idempotent framework.
2. The method of claim 1, wherein the step of the server obtaining idempotent information carried by the client comprises:
a client acquires the idempotent request header information from an idempotent framework tool class;
acquiring idempotent request header information from an idempotent tool class according to the client, and sending an idempotent information request carried by the client to a server;
the server judges whether the idempotent number of the idempotent information request exists or not;
if yes, the server processes the idempotent information request;
and if not, the server executes the service request of the client.
3. The method of claim 1, wherein the step of the server obtaining the idempotent information stored in the idempotent frame according to the idempotent information carried by the client obtained by the server comprises:
according to the idempotent information carried by the client side, which is acquired by the server, the server transmits the idempotent information carried by the client side to an interface realizing side;
according to the idempotent information carried by the client side and transmitted by the server, the interface realizing party analyzes the idempotent signs of the idempotent information;
according to the idempotent signs of the idempotent information analyzed by the interface realizing party, the interface realizing party transmits the idempotent signs to an idempotent frame;
and according to the idempotent information received by the idempotent frame, the server acquires the idempotent frame storage idempotent condition.
4. The method of claim 3, wherein the server obtaining the idempotent frame stores idempotent cases comprises:
according to the idempotent information received by the idempotent frame, the idempotent frame searches whether the idempotent exists from a cache;
if the idempotent exists, sending the information that the idempotent exists to a server;
if not, the power equivalent sign is stored in a relational database of the power framework.
5. The method of claim 4, wherein the storing the power sign in the relational database of the power frame comprises:
acquiring a storage field of the power equal sign in the relational database;
setting a unique key for the storage field of the power-equal number in the relational database according to the storage field of the power-equal number in the relational database;
storing the unique key and the power-idempotent into a relational database of the power-idempotent framework.
6. The method of claim 5, wherein the step of handling the abnormal events occurring in the execution process of the server according to the idempotent information condition stored by the idempotent framework comprises:
if the power equal number already exists in the cache, the server executing the service request of the client;
if the power-equal number exists in the relational database, the server executes the service request of the client through the power-equal number in the relational database;
if the server executes the business request of the client through the power-equal number in the relational database, the server acquires the unique key of the power-equal number;
and rolling back the executed service request of the client by the server according to the unique key of the power equal number.
7. The method of claim 6, wherein the step of handling the abnormal events occurring during the execution of the server according to the idempotent information stored by the idempotent framework further comprises:
after the server executes the service request of the client through the idempotent in the relational database, the idempotent frame synchronizes the idempotent to a cache;
and setting a log clearing parameter of the idempotent frame, and deleting the idempotent log record in the relational database.
8. An idempotent problem processing device, wherein a client carries idempotent information, and a server handles abnormal events in a process that the server executes a business request of the client according to the idempotent information of the client, the device comprises:
the server comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring idempotent information carried by the client by the server, and the idempotent information comprises idempotent signs;
the power-idempotent analysis module is used for acquiring the power-idempotent information condition stored in the power-idempotent frame by the server according to the power-idempotent information carried by the client acquired by the server;
and the handling module is used for handling abnormal events which occur in the execution process of the server according to the situation of the idempotent information stored in the idempotent frame.
9. An electronic device, 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, the one or more programs comprising instructions for performing any of the methods of claims 1-7.
10. 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 of the methods of claims 1-7.
CN202210398097.0A 2022-04-12 2022-04-12 Idempotent problem processing method, idempotent problem processing device, electronic equipment and storage medium Pending CN114968977A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210398097.0A CN114968977A (en) 2022-04-12 2022-04-12 Idempotent problem processing method, idempotent problem processing device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210398097.0A CN114968977A (en) 2022-04-12 2022-04-12 Idempotent problem processing method, idempotent problem processing device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114968977A true CN114968977A (en) 2022-08-30

Family

ID=82977269

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210398097.0A Pending CN114968977A (en) 2022-04-12 2022-04-12 Idempotent problem processing method, idempotent problem processing device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114968977A (en)

Similar Documents

Publication Publication Date Title
EP3629272B1 (en) Method and device for running chaincode
TWI706665B (en) Blockchain-based data checking system, method, computing equipment and storage media
CN112380227B (en) Data synchronization method, device, equipment and storage medium based on message queue
CN110196759B (en) Distributed transaction processing method and device, storage medium and electronic device
US20110276821A1 (en) Method and system for migrating data from multiple sources
CN111526181B (en) Data request processing method and system and computing device
CN113568716A (en) Transaction processing method and device, electronic equipment and storage medium
CN111338834B (en) Data storage method and device
CN116166390A (en) Service processing method and device, electronic equipment and storage medium
CN112835885A (en) Processing method, device and system for distributed table storage
CN107249019A (en) Data handling system, method, device and server based on business
CN111125168B (en) Data processing method and device, electronic equipment and storage medium
CN110955719A (en) Data access processing equipment, system and method
WO2023207529A1 (en) Data processing method and apparatus, device, medium, and product
CN114968977A (en) Idempotent problem processing method, idempotent problem processing device, electronic equipment and storage medium
CN113051008A (en) Interface request processing method and device, computer equipment and storage medium
US8285775B2 (en) Expedited transaction failure handling by leveraging a reliable message transport protocol to assist detection of discarded processing
CN110765144B (en) Distributed heterogeneous database data processing method and device
CN109740027B (en) Data exchange method, device, server and storage medium
CN113592645A (en) Data verification method and device
CN107704557B (en) Processing method and device for operating mutually exclusive data, computer equipment and storage medium
CN111639936A (en) Transaction information acquisition method and device, electronic equipment and readable storage medium
CN110764933A (en) Message processing method, device and system and computing equipment
CN117891794A (en) Log generation method and device, terminal equipment and storage medium
WO2019056736A1 (en) Breakpoint data acquisition method and apparatus, terminal device and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination