A method and system for managing special car order data by database and table partitioning

Through the setting and hashing operation of passenger and driver order mapping tables, the problem of managing online car-hailing special car order data database and table sub-table management is solved, ensuring the search and query efficiency of both drivers and passengers.

CN114493799BActive Publication Date: 2025-07-18广州宸祺出行科技有限公司
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210141650.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-16
Publication Date
2025-07-18
Estimated Expiration
2042-02-16

AI Technical Summary

Technical Problem

The traditional single node single library form is difficult to support the business development of online car-hailing special car order data, especially due to the access needs of both drivers and passengers, the database and table management is difficult.

Method used

By setting up a passenger order mapping table and a driver order mapping table, the passenger code and driver code are mapped with the order number list, and the target node number is determined using hash calculation and modulo operation to realize the database and table management of the special vehicle order data.

Benefits of technology

It is realized that under the situation of dividing databases and tables, both drivers and passengers can still successfully retrieve special vehicle order data, avoiding restrictions on traditional single database management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114493799B_ABST
    Figure CN114493799B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for managing special car order data by database sharding and table partitioning. The method includes: receiving special car order data; querying the passenger order mapping table to index to the list of order numbers corresponding to the passenger code therein; after establishing a mapping between the order number corresponding to the special car order and the passenger code, appending the order number to the list of order numbers in the passenger order mapping table; performing modulo operation based on the number of nodes to obtain the target node number, writing the special car order data to the target node corresponding to the target node number, and dispatching orders; obtaining the information of the driver who accepts the order, querying the special car driver order mapping table to index to the list of order numbers corresponding to the driver code therein; after establishing a mapping between the special car order and the driver code, appending the order number corresponding to the special car order to the list of order numbers in the driver order mapping table; obtaining a retrieval request for the special car order data and performing retrieval based on the corresponding passenger code or driver code.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of special car order dispatching methods, and particularly to a method and system for managing special car order data by database sharding and table partitioning. Background Art

[0002] Online reservation taxi operation service, that is, online car-hailing, is a timely and convenient travel service method, and is accepted and promoted by people with the development of online car-hailing. Among them, special car orders of online car-hailing are one type of online car-hailing orders. With the growth of special car orders in the online car-hailing platform, the form of single-node single-database used in traditional special car order data management has been difficult to support business development. However, special car orders of online car-hailing have special properties. Since the driver and passenger need to access the same order, it is difficult to perform database sharding and table partitioning when storing special car orders in order to meet the retrieval and access requirements of both the driver and passenger.

[0003] Therefore, in order to support the business development needs of special car orders, it is urgent to invent a method that can overcome the difficulty of database sharding and table partitioning and apply the storage management method of database sharding and table partitioning to special car order management without affecting the normal access of both the driver and passenger. Summary of the Invention

[0004] In order to overcome the technical defect that the single-node single-database used in the existing special car orders is difficult to support business development, the present invention provides a method and system for managing special car order data by database sharding and table partitioning.

[0005] To solve the above problems, the present invention is implemented according to the following technical solutions:

[0006] In a first aspect, the present invention discloses a method for managing special car order data by database sharding and table partitioning, including the following steps:

[0007] Receive special car order data, and obtain the corresponding order number and passenger code;

[0008] Query the passenger order mapping table, and index to the list of order numbers corresponding to the passenger code therein;

[0009] After establishing a mapping between the order number corresponding to the special car order and the passenger code, append the order number to the list of order numbers in the passenger order mapping table;

[0010] Perform modulo operation based on the number of nodes to obtain the target node number, write the special car order data into the target node corresponding to the target node number, and perform order dispatching;

[0011] Obtain the information of the driver who accepts the order, query the special car driver order mapping table, and index to the list of order numbers corresponding to the driver code therein;

[0012] After establishing the mapping between the dedicated car order and the driver code, append the order number corresponding to the dedicated car order to the order number list in the driver order mapping table;

[0013] Obtain the retrieval request for the dedicated car order data, retrieve from the passenger order mapping table or the driver order mapping table based on the corresponding passenger code or driver code, obtain the target node number after comparison, and output the dedicated car order data from the target node corresponding to the target node number.

[0014] Combined with the first aspect, provide the first preferred implementation manner. The modulo operation based on the number of nodes to obtain the node number specifically includes:

[0015] Perform a hash calculation on the order number corresponding to the dedicated car order to obtain a uniquely corresponding hash value, obtain the node information, where the node information includes the total number of nodes and the node numbers corresponding to the nodes, and then perform a modulo operation based on the hash value and the total number of nodes to select the target node number, and then select the target node;

[0016] The calculation formula for the modulo operation is p = h % n, where p is the target node number, h is the hash value, and n is the total number of nodes. Select the remainder obtained after dividing the hash value by the total number of nodes as the target node number.

[0017] Combined with the first aspect, provide the second preferred implementation manner. The retrieval from the passenger order mapping table or the driver order mapping table, obtaining the node number after comparison, and outputting the dedicated car order data from the node corresponding to the node number specifically includes:

[0018] Obtain the retrieval request for the dedicated car order data, obtain the passenger number or driver number from the retrieval request to determine the retrieval request source, query the corresponding passenger order mapping table or driver order mapping table based on the type of the retrieval request source, index to the order number list corresponding to the passenger number or driver number in the passenger order mapping table or the driver order mapping table, and perform a hash calculation on the order numbers in the order number list in sequence to obtain the hash values corresponding to the order numbers respectively, obtain the total number of nodes, perform a modulo operation based on the hash value and the total number of nodes to obtain the target node number, and then obtain the dedicated car order data from the target node;

[0019] The calculation formula for the modulo operation is p = h % n.

[0020] Combined with the first aspect, provide the third preferred implementation manner. After receiving the dedicated car order data and obtaining the corresponding order number and passenger code, it further includes:

[0021] Judge whether there is a passenger code corresponding to the dedicated car order in the passenger order mapping table;

[0022] If it exists, execute querying the passenger order mapping table;

[0023] If not, establish a mapping between the passenger code and the order number, create an order number list based on the passenger code in the passenger order mapping table, and add the order number to the order number list.

[0024] Combined with the first aspect, the 4th preferred implementation manner is provided. After obtaining the information of the driver who takes the order, it further includes:

[0025] Judge whether there is a driver code corresponding to the driver who takes the order in the driver order mapping table;

[0026] If it exists, execute querying the driver order mapping table;

[0027] If not, establish a mapping between the driver code and the order number, create an order number list based on the driver code in the driver order mapping table, and add the order number to the order number list.

[0028] In the second aspect, the present invention discloses a system for managing special car order data by database sharding and table partitioning, including an order receiving module, a passenger query module, a passenger mapping module, a dispatching operation module, a driver query module, a driver mapping module, and an order retrieval module, where:

[0029] The order receiving module is used to receive special car order data and obtain the corresponding order number and passenger code;

[0030] The passenger query module is used to query the passenger order mapping table and index to the order number list corresponding to the passenger code therein;

[0031] The passenger mapping module is used to establish a mapping between the order number corresponding to the special car order and the passenger code, and then append the order number to the order number list in the passenger order mapping table;

[0032] The dispatching operation module is used to perform modulo operation based on the number of nodes to obtain the target node number, write the special car order data into the target node corresponding to the target node number, and perform dispatching;

[0033] The driver query module is used to obtain the information of the driver who takes the order, query the special car driver order mapping table, and index to the order number list corresponding to the driver code therein;

[0034] The driver mapping module is used to establish a mapping between the special car order and the driver code, and then append the order number corresponding to the special car order to the order number list in the driver order mapping table;

[0035] The order retrieval module is used to obtain the retrieval request of the special car order data, retrieve from the passenger order mapping table or the driver order mapping table based on the corresponding passenger code or driver code, obtain the target node number after comparison, and output the special car order data from the target node corresponding to the target node number.

[0036] Providing the first preferred implementation manner in combination with the second aspect, when the order assignment operation module runs, it specifically executes:

[0037] Perform a hash calculation on the order number corresponding to the dedicated car order to obtain a uniquely corresponding hash value, obtain node information, where the node information includes the total number of nodes and the node numbers corresponding to the nodes, and then perform a modulo operation based on the hash value and the total number of nodes to select the target node number, and then select the target node;

[0038] The calculation formula of the modulo operation is p = h % n, where p is the target node number, h is the hash value, and n is the total number of nodes, and the remainder obtained after dividing the hash value by the total number of nodes is selected as the target node number.

[0039] Providing the second preferred implementation manner in combination with the second aspect, when the order retrieval module runs, it specifically executes:

[0040] Obtain the retrieval request for the dedicated car order data, obtain the passenger number or driver number from the retrieval request to determine the retrieval request source, query the corresponding passenger order mapping table or driver order mapping table based on the type of the retrieval request source, index to the order number list corresponding to the passenger number or driver number in the passenger order mapping table or driver order mapping table, and perform a hash calculation on the order numbers in the order number list in sequence to respectively obtain the hash values corresponding to the order numbers, obtain the total number of nodes, perform a modulo operation based on the hash value and the total number of nodes to obtain the target node number, and then obtain the dedicated car order data from the target node;

[0041] The calculation formula of the modulo operation is p = h % n.

[0042] Providing the third preferred implementation manner in combination with the second aspect, in the order receiving module, it further includes:

[0043] A passenger history query unit, which is used to judge whether there is a passenger code corresponding to the dedicated car order in the passenger order mapping table;

[0044] If it exists, execute querying the passenger order mapping table;

[0045] If it does not exist, establish a mapping between the passenger code and the order number, establish an order number list based on the passenger code in the passenger order mapping table, and add the order number to the order number list.

[0046] Providing the fourth preferred implementation manner in combination with the second aspect, in the driver query module, it further includes:

[0047] A driver history query unit, which is used to judge whether there is a driver code corresponding to the driver who takes the order in the driver order mapping table;

[0048] If it exists, execute querying the driver order mapping table;

[0049] If it does not exist, a mapping is established between the driver code and the order number, and an order number list is established based on the driver code in the driver-order mapping table, and the order number is added to the order number list.

[0050] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0051] 1. By setting up a passenger-order mapping table and a driver-order mapping table, the present invention maps the passenger code and the driver code to the order number list respectively, so as to apply the multi-field database and table partitioning to the management of the dedicated car orders. The dedicated car order data only needs to be simply partitioned by the order number and then appended to the corresponding order number lists in the passenger-order mapping table or the driver-order mapping table respectively.

[0052] 2. In the present invention, the target node number corresponding to the target node storing the dedicated car order data is obtained by performing a modulo operation on the order number and the total number of nodes. The target node number and the order number are uniquely corresponding, so that the dedicated car order data can be managed by database and table partitioning.

[0053] 3. When it is necessary to query and retrieve the dedicated car order data, only by the passenger number or the driver number, find the corresponding order number list in the corresponding passenger-order mapping table or driver-order mapping table, then obtain the target node number in reverse through the order number respectively, and then obtain the dedicated car order data to be queried from the target node, so as to realize that the retrieval and query of the dedicated car order data by both the driver and the passenger are not affected under the condition of managing the dedicated car order by database and table partitioning. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] The following further elaborates in detail the specific implementation manners of the present invention with reference to the drawings, where:

[0055] Figure 1 is a flowchart showing the method for managing dedicated car order data by database and table partitioning of the present invention;

[0056] Figure 2 is a schematic diagram of the system for managing dedicated car order data by database and table partitioning of the present invention; DETAILED DESCRIPTION OF THE INVENTION

[0057] The preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure will be more thorough and complete, and can fully convey the scope of the present disclosure to those skilled in the art.

[0058] As used herein, the term "including" and its variations mean open inclusion, i.e., "including but not limited to". Unless otherwise specified, the term "or" means "and / or". The term "based on" means "at least partially based on". The terms "an example embodiment" and "an embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc. may refer to different or the same objects. There may also be other explicit and implicit definitions hereinafter.

[0059] The access device and the server can be directly or indirectly connected through wired or wireless communication means. The access device can be a terminal or a server. A target application is running on the access device. The target application is an application program capable of initiating a data request to the server, such as a social application, a payment application, a game application, etc. The server can be an application server providing services for the target application or a proxy server different from the application server corresponding to the target application. The server is used to identify whether each access device belongs to a malicious device and intercept data packets from malicious devices. When the server is a proxy server, the proxy server forwards data packets that do not come from malicious devices to the application server. The terminal can specifically be a desktop terminal or a mobile terminal. The mobile terminal can specifically be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The server and the server can respectively be independent physical servers, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0060] Embodiment 1

[0061] As Figure 1 shown, in a first aspect, the present invention discloses a method for managing special car order data by database sharding and table partitioning, including the following steps:

[0062] Step S1: Receive special car order data and obtain the corresponding order number and passenger code.

[0063] Specifically, the server receives special car order data from the passenger side, numbers the special car order to obtain the order number corresponding to the special car order, and analyzes and obtains the passenger number uniquely corresponding to the passenger from the special car order data.

[0064] Preferably, it further includes step S11: Determine whether there is a passenger code corresponding to the special car order in the passenger order mapping table;

[0065] If it exists, execute querying the passenger order mapping table;

[0066] If not, establish a mapping between the passenger code and the order number, create a list of order numbers based on the passenger code in the passenger order mapping table, and add the order number to the list of order numbers.

[0067] Step S2: Query the passenger order mapping table and index to the list of order numbers corresponding to the passenger code therein.

[0068] Specifically, the server queries from the passenger order mapping table based on the passenger code and indexes to the list of order numbers mapped to the passenger code to complete the preparation for order number mapping and appending.

[0069] Step S3: After establishing a mapping between the order number corresponding to the dedicated car order and the passenger code, append the order number to the list of order numbers in the passenger order mapping table.

[0070] Step S4: Perform a modulo operation based on the number of nodes to obtain the target node number, write the dedicated car order data to the target node corresponding to the target node number, and dispatch the order.

[0071] Specifically, before storing the dedicated car order data, the server needs to select a suitable node, and for the convenience of retrieval and query, the nodes need to be numbered. In this embodiment, preferably, when the server selects a node, it performs a hash calculation on the order number corresponding to the dedicated car order to obtain a uniquely corresponding hash value, obtains node information, where the node information includes the total number of nodes and the node numbers corresponding to the nodes, and then performs a modulo operation based on the hash value and the total number of nodes to select the target node number, and then selects the target node;

[0072] Specifically, the calculation formula of the modulo operation is p = h % n, where p is the target node number, h is the hash value, and n is the total number of nodes, and the remainder obtained after dividing the hash value by the total number of nodes is selected as the target node number. The hash value corresponds uniquely to the order number, making it accurate and efficient to query the order number by comparing the hash value in reverse.

[0073] Step S5: Obtain the information of the driver who accepts the order, query the dedicated car driver order mapping table, and index to the list of order numbers corresponding to the driver code therein.

[0074] Specifically, after the driver accepts the order, the server obtains the information of the driver who accepts the order from the driver terminal, and the information of the driver who accepts the order includes the driver number. Then, it queries through the driver number in the driver order mapping table, so as to index to the list of order numbers corresponding to the driver code to complete the preparation for order appending.

[0075] Preferably, it further includes step S51: Combining the 4th preferred implementation manner provided in the first aspect, after obtaining the information of the driver who accepts the order, it further includes:

[0076] Determine whether there is a driver code corresponding to the driver who accepts the order in the driver-order mapping table;

[0077] If it exists, execute the query of the driver-order mapping table;

[0078] If it does not exist, establish a mapping between the driver code and the order number, create an order number list based on the driver code in the driver-order mapping table, and add the order number to the order number list.

[0079] Step S6: After establishing a mapping between the dedicated car order and the driver code, append the order number corresponding to the dedicated car order to the order number list in the driver-order mapping table.

[0080] Step S7: Obtain a retrieval request for dedicated car order data, retrieve from the passenger-order mapping table or the driver-order mapping table based on the corresponding passenger code or driver code, obtain the target node number after comparison, and output the dedicated car order data from the target node corresponding to the target node number.

[0081] Obtain a retrieval request for dedicated car order data, obtain the passenger number or driver number from the retrieval request to determine the retrieval request source, query the corresponding passenger-order mapping table or driver-order mapping table based on the type of the retrieval request source, index to the order number list corresponding to the passenger number or driver number in the passenger-order mapping table or the driver-order mapping table, and perform a hash calculation on the order numbers in the order number list in sequence to obtain the hash values corresponding to the order numbers respectively, obtain the total number of nodes, perform a modulo operation based on the hash value and the total number of nodes to obtain the target node number, and then obtain the dedicated car order data from the target node; where the calculation formula of the modulo operation is p = h % n.

[0082] Since when selecting the target node, a modulo operation is performed using the hash value uniquely corresponding to the order number and the fixed total number of nodes to obtain the target node number, so that during retrieval, only by knowing the order number, the reverse calculation can be realized, thereby obtaining the target node number, and then realizing the efficient and accurate acquisition of the dedicated car order data from the target node, so that the driver and the passenger can still smoothly perform the retrieval and query of the dedicated car order data under the condition of sharding and table partitioning management.

[0083] In summary, the present invention realizes the application of multi-field database sharding and table partitioning to the management of special car orders by setting up a passenger order mapping table and a driver order mapping table, which respectively map passenger codes and driver codes to a list of order numbers. The special car order data only needs to be simply sharded and partitioned by the order number, and then appended to the corresponding list of order numbers in the passenger order mapping table or the driver order mapping table. Moreover, the target node number corresponding to the target node storing the special car order data in the present invention is obtained by performing a modulo operation on the order number and the total number of nodes. The target node number corresponds uniquely to the order number, so that the special car order data can be managed through database sharding and table partitioning. In addition, when querying and retrieving special car order data, only by using the passenger number or the driver number, find the corresponding list of order numbers in the corresponding passenger order mapping table or driver order mapping table, then inversely obtain the target node number through the order number, and then obtain the special car order data to be queried from the target node, thus realizing that the retrieval and query of special car order data by both the driver and the passenger are not affected under the condition of managing special car orders through database sharding and table partitioning.

[0084] For other steps of the method for managing special car order data through database sharding and table partitioning described in this embodiment, refer to the prior art.

[0085] Embodiment 2

[0086] As Figure 2 shown, in the second aspect, the present invention discloses a system for managing special car order data through database sharding and table partitioning, including an order receiving module M1, a passenger query module M2, a passenger mapping module M3, a dispatching operation module M4, a driver query module M5, a driver mapping module M6, and an order retrieval module M7, where:

[0087] The order receiving module M1 is used to receive special car order data and obtain the corresponding order number and passenger code;

[0088] The passenger query module M2 is used to query the passenger order mapping table and index to the list of order numbers corresponding to the passenger code therein;

[0089] The passenger mapping module M3 is used to establish a mapping between the order number corresponding to the special car order and the passenger code, and then append the order number to the list of order numbers in the passenger order mapping table;

[0090] The dispatching operation module M4 is used to perform a modulo operation based on the number of nodes to obtain the target node number, write the special car order data into the target node corresponding to the target node number, and perform dispatching;

[0091] The driver query module M5 is used to obtain the information of the receiving driver, query the special car driver order mapping table, and index to the list of order numbers corresponding to the driver code therein;

[0092] The driver mapping module M6 is used to establish a mapping between the dedicated car order and the driver code, and then append the order number corresponding to the dedicated car order to the order number list in the driver-order mapping table;

[0093] The order retrieval module M7 is used to obtain the retrieval request for the dedicated car order data, retrieve from the passenger-order mapping table or the driver-order mapping table based on the corresponding passenger code or driver code, obtain the target node number after comparison, and output the dedicated car order data from the target node corresponding to the target node number.

[0094] As a preferred implementation, when the dispatching operation module M4 runs, it specifically executes:

[0095] Perform a hash calculation on the order number corresponding to the dedicated car order to obtain a uniquely corresponding hash value, obtain node information, where the node information includes the total number of nodes and the node numbers corresponding to the nodes, and then perform a modulo operation based on the hash value and the total number of nodes to select the target node number, and then select the target node;

[0096] The calculation formula of the modulo operation is p = h % n, where p is the target node number, h is the hash value, and n is the total number of nodes, and the remainder obtained after dividing the hash value by the total number of nodes is selected as the target node number.

[0097] When the order retrieval module M7 runs, it specifically executes:

[0098] Obtain the retrieval request for the dedicated car order data, obtain the passenger number or driver number from the retrieval request to determine the retrieval request source, query the corresponding passenger-order mapping table or driver-order mapping table based on the type of the retrieval request source, index to the order number list corresponding to the passenger number or driver number in the passenger-order mapping table or driver-order mapping table, and perform a hash calculation on the order numbers in the order number list in turn to obtain the hash values corresponding to the order numbers respectively, obtain the total number of nodes, perform a modulo operation based on the hash value and the total number of nodes to obtain the target node number, and then obtain the dedicated car order data from the target node; the calculation formula of the modulo operation is p = h % n.

[0099] In the order receiving module M1, it further includes: a passenger history query unit, which is used to judge whether there is a passenger code corresponding to the dedicated car order in the passenger-order mapping table;

[0100] If it exists, execute querying the passenger-order mapping table;

[0101] If it does not exist, establish a mapping between the passenger code and the order number, establish an order number list based on the passenger code in the passenger-order mapping table, and add the order number to the order number list.

[0102] In the driver query module M5, it further includes: a driver history query unit, which is used to determine whether there is a driver code corresponding to the order-taking driver in the driver order mapping table;

[0103] If it exists, execute querying the driver order mapping table;

[0104] If it does not exist, establish a mapping between the driver code and the order number, create an order number list based on the driver code in the driver order mapping table, and add the order number to the order number list.

[0105] In summary, when the system for managing special car order data by database sharding and table partitioning described in this embodiment runs, it can execute all steps of the method for managing special car order data by database sharding and table partitioning described in Embodiment 1, thereby realizing the management of special car orders by database sharding and table partitioning.

[0106] For other structures of the system for managing special car order data by database sharding and table partitioning described in this embodiment, refer to the prior art.

[0107] Embodiment 3

[0108] The present invention also discloses an electronic device, at least one processor, and a memory communicatively connected to the at least one processor. Among them, the memory stores instructions executable by the at least one processor. When the instructions are executed by the at least one processor, the following steps are specifically implemented: receiving special car order data, obtaining the corresponding order number and passenger code; querying the passenger order mapping table to index to the order number list corresponding to the passenger code therein; after establishing a mapping between the order number corresponding to the special car order and the passenger code, appending the order number to the order number list in the passenger order mapping table; performing modulo operation based on the number of nodes to obtain the target node number, writing the special car order data to the target node corresponding to the target node number, and dispatching the order; obtaining the information of the order-taking driver, querying the special car driver order mapping table to index to the order number list corresponding to the driver code therein; after establishing a mapping between the special car order and the driver code, appending the order number corresponding to the special car order to the order number list in the driver order mapping table; obtaining a retrieval request for the special car order data, retrieving from the passenger order mapping table or the driver order mapping table based on the corresponding passenger code or driver code, obtaining the target node number after comparison, and outputting the special car order data from the target node corresponding to the target node number.

[0109] Embodiment 4

[0110] The present invention also discloses a storage medium storing a computer program, which when executed by a processor, specifically implements the following steps: receiving car-hailing order data, obtaining the corresponding order number and passenger code; querying the passenger order mapping table to index to the order number list corresponding to the passenger code therein; after establishing a mapping between the order number corresponding to the car-hailing order and the passenger code, appending the order number to the order number list in the passenger order mapping table; performing modulo operation based on the number of nodes to obtain a target node number, writing the car-hailing order data to the target node corresponding to the target node number, and dispatching orders; obtaining the information of the driver who accepts the order, querying the car-hailing driver order mapping table to index to the order number list corresponding to the driver code therein; after establishing a mapping between the car-hailing order and the driver code, appending the order number corresponding to the car-hailing order to the order number list in the driver order mapping table; obtaining a retrieval request for the car-hailing order data, retrieving from the passenger order mapping table or the driver order mapping table based on the corresponding passenger code or driver code, obtaining the target node number after comparison, and outputting the car-hailing order data from the target node corresponding to the target node number.

[0111] The present disclosure may be a method, apparatus, system, and / or computer program product. The computer program product may include a computer-readable storage medium having thereon computer-readable program instructions for performing various aspects of the present disclosure.

[0112] A computer-readable storage medium may be a tangible device that can retain and store instructions for use by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punched card or raised structures in grooves storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage medium used herein is not construed as an instantaneous signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated through a waveguide or other transmission medium (e.g., an optical pulse through an optical fiber cable), or an electrical signal transmitted through a wire.

[0113] The computer-readable program instructions described herein can be downloaded to various computing / processing devices from a computer-readable storage medium or downloaded to an external computer or an external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network may include copper transmission cables, optical fiber transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing / processing device.

[0114] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state-setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, Java, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, by using the state information of the computer-readable program instructions to customize an electronic circuit, such as a programmable logic circuit, a field-programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit can execute the computer-readable program instructions to implement various aspects of the present disclosure.

[0115] Aspects of the present disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It should 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-readable program instructions.

[0116] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that the instructions, when executed by the processing unit of the computer or other programmable data processing apparatus, create means for implementing the functions / acts specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions may also be stored in a computer-readable storage medium that causes a computer, a programmable data processing apparatus, and / or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises a manufacture including instructions for implementing various aspects of the functions / acts specified in one or more blocks of the flowchart and / or block diagram.

[0117] The computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other devices to produce a computer-implemented process such that the instructions executed on the computer, other programmable data processing apparatus, or other devices implement the functions / acts specified in one or more blocks of the flowchart and / or block diagram.

[0118] The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of code, or a portion of an instruction, and the above-mentioned module, segment of code, or portion of an instruction contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two consecutive blocks may in fact be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or acts, or by a combination of dedicated hardware and computer instructions.

[0119] The various embodiments of the present disclosure have been described above. The above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, the practical application, or the improvement of technologies in the market, or to enable other ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A method for managing special car order data by database and table partitioning, characterized in that, Including the following steps: Receiving special car order data, and obtaining the corresponding order number and passenger code; Querying the passenger order mapping table, and indexing to the order number list corresponding to the passenger code therein; After establishing a mapping between the order number corresponding to the special car order and the passenger code, appending the order number to the order number list in the passenger order mapping table; Performing modulo operation based on the number of nodes to obtain the target node number, writing the special car order data to the target node corresponding to the target node number, and dispatching orders; Obtaining the information of the driver who accepts the order, querying the special car driver order mapping table, and indexing to the order number list corresponding to the driver code therein; After establishing a mapping between the special car order and the driver code, appending the order number corresponding to the special car order to the order number list in the driver order mapping table; Obtaining a retrieval request for the special car order data, retrieving from the passenger order mapping table or the driver order mapping table based on the corresponding passenger code or driver code, obtaining the target node number after comparison, and outputting the special car order data from the target node corresponding to the target node number; The performing modulo operation based on the number of nodes to obtain the node number specifically includes: Performing hash calculation on the order number corresponding to the special car order to obtain a uniquely corresponding hash value, obtaining node information, where the node information includes the total number of nodes and the node numbers corresponding to the nodes, and then performing modulo operation based on the hash value and the total number of nodes to select the target node number, and further selecting the target node; The calculation formula of the modulo operation is p = h % n, where p is the target node number, h is the hash value, and n is the total number of nodes, and the remainder obtained after dividing the hash value by the total number of nodes is selected as the target node number; The retrieving from the passenger order mapping table or the driver order mapping table, obtaining the node number after comparison, and outputting the special car order data from the node corresponding to the node number specifically includes: Obtaining a retrieval request for the special car order data, obtaining the passenger number or driver number from the retrieval request to determine the retrieval request source, querying the corresponding passenger order mapping table or driver order mapping table based on the type of the retrieval request source, indexing to the order number list corresponding to the passenger number or driver number in the passenger order mapping table or the driver order mapping table, and sequentially performing hash calculation on the order numbers in the order number list to respectively obtain the hash values corresponding to the order numbers, obtaining the total number of nodes, performing modulo operation based on the hash value and the total number of nodes to obtain the target node number, and further obtaining the special car order data from the target node; The calculation formula of the modulo operation is p = h % n; When it is necessary to query and retrieve the special car order data, only by using the passenger number or driver number, finding the corresponding order number list in the corresponding passenger order mapping table or driver order mapping table, then respectively obtaining the target node number in reverse through the order number, and then obtaining the special car order data to be queried from the target node, so as to realize that the retrieval and query of the special car order data by both the driver and the passenger are not affected under the condition of managing the special car order by database sharding and table partitioning.

2. The method for managing special car order data by database and table partitioning according to claim 1, characterized in that, After receiving the special car order data and obtaining the corresponding order number and passenger code, it further includes: Judging whether there is a passenger code corresponding to the special car order in the passenger order mapping table; If it exists, execute the query of the passenger order mapping table; If it does not exist, establish a mapping between the passenger code and the order number, create an order number list based on the passenger code in the passenger order mapping table, and add the order number to the order number list.

3. The method for managing special car order data by database and table partitioning according to claim 2, characterized in that, After obtaining the information of the driver who accepts the order, it further includes: Judge whether there is a driver code corresponding to the driver who accepts the order in the driver order mapping table; If it exists, execute the query of the driver order mapping table; If it does not exist, establish a mapping between the driver code and the order number, create an order number list based on the driver code in the driver order mapping table, and add the order number to the order number list.

4. A system for managing special car order data by database and table partitioning, characterized in that, It includes an order receiving module, a passenger query module, a passenger mapping module, a dispatching operation module, a driver query module, a driver mapping module, and an order retrieval module, where: The order receiving module is used to receive the special car order data and obtain the corresponding order number and passenger code; The passenger query module is used to query the passenger order mapping table and index to the order number list corresponding to the passenger code therein; The passenger mapping module is used to establish a mapping between the order number corresponding to the special car order and the passenger code, and then append the order number to the order number list in the passenger order mapping table; The dispatching operation module is used to perform modulo operation based on the number of nodes to obtain the target node number, write the special car order data to the target node corresponding to the target node number, and perform dispatching; The driver query module is used to obtain the information of the driver who accepts the order, query the special car driver order mapping table, and index to the order number list corresponding to the driver code therein; The driver mapping module is used to establish a mapping between the special car order and the driver code, and then append the order number corresponding to the special car order to the order number list in the driver order mapping table; The order retrieval module is used to obtain the retrieval request of the special car order data, retrieve from the passenger order mapping table or the driver order mapping table based on the corresponding passenger code or driver code, compare to obtain the target node number, and output the special car order data from the target node corresponding to the target node number; When the dispatching operation module is running, it specifically executes: Perform a hash calculation on the order number corresponding to the special car order to obtain a uniquely corresponding hash value, obtain node information, where the node information includes the total number of nodes and the node numbers corresponding to the nodes, and then perform a modulo operation based on the hash value and the total number of nodes to select the target node number, and then select the target node; The calculation formula of the modulo operation is p = h % n, where p is the target node number, h is the hash value, and n is the total number of nodes, and select the remainder obtained after dividing the hash value by the total number of nodes as the target node number; When the order retrieval module is running, it specifically executes: A retrieval request for obtaining car-hailing order data, obtaining a passenger number or a driver number from the retrieval request to determine the source of the retrieval request, querying the corresponding passenger order mapping table or driver order mapping table based on the type of the retrieval request source, indexing to the order number list corresponding to the passenger number or driver number in the passenger order mapping table or driver order mapping table, and performing hash calculation on the order numbers in the order number list in sequence to respectively obtain the hash values corresponding to the order numbers, obtaining the total number of nodes, performing modulo operation based on the hash value and the total number of nodes to obtain the target node number, and further obtaining the car-hailing order data from the target node; The calculation formula of the modulo operation is p = h % n; When it is necessary to query and retrieve car-hailing order data, only by using the passenger number or driver number, find the corresponding order number list in the corresponding passenger order mapping table or driver order mapping table, then respectively obtain the target node number in reverse through the order number, and then obtain the car-hailing order data to be queried from the target node, so as to realize that the retrieval and query of car-hailing order data by both the driver and the passenger are not affected under the condition of sub-library and sub-table management of car-hailing orders.

5. The system for managing special car order data with sub-library and sub-table division according to claim 4, characterized in that, In the order receiving module, it further includes: A passenger history query unit, which is used to judge whether there is a passenger code corresponding to the car-hailing order in the passenger order mapping table; If it exists, execute querying the passenger order mapping table; If it does not exist, establish a mapping between the passenger code and the order number, establish an order number list based on the passenger code in the passenger order mapping table, and add the order number to the order number list.

6. The system for managing special car order data by database and table partitioning according to claim 5, wherein, In the driver query module, it further includes: A driver history query unit, which is used to judge whether there is a driver code corresponding to the driver who takes the order in the driver order mapping table; If it exists, execute querying the driver order mapping table; If it does not exist, establish a mapping between the driver code and the order number, establish an order number list based on the driver code in the driver order mapping table, and add the order number to the order number list.

Citation Information

Patent Citations

  • Vehicle dispatching method for new energy chauffeured on-demand vehicle platform

    CN108417022A

  • Order distribution method and device thereof

    CN112700049A

  • Driver-passenger matching mechanism oriented to privacy protection

    CN112752232A