A data information query processing method and device
By integrating a lightweight data routing device into the application server, the problems of low resource utilization and high deployment costs between different shards within the unit are solved, achieving efficient and low-cost data information query and business continuity.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2022-11-30
- Publication Date
- 2026-07-14
AI Technical Summary
In existing technologies, application servers cannot be shared between different shards within a unit, resulting in low resource utilization, a large number of deployed devices, and complex and costly high availability strategies.
By integrating a lightweight data routing device into the application server, unified processing of data sharding and simplification of high availability strategies are achieved. Data sharding and unit status are determined using preset correspondences, and plugins are called to calculate data sharding, enabling automatic switching between primary and backup units.
It improved equipment resource utilization, reduced deployment costs, simplified high availability strategies, and ensured the efficiency and continuity of data information retrieval.
Smart Images

Figure CN115827667B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and specifically to a data information query and processing method and apparatus. Background Technology
[0002] The foundation for an enterprise's implementation of a unitized architecture deployment is a distributed architecture with database sharding, such as... Figure 1 As shown, since the number of units is usually less than the number of database shards, the database sharding is the core. First, data shards are uniformly divided, and then multiple data shards are divided into a unit. Within a unit, the application server and the database service typically use direct shard connection or direct tenant connection.
[0003] Because the application servers and databases in each shard within a unit are bound together, there are drawbacks such as the inability of application servers to be shared between different shards within the unit, the need for a large number of deployed devices, and low resource utilization. Summary of the Invention
[0004] To address the problems in the prior art, embodiments of the present invention provide a data information query and processing method and apparatus, which can at least partially solve the problems existing in the prior art.
[0005] On the one hand, the present invention proposes a data information query and processing method, including:
[0006] Obtain transaction elements and determine data segments corresponding to the transaction element information based on the first preset correspondence relationship;
[0007] The first preset correspondence includes the correspondence between preset transaction element information and preset data fragments;
[0008] The unit corresponding to the data fragment is determined according to the second preset correspondence, and the unit status of the unit is obtained;
[0009] The second preset correspondence includes the correspondence between preset data fragments and preset units;
[0010] If the unit is determined to be in a normal state, the database information corresponding to each data segment of the unit is determined according to the third preset correspondence, and the database information is used as the data query result.
[0011] The third preset correspondence includes the correspondence between preset data fragments and preset database information.
[0012] The transaction element information includes the order of magnitude of the transaction elements; correspondingly, the data information query and processing method further includes:
[0013] Based on the comparison between the magnitude of the transaction elements and the preset threshold for the magnitude of the transaction elements, the data segmentation matching method is determined;
[0014] The data fragments corresponding to the transaction element information are determined based on the data fragment matching method.
[0015] The step of determining the data sharding matching method based on the comparison result between the order of magnitude of the transaction elements and a preset order of magnitude threshold of the transaction elements includes:
[0016] If it is determined that the magnitude of the transaction elements is greater than or equal to the preset threshold for the magnitude of transaction elements, then the data sharding matching method is determined to be to call the plugin to calculate the data shards.
[0017] The step of determining the data sharding matching method based on the comparison result between the order of magnitude of the transaction elements and a preset order of magnitude threshold of the transaction elements includes:
[0018] If it is determined that the order of magnitude of the transaction elements is less than a preset order of magnitude threshold for transaction elements, then the data sharding matching method is determined to be data sharding based on a first preset correspondence.
[0019] The data sharding matching method includes calling a plugin to calculate data shards; correspondingly, determining the data shards corresponding to the transaction element information according to the data sharding matching method includes:
[0020] In response to the user-selected mapping algorithm function, the plugin path corresponding to the mapping algorithm function is determined according to the fourth preset correspondence relationship;
[0021] The fourth preset correspondence includes the correspondence between preset mapping algorithm functions and preset plugin paths;
[0022] The mapping algorithm function is obtained according to the plugin path, and the data shards corresponding to the transaction element information are calculated based on the mapping algorithm function.
[0023] The method includes determining a backup unit to take over the unit based on pre-configuration information; correspondingly, the data information query and processing method further includes:
[0024] If an abnormality is detected in the unit, the unit state is switched to an abnormal state;
[0025] If the unit status of the backup unit is determined to be normal, the database information corresponding to each data shard of the backup unit is determined according to the third preset correspondence, and the database information is used as the data query result.
[0026] The data information query and processing method further includes:
[0027] The first preset correspondence, the second preset correspondence, the third preset correspondence, and the fourth preset correspondence are pre-stored in the local cache.
[0028] On one hand, the present invention proposes a data information query and processing device, comprising:
[0029] The determining unit is used to acquire transaction elements and determine data segments corresponding to the transaction element information according to a first preset correspondence relationship.
[0030] The first preset correspondence includes the correspondence between preset transaction element information and preset data fragments;
[0031] An acquisition unit is used to determine the unit corresponding to the data fragment according to a second preset correspondence relationship, and to acquire the unit status of the unit;
[0032] The second preset correspondence includes the correspondence between preset data fragments and preset units;
[0033] The query unit is used to determine the database information corresponding to each data fragment of the unit according to the third preset correspondence relationship if the unit status is determined to be normal, and to use the database information as the data query result;
[0034] The third preset correspondence includes the correspondence between preset data fragments and preset database information.
[0035] In another aspect, embodiments of the present invention provide an electronic device, including: a processor, a memory, and a bus, wherein,
[0036] The processor and the memory communicate with each other via the bus;
[0037] The memory stores program instructions that can be executed by the processor, and the processor can execute the following methods by calling the program instructions:
[0038] Obtain transaction elements and determine data segments corresponding to the transaction element information based on the first preset correspondence relationship;
[0039] The first preset correspondence includes the correspondence between preset transaction element information and preset data fragments;
[0040] The unit corresponding to the data fragment is determined according to the second preset correspondence, and the unit status of the unit is obtained;
[0041] The second preset correspondence includes the correspondence between preset data fragments and preset units;
[0042] If the unit is determined to be in a normal state, the database information corresponding to each data segment of the unit is determined according to the third preset correspondence, and the database information is used as the data query result.
[0043] The third preset correspondence includes the correspondence between preset data fragments and preset database information.
[0044] This invention provides a non-transitory computer-readable storage medium, comprising:
[0045] The non-transitory computer-readable storage medium stores computer instructions that cause the computer to perform the following methods:
[0046] Obtain transaction elements and determine data segments corresponding to the transaction element information based on the first preset correspondence relationship;
[0047] The first preset correspondence includes the correspondence between preset transaction element information and preset data fragments;
[0048] The unit corresponding to the data fragment is determined according to the second preset correspondence, and the unit status of the unit is obtained;
[0049] The second preset correspondence includes the correspondence between preset data fragments and preset units;
[0050] If the unit is determined to be in a normal state, the database information corresponding to each data segment of the unit is determined according to the third preset correspondence, and the database information is used as the data query result.
[0051] The third preset correspondence includes the correspondence between preset data fragments and preset database information.
[0052] The data information query and processing method and apparatus provided in this invention obtain transaction elements, determine data segments corresponding to the transaction element information according to a first preset correspondence relationship; the first preset correspondence relationship includes a correspondence relationship between preset transaction element information and preset data segments; determine units corresponding to the data segments according to a second preset correspondence relationship, and obtain the unit status of the unit; the second preset correspondence relationship includes a correspondence relationship between preset data segments and preset units; if the unit status is determined to be a normal state, determine database information corresponding to each data segment of the unit according to a third preset correspondence relationship, and use the database information as the data query result; the third preset correspondence relationship includes a correspondence relationship between preset data segments and preset database information, which can improve the utilization rate of equipment resources and realize low-cost data information query. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings:
[0054] Figure 1 This is a schematic diagram of the modular architecture for deploying existing technologies.
[0055] Figure 2 This is a schematic diagram of the deployment unitized architecture according to an embodiment of the present invention.
[0056] Figure 3 This is a flowchart illustrating a data information query and processing method provided in an embodiment of the present invention.
[0057] Figure 4 This is a schematic diagram of the data routing device provided in an embodiment of the present invention.
[0058] Figure 5 This is a flowchart illustrating a data information query and processing method provided in another embodiment of the present invention.
[0059] Figure 6 This is a flowchart illustrating a data information query and processing method provided in another embodiment of the present invention.
[0060] Figure 7 This is a schematic diagram of the structure of a data information query and processing device provided in an embodiment of the present invention.
[0061] Figure 8 This is a schematic diagram of the physical structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0062] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. Here, the illustrative embodiments and descriptions of the present invention are used to explain the present invention, but are not intended to limit the present invention. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be arbitrarily combined with each other.
[0063] Explanation of relevant terms:
[0064] Unit: A self-contained set of operations that can satisfy the business processing links of a certain type of business according to a certain dimension. This set contains most of the key services required by the business processing links of that type of business, as well as the data that this unit needs to process.
[0065] Unitized architecture: The unit is used as the basic unit of deployment, and most of the key applications or functional modules required for customer business are deployed within the unit.
[0066] Combination Figure 1 right Figure 1 The disadvantages of the architecture shown are further explained below:
[0067] 1) Application servers in different shards within a unit cannot be shared. Dedicated backup devices (normally idle) are required for each shard's application server cluster and database cluster. High availability strategies at both the shard and unit levels are also required.
[0068] A. If a shard application server cluster within a unit fails, the access route will switch the shard application server cluster to another corresponding shard application server cluster specifically prepared for backup in the backup unit.
[0069] B. If the application server of the entire unit fails, all the sharded application server clusters of the unit will be switched from the access route to all the corresponding sharded application server clusters prepared in advance in the backup unit for backup.
[0070] 2) Due to the above high availability strategies, a large number of devices need to be deployed, resulting in higher costs.
[0071] Taking a unit with 32 shards as an example, each shard requires at least 2 application servers with high availability load protection, so at least 64 application servers are needed in the unit. In addition, 64 application servers are needed to back up the application servers of another unit. In total, each unit requires at least 128 application servers. Especially for applications with relatively low business volume, deploying equipment in this way will be more wasteful because the same number of shards and units must be followed.
[0072] Overall, high availability deployment is costly and high availability strategies are complex.
[0073] like Figure 2 As shown, for Figure 1 The architecture shown has been improved, as explained below:
[0074] 1) Add a new lightweight data routing device:
[0075] The data routing device is deployed on the application server within each unit. The application server within the unit processes data in a unified cluster, and all segments can use the same data.
[0076] 2) Changes in high availability strategy:
[0077] The application servers within the unit have become a unified cluster, eliminating the need to consider high availability strategies for different application shards within the unit separately, thus simplifying operation and maintenance costs.
[0078] Inter-unit disaster recovery takeover allows direct reuse of application server clusters from another unit, eliminating the need to prepare a disaster recovery server cluster in another unit and saving deployment costs.
[0079] Beneficial effects include:
[0080] 1) The traditional one-layer application server routing method based on distributed architecture has been changed to two-layer application server routing, breaking the inherent practice of pairing application servers and database servers to form a SET in traditional distributed deployment architecture.
[0081] 2) Data routing is usually used in the database process or integrated into the database as a data access layer. This invention is integrated into the application server and does not parse SQL statements, which greatly reduces complexity, keeps it lightweight and improves efficiency. It is also not deployed as an independent node, reducing the communication between network nodes.
[0082] Figure 3 This is a flowchart illustrating a data information query and processing method provided in an embodiment of the present invention, as shown below. Figure 3 As shown, the data information query and processing method provided in this embodiment of the invention includes:
[0083] Step S1: Obtain transaction elements and determine the data segments corresponding to the transaction element information according to the first preset correspondence relationship;
[0084] The first preset correspondence includes the correspondence between preset transaction element information and preset data fragments.
[0085] Step S2: Determine the unit corresponding to the data fragment according to the second preset correspondence, and obtain the unit status of the unit;
[0086] The second preset correspondence includes the correspondence between preset data segments and preset units.
[0087] Step S3: If the unit status is determined to be normal, the database information corresponding to each data fragment of the unit is determined according to the third preset correspondence, and the database information is used as the data query result;
[0088] The third preset correspondence includes the correspondence between preset data fragments and preset database information.
[0089] In step S1 above, the device acquires transaction elements and determines data segments corresponding to the transaction element information according to the first preset correspondence relationship.
[0090] The first preset correspondence includes the correspondence between preset transaction element information and preset data fragments. The device can be a computer equipment executing the method, for example, it may include a server, specifically... Figure 2 The servers in the application server cluster shown are examples. It should be noted that the data acquisition and analysis involved in this embodiment of the invention are authorized by the user. Transaction elements can be understood as key transaction data, such as transaction serial number, transaction amount, and the identity information of the buyer and seller.
[0091] The content of the first preset correspondence may include: Field 1 (primary key) "Transaction Element" and "Sharding".
[0092] In step S2 above, the device determines the unit corresponding to the data slice according to the second preset correspondence relationship, and obtains the unit status of the unit; the unit status of the unit may include a normal state or an abnormal state.
[0093] The second preset correspondence includes the correspondence between preset data fragments and preset units. The content of the second preset correspondence may include:
[0094] Field 1 (Primary Key) "Sharding", Field 2 "Unit", Field 3 "Status".
[0095] In step S3 above, if the device determines that the unit is in a normal state, it determines the database information corresponding to each data segment of the unit according to the third preset correspondence relationship, and uses the database information as the data query result.
[0096] The third preset correspondence includes the correspondence between preset data fragments and preset database information. The content of the third preset correspondence may include:
[0097] Field 1 (primary key) "sharding", field 2 "connection string" (a string that contains at least the target database domain name or IP, database user, and password, separated by a delimiter).
[0098] If the cell status is determined to be an abnormal state (i.e., a prohibited state), an error message can be returned.
[0099] The transaction element information includes the order of magnitude of the transaction elements; correspondingly, the data information query and processing method further includes:
[0100] The data sharding matching method is determined based on the comparison between the magnitude of the transaction elements and a preset threshold for the magnitude of the transaction elements. The preset threshold for the magnitude of the transaction elements can be set independently according to actual conditions and can be selected as a number in the hundreds. The data sharding matching method may include calling a plugin to calculate data shards, or it may include determining data shards based on a first preset correspondence.
[0101] The data fragments corresponding to the transaction element information are determined based on the data fragment matching method.
[0102] The step of determining the data sharding matching method based on the comparison result between the order of magnitude of the transaction elements and the preset order of magnitude threshold of the transaction elements includes:
[0103] If the order of magnitude of the transaction elements is determined to be greater than or equal to a preset threshold for the order of magnitude of transaction elements, then the data sharding matching method is determined to be to call a plugin to calculate data shards. Accordingly, determining the data shards corresponding to the transaction element information based on the data sharding matching method includes:
[0104] In response to the user-selected mapping algorithm function, the plugin path corresponding to the mapping algorithm function is determined according to the fourth preset correspondence relationship;
[0105] The fourth preset correspondence includes the correspondence between preset mapping algorithm functions and preset plugin paths; the content of the fourth preset correspondence may include:
[0106] Field 1 (whether to use the calculation plugin, and the preset mapping algorithm function, etc.), Field 2 (preset plugin path).
[0107] The mapping algorithm function is obtained according to the plugin path, and data shards corresponding to the transaction element information are calculated based on the mapping algorithm function. The preset mapping algorithm function may include hash mapping, taking the last two digits of the last digit, etc., and the user can choose one of them as the mapping algorithm function.
[0108] Transaction element information can be input into a mapping algorithm function, and the calculation result in the mapping algorithm function can be used as a data fragment corresponding to the transaction element information.
[0109] If the order of magnitude of the transaction elements is determined to be less than a preset threshold for the order of magnitude of transaction elements, then the data sharding matching method is determined to be based on a first preset correspondence. The determination of data sharding based on the first preset correspondence can be referred to the above explanation and will not be repeated here.
[0110] The standby unit to take over the unit is determined based on the pre-configuration information; correspondingly, the data information query and processing method further includes:
[0111] If an anomaly is detected in the unit, the unit's state is switched to an abnormal state; refer to Figure 2 The backup unit for takeover unit 1 can be configured as unit 2 in the pre-configuration information. Figure 2 (Not shown, but the composition and architecture of unit 2 are the same as those of unit 1). When an anomaly is detected in unit 1, the unit state of unit 1 is switched to the abnormal state.
[0112] If the standby unit is determined to be in a normal state, then the database information corresponding to each data shard of the standby unit is determined according to the third preset correspondence, and the database information is used as the data query result. If the unit 2 is in a normal state, the database information corresponding to each data shard of unit 2 is determined according to the third preset correspondence, thereby realizing the switching between the primary and standby units.
[0113] The data information query and processing method further includes:
[0114] The first preset correspondence, the second preset correspondence, the third preset correspondence, and the fourth preset correspondence are pre-stored in a local cache to facilitate quick data retrieval during use.
[0115] like Figure 4 As shown, the data routing device includes connection pool mapping, transaction element-shard mapping, shard-unit mapping, and calculation plug-in status.
[0116] The data information query and processing methods are explained, such as... Figure 5 As shown, the configuration center is used to configure content.
[0117] You can determine whether the range of transaction elements is within the hundreds of data points by querying the status of the calculation plugin. If it is within the hundreds of data points, the calculation plugin is not used; if it exceeds the hundreds of data points, the calculation plugin is used.
[0118] It should be noted that, Figure 5 The final step in the process is to update the cell state, thereby ensuring that the cell state is correct.
[0119] like Figure 6 As shown, the process of unit 2 taking over unit 1 is explained:
[0120] Access routing rules can be pre-stored in each application server cluster, and can be flexibly configured according to actual needs.
[0121] By enabling the connection status in a timely manner, it is ensured that Unit 2 can access the sharded database of Unit 1.
[0122] After Unit 2 takes over from Unit 1, Unit 2 can not only handle the data processing tasks of Unit 1, but also handle its own original data processing tasks.
[0123] By using the method of this invention, the problems of high deployment cost and complex high availability strategy of application servers in existing unitized architecture deployment units are overcome. It can be extended to use in scenarios such as disaster takeover and data sharding adjustment and migration between units. It has a wide range of applications, is almost imperceptible to customers, can effectively improve the continuity of business operations, and has good application prospects.
[0124] The data information query processing method provided in this embodiment of the invention obtains transaction elements, determines data segments corresponding to the transaction element information according to a first preset correspondence relationship; the first preset correspondence relationship includes a preset correspondence relationship between transaction element information and preset data segments; determines units corresponding to the data segments according to a second preset correspondence relationship, and obtains the unit status of the unit; the second preset correspondence relationship includes a preset correspondence relationship between preset data segments and preset units; if the unit status is determined to be a normal state, then determines database information corresponding to each data segment of the unit according to a third preset correspondence relationship, and uses the database information as the data query result; the third preset correspondence relationship includes a preset correspondence relationship between preset data segments and preset database information, which can improve the utilization rate of equipment resources and realize low-cost data information query.
[0125] Furthermore, the transaction element information includes the order of magnitude of the transaction elements; correspondingly, the data information query and processing method further includes:
[0126] The data segmentation matching method is determined based on the comparison between the magnitude of the transaction elements and the preset threshold for the magnitude of the transaction elements; the above description is provided and will not be repeated here.
[0127] The data shards corresponding to the transaction element information are determined according to the data sharding matching method described above. This will not be repeated here.
[0128] The data information query and processing method provided in this embodiment of the invention further improves the efficiency of data information query by reasonably determining the data segmentation and matching method.
[0129] Further, determining the data sharding matching method based on the comparison result between the order of magnitude of the transaction elements and a preset order of magnitude threshold of the transaction elements includes:
[0130] If the magnitude of the transaction elements is determined to be greater than or equal to a preset threshold for the magnitude of transaction elements, then the data sharding matching method is determined to be to call the plugin to calculate the data shards. This can be referred to the above explanation and will not be repeated here.
[0131] The data information query and processing method provided in this embodiment of the invention further improves the efficiency of data information query by calling a plugin to calculate data fragments.
[0132] Further, determining the data sharding matching method based on the comparison result between the order of magnitude of the transaction elements and a preset order of magnitude threshold of the transaction elements includes:
[0133] If it is determined that the order of magnitude of the transaction elements is less than a preset threshold for the order of magnitude of transaction elements, then the data sharding matching method is determined to be based on a first preset correspondence. This can be referred to the above explanation and will not be repeated here.
[0134] The data information query and processing method provided in this embodiment of the invention further improves the efficiency of data information query by determining data fragments according to a first preset correspondence relationship.
[0135] Furthermore, the data sharding matching method includes calling a plugin to calculate data shards; correspondingly, determining the data shards corresponding to the transaction element information according to the data sharding matching method includes:
[0136] In response to the user-selected mapping algorithm function, the plugin path corresponding to the mapping algorithm function is determined according to the fourth preset correspondence; the above description is provided and will not be repeated here.
[0137] The fourth preset correspondence includes the correspondence between preset mapping algorithm functions and preset plugin paths; please refer to the above description, and it will not be repeated here.
[0138] The mapping algorithm function is obtained according to the plugin path, and data shards corresponding to the transaction element information are calculated based on the mapping algorithm function. This can be referred to the above description and will not be repeated here.
[0139] The data information query and processing method provided in this embodiment of the invention can flexibly determine data shards by allowing users to independently select the mapping algorithm function used to calculate data shards.
[0140] Furthermore, a backup unit to take over the unit is determined based on pre-configuration information; correspondingly, the data information query and processing method further includes:
[0141] If an abnormality is detected in the unit, the unit state is switched to the abnormal state; please refer to the above description, and it will not be repeated here.
[0142] If the unit status of the backup unit is determined to be normal, then the database information corresponding to each data shard of the backup unit is determined according to the third preset correspondence, and the database information is used as the data query result. Refer to the above description; further details are omitted.
[0143] The data information query and processing method provided in this embodiment of the invention facilitates the switching between primary and backup units and ensures that data information queries are available at any time.
[0144] Furthermore, the data information query and processing method also includes:
[0145] The first preset correspondence, the second preset correspondence, the third preset correspondence, and the fourth preset correspondence are pre-stored in a local cache. Refer to the above description; further details are omitted.
[0146] The data information query and processing method provided in this embodiment of the invention improves data reading efficiency.
[0147] It should be noted that the data information query and processing method provided in this embodiment of the invention can be used in the financial field, or in any technical field other than the financial field. This embodiment of the invention does not limit the application field of the data information query and processing method.
[0148] Figure 7 This is a schematic diagram of the structure of a data information query and processing device provided in an embodiment of the present invention, as shown below. Figure 7 As shown, the data information query processing apparatus provided in this embodiment of the invention includes a determining unit 701, an acquiring unit 702, and a querying unit 703, wherein:
[0149] The determining unit 701 is used to acquire transaction elements and determine data shards corresponding to the transaction element information according to a first preset correspondence relationship; the first preset correspondence relationship includes a correspondence relationship between preset transaction element information and preset data shards; the acquiring unit 702 is used to determine the unit corresponding to the data shard according to a second preset correspondence relationship and acquire the unit status of the unit; the second preset correspondence relationship includes a correspondence relationship between preset data shards and preset units; the querying unit 703 is used to determine the database information corresponding to each data shard of the unit according to a third preset correspondence relationship if the unit status is determined to be normal, and use the database information as the data query result; the third preset correspondence relationship includes a correspondence relationship between preset data shards and preset database information.
[0150] Specifically, the determining unit 701 in the device is used to acquire transaction elements and determine data segments corresponding to the transaction element information according to a first preset correspondence relationship; the first preset correspondence relationship includes a correspondence relationship between preset transaction element information and preset data segments; the acquiring unit 702 is used to determine the unit corresponding to the data segment according to a second preset correspondence relationship and acquire the unit status of the unit; the second preset correspondence relationship includes a correspondence relationship between preset data segments and preset units; the querying unit 703 is used to determine the database information corresponding to each data segment of the unit according to a third preset correspondence relationship if the unit status is determined to be normal, and use the database information as the data query result; the third preset correspondence relationship includes a correspondence relationship between preset data segments and preset database information.
[0151] The data information query and processing apparatus provided in this embodiment of the invention acquires transaction elements, determines data segments corresponding to the transaction element information according to a first preset correspondence relationship; the first preset correspondence relationship includes a correspondence relationship between preset transaction element information and preset data segments; determines units corresponding to the data segments according to a second preset correspondence relationship, and acquires the unit status of the unit; the second preset correspondence relationship includes a correspondence relationship between preset data segments and preset units; if the unit status is determined to be a normal state, then determines database information corresponding to each data segment of the unit according to a third preset correspondence relationship, and uses the database information as the data query result; the third preset correspondence relationship includes a correspondence relationship between preset data segments and preset database information, which can improve the utilization rate of equipment resources and realize low-cost data information query.
[0152] Furthermore, the transaction element information includes the order of magnitude of the transaction elements; correspondingly, the data information query and processing device is also used for:
[0153] Based on the comparison between the magnitude of the transaction elements and the preset threshold for the magnitude of the transaction elements, the data segmentation matching method is determined;
[0154] The data fragments corresponding to the transaction element information are determined based on the data fragment matching method.
[0155] The data information query and processing device provided in this embodiment of the invention further improves the efficiency of data information query by reasonably determining the data segmentation and matching method.
[0156] Furthermore, the data information query and processing device is also specifically used for:
[0157] If it is determined that the magnitude of the transaction elements is greater than or equal to the preset threshold for the magnitude of transaction elements, then the data sharding matching method is determined to be to call the plugin to calculate the data shards.
[0158] The data information query and processing device provided in this embodiment of the invention further improves the efficiency of data information query by calling a plug-in to calculate data fragments.
[0159] Furthermore, the data information query and processing device is also specifically used for:
[0160] If it is determined that the order of magnitude of the transaction elements is less than a preset order of magnitude threshold for transaction elements, then the data sharding matching method is determined to be data sharding based on a first preset correspondence.
[0161] The data information query and processing device provided in this embodiment of the invention further improves the efficiency of data information query by determining data fragments according to a first preset correspondence relationship.
[0162] Furthermore, the data sharding matching method includes calling a plugin to calculate data shards; correspondingly, the data information query and processing device is also specifically used for:
[0163] In response to the user-selected mapping algorithm function, the plugin path corresponding to the mapping algorithm function is determined according to the fourth preset correspondence relationship;
[0164] The fourth preset correspondence includes the correspondence between preset mapping algorithm functions and preset plugin paths;
[0165] The mapping algorithm function is obtained according to the plugin path, and the data shards corresponding to the transaction element information are calculated based on the mapping algorithm function.
[0166] The data information query and processing device provided in this embodiment of the invention can flexibly determine data sharding by allowing the user to independently select the mapping algorithm function used to calculate data sharding.
[0167] Furthermore, the standby unit to take over the unit is determined based on the pre-configuration information; correspondingly, the data information query and processing device is also used for:
[0168] If an abnormality is detected in the unit, the unit state is switched to an abnormal state;
[0169] If the unit status of the backup unit is determined to be normal, the database information corresponding to each data shard of the backup unit is determined according to the third preset correspondence, and the database information is used as the data query result.
[0170] The data information query and processing device provided in this embodiment of the invention facilitates switching between primary and backup units, ensuring that data information queries are always available.
[0171] Furthermore, the data information query and processing device is also used for:
[0172] The first preset correspondence, the second preset correspondence, the third preset correspondence, and the fourth preset correspondence are pre-stored in the local cache.
[0173] The data information query and processing device provided in this embodiment of the invention improves data reading efficiency.
[0174] The embodiments of the data information query and processing device provided in this invention can be used to execute the processing flow of the above-described method embodiments. Its functions will not be repeated here, but can be referred to the detailed description of the above-described method embodiments.
[0175] Figure 8 This is a schematic diagram of the physical structure of an electronic device provided in an embodiment of the present invention, such as... Figure 8 As shown, the electronic device includes: a processor 801, a memory 802, and a bus 803;
[0176] The processor 801 and the memory 802 communicate with each other via the bus 803.
[0177] The processor 801 is used to call program instructions in the memory 802 to execute the methods provided in the above-described method embodiments, including, for example:
[0178] Obtain transaction elements and determine data segments corresponding to the transaction element information based on the first preset correspondence relationship;
[0179] The first preset correspondence includes the correspondence between preset transaction element information and preset data fragments;
[0180] The unit corresponding to the data fragment is determined according to the second preset correspondence, and the unit status of the unit is obtained;
[0181] The second preset correspondence includes the correspondence between preset data fragments and preset units;
[0182] If the unit is determined to be in a normal state, the database information corresponding to each data segment of the unit is determined according to the third preset correspondence, and the database information is used as the data query result.
[0183] The third preset correspondence includes the correspondence between preset data fragments and preset database information.
[0184] This embodiment discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions, and when the program instructions are executed by a computer, the computer can perform the methods provided in the above-described method embodiments, such as:
[0185] Obtain transaction elements and determine data segments corresponding to the transaction element information based on the first preset correspondence relationship;
[0186] The first preset correspondence includes the correspondence between preset transaction element information and preset data fragments;
[0187] The unit corresponding to the data fragment is determined according to the second preset correspondence, and the unit status of the unit is obtained;
[0188] The second preset correspondence includes the correspondence between preset data fragments and preset units;
[0189] If the unit is determined to be in a normal state, the database information corresponding to each data segment of the unit is determined according to the third preset correspondence, and the database information is used as the data query result.
[0190] The third preset correspondence includes the correspondence between preset data fragments and preset database information.
[0191] This embodiment provides a computer-readable storage medium storing a computer program that causes the computer to execute the methods provided in the above-described method embodiments, including, for example:
[0192] Obtain transaction elements and determine data segments corresponding to the transaction element information based on the first preset correspondence relationship;
[0193] The first preset correspondence includes the correspondence between preset transaction element information and preset data fragments;
[0194] The unit corresponding to the data fragment is determined according to the second preset correspondence, and the unit status of the unit is obtained;
[0195] The second preset correspondence includes the correspondence between preset data fragments and preset units;
[0196] If the unit is determined to be in a normal state, the database information corresponding to each data segment of the unit is determined according to the third preset correspondence, and the database information is used as the data query result.
[0197] The third preset correspondence includes the correspondence between preset data fragments and preset database information.
[0198] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0199] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0200] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0201] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0202] In the description of this specification, the references to terms such as "an embodiment," "a specific embodiment," "some embodiments," "for example," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0203] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A data information query and processing method, characterized in that, include: Obtain transaction elements and determine data segments corresponding to the transaction element information based on the first preset correspondence relationship; The first preset correspondence includes the correspondence between preset transaction element information and preset data fragments; The unit corresponding to the data fragment is determined according to the second preset correspondence, and the unit status of the unit is obtained; The second preset correspondence includes the correspondence between preset data fragments and preset units; If the unit is determined to be in a normal state, the database information corresponding to each data segment of the unit is determined according to the third preset correspondence, and the database information is used as the data query result. The third preset correspondence includes the correspondence between preset data fragments and preset database information.
2. The data information query and processing method according to claim 1, characterized in that, The transaction element information includes the order of magnitude of the transaction elements; correspondingly, the data information query and processing method further includes: Based on the comparison between the magnitude of the transaction elements and the preset threshold for the magnitude of the transaction elements, the data segmentation matching method is determined; The data fragments corresponding to the transaction element information are determined based on the data fragment matching method.
3. The data information query and processing method according to claim 2, characterized in that, The step of determining the data sharding matching method based on the comparison result between the order of magnitude of the transaction elements and the preset order of magnitude threshold of the transaction elements includes: If it is determined that the magnitude of the transaction elements is greater than or equal to the preset threshold for the magnitude of transaction elements, then the data sharding matching method is determined to be to call the plugin to calculate the data shards.
4. The data information query and processing method according to claim 2, characterized in that, The step of determining the data sharding matching method based on the comparison result between the order of magnitude of the transaction elements and the preset order of magnitude threshold of the transaction elements includes: If it is determined that the order of magnitude of the transaction elements is less than a preset order of magnitude threshold for transaction elements, then the data sharding matching method is determined to be data sharding based on a first preset correspondence.
5. The data information query and processing method according to claim 2, characterized in that, The data sharding matching method includes calling a plugin to calculate data shards; correspondingly, determining the data shards corresponding to the transaction element information according to the data sharding matching method includes: In response to the user-selected mapping algorithm function, the plugin path corresponding to the mapping algorithm function is determined according to the fourth preset correspondence relationship; The fourth preset correspondence includes the correspondence between preset mapping algorithm functions and preset plugin paths; The mapping algorithm function is obtained according to the plugin path, and the data shards corresponding to the transaction element information are calculated based on the mapping algorithm function.
6. The data information query and processing method according to any one of claims 1 to 5, characterized in that, The standby unit to take over the unit is determined based on the pre-configuration information; correspondingly, the data information query and processing method further includes: If an abnormality is detected in the unit, the unit state is switched to an abnormal state; If the unit status of the backup unit is determined to be normal, the database information corresponding to each data shard of the backup unit is determined according to the third preset correspondence, and the database information is used as the data query result.
7. The data information query and processing method according to any one of claims 1 to 5, characterized in that, The data information query and processing method further includes: The first preset correspondence, the second preset correspondence, and the third preset correspondence are pre-stored in the local cache.
8. The data information query and processing method according to claim 5, characterized in that, The data information query and processing method further includes: pre-storing the fourth preset correspondence in a local cache.
9. A data information query and processing device, characterized in that, include: The determining unit is used to acquire transaction elements and determine data segments corresponding to the transaction element information according to a first preset correspondence relationship. The first preset correspondence includes the correspondence between preset transaction element information and preset data fragments; An acquisition unit is used to determine the unit corresponding to the data fragment according to a second preset correspondence relationship, and to acquire the unit status of the unit; The second preset correspondence includes the correspondence between preset data fragments and preset units; The query unit is used to determine the database information corresponding to each data fragment of the unit according to the third preset correspondence relationship if the unit status is determined to be normal, and to use the database information as the data query result; The third preset correspondence includes the correspondence between preset data fragments and preset database information.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 8.