Data processing methods, apparatuses, non-volatile storage media, and electronic devices
By utilizing the queue of the state processing module to process and update order states in an orderly manner under high concurrency scenarios, the problems of request loss and untimely state updates when the database processes order states are solved, and lossless flow and timely updates of order states are achieved.
Patent Information
- Application Number
- CN202411123608.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2044-08-15
AI Technical Summary
In high-concurrency scenarios, existing technologies often encounter problems such as request loss and untimely status updates when processing order status in databases due to large data volumes. This is especially true when lock contention is severe, which can cause some requests to be blocked or dropped, preventing users from obtaining the latest status in a timely manner.
By receiving multiple pending requests, the system sequentially processes each request using a pre-defined queue of status processing modules, generating processed order statuses and updating the database accordingly to ensure seamless order status transitions.
It enables seamless transfer of order status under high concurrency, avoids request loss, ensures the timeliness and accuracy of status updates, and improves the system's response performance.
Smart Images

Figure CN119127889B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and more specifically, to a data processing method, apparatus, non-volatile storage medium, and electronic device. Background Technology
[0002] When issuing coupon-type benefit orders on a benefits platform, a large number of benefit orders need to be issued to different requesting systems simultaneously. In this high-concurrency scenario, it's crucial to ensure the correct status transition for each benefit order while maintaining high performance and fast response time. This puts significant pressure on the server. Related technologies employ database locks or distributed locks for direct status transitions, meaning only one thread can hold the lock resource, and other threads must wait for the lock to be released before continuing execution. However, when a large number of requests simultaneously access the database or distributed lock, lock contention occurs. Multiple concurrent requests compete for the same lock resource, leading to performance degradation and prolonged system response time. This can result in some requests being blocked or dropped, causing untimely status updates and preventing users from obtaining the latest status.
[0003] There is currently no effective solution to the above problems. Summary of the Invention
[0004] This invention provides a data processing method, apparatus, non-volatile storage medium, and electronic device to at least solve the technical problems of request loss and untimely status updates caused by large amounts of data during the database processing of order status in the prior art.
[0005] According to one aspect of the present invention, a data processing method is provided, comprising: receiving multiple pending requests that respectively represent requests to update the status of corresponding orders in a database, wherein the status of the orders corresponding to the multiple pending requests has changed; processing the multiple pending requests sequentially using multiple status processing modules in a predetermined status processing module queue to obtain processed order statuses, wherein the multiple status processing modules process requests corresponding to orders with different status changes; and updating the database based on the processed order statuses.
[0006] Optionally, according to a pre-determined queue of status processing modules, multiple status processing modules in the queue are used sequentially to process multiple pending requests to obtain the processed order status. This includes: determining the order of the multiple status processing modules in the queue; inputting multiple pending requests into the first status processing module according to the order, whereby the first status processing module processes the first request corresponding to the order whose status has undergone a first change, to obtain the processed order status of the order corresponding to the first request; and inputting unprocessed requests from the multiple pending requests into the next status processing module according to the order, until all multiple status processing modules have processed the multiple pending requests to obtain the processed order status.
[0007] Optionally, the database is updated according to the processed order status, including: updating the database sequentially according to the processed order status obtained by the multiple status processing modules in the order of the multiple status processing modules.
[0008] Optionally, the database is updated sequentially according to the processed order status obtained by the multiple status processing modules, following the order order status of the first request output by the first status processing module; the database is updated according to the processed order status of the next status processing module, following the order of the multiple status processing modules, until the database is updated according to the processed order status output by the last status processing module, thus confirming that the database update is complete.
[0009] Optionally, the status processing module queue is generated as follows: obtain a predetermined order status change process, which includes multiple ordered order statuses; determine adjacent order statuses among the multiple order statuses according to the order status change process; generate status processing modules corresponding to the adjacent order statuses to obtain multiple status processing modules; and sort the multiple status processing modules according to the order status change process to obtain the status processing module queue.
[0010] Optionally, generating a status processing module corresponding to adjacent order states includes: determining the earlier order state and the later order state among adjacent order states; obtaining a processing step of processing the order in the earlier order state into an order in the later order state; and integrating the processing steps to obtain a status processing module corresponding to adjacent order states.
[0011] According to another aspect of the present invention, a data processing apparatus is also provided, comprising: a first receiving module, configured to receive multiple pending requests that respectively represent requests to update the corresponding order status in a database; a processing module, configured to process the multiple pending requests to obtain a processed order status; and a first determining module, configured to process the multiple pending requests to obtain a processed order status.
[0012] According to another aspect of the present invention, a non-volatile storage medium is provided, which stores a plurality of instructions adapted for loading by a processor and executing any of the above-described data processing methods.
[0013] According to another aspect of the present invention, an electronic device is provided, comprising: a processor and a memory, the memory being used to store a program, wherein when the program is executed by the processor, the processor causes the processor to implement the data processing method described above.
[0014] According to another aspect of the present invention, a computer program product is also provided, including a data processing method in which computer instructions are executed by a processor.
[0015] In this embodiment of the invention, multiple pending requests, each representing a request to update the corresponding order status in the database, are received. Following a pre-determined queue of status processing modules, multiple status processing modules in the queue process each of the pending requests to obtain the processed order status. Based on the processed order status, the database is updated. This process sends all order status information to the corresponding status processing modules in the queue for processing, achieving lossless transfer of order status. It also ensures that order status is not discarded under high concurrency, thus solving the technical problems of request loss and untimely status updates caused by large data volumes in the prior art during order status processing. Attached Figure Description
[0016] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0017] Figure 1 This is a flowchart of a data processing method provided according to an embodiment of the present invention;
[0018] Figure 2 This is a schematic diagram of a state processing flow provided by an optional embodiment of the present invention;
[0019] Figure 3This is a structural block diagram of a data processing apparatus provided according to an embodiment of the present invention;
[0020] Figure 4 This is a schematic diagram of an electronic device provided according to an embodiment of the present invention. Detailed Implementation
[0021] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. 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 should fall within the scope of protection of the present invention.
[0022] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0023] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:
[0024] The Kafka platform is a high-performance, scalable, and reliable platform primarily used for building real-time data stream processing applications. It can handle large volumes of data streams and provides reliable message delivery and persistent storage. The Kafka platform also offers a suite of tools to simplify the development and management of data stream processing.
[0025] A Kafka cluster is a distributed messaging system composed of multiple Kafka platforms. Together, they form a highly available and high-performance message queue cluster capable of handling large-scale message data streams.
[0026] According to an embodiment of the present invention, a method embodiment for data processing is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0027] Figure 1 This is a flowchart of a data method according to an embodiment of the present invention, such as... Figure 1 As shown, the method includes the following steps:
[0028] Step S102: Receive multiple pending requests that represent requests to update the corresponding order status in the database.
[0029] In this step, coupon-based benefit orders refer to orders issued by the benefit platform to users that include specific offers or discounts. Users can use these discount codes to enjoy corresponding offers or discounts when placing an order. When the benefit platform issues a large number of coupon-based benefit orders, users may use these offers or discounts, at which point the status of these coupon-based orders will change. To ensure that users can correctly know the status of the offers or discounts, the status of coupon-based order information in the database needs to be updated. Therefore, the database will contain multiple unordered order status information. These order statuses include, but are not limited to, pending use, used, expired, cancelled, refunding, and refunded. Pending use means the user has successfully paid but has not yet used the coupon code; the order is in a pending use state. Used means the user has successfully used the coupon code; the order status changes to used. Expired means the coupon code's validity period has expired; the order status changes to expired. Cancelled means the user cancelled the order or the system automatically cancelled the order; the order status changes to cancelled. Refunding means the user applied for a refund; the order status changes to refunding. A "refunded" status means the refund request has been processed and the order status has changed to "refunded." When order status information changes, the order status information in the database needs to be updated. At this time, the upstream business system interacting with the user will send a request to the data processing system to change the order status in the database based on the user's operation. This results in multiple pending requests, and the database will also contain multiple order statuses waiting to be updated. The data processing system will receive and process these pending requests.
[0030] Step S104: According to the pre-determined state processing module queue, multiple state processing modules in the state processing module queue are used in sequence to process multiple pending requests to obtain the processed order status. Among them, multiple state processing modules process requests corresponding to orders with different status changes.
[0031] In this step, the status processing module queue consists of multiple status processing modules arranged in a specific order. These modules process multiple pending requests. These modules include, but are not limited to, modules that update a status from "pending use" to "used," from "used" to "cancelled," from "used" to "refund in progress," from "refund in progress" to "refunded," and from "refunded" to "pending use." The pending requests include, but are not limited to, requests to update from "pending use" to "used," from "used" to "cancelled," from "used" to "refund in progress," from "refund in progress" to "refunded," and from "refunded" to "pending use." The pending requests pass through these status processing modules sequentially. Each module updates the request corresponding to the order with the change in status, ultimately resulting in the processed order status.
[0032] In one optional embodiment, according to a pre-determined queue of state processing modules, multiple state processing modules in the queue are used sequentially to process multiple pending requests to obtain a processed order status. This includes: determining the order of the multiple state processing modules in the queue; inputting multiple pending requests into the first state processing module according to the order, whereby the first state processing module processes the first request corresponding to the order whose status has undergone a first change, to obtain the processed order status of the order corresponding to the first request; and inputting unprocessed requests from the multiple pending requests into the next state processing module according to the order, until all multiple state processing modules have processed the multiple pending requests to obtain a processed order status.
[0033] Optionally, when processing multiple pending requests based on the status processing module queue, the order of the multiple status processing modules in the status processing module queue can be determined first. For example, the first status processing module can be determined as the status processing module that updates from the pending state to the used state, the second status processing module is the status processing module that updates from the used state to the refunding state, the third status processing module is the status processing module that updates from the refunding state to the refunded state, and the fourth status processing module is the processing module that updates from the refunded state to the pending state. During the processing, the first status processing module can update the order status of the first request corresponding to the order whose status has changed for the first time, thus obtaining the processed order status of the order corresponding to the first request. For example, if the first status processing module is a status processing module that updates from the pending state to the used state, then the first status processing module will identify the first request corresponding to the order whose status has changed from pending to used among multiple pending requests, and record the order whose status has changed for the first time as the used state based on the first request. Other order statuses that have not been processed by the first status processing module will enter the second status processing module, which will process the second request corresponding to the order whose status has changed for the second time (from used to refunding), thus obtaining the processed order status of the order corresponding to the second request. At this time, other order statuses that have not been processed by the first and second status processing modules will enter the next status processing module, until every pending request has been processed by the corresponding status processing module in the status processing module queue, thus obtaining all processed order statuses.
[0034] In one optional embodiment, the status processing module queue is generated as follows: a predetermined order status change process is obtained, which includes multiple ordered order statuses; adjacent order statuses are determined according to the order status change process; a status processing module corresponding to the adjacent order status is generated, resulting in multiple status processing modules; and the multiple status processing modules are sorted according to the order status change process to obtain the status processing module queue.
[0035] Optionally, when generating the status processing queue, the business process can be analyzed, specifically the process of order status changes. This process should include all possible order states and the relationships between these states. The status processing module queue generated based on the business process can effectively manage the order status change process, ensuring that the changes are orderly and controllable, and also facilitating subsequent monitoring and optimization of the order status change process.
[0036] After determining the order status change process, adjacent order statuses can be identified based on this process. For example, order statuses might include "Pending Use," "Used," "Expired," "Cancelled," "Refunding in Progress," and "Refunded." Therefore, "Pending Use" and "Used," "Pending Use" and "Expired," and "Refunding in Progress" and "Refunded" are adjacent order statuses. For each pair of adjacent order statuses, a corresponding status processing module can be generated. This module can be a piece of code used to handle the operations required when an order status changes from one status to another. Finally, based on the order status change process, the generated status processing modules can be sorted according to the order of the order statuses, forming a status processing module queue. This way, when an order status changes, the corresponding status processing module can be executed sequentially according to the order in the queue, ensuring that the order status change process follows the predetermined procedure.
[0037] In one optional embodiment, generating a status processing module corresponding to adjacent order statuses includes: determining the earlier order status and the later order status among adjacent order statuses; obtaining a processing step of processing the order in the earlier order status to be in the later order status; and integrating the processing steps to obtain a status processing module corresponding to adjacent order statuses.
[0038] Optionally, order statuses include, but are not limited to, pending use, used, expired, cancelled, refunding, and refunded. The module determines the preceding order status (e.g., if the preceding order status was not pending use) and the subsequent order status (e.g., if the subsequent order status was not used). It then obtains the processing steps to change the pending use order to the used status, integrating all order status processing steps into a module capable of handling adjacent order statuses. After determining the preceding and subsequent order statuses among adjacent order statuses, it is also necessary to determine how to process the order in the preceding status into the subsequent status. This may involve different processing steps, such as order processing, review, and confirmation. These processing steps need to be determined based on the specific business logic and order status transition rules. Finally, integrating these processing steps forms a complete status processing module for handling orders corresponding to adjacent order statuses. In this way, order status transitions can be effectively managed, ensuring the smooth operation of the order processing flow.
[0039] Step S106: Update the database according to the processed order status.
[0040] In this step, the order status information processed by the status processing module queue is stored into the database in sequence, thereby updating the information in the database.
[0041] In one optional embodiment, updating the database based on the processed order status includes: updating the database sequentially based on the processed order status obtained by the multiple status processing modules in the order of the multiple status processing modules.
[0042] Optionally, when updating the database based on the processed order status, to ensure the order status in the database is up-to-date, it's necessary to update the database sequentially using the processed order statuses obtained from multiple status processing modules. For example, in some cases, if order status changes frequently, there might be repeated update requests for the same order's status among multiple pending requests. That is, there might be requests simultaneously changing an order from "pending use" to "used," then from "used" to "refund in progress," and then from "refund in progress" to "refunded," all of which are still waiting to be processed. In this case, the request to change from "pending use" to "used" will pass through one of the status processing modules, resulting in a processed order status of "used." Then, the remaining requests will sequentially pass through two other status processing modules, resulting in processed order statuses of "refund in progress" and "refunded," respectively. If the database updates are not performed in the processing order, it's possible for the order status in the database to be changed from "refunded" to "used," leading to inaccurate order statuses in the database.
[0043] Therefore, when updating the database, the processed order statuses obtained by the multiple status processing modules can be stored in the database according to the order in which multiple pending requests are processed by each status processing module, thereby updating the database.
[0044] In one optional embodiment, the database is updated sequentially according to the processed order status obtained by the multiple status processing modules, following the order sequence of the multiple status processing modules: updating the database according to the processed order status of the order corresponding to the first request output by the first status processing module; updating the database according to the processed order status output by the next status processing module, following the order sequence of the multiple status processing modules, until the database is updated according to the processed order status output by the last status processing module, and determining that the database update is complete.
[0045] Optionally, the data processing system updates and records the order status in the database sequentially according to the order of multiple status processing modules. First, the order of the multiple status processing modules can be determined, identifying the first status processing module. Second, based on the processed order status output by the first status processing module, the order information in the database is updated, specifically by performing database operations (such as insert, update, or delete). Next, following the order of the status processing modules, the processed order status output by the next status processing module is updated in the database, until all status processing modules have completed their processing.
[0046] Through this implementation, the data processing system can ensure that order status is correctly recorded and updated at each stage of processing, thereby achieving traceability and reliability in order management. Simultaneously, by updating the database at each stage, the system can avoid data inconsistencies during processing.
[0047] The process involves receiving multiple pending requests, each representing a request to update the corresponding order status in the database. These requests correspond to changes in the order status. Following a pre-determined queue of status processing modules, each module sequentially processes the requests to obtain the processed order status. Each module handles requests for orders with different status changes. Based on the processed order status, the database is updated, ensuring that all order status information is processed by the corresponding modules in the queue. This achieves lossless order status transfer, preventing order status loss under high concurrency, and solves the technical problems of request loss and untimely status updates caused by large data volumes in existing database order status processing.
[0048] Based on the above embodiments and optional embodiments, the present invention proposes an optional implementation method, such as... Figure 2 As shown,
[0049] Step S1: Obtain the predetermined order status change process, which includes multiple ordered order statuses; determine the adjacent order statuses among the multiple order statuses according to the order status change process; generate a status set corresponding to the adjacent order statuses, obtain multiple status sets, and sort the multiple status sets according to the order status change process to obtain a status set queue.
[0050] Optionally, order status includes, but is not limited to, pending use, used, expired, cancelled, refunding, and refunded. Order status processes include, but are not limited to, updating from pending use to used, requesting an update from used to cancelled, requesting an update from used to refunding, requesting an update from refunding to refunded, and updating from refunded to pending use. Based on the order change process, a status set (i.e., the status processing module) corresponding to adjacent order statuses is generated. The status sets are then sorted according to the order status change process to obtain a status set queue (i.e., the status processing module queue). Figure 2 State sets A, B, and C are arranged into a sequence of state sets according to the order status change process. The state sets include, but are not limited to, state sets A, B, and C.
[0051] The process of generating a state set corresponding to adjacent order states includes: determining the preceding and following order states among adjacent order states; obtaining processing steps to change the order in the preceding order state to the order in the following order state; and integrating these processing steps to obtain the state set corresponding to adjacent order states. Determining the preceding order state (e.g., if the preceding order state is "pending," and the following order state is "used," obtaining processing steps to change the order in the "pending" state to the "used" state, and integrating all order state processing steps to form a state set that can handle adjacent order states.
[0052] Step S2: Receive multiple pending requests that represent requests to update the status of corresponding orders in the database, wherein the status of the orders corresponding to the multiple pending requests has changed.
[0053] Optionally, the order status database contains multiple order status records. When an order status changes, it needs to be updated in real time. In this case, a status set queue consisting of status sets A, B, and C will receive multiple pending requests through the Kafka cluster. These requests represent requests to update the corresponding order status in the database. The Kafka cluster will send these unordered pending requests from the database to the status set queue. The Kafka platform is a high-performance, scalable, and reliable platform primarily used for building real-time data stream processing applications. It can handle large volumes of data streams and provides reliable message delivery and persistent storage. The Kafka platform also provides a series of tools to simplify the development and management of data stream processing. A Kafka cluster is a distributed messaging system composed of multiple Kafka platforms, which together form a highly available, high-performance message queue cluster capable of handling large-scale message data streams.
[0054] Step S3: According to the pre-determined state set queue, multiple state sets in the state set queue are used sequentially to process multiple pending requests to obtain the processed order status. Among them, multiple state sets are used to process requests corresponding to orders with different status changes.
[0055] Optionally, the pending requests are in an unordered state. Multiple pending requests in an unordered state are input into a state set queue through the Kafka cluster. The state set queue includes, but is not limited to, state set A, state set B, and state set C. State set A, state set B, and state set C process the pending requests corresponding to them. For example, state set A is the state set that updates from the pending state to the used state, state set B is the state set that updates from the used state to the refunding state, and state set C is the state set that updates from the refunding state to the refunded state. State set A processes pending requests that update from the pending state to the used state, state set B processes pending requests that update from the used state to the refunding state, and state set C processes pending requests that update from the refunding state to the refunded state.
[0056] Step S4: According to the order of multiple state sets, input multiple pending requests into the first state set, and process the first request corresponding to the order whose status has changed for the first time, to obtain the processed order status of the order corresponding to the first request; according to the order of multiple sets, input the unprocessed requests among the multiple pending requests into the next state set, until multiple state sets have processed multiple pending requests, to obtain the processed order status.
[0057] Optionally, the pending requests are in an unordered state. Multiple pending requests in an unordered state are input into a state set queue. The first state set, state set A, processes the requests corresponding to orders that have undergone the first change. For example, state set A is the state set that updates from the pending state to the used state, and the request corresponding to the order that has undergone the first change is the request that updates from the pending state to the used state. The remaining requests that have not been processed by state set A are input into state set B. State set B processes the requests corresponding to orders that have undergone the second change. For example, state set B is the state set that updates from the used state to the refund pending state, and the request corresponding to the order that has undergone the second change is the request that updates from the pending state to the used state. The corresponding request is to update from the used status to the refunding status. State set B processes the requests corresponding to the orders that have undergone the second change. The remaining requests that have not been processed by state sets A and B are input into state set C. State set C processes the requests corresponding to the orders that have undergone the third change. For example, state set C is the state set that updates from the refunding status to the refunded status. The request corresponding to the order that has undergone the third change is to update from the refunding status to the refunded status. State set C processes the requests corresponding to the orders that have undergone the third change until all pending requests have been processed by their corresponding state sets, and then the processed order status is obtained.
[0058] Step S5: Update the database sequentially based on the processed order status obtained from the multiple status sets, according to the order of the multiple status sets.
[0059] The first request corresponding to an order whose state has undergone a first change is processed by state set A to obtain the processed order state. For example, if the first request for an order whose state has undergone a first change is to update the order from a pending state to a used state, then the processed order state information is stored in the database, and the database DB is updated. The unprocessed order state then enters state set B. State set B then processes the second request corresponding to an order whose state has undergone a second change to obtain the processed order state. For example, the second request for an order whose state has undergone a second change... The request is to update an order from a "used" status to a "refund in progress" status. Order status information processed by status set B is stored in the database DB, and the database DB is updated. Similarly, order status information processed by status set C is stored in the database DB, and the database DB is updated. Requests not processed by status sets A, B, or C proceed to the next status set, until every pending request has been processed by its corresponding status set in the status set queue. All order status information processed by each status set is then stored in the database DB in the order it was processed by each status set, thus achieving real-time updates to the database DB.
[0060] The above optional implementation methods achieve at least the following effects: order status is transferred without loss, and order status is not discarded under high concurrency, solving the technical problems of request loss and untimely status updates caused by large data volume in the database processing of order status in the prior art.
[0061] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0062] This embodiment also provides a data processing apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the terms "module" and "apparatus" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0063] According to embodiments of the present invention, an apparatus embodiment for implementing a data processing method is also provided. Figure 3 A structural block diagram of a data processing apparatus according to an embodiment of the present invention is shown below. Figure 3 As shown, the above-mentioned data processing device includes a first receiving module 31, a processing module 32, and a first determining module 33. The device will be described below.
[0064] The first receiving module 31 is used to receive multiple pending requests that represent requests to update the status of corresponding orders in the database, wherein the status of the orders corresponding to the multiple pending requests has changed.
[0065] The processing module 32, connected to the first receiving module 31, is used to process multiple pending requests sequentially using multiple state processing modules in the state processing module queue according to a pre-determined state processing module queue, and obtain the processed order status. The multiple state processing modules process the requests corresponding to orders with different status changes.
[0066] The first determining module 33 is connected to the processing module 32 and is used to update the database based on the processed order status.
[0067] In a data processing device provided by this invention, multiple pending requests, each representing a request to update the corresponding order status in the database, are received. These pending requests correspond to changes in the status of the orders. Following a pre-determined queue of status processing modules, multiple status processing modules in the queue process each pending request sequentially to obtain the processed order status. Each status processing module processes requests corresponding to orders with different status changes. Based on the processed order status, the database is updated, ensuring that all order status information can be processed by the corresponding status processing modules in the queue. This achieves lossless order status transfer and prevents order status loss under high concurrency, thus solving the technical problems of request loss and untimely status updates caused by large data volumes in existing database order status processing.
[0068] It should be noted that the above modules can be implemented by software or hardware. For example, for the latter, it can be implemented in the following ways: the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0069] It should be noted that the first receiving module 31, processing module 32, and first determining module 33 mentioned above correspond to steps S102 to S106 in the embodiments. The instances and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the content disclosed in the above embodiments. It should be noted that the above modules, as part of the device, can run in a computer terminal.
[0070] It should be noted that the optional or preferred implementation methods of this embodiment can be found in the relevant descriptions in the embodiments, and will not be repeated here.
[0071] The aforementioned data processing device may further include a processor and a memory. The first receiving module 31, the processing module 32, the first determining module 33, etc., are all stored in the memory as program modules, and the processor executes the aforementioned program modules stored in the memory to realize the corresponding functions.
[0072] The processor contains a kernel that retrieves the corresponding program modules from memory. One or more kernels may be configured. Memory may include non-persistent memory in computer-readable media, random access memory (RAM), and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory includes at least one memory chip.
[0073] This invention provides a non-volatile storage medium storing a program that, when executed by a processor, implements a data processing method.
[0074] like Figure 4 As shown, this embodiment of the invention provides an electronic device. The electronic device 10 includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps: the memory is used to store the computer program, wherein when the computer program is executed by the processor, the processor performs the above-mentioned data processing method. The device in this article may be a server, PC, etc.
[0075] The present invention also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having the following method steps: computer instructions are executed by a processor using the above-described data processing method.
[0076] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, 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.
[0077] This invention is described with reference to flowchart illustrations of methods, apparatus, and computer program products according to embodiments of the invention. It will be understood that each step in the flowchart and combinations thereof 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 device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, generate instructions for implementing the processes... Figure 1 A device for a function specified in one or more processes.
[0078] 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 The function specified in one or more processes.
[0079] 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 Steps of a specified function in one or more processes.
[0080] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0081] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0082] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media 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, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0083] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0084] 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.
[0085] The above are merely embodiments of the present invention and are not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of the claims of the present invention.
Claims
1. A data processing method, characterized in that, include: Receive multiple pending requests, each representing a request to update the status of a corresponding order in the database, wherein the status of the orders corresponding to the multiple pending requests has changed; According to the pre-determined queue of state processing modules, multiple state processing modules in the queue are used sequentially to process the multiple requests to be processed, and the processed order status is obtained. The multiple state processing modules process the requests corresponding to orders with different status changes. The database is updated based on the processed order status; The step of sequentially using multiple state processing modules in a pre-determined state processing module queue to process multiple pending requests and obtain a processed order status includes: determining the order of the multiple state processing modules in the state processing module queue; inputting the multiple pending requests into the first state processing module according to the order, whereby the first state processing module processes the first request corresponding to the order whose status has undergone a first change, to obtain the processed order status of the order corresponding to the first request; and inputting unprocessed requests from the multiple pending requests into the next state processing module according to the order, until all multiple state processing modules have processed the multiple pending requests to obtain the processed order status. The step of updating the database based on the processed order status includes: updating the database sequentially according to the processed order status obtained by the plurality of status processing modules in the order of the plurality of status processing modules.
2. The method according to claim 1, characterized in that, The step of updating the database sequentially according to the processed order status obtained by the plurality of status processing modules, in the order of the plurality of status processing modules, includes: According to the order of the plurality of status processing modules, the database is updated according to the order status after processing of the first request corresponding to the first request output by the first status processing module; According to the order of the multiple status processing modules, the database is updated according to the processed order status output by the next status processing module, until the database is updated according to the processed order status output by the last status processing module, and the database update is determined to be complete.
3. The method according to any one of claims 1 to 2, characterized in that, The state processing module queue is generated in the following manner: Obtain a predetermined order status change process, wherein the order status change process includes multiple ordered order statuses; Based on the order status change process, determine adjacent order statuses among the multiple order statuses; Generate a status processing module corresponding to the adjacent order status, thus obtaining the plurality of status processing modules; According to the order status change process, the multiple status processing modules are sorted to obtain the status processing module queue.
4. The method according to claim 3, characterized in that, The status processing module that generates the status corresponding to the adjacent order status includes: Determine the earlier and later order states among the adjacent order states; The processing step of acquiring orders that are in the earlier order status and processing them into orders that are in the later order status; The processing steps are integrated to obtain the status processing module corresponding to the adjacent order status.
5. A data processing apparatus, characterized in that, include: The first receiving module is used to receive multiple pending requests that represent requests to update the status of corresponding orders in the database, wherein the status of the orders corresponding to the multiple pending requests has changed; The processing module is used to process the multiple pending requests sequentially using multiple state processing modules in the pre-determined state processing module queue to obtain the processed order status. The multiple state processing modules process the requests corresponding to orders with different status changes. The first determining module is used to update the database based on the processed order status; The processing module is further configured to determine the order of the plurality of state processing modules in the state processing module queue; according to the order of the plurality of state processing modules, input the plurality of pending requests into the first state processing module, and the first state processing module processes the first request corresponding to the order whose state has undergone a first change, to obtain the processed order state of the order corresponding to the first request; according to the order of the plurality of state processing modules, input the unprocessed requests among the plurality of pending requests into the next state processing module, until all the plurality of state processing modules have processed the plurality of pending requests, to obtain the processed order state; The first determining module is further configured to update the database sequentially according to the processed order status obtained by the plurality of status processing modules, following the order of the plurality of status processing modules.
6. A non-volatile storage medium, characterized in that, The non-volatile storage medium stores multiple instructions adapted to be loaded and executed by a processor to implement the data processing method according to any one of claims 1 to 4.
7. An electronic device comprising a processor and a memory, characterized in that, The memory is used to store a computer program, wherein when the computer program is executed by the processor, the processor causes the processor to implement the data processing method according to any one of claims 1 to 4.
8. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the data processing method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Order processing method and related device
CN117114814A
Real-time processing of event-based streaming with nosql databases
US20200175018A1
