Method, device and equipment for accessing service data based on global sequence number and medium

By generating globally unique business sequence numbers and constructing a data routing tree, the problem of low access efficiency caused by data dispersion in the financial system is solved, and efficient data access is achieved.

CN116842014BActive Publication Date: 2025-12-16CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310790694.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-29
Publication Date
2025-12-16
Estimated Expiration
2043-06-29

AI Technical Summary

Technical Problem

In financial systems, data access efficiency is low due to data being distributed across different databases and data partitioning, especially in multi-system, multi-relational data access, where the database's own primary key generation mechanism cannot be relied upon, and global uniqueness cannot be guaranteed.

Method used

By monitoring data operation requests initiated by business applications, parsing sharding keys, generating globally unique business sequence numbers, and generating data routing trees based on these sequence numbers, unified data routing is achieved.

Benefits of technology

It improves the efficiency of data access in the financial data field, especially the efficiency of accessing data across multiple systems and multiple connections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116842014B_ABST
    Figure CN116842014B_ABST
Patent Text Reader

Abstract

The application relates to the field of financial technology data processing, and discloses a business data access method based on a global serial number, which comprises the following steps: when a data operation request initiated by a business application is monitored, a shard key is obtained by analyzing the data access request; a target table splitting rule corresponding to the shard key is acquired, a current used serial number of the business application is inquired in a preset table splitting rule and business serial number mapping relationship table; a business serial number of the business application is generated according to a preset business serial number composition rule and the current used serial number; a data routing tree of the business application is generated according to the business serial number, and the data access request is executed by using the data routing tree. The application further discloses a business data access device based on a global serial number, an electronic device and a computer readable storage medium. The application can improve the data access efficiency in the field of financial data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of financial technology data processing, and in particular to a business data access method, apparatus, electronic device, and computer-readable storage medium based on a global serial number. Background Technology

[0002] The business modules of financial systems such as banks, securities firms, trusts, insurance companies, funds, and financial leasing companies generate massive amounts of data. For example, daily peak data such as customer group data and business settlement data can reach tens of millions. To address the data storage characteristics of the financial industry's large volumes, financial business systems typically employ database sharding and table partitioning. This involves dividing a database or business table across multiple physical nodes, which alleviates the pressure of storing large amounts of data and improves database performance.

[0003] However, related data for the same business will be scattered across different databases and data partitions. When performing related operations for the same business, because the database is split across multiple physical nodes, data access cannot rely on the database's own primary key generation mechanism. Furthermore, the IDs generated by the partitioned database cannot be guaranteed to be globally unique. This is especially true in multi-system, multi-related data access, where the access chain is long and the access efficiency is low. Summary of the Invention

[0004] This invention provides a business data access method, apparatus, electronic device, and computer-readable storage medium based on a global serial number, with the main purpose of improving data access efficiency in the financial data field.

[0005] To achieve the above objectives, the present invention provides a service data access method based on a global sequence number, comprising:

[0006] When a data operation request is detected from a business application, the data access request is parsed to obtain the sharding key.

[0007] Obtain the target sharding rule corresponding to the sharding key, and query the currently used sequence number of the business application in the preset mapping relationship table between sharding rules and business sequence tables;

[0008] According to the preset business serial number composition rules, the business serial number of the business application is generated using the currently used serial number;

[0009] Based on the business sequence number, a data routing tree for the business application is generated, and the data access request is executed using the data routing tree.

[0010] Optionally, when a data operation request is detected from a business application, parsing the data access request to obtain the sharding key includes:

[0011] The data operation request is structured according to a preset business syntax;

[0012] Identify the data table to be operated on in the data operation request after structured processing;

[0013] In the preset mapping table between shard keys and data tables, the shard key corresponding to the data table to be operated on is queried, and the shard key obtained is used as the shard key of the data operation request.

[0014] Optionally, querying the currently used sequence number of the business application in the preset mapping relationship table between the table partitioning rules and the business sequence table includes:

[0015] In the preset mapping relationship table between table partitioning rules and business sequence tables, query the business sequence table corresponding to the target table partitioning rule to obtain the target business sequence table;

[0016] Obtain the target sequence number range corresponding to the target table partitioning rule;

[0017] Determine whether the currently used sequence number in the target service sequence table has reached the upper limit of the target sequence number range;

[0018] When the currently used sequence number has reached the upper limit of the target sequence number range, the target sequence number range is refreshed in a preset order, the refreshed target sequence number range is written into the target service sequence table, and the minimum value of the refreshed target sequence number range is selected as the currently used sequence number of the service application.

[0019] If the currently used sequence number does not reach the upper limit of the target sequence number range, then the currently used sequence number in the target service sequence table is used as the currently used sequence number of the service application.

[0020] Optionally, the method further includes querying the currently used sequence number of the business application in the preset mapping relationship table between the table partitioning rules and the business sequence table.

[0021] When the target sequence number range is not in the target service sequence table, update the target sequence number range to the target service sequence table;

[0022] Set the minimum value of the target sequence number interval, -1, as the currently used sequence number in the target business sequence table.

[0023] Optionally, generating the data routing tree for the service application based on the service sequence number includes:

[0024] Retrieve all routing tables corresponding to the specified partition key;

[0025] Using the service serial number of the service application as the root node, and the starting position of each of the routing tables as the leaf nodes, a data routing tree for the service application is formed.

[0026] To address the aforementioned problems, the present invention also provides a service data access device based on a global sequence number, the device comprising:

[0027] The sharding key acquisition module is used to detect when a business application initiates a data operation request and parse the data access request to obtain the sharding key.

[0028] The used sequence number query module is used to obtain the target sharding rule corresponding to the sharding key, and query the current used sequence number of the business application in the preset mapping relationship table between sharding rules and business sequence table;

[0029] The business serial number generation module is used to generate the business serial number of the business application based on the currently used serial number according to the preset business serial number composition rules.

[0030] The routing unification module is used to generate a data routing tree for the business application based on the business sequence number, and to execute the data access request using the data routing tree.

[0031] Optionally, the sharding key acquisition module obtains the sharding key by parsing the data access request using the following method:

[0032] The data operation request is structured according to a preset business syntax;

[0033] Identify the data table to be operated on in the data operation request after structured processing;

[0034] In the preset mapping table between shard keys and data tables, the shard key corresponding to the data table to be operated on is queried, and the shard key obtained is used as the shard key of the data operation request.

[0035] Optionally, the used sequence number query module queries the currently used sequence number of the business application using the following method:

[0036] In the preset mapping relationship table between table partitioning rules and business sequence tables, query the business sequence table corresponding to the target table partitioning rule to obtain the target business sequence table;

[0037] Obtain the target sequence number range corresponding to the target table partitioning rule;

[0038] Determine whether the currently used sequence number in the target service sequence table has reached the upper limit of the target sequence number range;

[0039] When the currently used sequence number has reached the upper limit of the target sequence number range, the target sequence number range is refreshed in a preset order, the refreshed target sequence number range is written into the target service sequence table, and the minimum value of the refreshed target sequence number range is selected as the currently used sequence number of the service application.

[0040] If the currently used sequence number does not reach the upper limit of the target sequence number range, then the currently used sequence number in the target service sequence table is used as the currently used sequence number of the service application.

[0041] To address the above problems, the present invention also provides an electronic device, the electronic device comprising:

[0042] Memory, storing at least one computer program; and

[0043] The processor executes the program stored in the memory to implement the aforementioned business data access method based on global serial numbers.

[0044] To address the aforementioned problems, the present invention also provides a computer-readable storage medium storing at least one computer program, which is executed by a processor in an electronic device to implement the aforementioned business data access method based on a global serial number.

[0045] When a business application initiates a data operation request, this invention first obtains the sharding key information corresponding to the business application. The sharding key is a key field for database splitting. Based on the sharding key, a globally unique business sequence number for the business application is generated. Then, based on the business sequence number, a data routing tree for the business application is generated. Finally, the business sequence number is used to realize unified data routing for data operations related to the business application, thereby improving the data access efficiency of the business application. Attached Figure Description

[0046] Figure 1 This is a flowchart illustrating a business data access method based on a global sequence number according to an embodiment of the present invention.

[0047] Figure 2 This is a detailed implementation flowchart of one step of a service data access method based on a global serial number provided in an embodiment of the present invention;

[0048] Figure 3 A functional block diagram of a service data access device based on a global serial number provided in an embodiment of the present invention;

[0049] Figure 4 This is a schematic diagram of the structure of an electronic device that implements the service data access method based on global serial numbers, according to an embodiment of the present invention.

[0050] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0051] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0052] This application provides a business data access method based on a global serial number. The execution entity of this method includes, but is not limited to, at least one of electronic devices configured to execute the method provided in this application, such as a server or a terminal. In other words, the global serial number-based business data access method can be executed by software or hardware installed on a terminal device or a server device; the software may be a blockchain platform. The server may be an independent server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0053] Reference Figure 1 The diagram shown is a flowchart illustrating a service data access method based on a global sequence number according to an embodiment of the present invention. In this embodiment, the service data access method based on a global sequence number includes:

[0054] S1. When a data operation request is detected from a business application, the data access request is parsed to obtain the sharding key.

[0055] In this embodiment of the invention, a business data access method based on a global sequence number is illustrated using financial services as an example. The business application can be a service provided by the financial business, such as settlement services for wealth management products, deduction services for bank accounts, and securities trading services.

[0056] In this embodiment of the invention, the data operation request includes, but is not limited to, requests involving operations such as data query, data comparison, data verification, data settlement, and data insertion.

[0057] For example, to enhance customer loyalty, insurance businesses often organize activities where participants can receive coupons or vouchers for specific projects. This application involves a series of data operations, including coupon validity verification, coupon activity rule identification, coupon redemption (gifts or monetary value), and coupon cancellation. Due to database sharding, the data involved in these operations is typically distributed across different physical nodes and different business tables. Using only the routing table and custom primary key for each business table would result in relatively low efficiency for table lookup routing.

[0058] In this embodiment of the invention, when a business application initiates a data operation request, based on the characteristic that the business application data is relatively scattered, this application first obtains the sharding key information corresponding to the business application. The sharding key is a key field for database splitting. Based on the sharding key, a globally unique business sequence number of the business application is generated. Then, the business sequence number is used to realize unified data routing for data operations related to the business application, thereby improving the data access efficiency of the business application.

[0059] Specifically, when a data operation request is detected from a business application, parsing the data access request to obtain the sharding key includes:

[0060] The data operation request is structured according to a preset business syntax;

[0061] Identify the data table to be operated on in the data operation request after structured processing;

[0062] In the preset mapping table between shard keys and data tables, the shard key corresponding to the data table to be operated on is queried, and the shard key obtained is used as the shard key of the data operation request.

[0063] In this embodiment of the invention, the preset business syntax can be set according to the actual business development logic. For example, if the actual financial business uses JAVA, C++, or other languages, then the corresponding syntax logic will be adopted.

[0064] In this embodiment of the invention, the step of structuring the data operation request according to a preset business syntax means dividing the data operation request according to the preset business syntax, for example, dividing the data operation request into several parts such as a data table to be operated, a data field to be operated, and an operation condition field.

[0065] In this embodiment of the invention, the preset mapping table between sharding keys and data tables is determined based on the actual database sharding and table partitioning situation of the business. For example, the sharding key information corresponding to each data table is recorded according to the established table partitioning rules.

[0066] In another optional embodiment of the present invention, the sharding key can also be preset according to actual business needs, and corresponding sharding keys can be preset for different business applications.

[0067] S2. Obtain the target sharding rule corresponding to the sharding key, and query the currently used sequence number of the business application in the preset mapping relationship table between sharding rules and business sequence table;

[0068] In this embodiment of the invention, each sharding key corresponds to sharded database and table data with predetermined sharding rules. Typically, each sharding rule corresponds to an independent business sequence table, which is used to define the usage and allocation of global business sequence numbers. The business sequence number corresponding to the same business application is globally unique, meaning that different business applications have different business sequence numbers.

[0069] In this embodiment of the invention, the currently used sequence number is the most recently occupied sequence number in the practical case of global business sequence numbers.

[0070] For details, please refer to Figure 2 As shown, querying the currently used sequence number of the business application in the preset table partitioning rules and business sequence table mapping relationship table includes:

[0071] S21. In the preset mapping relationship table between table partitioning rules and business sequence tables, query the business sequence table corresponding to the target table partitioning rule to obtain the target business sequence table;

[0072] S22. Obtain the target sequence number range corresponding to the target table partitioning rule;

[0073] S23. Determine whether the currently used sequence number in the target service sequence table has reached the upper limit of the target sequence number range;

[0074] S24. When the currently used sequence number has reached the upper limit of the target sequence number range, the target sequence number range is refreshed according to a preset order, the refreshed target sequence number range is written into the target service sequence table, and the minimum value of the refreshed target sequence number range is selected as the currently used sequence number of the service application.

[0075] S25. If the currently used sequence number has not reached the upper limit of the target sequence number range, then the currently used sequence number in the target service sequence table shall be used as the currently used sequence number of the service application.

[0076] In this embodiment of the invention, each table partitioning rule corresponds to a business sequence table. Each business sequence table is used to record the business sequence numbers corresponding to the same business application. The target sequence number range corresponding to each target table partitioning rule refers to the range of sequence numbers that can be used by the same table partitioning rule.

[0077] For example, taking a card and coupon business application as an example, the business sequence table corresponding to this card and coupon business application includes, but is not limited to, the following fields:

[0078] ID: Represents the primary key of this business sequence table, for example, 124562

[0079] seq_name: Represents the name of the business sequence number corresponding to this business sequence table, for example, SEQ_coupon business;

[0080] currentValue: Represents the currently used sequence number of the coupon application;

[0081] min_value: Represents the minimum value in the sequence range of the coupon application;

[0082] max_value: Represents the maximum value within the sequence range of the coupon application;

[0083] Assuming the target sequence number range corresponding to the target table partitioning rule for the coupon service application is 400-450, and the corresponding currentValue in the target service sequence table is 436 and max_value is 999, then the currently used sequence number corresponding to the coupon service application is 436. If currentValue is 450, then the target sequence number range of 450-500 is refreshed according to a preset order, and the currently used sequence number corresponding to SEQ_Coupon Service is 450. In this embodiment of the invention, the preset order refers to the sequence number range distribution set according to the actual business situation, in ascending order. When a sequence number range is full, the sequence number increments to the next sequence number range.

[0084] In this embodiment of the invention, when the target sequence number range is not in the target service sequence table, the currently used sequence number of the service application can be obtained by the following method:

[0085] Update the target sequence number range to the target service sequence table, and set the minimum value of the target sequence number range -1 as the currently used sequence number in the target service sequence table.

[0086] S3. Based on the preset business sequence number composition rules, generate the business sequence number of the business application using the currently used sequence number, generate the data routing tree of the business application based on the business sequence number, and execute the data access request using the data routing tree.

[0087] In this embodiment of the invention, the preset business sequence number composition rule can be set according to the actual data volume of the business and the type of business application.

[0088] For example, according to the preset business sequence number composition rules, a business sequence number consists of: YY + MM + DD + reserved space + table partition space + numeric sequence number, where YY represents a 2-digit year, such as 19; MM represents a 2-digit month, such as 06; DD represents a 2-digit day, such as 25; the reserved space can be used for expansion and can be set to 2 digits; the table partition space can be obtained by querying the business sequence table and is usually 2 digits; the numeric sequence number can be generated based on the currently used sequence number and can be 8 digits. The total length of the business sequence number can be 18 digits, which can meet the maximum numeric limit of common databases such as Oracle and MySQL.

[0089] According to the preset business serial number composition rules described above, a usable, globally unique business serial number can be obtained by adding 1 to the currently used serial number.

[0090] It is understood that each business sub-table corresponds to a routing table, which records the database shard node and table location of that business sub-table. In this embodiment of the invention, the business sequence number and the corresponding business sub-table's routing table can be combined to construct the data routing tree for the business application.

[0091] Specifically, generating the data routing tree for the service application based on the service sequence number includes:

[0092] Obtain all routing tables corresponding to the partition key, take the business serial number of the business application as the root node, and take the starting position of each routing table as the leaf node to form the data routing tree of the business application.

[0093] In this embodiment of the invention, the data routing tree can be used to initiate the retrieval of the same business application.

[0094] In another optional embodiment of the present invention, a segment lock can be set based on each shard key to support concurrent processing of data access for multiple sharding rules.

[0095] When a business application initiates a data operation request, this invention first obtains the sharding key information corresponding to the business application. The sharding key is a key field for database splitting. Based on the sharding key, a globally unique business sequence number for the business application is generated. Then, based on the business sequence number, a data routing tree for the business application is generated. Finally, the business sequence number is used to realize unified data routing for data operations related to the business application, thereby improving the data access efficiency of the business application.

[0096] like Figure 3 The diagram shown is a functional block diagram of a service data access device based on a global serial number provided in an embodiment of the present invention.

[0097] The service data access device 100 based on global serial numbers described in this invention can be installed in an electronic device. Depending on the functions implemented, the service data access device 100 based on global serial numbers includes a fragment key acquisition module 101, a used serial number query module 102, a service serial number generation module 103, and a routing unification module 104. The modules described in this invention can also be called units, referring to a series of computer program segments that can be executed by the processor of an electronic device and perform a fixed function, stored in the memory of the electronic device.

[0098] In this embodiment, the functions of each module / unit are as follows:

[0099] The sharding key acquisition module 101 is used to parse the data access request to obtain the sharding key when a business application initiates a data operation request.

[0100] The used sequence number query module 102 is used to obtain the target sharding rule corresponding to the sharding key, and query the current used sequence number of the business application in the preset mapping relationship table between sharding rules and business sequence table;

[0101] The business serial number generation module 103 is used to generate the business serial number of the business application according to the preset business serial number composition rules and the currently used serial number.

[0102] The routing unification module 104 is used to generate a data routing tree for the business application based on the business sequence number, and to execute the data access request using the data routing tree.

[0103] In detail, the specific implementation methods of each module of the service data access device 100 based on the global sequence number are as follows:

[0104] Step 1: When a business application initiates a data operation request, parse the data access request to obtain the sharding key;

[0105] In this embodiment of the invention, a business data access method based on a global sequence number is illustrated using financial services as an example. The business application can be a service provided by the financial business, such as settlement services for wealth management products, deduction services for bank accounts, and securities trading services.

[0106] In this embodiment of the invention, the data operation request includes, but is not limited to, requests involving operations such as data query, data comparison, data verification, data settlement, and data insertion.

[0107] For example, to enhance customer loyalty, insurance businesses often organize activities where participants can receive coupons or vouchers for specific projects. This application involves a series of data operations, including coupon validity verification, coupon activity rule identification, coupon redemption (gifts or monetary value), and coupon cancellation. Due to database sharding, the data involved in these operations is typically distributed across different physical nodes and different business tables. Using only the routing table and custom primary key for each business table would result in relatively low efficiency for table lookup routing.

[0108] In this embodiment of the invention, when a business application initiates a data operation request, based on the characteristic that the business application data is relatively scattered, this application first obtains the sharding key information corresponding to the business application. The sharding key is a key field for database splitting. Based on the sharding key, a globally unique business sequence number of the business application is generated. Then, the business sequence number is used to realize unified data routing for data operations related to the business application, thereby improving the data access efficiency of the business application.

[0109] Specifically, when a data operation request is detected from a business application, parsing the data access request to obtain the sharding key includes:

[0110] The data operation request is structured according to a preset business syntax;

[0111] Identify the data table to be operated on in the data operation request after structured processing;

[0112] In the preset mapping table between shard keys and data tables, the shard key corresponding to the data table to be operated on is queried, and the shard key obtained is used as the shard key of the data operation request.

[0113] In this embodiment of the invention, the preset business syntax can be set according to the actual business development logic. For example, if the actual financial business uses JAVA, C++, or other languages, then the corresponding syntax logic will be adopted.

[0114] In this embodiment of the invention, the step of structuring the data operation request according to a preset business syntax means dividing the data operation request according to the preset business syntax, for example, dividing the data operation request into several parts such as a data table to be operated, a data field to be operated, and an operation condition field.

[0115] In this embodiment of the invention, the preset mapping table between sharding keys and data tables is determined based on the actual database sharding and table partitioning situation of the business. For example, the sharding key information corresponding to each data table is recorded according to the established table partitioning rules.

[0116] In another optional embodiment of the present invention, the sharding key can also be preset according to actual business needs, and corresponding sharding keys can be preset for different business applications.

[0117] Step 2: Obtain the target sharding rule corresponding to the sharding key, and query the currently used sequence number of the business application in the preset mapping relationship table between sharding rules and business sequence tables;

[0118] In this embodiment of the invention, each sharding key corresponds to sharded database and table data with predetermined sharding rules. Typically, each sharding rule corresponds to an independent business sequence table, which is used to define the usage and allocation of global business sequence numbers. The business sequence number corresponding to the same business application is globally unique, meaning that different business applications have different business sequence numbers.

[0119] In this embodiment of the invention, the currently used sequence number is the most recently occupied sequence number in the practical case of global business sequence numbers.

[0120] Specifically, querying the currently used sequence number of the business application in the preset mapping relationship table between the table partitioning rules and the business sequence table includes:

[0121] In the preset mapping relationship table between table partitioning rules and business sequence tables, query the business sequence table corresponding to the target table partitioning rule to obtain the target business sequence table;

[0122] Obtain the target sequence number range corresponding to the target table partitioning rule;

[0123] Determine whether the currently used sequence number in the target service sequence table has reached the upper limit of the target sequence number range;

[0124] When the currently used sequence number has reached the upper limit of the target sequence number range, the target sequence number range is refreshed in a preset order, the refreshed target sequence number range is written into the target service sequence table, and the minimum value of the refreshed target sequence number range is selected as the currently used sequence number of the service application.

[0125] If the currently used sequence number does not reach the upper limit of the target sequence number range, then the currently used sequence number in the target service sequence table is used as the currently used sequence number of the service application.

[0126] In this embodiment of the invention, each table partitioning rule corresponds to a business sequence table. Each business sequence table is used to record the business sequence numbers corresponding to the same business application. The target sequence number range corresponding to each target table partitioning rule refers to the range of sequence numbers that can be used by the same table partitioning rule.

[0127] For example, taking a card and coupon business application as an example, the business sequence table corresponding to this card and coupon business application includes, but is not limited to, the following fields:

[0128] ID: Represents the primary key of this business sequence table, for example, 124562

[0129] seq_name: Represents the name of the business sequence number corresponding to this business sequence table, for example, SEQ_coupon business;

[0130] currentValue: Represents the currently used sequence number of the coupon application;

[0131] min_value: Represents the minimum value in the sequence range of the coupon application;

[0132] max_value: Represents the maximum value within the sequence range of the coupon application;

[0133] Assuming the target sequence number range corresponding to the target table partitioning rule for the coupon service application is 400-450, and the corresponding currentValue in the target service sequence table is 436 and max_value is 999, then the currently used sequence number corresponding to the coupon service application is 436. If currentValue is 450, then the target sequence number range of 450-500 is refreshed according to a preset order, and the currently used sequence number corresponding to SEQ_Coupon Service is 450. In this embodiment of the invention, the preset order refers to the sequence number range distribution set according to the actual business situation, in ascending order. When a sequence number range is full, the sequence number increments to the next sequence number range.

[0134] In this embodiment of the invention, when the target sequence number range is not in the target service sequence table, the currently used sequence number of the service application can be obtained by the following method:

[0135] Update the target sequence number range to the target service sequence table, and set the minimum value of the target sequence number range -1 as the currently used sequence number in the target service sequence table.

[0136] Step 3: Based on the preset business sequence number composition rules, generate the business sequence number of the business application using the currently used sequence number, generate the data routing tree of the business application based on the business sequence number, and execute the data access request using the data routing tree.

[0137] In this embodiment of the invention, the preset business sequence number composition rule can be set according to the actual data volume of the business and the type of business application.

[0138] For example, according to the preset business sequence number composition rules, a business sequence number consists of: YY + MM + DD + reserved space + table partition space + numeric sequence number, where YY represents a 2-digit year, such as 19; MM represents a 2-digit month, such as 06; DD represents a 2-digit day, such as 25; the reserved space can be used for expansion and can be set to 2 digits; the table partition space can be obtained by querying the business sequence table and is usually 2 digits; the numeric sequence number can be generated based on the currently used sequence number and can be 8 digits. The total length of the business sequence number can be 18 digits, which can meet the maximum numeric limit of common databases such as Oracle and MySQL.

[0139] According to the preset business serial number composition rules described above, a usable, globally unique business serial number can be obtained by adding 1 to the currently used serial number.

[0140] It is understood that each business sub-table corresponds to a routing table, which records the database shard node and table location of that business sub-table. In this embodiment of the invention, the business sequence number and the corresponding business sub-table's routing table can be combined to construct the data routing tree for the business application.

[0141] Specifically, generating the data routing tree for the service application based on the service sequence number includes:

[0142] Obtain all routing tables corresponding to the partition key, take the business serial number of the business application as the root node, and take the starting position of each routing table as the leaf node to form the data routing tree of the business application.

[0143] In this embodiment of the invention, the data routing tree can be used to initiate the retrieval of the same business application.

[0144] In another optional embodiment of the present invention, a segment lock can be set based on each shard key to support concurrent processing of data access for multiple sharding rules.

[0145] When a data operation request is detected by a business application, this invention first obtains the sharding key information corresponding to the business application. The sharding key is a key field for database partitioning. Based on the sharding key, a globally unique business sequence number is generated for the business application. Then, based on the business sequence number, a data routing tree for the business application is generated. Finally, the business sequence number is used to realize unified data routing for data operations related to the business application. Therefore, the business data access device based on a global sequence number provided by this invention can improve the data access efficiency of the business application.

[0146] like Figure 4The diagram shown is a structural schematic of an electronic device that implements a service data access method based on a global serial number, according to an embodiment of the present invention.

[0147] The electronic device 1 may include a processor 10, a memory 11 and a bus, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a business data access to a global serial number.

[0148] The memory 11 includes at least one type of readable storage medium, such as flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the electronic device 1, such as a portable hard drive. In other embodiments, the memory 11 can be an external storage device of the electronic device 1, such as a plug-in portable hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, the memory 11 can include both internal and external storage units of the electronic device 1. The memory 11 can be used not only to store application software and various types of data installed on the electronic device 1, such as the code for accessing business data with a global serial number, but also to temporarily store data that has been output or will be output.

[0149] In some embodiments, the processor 10 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control unit of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes programs or modules stored in the memory 11 (e.g., access to business data using global serial numbers) and calls data stored in the memory 11 to perform various functions and process data in the electronic device 1.

[0150] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable communication between the memory 11 and at least one processor 10, etc.

[0151] Figure 4 Only electronic devices with components are shown; it will be understood by those skilled in the art that... Figure 4 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.

[0152] For example, although not shown, the electronic device 1 may also include a power supply (such as a battery) to power various components. Preferably, the power supply can be logically connected to the at least one processor 10 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.

[0153] Furthermore, the electronic device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), which is typically used to establish communication connections between the electronic device 1 and other electronic devices.

[0154] Optionally, the electronic device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired or wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device 1 and to display a visual user interface.

[0155] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.

[0156] Access to the service data of the global serial number stored in the memory 11 of the electronic device 1 is a combination of multiple instructions, which, when executed in the processor 10, can be implemented as follows:

[0157] When a data operation request is detected from a business application, the data access request is parsed to obtain the sharding key.

[0158] Obtain the target sharding rule corresponding to the sharding key, and query the currently used sequence number of the business application in the preset mapping relationship table between sharding rules and business sequence tables;

[0159] According to the preset business serial number composition rules, the business serial number of the business application is generated using the currently used serial number;

[0160] Based on the business sequence number, a data routing tree for the business application is generated, and the data access request is executed using the data routing tree.

[0161] Furthermore, if the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).

[0162] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor of an electronic device, can perform the following:

[0163] When a user is detected accessing a preset page, the user's user information is obtained, and the user's user type is generated based on the user information;

[0164] When a data operation request is detected from a business application, the data access request is parsed to obtain the sharding key.

[0165] Obtain the target sharding rule corresponding to the sharding key, and query the currently used sequence number of the business application in the preset mapping relationship table between sharding rules and business sequence tables;

[0166] According to the preset business serial number composition rules, the business serial number of the business application is generated using the currently used serial number;

[0167] Based on the business sequence number, a data routing tree for the business application is generated, and the data access request is executed using the data routing tree.

[0168] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.

[0169] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0170] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.

[0171] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.

[0172] The embodiments of this application can acquire and process relevant data based on holographic projection technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0173] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. The term "second class" is used to indicate names and does not indicate any specific order.

[0174] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A method for accessing business data based on a global sequence number, characterized in that, The method includes: When a data operation request is detected from a business application, the data access request is parsed to obtain the sharding key. Obtain the target sharding rule corresponding to the sharding key, and query the currently used sequence number of the business application in the preset mapping relationship table between sharding rules and business sequence tables; According to the preset business serial number composition rules, the business serial number of the business application is generated using the currently used serial number; Obtain all routing tables corresponding to the sharding key, and form a data routing tree for the business application with the business serial number of the business application as the root node and the starting position of each routing table as the leaf node. Then, use the data routing tree to execute the data access request.

2. The service data access method based on global sequence numbers as described in claim 1, characterized in that, When a data operation request is detected from a business application, the sharding key is obtained by parsing the data access request, including: The data operation request is structured according to a preset business syntax; Identify the data table to be operated on in the data operation request after structured processing; In the preset mapping table between shard keys and data tables, the shard key corresponding to the data table to be operated on is queried, and the shard key obtained is used as the shard key of the data operation request.

3. The service data access method based on global sequence numbers as described in claim 1, characterized in that, The step of querying the currently used sequence number of the business application in the preset mapping relationship table between the table partitioning rules and the business sequence table includes: In the preset mapping relationship table between table partitioning rules and business sequence tables, query the business sequence table corresponding to the target table partitioning rule to obtain the target business sequence table; Obtain the target sequence number range corresponding to the target table partitioning rule; Determine whether the currently used sequence number in the target service sequence table has reached the upper limit of the target sequence number range; When the currently used sequence number has reached the upper limit of the target sequence number range, the target sequence number range is refreshed in a preset order, the refreshed target sequence number range is written into the target service sequence table, and the minimum value of the refreshed target sequence number range is selected as the currently used sequence number of the service application. If the currently used sequence number does not reach the upper limit of the target sequence number range, then the currently used sequence number in the target service sequence table is used as the currently used sequence number of the service application.

4. The service data access method based on global serial numbers as described in claim 3, characterized in that, The method further includes querying the currently used sequence number of the business application in the preset mapping relationship table between the table partitioning rules and the business sequence table. When the target sequence number range is not in the target service sequence table, update the target sequence number range to the target service sequence table; Set the minimum value of the target sequence number interval, -1, as the currently used sequence number in the target business sequence table.

5. A service data access device based on a global serial number, characterized in that, The device includes: The sharding key acquisition module is used to detect when a business application initiates a data operation request and parse the data access request to obtain the sharding key. The used sequence number query module is used to obtain the target sharding rule corresponding to the sharding key, and query the current used sequence number of the business application in the preset mapping relationship table between sharding rules and business sequence table; The business serial number generation module is used to generate the business serial number of the business application based on the currently used serial number according to the preset business serial number composition rules. The unified routing module is used to obtain all routing tables corresponding to the sharding key, form a data routing tree for the business application with the business serial number of the business application as the root node and the starting position of each routing table as the leaf node, and use the data routing tree to execute the data access request.

6. The service data access device based on a global serial number as described in claim 5, characterized in that, The sharding key acquisition module obtains the sharding key by parsing the data access request using the following method: The data operation request is structured according to a preset business syntax; Identify the data table to be operated on in the data operation request after structured processing; In the preset mapping table between shard keys and data tables, the shard key corresponding to the data table to be operated on is queried, and the shard key obtained is used as the shard key of the data operation request.

7. The service data access device based on a global serial number as described in claim 5, characterized in that, The used sequence number query module queries the currently used sequence number of the business application using the following method: In the preset mapping relationship table between table partitioning rules and business sequence tables, query the business sequence table corresponding to the target table partitioning rule to obtain the target business sequence table; Obtain the target sequence number range corresponding to the target table partitioning rule; Determine whether the currently used sequence number in the target service sequence table has reached the upper limit of the target sequence number range; When the currently used sequence number has reached the upper limit of the target sequence number range, the target sequence number range is refreshed in a preset order, the refreshed target sequence number range is written into the target service sequence table, and the minimum value of the refreshed target sequence number range is selected as the currently used sequence number of the service application. If the currently used sequence number does not reach the upper limit of the target sequence number range, then the currently used sequence number in the target service sequence table is used as the currently used sequence number of the service application.

8. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the business data access method based on a global serial number as described in any one of claims 1 to 4.

9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the business data access method based on global serial numbers as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Serial number generation method and device, equipment and computer readable storage medium

    CN111414379A

  • Data entropy reduction across stream shard

    US10769126B1