CN108647105B - Idempotent control method, device and system in system switching process - Google Patents

Idempotent control method, device and system in system switching process Download PDF

Info

Publication number
CN108647105B
CN108647105B CN201810497483.9A CN201810497483A CN108647105B CN 108647105 B CN108647105 B CN 108647105B CN 201810497483 A CN201810497483 A CN 201810497483A CN 108647105 B CN108647105 B CN 108647105B
Authority
CN
China
Prior art keywords
idempotent
service
business
single number
control record
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.)
Active
Application number
CN201810497483.9A
Other languages
Chinese (zh)
Other versions
CN108647105A (en
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.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Advanced New Technologies 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 Advanced New Technologies Co Ltd filed Critical Advanced New Technologies Co Ltd
Priority to CN201810497483.9A priority Critical patent/CN108647105B/en
Publication of CN108647105A publication Critical patent/CN108647105A/en
Application granted granted Critical
Publication of CN108647105B publication Critical patent/CN108647105B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/544Remote

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Hardware Redundancy (AREA)

Abstract

The embodiment of the specification provides a method, a device and a system for controlling power in a system switching process, wherein in the system switching process, whether a service is accepted by an opposite system is determined by calling power verification service of the opposite system, so that the situation that different systems repeatedly accept the same service is avoided, and the global power among the systems in the system switching process is ensured.

Description

Idempotent control method, device and system in system switching process
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to an idempotent control method, apparatus, and system in a system handover process.
Background
In a distributed system, different application systems are responsible for different functions, one business function needs to be realized by calling services among a plurality of systems, and an upstream system and a downstream system with a direct calling relation need to ensure the idempotent of service calling. The application system is often lifecycle, when the cost for building an application system is lower than the cost for continuously upgrading the old system and the future value is larger, the enterprise often chooses to build a system to replace the old system, and switches the service function accepted by the old system to a new system for acceptance, which is called system switching.
Disclosure of Invention
In order to overcome the problems in the related art, embodiments of the present specification provide an idempotent control method, apparatus, and system in a system handover process.
According to a first aspect of embodiments herein, there is provided an idempotent control method in a system handover process, the method including: in the system switching process, sending a calling request for idempotent verification to a second system, wherein the calling request carries a service single number; and determining whether to accept the service corresponding to the service single number according to the idempotent verification result of the second system, wherein the idempotent verification result of the second system is used for representing whether the service single number is successfully inserted into the idempotent control record of the second system.
Further, determining whether to accept the service corresponding to the service single number according to the idempotent verification result of the second system comprises at least any one of the following steps: when the idempotent check result of the second system represents that the service single number is successfully inserted into the idempotent control record of the second system, the service corresponding to the service single number is accepted; or when the idempotent check result of the second system represents that the business single number is inserted into the idempotent control record of the second system unsuccessfully, if the business bill corresponding to the business single number is not found in the second system, the business corresponding to the business single number is accepted; or when the idempotent check result of the second system represents that the business single number is inserted into the idempotent control record of the second system unsuccessfully, if the business bill corresponding to the business single number is found in the second system, the upstream business system is informed that the business corresponding to the business single number is successfully accepted.
Further, the step of accepting the service corresponding to the service ticket number includes: performing local idempotent verification according to the service single number; and determining whether to accept the service corresponding to the service single number according to a local idempotent check result, wherein the local idempotent check result is used for representing whether the service single number is successfully inserted into a local idempotent control record.
Further, determining whether to accept the service corresponding to the service single number according to a local idempotent check result includes at least any one of the following steps: when the local idempotent check result represents that the service single number is successfully inserted into the local idempotent control record, the service corresponding to the service single number is accepted; or when the local idempotent check result represents that the business single number is inserted into the local idempotent control record unsuccessfully, after the business acceptance corresponding to the business single number is completed, the business system is informed that the business acceptance corresponding to the business single number is successful.
Further, before sending the idempotent call request to the second system, the method further includes: receiving a service request sent by an upstream service system; and responding to the service request to generate a service order number.
According to a second aspect of embodiments herein, there is provided an idempotent control method in a system handover process, the method comprising: receiving a calling request of idempotent verification sent by a first system in the system switching process, wherein the calling request carries a service single number; executing local idempotent verification according to the service single number, and sending an idempotent verification result to the first system so that the first system determines whether to accept the service corresponding to the service single number according to the idempotent verification result; and the local idempotent verification result is used for representing whether the service single number is successfully inserted into the local idempotent control record.
Further, sending the idempotent verification result to the first system includes at least any one of: when the business single sign is successfully inserted into the local idempotent control record, sending a first idempotent verification result representing that the business single sign is successfully inserted into the local idempotent control record to a first system; or when the business order number fails to be inserted into the local idempotent control record, if the business bill corresponding to the business order number is not found locally, sending the first idempotent verification result to a first system; or when the business single number fails to be inserted into the local idempotent control record, if the business bill corresponding to the business single number is found locally, a second idempotent verification result representing the failure of the business single number to be inserted into the local idempotent control record is sent to the first system.
Further, the first idempotent verification result is used for the first system to accept the service corresponding to the service single number, and the second idempotent verification result is used for the first system to notify the upstream service system that the service acceptance corresponding to the service single number is successful after the service acceptance corresponding to the service single number is completed.
According to a third aspect of embodiments herein, there is provided an idempotent control apparatus in a system handover process, the apparatus comprising: the first sending module is used for sending a calling request for idempotent verification to a second system in the system switching process, wherein the calling request carries a service single number; and the service acceptance module is used for determining whether to accept the service corresponding to the service single number according to the idempotent verification result of the second system, wherein the idempotent verification result of the second system is used for representing whether the service single number is successfully inserted into the idempotent control record of the second system.
Further, the service acceptance module is configured to perform any one of the following steps: when the idempotent check result of the second system represents that the service single number is successfully inserted into the idempotent control record of the second system, the service corresponding to the service single number is accepted; or when the idempotent check result of the second system represents that the business single number is inserted into the idempotent control record of the second system unsuccessfully, if the business bill corresponding to the business single number is not found in the second system, the business corresponding to the business single number is accepted; or when the idempotent check result of the second system represents that the business single number is inserted into the idempotent control record of the second system unsuccessfully, if the business bill corresponding to the business single number is found in the second system, the upstream business system is informed that the business corresponding to the business single number is successfully accepted.
Further, the service acceptance module is configured to: performing local idempotent verification according to the service single number; and determining whether to accept the service corresponding to the service single number according to a local idempotent check result, wherein the local idempotent check result is used for representing whether the service single number is successfully inserted into a local idempotent control record.
Further, the service acceptance module is configured to perform at least any one of the following steps: when the local idempotent check result represents that the service single number is successfully inserted into the local idempotent control record, the service corresponding to the service single number is accepted; or when the local idempotent check result represents that the business single number is inserted into the local idempotent control record unsuccessfully, after the business acceptance corresponding to the business single number is completed, the business system is informed that the business acceptance corresponding to the business single number is successful.
Further, the apparatus further comprises: the second receiving module is used for receiving the service request sent by the upstream service system; and the generating module is used for responding to the service request to generate a service order number.
According to a fourth aspect of embodiments herein, there is provided an idempotent control apparatus in a system handover process, the apparatus comprising: the first receiving module is used for receiving a calling request of idempotent verification sent by a first system in the system switching process, wherein the calling request carries a service single number; the second sending module is used for executing local idempotent verification according to the business single number and sending an idempotent verification result to the first system so that the first system can determine whether to accept the business corresponding to the business single number according to the idempotent verification result; and the local idempotent verification result is used for representing whether the service single number is successfully inserted into the local idempotent control record.
Further, the second sending module is configured to perform at least any one of the following steps: when the business single sign is successfully inserted into the local idempotent control record, sending a first idempotent verification result representing that the business single sign is successfully inserted into the local idempotent control record to a first system; or when the business order number fails to be inserted into the local idempotent control record, if the business bill corresponding to the business order number is not found locally, sending the first idempotent verification result to a first system; or when the business single number fails to be inserted into the local idempotent control record, if the business bill corresponding to the business single number is found locally, a second idempotent verification result representing the failure of the business single number to be inserted into the local idempotent control record is sent to the first system.
Further, the first idempotent verification result is used for the first system to accept the service corresponding to the service single number, and the second idempotent verification result is used for the first system to notify the upstream service system that the service acceptance corresponding to the service single number is successful after the service acceptance corresponding to the service single number is completed.
According to a fifth aspect of embodiments herein, there is provided an idempotent control system in a system handover process, the system comprising: the system comprises a first system, a second system and an upstream service system; the first system is used for sending a calling request of idempotent verification to a second system if receiving a service request sent by an upstream service system in the process of system switching, wherein the calling request carries a service single number; determining whether to accept the service corresponding to the service single number according to the idempotent check result; the second system is used for executing the idempotent verification and sending the idempotent verification result to the first system; and the result of the idempotent check is used for representing whether the business single number is successfully inserted into the idempotent control record of the second system or not.
Further, the upstream service system further includes: and the change-over switch is used for controlling the service request to be sent to the first system or the second system.
Further, the switch is further configured to: and sending the service request corresponding to the service in the pre-stored white list to the first system, and sending the service request corresponding to the service except the white list to the second system.
According to a sixth aspect of embodiments herein, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of any of the above embodiments.
According to a seventh aspect of embodiments herein, there is provided a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any of the above embodiments when executing the program.
By applying the scheme of the embodiment of the specification, in the system switching process, whether the service is accepted by the opposite system is determined by calling the idempotent verification service of the opposite system, so that the situation that different systems repeatedly accept the same service is avoided, and the global idempotent between the systems in the system switching process is ensured.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the specification.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present specification and together with the description, serve to explain the principles of the specification.
FIG. 1 is a timing diagram for an idempotent failure of one embodiment.
Fig. 2 is a flowchart of an idempotent control method in a system handover process according to an embodiment of the present disclosure.
Fig. 3 is a timing chart of idempotent control in the first embodiment of this specification.
Fig. 4 is a timing chart of idempotent control in the second embodiment of the present specification.
Fig. 5 is a timing chart of idempotent control in the third embodiment of the present specification.
Fig. 6 is a flowchart of an idempotent control method in a system handover process according to another embodiment of the present disclosure.
Fig. 7 is a general flow diagram of an idempotent control method according to one embodiment of the present disclosure.
Fig. 8 is a schematic structural diagram of an idempotent control apparatus in a system handover process according to an embodiment of the present specification.
Fig. 9 is a schematic structural diagram of an idempotent control apparatus in a system handover process according to another embodiment of the present specification.
Fig. 10 is a block diagram of a computer device in which an idempotent control apparatus is located in a system switching process in the embodiment of the present specification.
Fig. 11 is a schematic structural diagram of an idempotent control system in a system handover process according to an embodiment of the present disclosure.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the specification, as detailed in the appended claims.
The terminology used in the description herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the description. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, the first information may also be referred to as second information, and similarly, the second information may also be referred to as first information, without departing from the scope of the present specification. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
In a distributed system, an upstream system and a downstream system with a direct calling relation need to ensure the idempotency of service calling. In an application system, the idempotent operation is characterized in that the influence generated by any multiple times of execution is the same as the influence generated by one time of execution, and in a distributed system, the effect of one time of interaction and the effect of multiple times of interaction of the same request parameter are the same between systems. The above characteristic is called idempotent.
It is important to maintain idempotency in the system. One case of non-compliance with the idempotent requirement is shown in figure 1. In step 102, the upstream business system sends a business request to the business acceptance system. In step 104, the service acceptance system accepts the request. In step 106, the service acceptance system transmits an acceptance success message to the upstream service system, but the message is not successfully transmitted. In step 108, the upstream service system retransmits the service request to the service acceptance system. In step 110, the service acceptance system re-accepts the request. In step 112, the service acceptance system returns an acceptance success message to the upstream service system. This results in the same transaction being accepted twice.
Taking a payment service as an example, when an upstream service system initiates a payment request to a service acceptance system, the service acceptance system accepts a payment operation according to the request, so that assets are deducted from an account of a user, and if the deduction is successful, the balance of the account is reduced by a corresponding value; if the deduction fails, the account balance is unchanged, and meanwhile, the service acceptance system can return prompt information of payment failure to the upstream service system. Typically, the payment request is correctly processed by the service acceptance system, but the processing result returned by the service acceptance system cannot be returned to the upstream service system due to a network or the like. At this time, the upstream service system may send the payment request to the service acceptance system again by means of refreshing the operation interface, and the service acceptance system performs the operation of deducting the account asset again. This results in the same service being accepted twice, resulting in a loss of user assets.
The system switching refers to a process of replacing a first system (i.e., an old system) with a second system (i.e., a new system) and switching a service accepted on the old system to a service accepted on the new system. Sometimes, after the old system is switched to the new system, the new system is unstable or abnormal, and in order to avoid affecting the service, the new system may be switched back to the old system again, and the old system is switched to after the new system is stable. In the process of switching between the new system and the old system, if a service is successfully accepted by the new system, but the old system fails to know that the new system is successfully accepted, the old system may repeatedly accept the service, and if the old system also successfully accepts the service, the old system may violate the idempotent requirement.
In view of the above problem, the present specification provides an idempotent control method in a system handover process, as shown in fig. 2, where the method may include the following steps 202 and 204:
step 202: in the system switching process, sending a calling request for idempotent verification to a second system, wherein the calling request carries a service single number;
step 204: and determining whether to accept the service corresponding to the service single number according to the idempotent verification result of the second system, wherein the idempotent verification result of the second system is used for representing whether the service single number is successfully inserted into the idempotent control record of the second system.
According to the scheme of the embodiment of the specification, when the first system accepts a service, the idempotent judgment service of the second system is called first, and whether the service is accepted in the second system is judged through the idempotent judgment service, so that whether the first system accepts the service is determined, the first system and the second system repeatedly accept the same service is avoided, and the global idempotent between the systems in the system switching process is guaranteed.
Generally, the following procedures can be included in the service acceptance process: the upstream service system sends a service request to a service acceptance system for accepting the service, wherein the service request carries a service single number and is used for uniquely determining a service. The service acceptance system accepts a service after receiving a service request, and adds information that the service has been accepted to an idempotent control record in a database, the idempotent control record being used for recording whether the service is accepted or not. After the acceptance is successful, generating a business document according to the business document number, and submitting the business document to a database; meanwhile, the service acceptance system can also return a service acceptance success message to the upstream service system, so as to inform the upstream service system that the service has been accepted successfully.
In step 202, the idempotent check is used to check whether the system has accepted the service corresponding to the service ticket number. Since the service may be accepted by the second system, the second system needs to provide an idempotent verification service, and the first system can know whether the second system has accepted the corresponding service by calling the idempotent verification service of the second system. The calling request for calling the second system idempotent verification service can carry a business single number, and after the second system receives the calling request, the second system can extract the business single number and execute idempotent verification according to the business single number.
In step 204, whether the second system has accepted the corresponding service is determined by inserting the service ticket number into the idempotent control record of the second system. The reason why the insertion mode is adopted is that whether the business document corresponding to the business document number exists in the idempotent control record is not directly inquired is that in some cases, the second system has another thread which accepts the business but does not accept the business and is not submitted because the business is not accepted yet, and the other threads cannot inquire the business document, so that the business document cannot be explained to be not accepted in the new system even if the business document does not exist in the idempotent control record. Therefore, the embodiment of the present specification can more accurately determine whether the service has been accepted or not by inserting, and reduce the probability of erroneous determination.
After inserting the service ticket number into the idempotent control record of the second system, any one of the following three situations may occur:
the first condition is as follows:
the insertion of the service ticket number into the idempotent control record of the second system is successful. If the insertion is successful, the second system does not perform the insertion operation before, and the current insertion is the first insertion. That is, the second system has not accepted the service. Therefore, the first system should accept the service corresponding to the service ticket number. After the service acceptance is successful, the first system can also notify the upstream service system that the service acceptance corresponding to the service ticket number is successful.
Case two:
the insertion of the business order number into the idempotent control record of the second system fails, but the business bill corresponding to the business order number is not found in the second system. This case illustrates that the first system has called the idempotent determination service of the second system before, and the insertion of the idempotent control record is successful, but the subsequent acceptance process of the second system is abnormal, and the acceptance is not successful, and the upstream business system retries, and after the retry, the first system calls the idempotent determination service of the new system again. At this time, the first system should accept the service corresponding to the service ticket number. After the service acceptance is successful, the first system can also notify the upstream service system that the service acceptance corresponding to the service ticket number is successful.
Case three:
the insertion of the business order number into the idempotent control record of the second system fails, and the business bill corresponding to the business order number is found in the second system. This situation indicates that the service has been accepted successfully at the second system and that the first system does not need to continue accepting. Therefore, the first system can directly inform the upstream service system that the service corresponding to the service order number is successfully accepted.
In one embodiment, when the first system accepts a service, the first system may first invoke a local idempotent check service to query whether the service has already been accepted locally, and accept a corresponding service only when the service has not been accepted locally, so as to avoid repeated acceptance of the service locally. Specifically, the step of accepting the service corresponding to the service ticket number includes: performing local idempotent verification according to the service single number; and determining whether to accept the service corresponding to the service single number according to a local idempotent check result, wherein the local idempotent check result is used for representing whether the service single number is successfully inserted into a local idempotent control record.
After inserting the service ticket number into the local idempotent control record, either of the following two situations may occur:
the first condition is as follows:
the service single number is inserted into the local idempotent control record successfully. This situation illustrates that the service corresponding to the service ticket number has not been accepted locally, and therefore the first system should accept the service. After the service acceptance is successful, the first system can also notify the upstream service system that the service acceptance corresponding to the service ticket number is successful.
Case two:
the insertion of the service ticket number into the local idempotent control record fails. This situation indicates that the service corresponding to the service ticket number is accepted locally, and therefore, the first system does not need to continue accepting any more, and the first system can directly notify the upstream service system that the service corresponding to the service ticket number is accepted successfully.
In one embodiment, if the service ticket number is successfully inserted into the idempotent control record of the second system, the second system may return an idempotent check success message to the first system to notify the first system of accepting the service. If the service single number fails to be inserted into the idempotent control record of the second system, the second system can return an idempotent check failure message to the first system to inform the first system that the first system does not need to accept the service.
In one embodiment, if the first system or the second system has successfully accepted the service, the first system may return an "idempotent retransmit" result code to the upstream service system for notifying the upstream service system that the service was successfully accepted.
The corresponding control timing diagrams are shown in fig. 3 to 5. The embodiment shown in fig. 3 comprises the following steps:
step 302: the upstream traffic system sends a traffic request to the first system.
Step 304: the first system invokes an idempotent verification service of the second system.
Step 306: the second system inserts the service ticket number into the idempotent control record of the second system.
Step 308: and if the insertion is successful or if the insertion is failed and the service bill corresponding to the service bill number is not found in the second system, the second system sends an idempotent verification success message to the first system.
Step 310: the first system performs a local idempotent check.
Step 312: the first system successfully inserts the service single number into the local idempotent control record, and the first system accepts the service.
Step 314: after the first system receives successfully, the result code of 'idempotent retransmission' is returned to the upstream service system.
The embodiment shown in fig. 4 comprises the following steps:
step 402: the upstream traffic system sends a traffic request to the first system.
Step 404: the first system invokes an idempotent verification service of the second system.
Step 406: the second system inserts the service ticket number into the idempotent control record of the second system.
Step 408: and if the insertion is successful or if the insertion is failed and the service bill corresponding to the service bill number is not found in the second system, the second system sends an idempotent verification success message to the first system.
Step 410: the first system performs a local idempotent check.
Step 412: the first system fails to insert the service single sign into the local idempotent control record, and returns the result code of 'idempotent retransmission' to the upstream service system.
The embodiment shown in fig. 5 comprises the following steps:
step 502: the upstream traffic system sends a traffic request to the first system.
Step 504: the first system invokes an idempotent verification service of the second system.
Step 506: the second system inserts the service ticket number into the idempotent control record of the second system.
Step 508: if the insertion fails, and the second system finds the service bill corresponding to the service bill number, the second system sends an idempotent check failure message to the first system.
Step 510: the first system returns an idempotent retransmit result code to the upstream traffic system.
The embodiment of the present specification further provides an idempotent control method in a system handover process, as shown in fig. 6, the method may include the following steps 602 and 604:
step 602: receiving a calling request of idempotent verification sent by a first system in the system switching process, wherein the calling request carries a service single number;
step 604: executing local idempotent verification according to the service single number, and sending an idempotent verification result to the first system so that the first system determines whether to accept the service corresponding to the service single number according to the idempotent verification result; and the local idempotent verification result is used for representing whether the service single number is successfully inserted into the local idempotent control record.
The second system in the embodiment of the present specification can provide an idempotent determination service for the first system receiving the service request to call, so that the first system knows whether the second system has accepted the service, thereby avoiding that the first system repeatedly accepts the same service, and ensuring global idempotent between systems in the system switching process.
After receiving the call request, the second system may extract the service number therein, and perform an idempotent check according to the service number. In step 604, whether the second system has accepted the corresponding service is determined by inserting the service ticket number into the idempotent control record of the second system. Whether the service is accepted or not can be judged more accurately by the insertion mode, and the misjudgment probability is reduced.
After inserting the service ticket number into the idempotent control record of the second system, any one of the following three situations may occur:
the first condition is as follows:
the insertion of the service ticket number into the idempotent control record of the second system is successful. If the insertion is successful, the second system does not perform the insertion operation before, and the current insertion is the first insertion. That is, the second system has not accepted the service. Therefore, the second system can send a first idempotent check result indicating that the service single sign is inserted into the local idempotent control record successfully to the first system, so that the first system accepts the service.
Case two:
the insertion of the business order number into the idempotent control record of the second system fails, but the business bill corresponding to the business order number is not found in the second system. This case illustrates that the first system has called the idempotent determination service of the second system before, and the insertion of the idempotent control record is successful, but the subsequent acceptance process of the second system is abnormal, and the acceptance is not successful, and the upstream business system retries, and after the retry, the first system calls the idempotent determination service of the new system again. At this time, the second system may send a first idempotent check result indicating that the service single sign is successfully inserted into the local idempotent control record to the first system, so that the first system accepts the service.
Case three:
the insertion of the business order number into the idempotent control record of the second system fails, and the business bill corresponding to the business order number is found in the second system. This situation indicates that the service has been accepted successfully at the second system and that the first system does not need to continue accepting. Therefore, the second system can send a second idempotent check result representing that the service single sign is inserted into the local idempotent control record failure to the first system so as to inform the first system that the service does not need to be accepted. In addition, after receiving the second idempotent verification result, the first system can also notify the upstream service system that the service corresponding to the service single number is successfully accepted.
Fig. 7 is a general flowchart of an idempotent control method according to an embodiment of the present disclosure.
In step 702, a service request is received at a first system.
In step 704, the first system invokes a new system idempotent determination service.
In step 706, the second system receives an idempotent determination request.
In step 708, the second system attempts to insert an idempotent control record, and if the insertion is successful, step 710 is performed; if the insertion fails, step 716 is performed.
In step 710, the second system returns an idempotent verification success message to the first system.
In step 712, the first system performs a local idempotent determination. If the insertion of the idempotent control record is successful, step 714 is performed, and if the insertion fails, step 722 is performed.
Step 714: the first system accepts the service.
Step 716: the second system judges whether the business acceptance document exists, if not, step 718 is executed; if so, step 720 is performed.
Step 718: the second system returns an idempotent verification success message to the first system and performs step 712.
Step 720: the second system returns an idempotent check failure message to the first system and performs step 722.
Step 722: the first system no longer accepts the service and proceeds to step 724.
Step 724: the first system returns a successful acceptance message to the upstream service system.
Corresponding to the embodiment of the idempotent control method in the system switching process, the embodiment of the specification also provides embodiments of an idempotent control device, a computing storage medium and a computer device in the system switching process.
As shown in fig. 8, fig. 8 is a block diagram of an idempotent control apparatus 800 in a system handover process according to an exemplary embodiment, the apparatus comprising:
a first sending module 802, configured to send a call request for idempotent verification to a second system in a system switching process, where the call request carries a service number;
and the service acceptance module 804 is configured to determine whether to accept the service corresponding to the service single number according to an idempotent check result of the second system, where the idempotent check result of the second system is used to represent whether the service single number is successfully inserted into the idempotent control record of the second system.
The specific details of the implementation process of the functions and actions of each module in the apparatus are the implementation process of the steps executed by the corresponding first system in the method, and are not described herein again.
As shown in fig. 9, fig. 9 is a block diagram of an idempotent control apparatus 900 in a system handover process shown in the present specification according to another exemplary embodiment, the apparatus includes:
a first receiving module 902, configured to receive a call request for idempotent verification sent by a first system in a system switching process, where the call request carries a service number;
a second sending module 904, configured to perform local idempotent verification according to the service single number, and send an idempotent verification result to the first system, so that the first system determines whether to accept a service corresponding to the service single number according to the idempotent verification result; and the local idempotent verification result is used for representing whether the service single number is successfully inserted into the local idempotent control record.
The specific details of the implementation process of the function and the action of each module in the apparatus are the implementation process of the step executed by the corresponding second system in the method, and are not described herein again.
The idempotent control device in the system switching process can be applied to computer equipment, such as a server or terminal equipment. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. The software implementation is taken as an example, and as a logical device, the device is formed by reading corresponding computer program instructions in the nonvolatile memory into the memory for operation through the processor in which the file processing is located. From a hardware level, as shown in fig. 10, it is a hardware structure diagram of a computer device in which an idempotent control apparatus is located in a system switching process in this specification, except for the processor 1002, the memory 1004, the network interface 1006, and the nonvolatile memory 1008 shown in fig. 10, a server or an electronic device in which the apparatus is located in an embodiment may also include other hardware according to an actual function of the computer device, and details thereof are not described again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, wherein the modules described as separate parts may or may not be physically separate, and the parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution in the specification. One of ordinary skill in the art can understand and implement it without inventive effort.
As shown in fig. 11, fig. 11 is a block diagram of an idempotent control system during system handover shown in the present specification according to another exemplary embodiment, the system including:
an upstream business system 1102, a first system 1104, and a second system 1106;
the first system 1104 is configured to send a call request for idempotent verification to the second system 1106 if a service request sent by the upstream service system 1102 is received in a system switching process, where the call request carries a service single number; determining whether to accept the service corresponding to the service single number according to the idempotent check result;
the second system 1106 is configured to perform an idempotent check and send the idempotent check result to the first system 1104; wherein the idempotent check result is used to characterize whether the service ticket number is successfully inserted into the idempotent control record of the second system 1106.
In one embodiment, the upstream traffic system 1102 further includes a switch 1108 for controlling the transmission of the traffic request to the first system 1104 or the second system 1106. By setting the switch 1108, the upstream traffic system 1102 can control the reception of traffic by the first system 1104 or the second system 1106. Further, a white list may be set, and the switch 1108 may send the service request corresponding to the service in the pre-stored white list to the first system 1104, and send the service request corresponding to the service outside the white list to the second system 1106. In the system switching process, a part (for example, 1%) of the services may be switched to the second system to be accepted, and therefore, the 1% of the services may be added to the white list first, and after the second system is stabilized, other services may be gradually switched to the second system to be accepted. By the method, the influence on the service in the system switching process can be reduced. Even if the second system fails to accept, only the 1% of the traffic will be affected at most.
In one embodiment, the upstream business system may assemble the business request into a request object and send an RPC request (Remote Procedure Call) to the first system 1104. After receiving the service request, the first system may also perform parameter verification, such as non-null verification and validity verification, on parameters in the service request, so as to ensure smooth execution of the service.
The functions performed by the first system 1104 and the second system 1106 in this embodiment are the same as the functions performed by the first system and the functions performed by the second system in the above method embodiments, respectively, and are not described again here.
The above embodiment can be used in the process of determining the idempotent of switching from the second system to the first system, the steps of determining the idempotent of switching from the first system to the second system are similar, and the idempotent determination of the second system can be executed first in the determination process, and then the service of determining the idempotent of the first system is called, so that the insertion sequence of the control records of the idempotent of the second system and the first system is consistent no matter which switching situation is adopted.
In the embodiment of the description, the first system and the second system provide the form of the idempotent judgment service for the system call of the other side, and in the implementation of the idempotent judgment service, the mode of inserting the idempotent control record to make the idempotent judgment is adopted, so that the error of the idempotent judgment caused by other concurrent threads accepting the business document is avoided, and the strict idempotent can be ensured in the high-concurrency real-time call system. In addition, the upstream service system does not need to do special idempotent processing, can switch between the first system and the second system at any time, and the whole scheme has low implementation cost and no intrusion to the upstream service system.
The scheme of the embodiment of the specification has certain universality, and for the same service system, two systems at the downstream can bear the scene of the service request of the upstream service system, and the scheme can be used for ensuring the global idempotency.
Accordingly, the embodiments of the present specification further provide a computer storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the idempotent control method in the system switching process in any of the above embodiments.
Accordingly, the embodiments of the present specification further provide a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the program, the idempotent control method in the system switching process in any of the above embodiments is implemented.
This application may take the form of a computer program product embodied on one or more storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having program code embodied therein. Computer-usable storage media include permanent and non-permanent, removable and non-removable media, and information storage may be implemented by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of the storage medium of the computer include, but are not limited to: phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technologies, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic tape storage or other magnetic storage devices, or any other non-transmission medium, may be used to store information that may be accessed by a computing device.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
The above description is only exemplary of the present disclosure and should not be taken as limiting the disclosure, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present disclosure should be included in the scope of the present disclosure.

Claims (14)

1. An idempotent control method in a system switching process is suitable for a first system, and comprises the following steps:
sending a calling request for idempotent verification to a second system in the switching process between a first system and the second system, wherein the calling request carries a service single number so that the second system executes local idempotent verification based on the service single number;
receiving an idempotent verification result of a second system, and when the idempotent verification result of the second system represents that the service single number is successfully inserted into the idempotent control record of the second system, the first system accepts the service corresponding to the service single number; or
When the idempotent check result of the second system represents that the business single number is inserted into the idempotent control record of the second system unsuccessfully, if the business bill corresponding to the business single number is not found in the second system, the first system accepts the business corresponding to the business single number; or
When the idempotent check result of the second system represents that the business single number is inserted into the idempotent control record of the second system unsuccessfully, if the business bill corresponding to the business single number is found in the second system, the first system informs an upstream business system that the business corresponding to the business single number is successfully accepted.
2. The method of claim 1, wherein the step of the first system accepting the service corresponding to the service ticket number comprises:
performing local idempotent verification according to the service single number;
and determining whether to accept the service corresponding to the service single number according to a local idempotent check result, wherein the local idempotent check result is used for representing whether the service single number is successfully inserted into a local idempotent control record.
3. The method according to claim 2, wherein determining whether to accept the service corresponding to the service ticket number according to the local idempotent check result comprises at least one of the following steps:
when the local idempotent check result represents that the service single number is successfully inserted into the local idempotent control record, the service corresponding to the service single number is accepted; or
And when the local idempotent check result represents that the business single number is inserted into the local idempotent control record unsuccessfully, after the business acceptance corresponding to the business single number is completed, a business system is informed that the business acceptance corresponding to the business single number is successful.
4. The method of claim 1, prior to sending the idempotent call request to the second system, further comprising:
receiving a service request sent by an upstream service system;
and responding to the service request to generate a service order number.
5. An idempotent control method in a system switching process is suitable for a second system, and comprises the following steps:
receiving a calling request of idempotent verification sent by a first system in the switching process between the first system and a second system, wherein the calling request carries a service single number;
and executing local idempotent verification according to the service single sign, and sending an idempotent verification result to the first system so that the first system executes the following steps:
when the idempotent check result of the second system represents that the service single number is successfully inserted into the idempotent control record of the second system, the first system accepts the service corresponding to the service single number; or
When the idempotent check result of the second system represents that the business single number is inserted into the idempotent control record of the second system unsuccessfully, if the business bill corresponding to the business single number is not found in the second system, the first system accepts the business corresponding to the business single number; or
When the idempotent check result of the second system represents that the business single number is inserted into the idempotent control record of the second system unsuccessfully, if the business bill corresponding to the business single number is found in the second system, the first system informs an upstream business system that the business corresponding to the business single number is successfully accepted.
6. The method of claim 5, wherein sending the idempotent verification result to the first system comprises at least one of:
when the business single sign is successfully inserted into the local idempotent control record, sending a first idempotent verification result to a first system, wherein the first idempotent verification result is used for representing that the business single sign is successfully inserted into the local idempotent control record; or
When the business order number fails to be inserted into a local idempotent control record, if the business bill corresponding to the business order number is not found locally, sending a first idempotent verification result to a first system; or
And when the business single sign fails to be inserted into the local idempotent control record, if the business bill corresponding to the business single sign is found locally, sending a second idempotent verification result to the first system, wherein the second idempotent verification result is used for representing the failure of the business single sign to be inserted into the local idempotent control record.
7. The method of claim 6, wherein the first idempotent check result is used for the first system to accept the service corresponding to the service ticket number, and the second idempotent check result is used for the first system to notify the upstream service system that the service acceptance corresponding to the service ticket number is successful after the service acceptance corresponding to the service ticket number is completed.
8. An idempotent control apparatus in a system switching process, adapted to a first system, the apparatus comprising:
the first sending module is used for sending a calling request of idempotent verification to a second system in the switching process between a first system and the second system, wherein the calling request carries a service single number, so that the second system executes local idempotent verification based on the service single number;
the service acceptance module is used for receiving an idempotent check result of the second system, and when the idempotent check result of the second system represents that the service single number is successfully inserted into the idempotent control record of the second system, the first system accepts the service corresponding to the service single number; or
When the idempotent check result of the second system represents that the business single number is inserted into the idempotent control record of the second system unsuccessfully, if the business bill corresponding to the business single number is not found in the second system, the first system accepts the business corresponding to the business single number; or
When the idempotent check result of the second system represents that the business single number is inserted into the idempotent control record of the second system unsuccessfully, if the business bill corresponding to the business single number is found in the second system, the first system informs an upstream business system that the business corresponding to the business single number is successfully accepted.
9. An idempotent control apparatus in a system switching process, adapted to a second system, the apparatus comprising:
the system comprises a first receiving module, a second receiving module and a processing module, wherein the first receiving module is used for receiving a calling request of idempotent verification sent by a first system in the switching process between the first system and a second system, and the calling request carries a service single number;
the second sending module is used for executing local idempotent verification according to the business single sign and sending an idempotent verification result to the first system so that the first system executes the following steps:
when the idempotent check result of the second system represents that the service single number is successfully inserted into the idempotent control record of the second system, the first system accepts the service corresponding to the service single number; or
When the idempotent check result of the second system represents that the business single number is inserted into the idempotent control record of the second system unsuccessfully, if the business bill corresponding to the business single number is not found in the second system, the first system accepts the business corresponding to the business single number; or
When the idempotent check result of the second system represents that the business single number is inserted into the idempotent control record of the second system unsuccessfully, if the business bill corresponding to the business single number is found in the second system, the first system informs an upstream business system that the business corresponding to the business single number is successfully accepted.
10. An idempotent control system during system handover, the system comprising:
the system comprises a first system, a second system and an upstream service system;
the first system is used for sending a calling request of idempotent verification to a second system if receiving a service request sent by an upstream service system in the process of system switching, wherein the calling request carries a service single number; receiving an idempotent verification result of a second system, and when the idempotent verification result of the second system represents that the service single number is successfully inserted into the idempotent control record of the second system, the first system accepts the service corresponding to the service single number; or
When the idempotent check result of the second system represents that the business single number is inserted into the idempotent control record of the second system unsuccessfully, if the business bill corresponding to the business single number is not found in the second system, the first system accepts the business corresponding to the business single number; or
When the idempotent check result of the second system represents that the business single number is inserted into the idempotent control record of the second system unsuccessfully, if the business bill corresponding to the business single number is found in the second system, the first system informs an upstream business system that the business corresponding to the business single number is successfully accepted.
11. The system of claim 10, the upstream traffic system further comprising:
and the change-over switch is used for controlling the service request to be sent to the first system or the second system.
12. The system of claim 11, the diverter switch further to:
and sending the service request corresponding to the service in the pre-stored white list to the first system, and sending the service request corresponding to the service except the white list to the second system.
13. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method of any one of claims 1 to 7.
14. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any one of claims 1 to 7 when executing the program.
CN201810497483.9A 2018-05-22 2018-05-22 Idempotent control method, device and system in system switching process Active CN108647105B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810497483.9A CN108647105B (en) 2018-05-22 2018-05-22 Idempotent control method, device and system in system switching process

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810497483.9A CN108647105B (en) 2018-05-22 2018-05-22 Idempotent control method, device and system in system switching process

Publications (2)

Publication Number Publication Date
CN108647105A CN108647105A (en) 2018-10-12
CN108647105B true CN108647105B (en) 2022-02-01

Family

ID=63757423

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810497483.9A Active CN108647105B (en) 2018-05-22 2018-05-22 Idempotent control method, device and system in system switching process

Country Status (1)

Country Link
CN (1) CN108647105B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111386673A (en) * 2019-11-29 2020-07-07 支付宝(杭州)信息技术有限公司 Method and apparatus for encryption key management based on blockchain system
CN113783666A (en) * 2020-11-27 2021-12-10 北京京东振世信息技术有限公司 Method and device for processing service
CN113553214B (en) * 2021-07-30 2024-04-02 国网数字科技控股有限公司 Idempotent verification method and device
CN113722122A (en) * 2021-08-13 2021-11-30 北京东方国信科技股份有限公司 RPC (remote procedure call) power equality guarantee method and system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105446801A (en) * 2014-06-23 2016-03-30 阿里巴巴集团控股有限公司 Task processing method and device in distributed system
CN105740258A (en) * 2014-12-09 2016-07-06 阿里巴巴集团控股有限公司 Business processing method and device based on power equal sign check
CN106921712A (en) * 2015-12-28 2017-07-04 阿里巴巴集团控股有限公司 A kind of method for processing business and device
CN107193827A (en) * 2016-03-14 2017-09-22 阿里巴巴集团控股有限公司 Divide the idempotent control method and device of storehouse point table
CN107229455A (en) * 2016-03-24 2017-10-03 阿里巴巴集团控股有限公司 A kind of method for processing business, apparatus and system
CN107391758A (en) * 2017-08-24 2017-11-24 阿里巴巴集团控股有限公司 Database switching method, device and equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10656972B2 (en) * 2016-11-10 2020-05-19 International Business Machines Corporation Managing idempotent operations while interacting with a system of record

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105446801A (en) * 2014-06-23 2016-03-30 阿里巴巴集团控股有限公司 Task processing method and device in distributed system
CN105740258A (en) * 2014-12-09 2016-07-06 阿里巴巴集团控股有限公司 Business processing method and device based on power equal sign check
CN106921712A (en) * 2015-12-28 2017-07-04 阿里巴巴集团控股有限公司 A kind of method for processing business and device
CN107193827A (en) * 2016-03-14 2017-09-22 阿里巴巴集团控股有限公司 Divide the idempotent control method and device of storehouse point table
CN107229455A (en) * 2016-03-24 2017-10-03 阿里巴巴集团控股有限公司 A kind of method for processing business, apparatus and system
CN107391758A (en) * 2017-08-24 2017-11-24 阿里巴巴集团控股有限公司 Database switching method, device and equipment

Also Published As

Publication number Publication date
CN108647105A (en) 2018-10-12

Similar Documents

Publication Publication Date Title
CN108647105B (en) Idempotent control method, device and system in system switching process
AU2017215589B2 (en) Electronic payment service processing method and device, and electronic payment method and device
CN105592117B (en) A kind for the treatment of method and apparatus of transaction message
CN111897825A (en) Distributed transaction processing method and device
CN110704490A (en) Service data processing method and device based on intelligent contract
CN112446786A (en) Abnormal transaction processing method and device, electronic equipment and readable storage medium
US20120166893A1 (en) Recording and Preventing Crash in an Appliance
CN111143041B (en) Data consistency method, distributed coordinator and central coordinator
CN109245941B (en) Service compensation method and device
CN116128491A (en) Payment information determination method, device, system and electronic equipment
CN105790975A (en) Service processing operation execution method and device
CN111367694B (en) Event processing method, server and computer storage medium
CN111784359B (en) Multi-mode wind control grading disaster recovery method and device
CN111369246B (en) Calling authentication method and device of intelligent contract, electronic equipment and storage medium
CN109347940B (en) Method and device for processing cross-domain service request and request for cross-domain service
CN111488252B (en) Flow playback method and device
CN111176845A (en) Data reading method of double controllers and related device
CN109325772B (en) Service settlement processing method and device
CN112910978B (en) Method and system for synchronizing network configuration data
CN113554498B (en) Processing method and device for user account request
CN114401223B (en) Information processing device and method
CN116069868B (en) Distributed flexible transaction processing method and device based on enterprise microservice
CN110032569B (en) Method, device, equipment and system for checking changed data
CN117237113A (en) Cross-system transaction state consistency maintaining method, intermediate system and electronic equipment
CN116643852A (en) Method and device for checking timing task

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20201022

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20201022

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Applicant before: Alibaba Group Holding Ltd.

GR01 Patent grant
GR01 Patent grant