CN-121235819-B - Out-of-order protection method for transaction system, device and medium
Abstract
The embodiment of the application discloses an out-of-order protection method of a transaction system, the transaction system, equipment and a medium. The method comprises the steps of sequentially receiving order return information from a preset channel through a service processing module, updating an associated parent list record according to the state return information through the service processing module, generating an object serial number ID in an increasing mode, storing the object serial number ID and the object parent list identifier in a cache container in an associating mode, determining whether an ID which is associated with the object parent list identifier and is larger than the object serial number ID exists in the cache container through a post-scrambling processing module, filtering the order return information through the post-scrambling processing module if the ID exists, and sending the order return information to a message pushing module and sending the order return information to a client if the ID does not exist. By the aid of the method and the system, the fact that the client receives out-of-order return information can be avoided.
Inventors
- ZHANG ZONGBIAO
- GAO HU
- Ying Chenghao
- HU LINLIN
Assignees
- 上海卡方信息科技有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20251013
Claims (8)
- 1. The method is characterized in that the method is applied to a transaction system, the transaction system comprises a business processing module, a post-scrambling processing module and a message pushing module, the business processing module is positioned in a business transaction lock, and the message pushing module is positioned outside the business transaction lock, and the method comprises the following steps: Sequentially receiving order return information from a preset channel through a service processing module, wherein the order return information comprises a target parent list identifier and state return information; Updating a master list record associated with the target master list identifier in a local database according to the state report information through the service processing module, generating a target serial number ID by increasing, storing the target serial number ID and the target master list identifier in a preset cache container in an associated mode, and storing the current master list state and the master list transaction amount in the master list record; the order return information is sent to the post-scrambling processing module through the service processing module; Determining, by the post-scrambling processing module, whether a serial number ID associated with the target parent list identifier and greater than the target serial number ID exists in the cache container; If the serial number ID which is associated with the target parent list identifier and is larger than the target serial number ID exists, filtering the order return information through the post-scrambling processing module; If the serial number ID which is associated with the target parent list identifier and is larger than the target serial number ID does not exist, the order return information is sent to the message pushing module, and the order return information is sent to a client associated with the target parent list identifier through the message pushing module; the preset channel comprises a master single channel corresponding to a master single return thread or a sub single channel corresponding to a sub single return thread, the state return information in the order return information from the master single channel comprises order part withdrawal state return information or accumulation part state return information, and the accumulation part state return information carries accumulated volume corresponding to the target master single mark; The transaction system further comprises a pre-scrambling processing module, and before the business processing module receives order return information from a preset channel in sequence, the method further comprises the steps of: when the preset channel is a master single channel corresponding to a master single return thread, judging whether the accumulated volume in the order return information is smaller than or equal to the master single volume in the master single record or not through the pre-scrambling processing module; and if the accumulated volume is smaller than or equal to the parent list volume, filtering the order return information through the pre-scrambling processing module.
- 2. The method of claim 1, wherein the master batch record further stores a total amount of delegation corresponding to the target master batch identifier, and the updating the master batch record associated with the target master batch identifier in the local database according to the state report information includes: when the state report information is order part withdrawal state report information, updating the current parent list state in the parent list record into part withdrawal state; When the state report information is the master single part state report information, the master single transaction amount in the master single record is updated through accumulation according to the child order transaction amount carried by the master single part state report information; if the updated parent list transaction amount is equal to the entrusted total amount, updating the current parent list state in the parent list record into a finished state; And if the updated parent list transaction amount is smaller than the entrusting total amount, updating the current parent list in the parent list record into a partial state.
- 3. The method of claim 1, wherein prior to sequentially receiving order return information from the predetermined lane by the business process module, the method further comprises: Receiving an order delegation instruction sent by the client, wherein the order delegation instruction comprises a user identifier and a delegation total amount; carrying out validity verification according to the user corresponding to the user identifier; When the validity check passes, generating a target mother bill corresponding to the order delegation instruction, wherein the target mother bill carries the target mother bill identification and the delegation total amount; Creating a master ticket record associated with the target master ticket identification in a local database, and sending the target master ticket to a dealer terminal so that the dealer terminal processes the target master ticket, and returning the order return information to the trading system through the preset channel based on a processing result.
- 4. The method according to claim 1, wherein the method further comprises: receiving an order inquiry instruction sent by the client, wherein the order inquiry instruction carries the target parent order identifier; responding to the order inquiry instruction, and generating order feedback information according to a parent list record corresponding to the target parent list identifier; and sending the order feedback information to the client.
- 5. The method of claim 1, wherein the target serial number ID is a globally incremented ID or an ID incremented based on the target parent list identification.
- 6. The transaction system is characterized by comprising a service processing module, a post-scrambling processing module and a message pushing module, wherein the service processing module is positioned in a service transaction lock, and the message pushing module is positioned outside the service transaction lock, wherein: The business processing module is used for receiving order return information from a preset channel in sequence, wherein the order return information comprises a target master list identifier and state return information, updating a master list record associated with the target master list identifier in a local database according to the state return information, generating a target serial number ID in an incremental mode, storing the target serial number ID and the target master list identifier in a preset cache container, and storing the current master list state and the master list transaction amount in the master list record; The post-scrambling processing module is used for determining whether a serial number ID which is associated with the target parent list identifier and is larger than the target serial number ID exists in the cache container, filtering the order return information if the serial number ID which is associated with the target parent list identifier and is larger than the target serial number ID exists, and transmitting the order return information to the message pushing module if the serial number ID which is associated with the target parent list identifier and is larger than the target serial number ID does not exist; The message pushing module is used for sending the order return information to a client associated with the target parent list identifier; the preset channel comprises a master single channel corresponding to a master single return thread or a sub single channel corresponding to a sub single return thread, the state return information in the order return information from the master single channel comprises order part withdrawal state return information or accumulation part state return information, and the accumulation part state return information carries accumulated volume corresponding to the target master single mark; The transaction system further comprises a pre-scrambling processing module for: when the preset channel is a master single channel corresponding to a master single return thread, judging whether the accumulated volume of the order return information is smaller than or equal to the volume of the master single in the master single record; And if the accumulated volume is smaller than or equal to the parent single volume, filtering the order return information.
- 7. A computer device comprising a memory, a processor and a computer program stored on the memory and operable on the processor, characterized in that the computer device is deployed with a transaction system comprising a traffic processing module, a post-scrambling processing module and a message pushing module, the traffic processing module being located in a traffic transaction lock, the processor implementing the method of out-of-order protection of the transaction system according to any of claims 1-5 when executing the computer program.
- 8. A storage medium storing a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the out-of-order protection method of a transaction system according to any of claims 1-5.
Description
Out-of-order protection method for transaction system, device and medium Technical Field The present application relates to the field of data processing technologies, and in particular, to an out-of-order protection method for a transaction system, a device, and a medium. Background In the financial field, the stock exchange system receives the order of the user, the order is sent to the external dealer as the master ticket, the external dealer will typically split the master ticket, i.e. split into a plurality of sub-tickets for stock exchange, then the stock exchange system returns the sub-tickets returned by the channel, and the master ticket return data updates the master ticket completion status of the system. Because the master report and the slave report are respectively pushed to the securities trading system through independent thread queues, the master report and the slave report form an unequal time sequence processing scene, for example, one thread receives the order report information of the slave report (the number of the backlog and the state of the master report are updated) in a similar time, the other thread receives the order report information of the master report, such as the part report, and the processing in the transaction of the two master report states is correct, but when the pushed master report state is updated, because the pushing step is executed outside the lock, the two order report information received in a similar time is easily disordered (for example, the order report information of the slave report is received, then the part report of the master report is received, but when the client sends the part report of the master report, then the order report information of the slave report is sent. The return on orders received by clients that result in downstream system access is out of order. In order to solve the above problem, in the prior art, business logic (network I/0 operation) pushed by each thread processing transaction is also put into a transaction lock for processing, while the problem of disorder is solved, the whole process (business transaction processing and business transaction pushing) is serial, and the transaction lock must wait for the completion of the whole process to execute information of the next thread, so that the data processing speed is slow, and the system performance is affected. Disclosure of Invention The embodiment of the application provides an out-of-order protection method of a transaction system, the transaction system, equipment and a medium, which can enable a message pushing module to send order return information to a client in order on the premise of not influencing the system performance, and avoid the client from receiving the out-of-order return information. In a first aspect, an embodiment of the present application provides an out-of-order protection method for a transaction system, where the method is applied to a transaction system, where the transaction system includes a service processing module, a post-scrambling processing module, and a message pushing module, where the service processing module is located in a service transaction lock, and the method includes: Sequentially receiving order return information from a preset channel through a service processing module, wherein the order return information comprises a target parent list identifier and state return information; Updating a master list record associated with the target master list identifier in a local database according to the state report information through the service processing module, generating a target serial number ID by increasing, storing the target serial number ID and the target master list identifier in a preset cache container in an associated mode, and storing the current master list state and the master list transaction amount in the master list record; the order return information is sent to the post-scrambling processing module through the service processing module; Determining, by the post-scrambling processing module, whether a serial number ID associated with the target parent list identifier and greater than the target serial number ID exists in the cache container; If the serial number ID which is associated with the target parent list identifier and is larger than the target serial number ID exists, filtering the order return information through the post-scrambling processing module; And if the serial number ID which is associated with the target parent list identifier and is larger than the target serial number ID does not exist, the order return information is sent to the message pushing module, and the order return information is sent to a client associated with the target parent list identifier through the message pushing module. In a second aspect, an embodiment of the present application further provides a transaction system, where the transaction system includes a service processing module, a post-scrambling processing module, and