Machine serial number processing method, device and system based on distributed system

By using emergency switch values ​​and sequence number preservation mechanisms in a distributed system, the problem of unstable machine sequence numbers caused by single points of failure in the banking transaction system was solved, enabling rapid generation and stable use, and ensuring high availability of transactions and customer experience.

CN114662163BActive Publication Date: 2026-06-02INDUSTRIAL AND COMMERCIAL BANK OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INDUSTRIAL AND COMMERCIAL BANK OF CHINA
Filing Date
2022-03-22
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In distributed systems with high transaction concurrency, such as those in banking, existing technologies struggle to quickly generate and stably use machine serial numbers in the event of a single point of failure, leading to transaction instability.

Method used

The machine serial number is selectively obtained from the registry center or public server based on the emergency switch value, and its availability is guaranteed through a serial number preservation mechanism, including sending preservation requests to the public server at intervals to maintain the validity of the serial number.

Benefits of technology

It enables smooth switching in the event of a single point of failure, ensuring high availability of transactions and rapid generation and stable use of sequence numbers, thereby improving the customer experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114662163B_ABST
    Figure CN114662163B_ABST
Patent Text Reader

Abstract

The application provides a machine serial number processing method, device and system based on a distributed system, which can be used in the financial field or other fields.The method comprises the following steps: obtaining a transaction request, reading an emergency switch value according to the transaction request, sending an application machine serial number request to a registration center if the emergency switch value is a first preset value, receiving a first machine serial number returned by the registration center, sending an application machine serial number request to a public server if the emergency switch value is a second preset value, receiving a second machine serial number sent by the public server, and sending a serial number preservation request to the public server according to a preset time interval.The application improves the machine serial number processing flow by means of emergency switching, improves the reliability, efficiency and availability of machine serial number processing, realizes dynamic switching of machine serial numbers in the case of transaction loss, and has strong expansibility and high practical value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of distributed systems technology and can be used in the financial field or other fields, particularly to a method, apparatus and system for processing machine serial numbers based on a distributed system. Background Technology

[0002] Generating machine numbers is for creating globally unique serial numbers, such as channel event numbers or order numbers. Generating globally unique serial numbers is a common problem faced by distributed systems, and there are generally two methods: Segmented serial numbering, where each server requests a segment of serial number from a serial number manager. Because serial number allocation is centralized, this can lead to resource contention in applications with a large number of servers and high transaction concurrency. The Snowflake algorithm, which uses timestamps, machine numbers, and internal serial numbers to create globally unique serial numbers, is a more distributed and efficient method. Banking operations often involve scenarios with a large number of servers and high transaction concurrency, making the Snowflake algorithm a more suitable choice.

[0003] Such algorithms require each server to directly possess a qualified machine ID, most commonly an integer. The requirements for this machine ID are typically global uniqueness, efficient acquisition, and secure stability. However, banking transactions involve accounting characteristics, demanding high availability in machine ID generation, especially the ability to handle transactions normally through multiple mechanisms in the event of a single point of failure. Currently, the industry lacks a satisfactory solution for ensuring both rapid and stable machine ID generation and high transaction availability, particularly regarding smooth failover in the event of a single point of failure. Summary of the Invention

[0004] In view of the problems existing in the prior art, the main objective of the embodiments of the present invention is to provide a machine serial number processing method, apparatus and system based on a distributed system, so as to realize the rapid generation and stable use of machine serial numbers and improve the customer experience.

[0005] To achieve the above objectives, embodiments of the present invention provide a machine sequence number processing method based on a distributed system, the method comprising:

[0006] Obtain the transaction request, and read the emergency switch value based on the transaction request;

[0007] If the emergency switch value is a first preset value, then send a request for a machine serial number to the registration center and receive the first machine serial number returned by the registration center;

[0008] If the emergency switch value is the second preset value, then a request for a machine serial number is sent to the public server, the second machine serial number is received from the public server, and a serial number preservation request is sent to the public server according to a preset time interval.

[0009] Optionally, in one embodiment of the present invention, receiving the second machine sequence number sent by the public server includes:

[0010] Receive the second machine serial number sent by the public server, and check the second machine serial number;

[0011] If the check fails, the request for a machine serial number is resent to the public server.

[0012] Optionally, in one embodiment of the present invention, the check on the second machine serial number includes: determining whether the second machine serial number is available; if the second machine serial number is unavailable, the check fails.

[0013] This invention also provides a machine serial number processing device based on a distributed system, the device comprising:

[0014] An emergency switch value module is used to acquire transaction requests and read emergency switch values ​​based on the transaction requests.

[0015] The first machine serial number module is used to send a request for a machine serial number to the registration center if the emergency switch value is a first preset value, and to receive the first machine serial number returned by the registration center.

[0016] The second machine serial number module is used to send a request for a machine serial number to the public server if the emergency switch value is a second preset value, receive the second machine serial number sent by the public server, and send a serial number preservation request to the public server according to a preset time interval.

[0017] This invention also provides a machine serial number processing system based on a distributed system, the system comprising: a public server, a transaction server, and a registration center;

[0018] The transaction server is used to obtain transaction requests and read the emergency switch value according to the transaction requests; if the emergency switch value is a first preset value, it sends a request to the registration center to apply for a machine serial number and receives the first machine serial number returned by the registration center; if the emergency switch value is a second preset value, it sends a request to the public server to apply for a machine serial number and receives the second machine serial number sent by the public server.

[0019] The public server is used to receive the request for a machine serial number sent by the transaction server, and according to the request for a machine serial number, read the preset machine serial number table in the database; randomly obtain the serial number group with the status of available in the machine serial number table, and randomly obtain the machine serial number with the status of available from the serial number group as the second machine serial number; send the second machine serial number to the transaction server, and update the status of the second machine serial number to occupied;

[0020] The registration center is used to receive the request for a machine serial number sent by the transaction server, and generate a machine serial number corresponding to the request for a machine serial number as a first machine serial number; and send the first machine serial number to the transaction server.

[0021] Optionally, in one embodiment of the present invention, the transaction server is further configured to send a sequence number preservation request to the public server according to a preset time interval.

[0022] Optionally, in one embodiment of the present invention, the public server is further configured to receive the sequence number preservation request and, according to the sequence number preservation request, perform preservation processing on the machine sequence number in the machine sequence number table corresponding to the sequence number preservation request.

[0023] Optionally, in one embodiment of the present invention, the public server is further configured to update the status of machine serial numbers in the machine serial number table that are occupied and have been occupied for a period exceeding the cleanup time interval to available, according to a preset cleanup time interval.

[0024] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-described method.

[0025] The present invention also provides a computer-readable storage medium storing a computer program for performing the above-described method.

[0026] This invention improves the machine serial number processing flow through emergency switching, enhancing the reliability, efficiency, and availability of machine serial number processing. It enables dynamic switching of machine serial numbers without transaction loss, demonstrating strong scalability and high practical value. Attached Figure Description

[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0028] Figure 1 This is a flowchart illustrating a machine sequence number processing method based on a distributed system, according to an embodiment of the present invention.

[0029] Figure 2 This is a flowchart of receiving the second machine sequence number in an embodiment of the present invention;

[0030] Figure 3This is a schematic diagram of the structure of a machine sequence number processing system based on a distributed system according to an embodiment of the present invention;

[0031] Figure 4 This is a flowchart illustrating the process of processing machine sequence numbers in the transaction processing cluster in an embodiment of the present invention.

[0032] Figure 5 This is a flowchart illustrating the machine serial number processing of the machine serial number management cluster in an embodiment of the present invention.

[0033] Figure 6 This is a flowchart of the G3 process steps for machine serial number management cluster in an embodiment of the present invention;

[0034] Figure 7 This is a flowchart of the G4 steps of the machine serial number management cluster in an embodiment of the present invention;

[0035] Figure 8 This is a flowchart of the G5 process steps for machine serial number management cluster in an embodiment of the present invention;

[0036] Figure 9 This is a flowchart of the transaction processing cluster T1 step in this embodiment of the invention;

[0037] Figure 10 This is a flowchart of the transaction processing cluster T2 step in this embodiment of the invention;

[0038] Figure 11 This is a flowchart of the transaction processing cluster T3 step in this embodiment of the invention;

[0039] Figure 12 This is an emergency switching flowchart in an embodiment of the present invention;

[0040] Figure 13 This is a schematic diagram of the structure of a machine serial number processing device based on a distributed system according to an embodiment of the present invention;

[0041] Figure 14 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0042] This invention provides a machine serial number processing method, apparatus, and system based on a distributed system, which can be used in the financial field and other fields. It should be noted that the machine serial number processing method, apparatus, and system based on a distributed system of this invention can be used in the financial field, or in any field other than the financial field. The application fields of the machine serial number processing method, apparatus, and system based on a distributed system of this invention are not limited.

[0043] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0044] like Figure 1 The diagram shows a flowchart of a machine serial number processing method based on a distributed system according to an embodiment of the present invention. The execution entity of the machine serial number processing method based on a distributed system provided in this embodiment of the present invention includes, but is not limited to, a transaction server. The method shown in the diagram includes:

[0045] Step S1: Obtain the transaction request and read the emergency switch value based on the transaction request.

[0046] The transaction server receives transaction requests submitted by clients, such as purchasing goods. Based on the client's transaction request, specifically the transaction type (e.g., balance inquiry or goods purchase), it reads the corresponding emergency switch value from the current transaction server.

[0047] Furthermore, the emergency switch value can be set to an initial value through a preset method. For example, when the initial value of the emergency switch value is set to 2, it corresponds to a non-emergency state, and the machine serial number needs to be obtained from the public server. If an abnormality or error occurs in the transaction, the emergency switch value will be updated to 1, which corresponds to an emergency state, and the machine serial number needs to be obtained from the registration center.

[0048] Step S2: If the emergency switch value is the first preset value, then send a request for a machine serial number to the registration center and receive the first machine serial number returned by the registration center.

[0049] The transaction server reads the emergency switch value and determines the application method for the machine serial number based on the value. If the emergency switch value is the first preset value, for example, 1, then it is in an emergency state and needs to send a request to the registration center to apply for a machine serial number.

[0050] Furthermore, emergency status refers to situations where public servers malfunction, transactions fail, or anomalies occur. Activating emergency status involves retrieving a machine serial number from the registry center to ensure smooth transaction execution and guarantee transaction stability. Specifically, the registry center can be ZooKeeper.

[0051] Furthermore, the registry center can generate machine serial numbers in real time using existing machine serial number generation methods, such as the snowflake algorithm. The machine serial number generated by the registry center is then used as the first machine serial number, and the registry center returns this first machine serial number to the transaction server.

[0052] Step S3: If the emergency switch value is the second preset value, then send a request for a machine serial number to the public server, receive the second machine serial number sent by the public server, and send a serial number preservation request to the public server according to the preset time interval.

[0053] If the emergency switch value is the second preset value, for example, the second preset value is 2, then it is a non-emergency state and a request to apply for a machine serial number needs to be sent to the public server.

[0054] Furthermore, the non-emergency state refers to the normal transaction state, in which the machine serial number is obtained from the public server to ensure the smooth execution of the transaction.

[0055] Furthermore, the public server pre-generates a machine serial number table and stores it in a database. Upon receiving a request for a machine serial number, the public server randomly selects a group of serial numbers with an available status from the database table. Specifically, each serial number group can include 10 machine serial numbers, each with a corresponding status. The public server randomly selects an available machine serial number from the group and uses it as the second machine serial number. The public server then returns this second machine serial number to the transaction server and updates its status from available to occupied.

[0056] Furthermore, the machine serial numbers in the machine serial number table can also be generated using existing serial number generation methods, or set according to actual needs. In addition, when at least one machine serial number in a serial number group is in an available state, the status of that serial number group is available; if all machine serial numbers in a serial number group are in an occupied state, then the status of that serial number group is occupied.

[0057] Furthermore, after receiving the second machine sequence number, the transaction server begins transaction processing. At this point, it's crucial to ensure the validity of this second machine sequence number during the transaction. Therefore, at preset time intervals, the transaction server sends a sequence number preservation request to the public server. Upon receiving the sequence number preservation request, the public server ensures that the second machine sequence number is in an occupied state for a preset preservation period.

[0058] As an embodiment of the present invention, such as Figure 2 As shown, the second machine sequence number received from the public server includes:

[0059] Step S21: Receive the second machine sequence number sent by the public server and check the second machine sequence number;

[0060] Step S22: If the check fails, resend the request for a machine serial number to the public server.

[0061] In this embodiment, checking the second machine serial number includes: determining whether the second machine serial number is available; if the second machine serial number is unavailable, the check fails.

[0062] Specifically, when the emergency switch value is the second preset value, the current state is non-emergency. The transaction server obtains the second machine serial number from the public server and checks the second machine serial number.

[0063] Furthermore, if the second machine serial number is not empty and is available, the transaction proceeds directly. If the second machine serial number is empty, or is unavailable (e.g., expired due to exceeding its shelf life), the check fails, and the transaction server resends a request for a machine serial number to the public server.

[0064] This invention ensures both the rapid generation and stable use of machine serial numbers, as well as high availability of transactions. In particular, it addresses how to smoothly switch over in the event of a single point of failure, enabling the cluster's unique serial numbers to be generated stably as required. This guarantees 24 / 7 transaction stability and high availability for the bank, thereby improving customer experience.

[0065] like Figure 3 The figure shows a schematic diagram of a machine serial number processing system based on a distributed system according to an embodiment of the present invention. The system shown in the figure includes: a public server, a transaction server and a registration center 103; wherein, multiple public servers and a database constitute a machine serial number management group 101, multiple transaction servers constitute multiple transaction processing clusters, and multiple transaction processing clusters constitute a transaction processing cluster group 102.

[0066] The transaction server is used to obtain transaction requests and read the emergency switch value according to the transaction request; if the emergency switch value is the first preset value, it sends a request to the registration center to apply for a machine serial number and receives the first machine serial number returned by the registration center; if the emergency switch value is the second preset value, it sends a request to the public server to apply for a machine serial number and receives the second machine serial number sent by the public server.

[0067] The public server is used to receive requests for machine serial numbers sent by the transaction server, and read the preset machine serial number table in the database according to the request; randomly select a group of serial numbers in the machine serial number table that is in an available state, and randomly select a machine serial number in the serial number group that is in an available state as a second machine serial number; send the second machine serial number to the transaction server, and update the status of the second machine serial number to occupied.

[0068] The registration center is used to receive the machine serial number request sent by the transaction server, and generate a machine serial number corresponding to the machine serial number request as the first machine serial number; and send the first machine serial number to the transaction server.

[0069] The transaction server receives transaction requests submitted by clients, such as purchasing goods. Based on the client's transaction request, specifically the transaction type (e.g., balance inquiry or goods purchase), it reads the corresponding emergency switch value from the current transaction server.

[0070] Furthermore, the emergency switch value can be set to an initial value through a preset method. For example, when the initial value of the emergency switch value is set to 2, it corresponds to a non-emergency state, and the machine serial number needs to be obtained from the public server. If an abnormality or error occurs in the transaction, the emergency switch value will be updated to 1, which corresponds to an emergency state, and the machine serial number needs to be obtained from the registration center.

[0071] The transaction server reads the emergency switch value and determines the application method for the machine serial number based on the value. If the emergency switch value is the first preset value, for example, 1, then it is in an emergency state and needs to send a request to the registration center to apply for a machine serial number.

[0072] Furthermore, emergency status refers to situations where public servers malfunction, transactions fail, or anomalies occur. Activating emergency status involves retrieving a machine serial number from the registry center to ensure smooth transaction execution and guarantee transaction stability. Specifically, the registry center can be ZooKeeper.

[0073] Furthermore, the registry center can generate machine serial numbers in real time using existing machine serial number generation methods, such as the snowflake algorithm. The machine serial number generated by the registry center is then used as the first machine serial number, and the registry center returns this first machine serial number to the transaction server.

[0074] If the emergency switch value is the second preset value, for example, the second preset value is 2, then it is a non-emergency state and a request to apply for a machine serial number needs to be sent to the public server.

[0075] Furthermore, the non-emergency state refers to the normal transaction state, in which the machine serial number is obtained from the public server to ensure the smooth execution of the transaction.

[0076] Furthermore, the public server pre-generates a machine serial number table and stores it in a database. Upon receiving a request for a machine serial number, the public server randomly selects a group of serial numbers with an available status from the database table. Specifically, each serial number group can include 10 machine serial numbers, each with a corresponding status. The public server randomly selects an available machine serial number from the group and uses it as the second machine serial number. The public server then returns this second machine serial number to the transaction server and updates its status from available to occupied.

[0077] Furthermore, the machine serial numbers in the machine serial number table can also be generated using existing serial number generation methods, or set according to actual needs. In addition, when at least one machine serial number in a serial number group is in an available state, the status of that serial number group is available; if all machine serial numbers in a serial number group are in an occupied state, then the status of that serial number group is occupied.

[0078] As an embodiment of the present invention, the transaction server is also used to send a sequence number preservation request to the public server according to a preset time interval.

[0079] In this embodiment, the public server is also used to receive sequence number preservation requests and, based on the sequence number preservation requests, to perform preservation processing on the machine sequence numbers in the machine sequence number table corresponding to the sequence number preservation requests.

[0080] Upon receiving the second machine sequence number, the transaction server begins transaction processing. At this stage, it's crucial to ensure the validity of this second machine sequence number during the transaction. Therefore, at preset time intervals, the transaction server sends a sequence number preservation request to the public server. Upon receiving the preservation request, the public server ensures that the second machine sequence number remains in an occupied state for a preset preservation period.

[0081] As an embodiment of the present invention, the public server is also used to update the status of machine serial numbers in the machine serial number table that are occupied and whose occupation time exceeds the cleanup time interval to available, according to a preset cleanup time interval.

[0082] The public server cleans up the machine serial number table in the database at preset cleanup intervals. Specifically, if no corresponding serial number preservation request is received within the cleanup interval, meaning the occupied time exceeds the cleanup interval, the status of the corresponding machine serial number in the machine serial number table is updated from occupied to available.

[0083] In a specific embodiment of the present invention, such as Figure 3 As shown, the cluster where the system is located and the cluster generated by the machine number management mainly include machine number management group 101, transaction processing cluster group 102, and Zookeeper-type cluster 103 (registration center).

[0084] Machine serial number management group 101 refers to the cluster group used for machine number generation, machine number allocation and machine number management. This cluster is equipped with a database for machine number processing.

[0085] Transaction processing cluster group 102 is a cluster group used to complete transaction processing, mainly to obtain machine numbers and complete transaction processing.

[0086] Zookeeper cluster 103 is a cluster used to build temporary node management sequence numbers, which is used to generate and manage node machine numbers.

[0087] The system's machine serial number management group mainly includes four processing steps: container startup creates serial number; transaction triggers check serial number; serial number preservation (timed batch); and serial number cleanup (timed batch).

[0088] Furthermore, within the transaction processing cluster, the normal process involves obtaining the machine sequence number β (from the public server) to complete the transaction. In the event of a single point of failure, the sequence number α (from the registry center) can be obtained by switching the emergency switch K1.

[0089] In this embodiment, as Figure 4 As shown, the machine number management involved in the transaction processing cluster mainly consists of the following steps:

[0090] Step T1: Create machine serial number: When the transaction processing cluster starts the container (i.e., the PaaS node container starts), it will access the machine serial number management group, apply for and obtain the machine serial number, and store it in the container for later use.

[0091] Step T2: Check the machine serial number: When the transaction processing cluster processes a transaction request, it will perform a serial number retrieval check. If the serial number is unavailable, it will access the machine serial number management group again to request a machine serial number.

[0092] Step T3, Machine Number Preservation: The transaction processing cluster defines a timed batch job that sends a machine number preservation request to the machine number management group at predetermined intervals.

[0093] In this embodiment, as Figure 5 As shown, the machine serial number management group involves machine number generation, machine number allocation, and machine number management, and mainly consists of the following steps:

[0094] Initial operation: When setting up and starting for the first time, step G1 creates a machine serial number table, and step G2 initializes the serial number data for subsequent machine number allocation and management.

[0095] Passive triggering: When a request for a machine number is received, the serial number management group will assign a machine serial number; when a request for machine number preservation is received, the serial number management group will perform preservation operations to extend the survival time of the target serial number.

[0096] Define interval self-trigger: The sequence number management group cluster defines a scheduled batch job to clean up the sequence numbers at predetermined intervals.

[0097] In this embodiment, as Figure 6 As shown, the specific steps for generating and assigning machine serial numbers in step G3 (Machine Serial Number Management Group) include:

[0098] 401) Start Loop1 and define the number of iterations n;

[0099] 402) Query the remaining available serial number groups in the machine serial number table. Query the serial number groups that are available. Each group contains 10 records, and they are retrieved in random order.

[0100] 403) Start the Loop2 loop and define the number of iterations m;

[0101] 404) Attempting to update the machine serial number table, changing the status of the target serial number from available to occupied;

[0102] 405) Check if step 404 was successfully updated. If successful, return the machine serial number and end the process; if it fails, proceed to step 406.

[0103] 406) Continue trying to update the next item;

[0104] 407) End Loop2 loop;

[0105] 408) End Loop1 loop;

[0106] 409) Still no available sequence number, returns empty.

[0107] In this embodiment, as Figure 7 As shown, the specific steps of the machine serial number preservation operation in step G4 of the machine serial number management group include:

[0108] 501) Look up the machine serial number table based on container name, IP address, and current machine number;

[0109] 502) Try to preserve the food and extend its shelf life;

[0110] 503) Determine if preservation was successful. If successful, end the process; if unsuccessful, proceed to step 504.

[0111] 504) Regenerate the machine number and return.

[0112] In this embodiment, as Figure 8 As shown, the specific steps of the machine serial number management group's cleanup of the machine serial number table in step G5 include: changing the status of serial numbers in the machine serial number table that are in use and whose usage time has expired from dedicated to available.

[0113] In this embodiment, as Figure 9 As shown, the specific steps for the transaction processing cluster to obtain the machine serial number include:

[0114] When starting a container, it accesses Zookeeper to obtain the machine sequence number. Zookeeper creates a temporary node and generates the machine sequence number.

[0115] After obtaining the Zookeeper machine number α, access the machine number management group;

[0116] The machine serial number management group is responsible for allocating machine serial numbers;

[0117] Obtain the machine number β of db (Database).

[0118] In this embodiment, as Figure 10 As shown, the specific steps for the transaction processing cluster to check the machine serial number include:

[0119] 801) The transaction triggered a request to check the machine serial number;

[0120] 802) Determine parameter K1 to dynamically decide whether to use zk machine number α or db machine number β. If zk machine number α is used, return zk machine number α. If db machine number β is used, proceed to step 803.

[0121] 803) Enter the detailed process for using machine serial number β;

[0122] 804) Check if machine number β is empty. If it is not empty, return to machine number β. If it is empty, proceed to step 805.

[0123] 805) Enable the synchronized lock;

[0124] 806) To meet the requirements of high concurrency scenarios, check again whether the machine number β is empty. If it is not empty, return the machine number β. If it is empty, proceed to step 807.

[0125] 807) Access the public server to obtain the machine serial number;

[0126] For details on assigning machine numbers to public servers (808), please refer to [link / reference needed]. Figure 6 step.

[0127] The data dictionary for K1 is: 1-zk, 2-db. If it is 1-zk, then obtain the machine number α; if it is 2-db, then obtain the machine number β.

[0128] In this embodiment, as Figure 11 As shown, the specific steps for keeping the machine sequence number of the transaction processing cluster fresh include:

[0129] Define a timed batch job that initiates a preservation request by accessing the machine serial number management group at predetermined intervals.

[0130] For steps on keeping public server machine IDs fresh, please see [link / details]. Figure 7 step.

[0131] In this embodiment, as Figure 12 The diagram shows emergency monitoring measures, the main steps of which include:

[0132] Configure relevant transaction availability monitoring to detect whether the sequence number is available. If the sequence number is determined to be unavailable, dynamically modify parameter K1 to determine whether to use the zk machine sequence number α or the db machine sequence number β.

[0133] It is used to switch machine serial number α and machine serial number β.

[0134] This invention improves the processes of machine number generation, allocation, management, preservation, and cleanup. Its advantages and benefits are: high reliability, based on a mature database and open-source framework dual generation mechanism; high efficiency, eliminating the need for repeated acquisition operations on the transaction side for each machine number usage scenario; high availability, enabling unified identification and dynamic switching under lossless transaction conditions in the event of failure or single point of failure; and strong scalability, allowing flexible switching to similar frameworks for this solution, thus possessing high practical value.

[0135] like Figure 13 The figure shows a schematic diagram of a machine serial number processing device based on a distributed system according to an embodiment of the present invention. The device shown in the figure includes:

[0136] Emergency switch value module 10 is used to acquire transaction requests and read emergency switch values ​​according to the transaction requests;

[0137] The first machine serial number module 20 is used to send a request for a machine serial number to the registration center if the emergency switch value is a first preset value, and to receive the first machine serial number returned by the registration center.

[0138] The second machine serial number module 30 is used to send a request for a machine serial number to the public server if the emergency switch value is a second preset value, receive the second machine serial number sent by the public server, and send a serial number preservation request to the public server according to a preset time interval.

[0139] Based on the same concept as the aforementioned machine serial number processing method and system based on a distributed system, this invention also provides a machine serial number processing apparatus based on a distributed system. Since the principle by which this machine serial number processing apparatus solves the problem is similar to that of the aforementioned machine serial number processing method and system based on a distributed system, the implementation of this machine serial number processing apparatus can refer to the implementation of the aforementioned machine serial number processing method and system based on a distributed system; repeated details will not be elaborated further.

[0140] This invention improves the machine serial number processing flow through emergency switching, enhancing the reliability, efficiency, and availability of machine serial number processing. It enables dynamic switching of machine serial numbers without transaction loss, demonstrating strong scalability and high practical value.

[0141] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-described method.

[0142] The present invention also provides a computer-readable storage medium storing a computer program for performing the above-described method.

[0143] like Figure 14 As shown, the electronic device 600 may also include: a communication module 110, an input unit 120, an audio processing unit 130, a display 160, and a power supply 170. It is worth noting that the electronic device 600 does not necessarily need to include these components. Figure 14 All components shown; in addition, the electronic device 600 may also include Figure 14 For components not shown, please refer to existing technologies.

[0144] like Figure 14 As shown, the central processing unit 100, sometimes also referred to as a controller or operating control, may include a microprocessor or other processor device and / or logic device. The central processing unit 100 receives inputs and controls the operation of various components of the electronic device 600.

[0145] The memory 140 may be, for example, one or more of a cache, flash memory, hard drive, removable media, volatile memory, non-volatile memory, or other suitable devices. It may store the aforementioned failure-related information, and also store a program for executing that information. The central processing unit 100 may execute the program stored in the memory 140 to perform information storage or processing, etc.

[0146] Input unit 120 provides input to central processing unit 100. Input unit 120 may be, for example, a keypad or touch input device. Power supply 170 provides power to electronic device 600. Display 160 displays images and text. Display may be, for example, an LCD display, but is not limited thereto.

[0147] The memory 140 can be a solid-state memory, such as a read-only memory (ROM), random access memory (RAM), a SIM card, etc. It can also be a memory that retains information even when power is off, can be selectively erased, and contains more data; examples of this type of memory are sometimes referred to as EPROMs. The memory 140 can also be some other type of device. The memory 140 includes a buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application / function storage unit 142 for storing application programs and function programs or processes for executing the operation of the electronic device 600 via the central processing unit 100.

[0148] The memory 140 may also include a data storage unit 143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 144 of the memory 140 may include various drivers for the electronic device's communication functions and / or for performing other functions of the electronic device (such as messaging applications, address book applications, etc.).

[0149] The communication module 110 is a transmitter / receiver 110 that transmits and receives signals via antenna 111. The communication module (transmitter / receiver) 110 is coupled to the central processing unit 100 to provide input signals and receive output signals, which can be the same as in a conventional mobile communication terminal.

[0150] Based on different communication technologies, multiple communication modules 110 can be configured in the same electronic device, such as cellular network modules, Bluetooth modules, and / or wireless LAN modules. The communication module (transmitter / receiver) 110 is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide audio output via the speaker 131 and receive audio input from the microphone 132, thereby enabling typical telecommunications functions. The audio processor 130 may include any suitable buffer, decoder, amplifier, etc. Additionally, the audio processor 130 is coupled to a central processing unit 100, enabling on-device recording via the microphone 132 and on-device playback of stored audio via the speaker 131.

[0151] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0152] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0153] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0154] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0155] Specific embodiments have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.

Claims

1. A machine sequence number processing method based on a distributed system, characterized in that, The method includes: Obtain the transaction request, and read the emergency switch value based on the transaction request; If the emergency switch value is a first preset value, then send a request for a machine serial number to the registration center and receive the first machine serial number returned by the registration center; If the emergency switch value is the second preset value, then a request for a machine serial number is sent to the public server, and the second machine serial number sent by the public server is received; the second machine serial number is a machine serial number in the available serial number group selected by the public server from the machine serial number table in the database. According to a preset time interval, a sequence number preservation request is sent to the public server so that the public server sets the status of the second machine sequence number to occupied within the preset preservation period. If no corresponding sequence number preservation request is received within the cleanup time interval, the status of the corresponding machine sequence number in the machine sequence number table is updated from occupied to available.

2. The method according to claim 1, characterized in that, The second machine sequence number received from the public server includes: Receive the second machine serial number sent by the public server, and check the second machine serial number; If the check fails, the request for a machine serial number is resent to the public server.

3. The method according to claim 2, characterized in that, The check on the second machine serial number includes: determining whether the second machine serial number is available; if the second machine serial number is not available, the check fails.

4. A machine sequence number processing device based on a distributed system, characterized in that, The device includes: An emergency switch value module is used to acquire transaction requests and read emergency switch values ​​based on the transaction requests. The first machine serial number module is used to send a request for a machine serial number to the registration center if the emergency switch value is a first preset value, and to receive the first machine serial number returned by the registration center. The second machine serial number module is used to send a request for a machine serial number to the public server if the emergency switch value is a second preset value, receive the second machine serial number sent by the public server, and send a serial number preservation request to the public server according to a preset time interval, so that the public server sets the status of the second machine serial number to occupied within a preset preservation time period; and update the status of machine serial numbers in the machine serial number table that are occupied and whose occupation time exceeds the cleanup time interval to available according to a preset cleanup time interval; wherein, the second machine serial number is a machine serial number in the available serial number group selected by the public server from the database machine serial number table.

5. A machine sequence number processing system based on a distributed system, characterized in that, The system includes: a public server, a transaction server, and a registration center; The transaction server is used to obtain transaction requests and read the emergency switch value according to the transaction requests; if the emergency switch value is a first preset value, it sends a request to the registration center to apply for a machine serial number and receives the first machine serial number returned by the registration center; if the emergency switch value is a second preset value, it sends a request to the public server to apply for a machine serial number and receives the second machine serial number sent by the public server. The transaction server is also used to send a sequence number preservation request to the public server according to a preset time interval; The public server is used to receive the machine serial number request sent by the transaction server, and read the preset machine serial number table in the database according to the machine serial number request; randomly obtain the serial number group with the status of available in the machine serial number table, and randomly obtain the machine serial number with the status of available from the serial number group as the second machine serial number; send the second machine serial number to the transaction server, and update the status of the second machine serial number to occupied; The public server is also used to update the status of the corresponding machine serial number in the machine serial number table from occupied to available if no corresponding serial number preservation request is received within the cleanup interval. The registration center is used to receive the application for machine serial number sent by the transaction server, and generate a machine serial number corresponding to the application for machine serial number as a first machine serial number according to the application for machine serial number; and send the first machine serial number to the transaction server.

6. The system according to claim 5, characterized in that, The public server is also used to receive the sequence number preservation request and, based on the sequence number preservation request, to perform preservation processing on the machine sequence number in the machine sequence number table corresponding to the sequence number preservation request.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method according to any one of claims 1 to 3.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that performs the method according to any one of claims 1 to 3.