A distributed data processing method, device, equipment and medium
By parsing and rewriting SQL statements using the Apache ShardingSphere middleware, we have achieved rapid distribution and processing of large amounts of data, solving the performance bottleneck problem of traditional databases and improving the system's throughput and processing efficiency.
Patent Information
- Application Number
- CN202210113083.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-29
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2042-01-29
AI Technical Summary
Traditional relational databases are prone to performance bottlenecks when processing large amounts of data, especially when performing join operations between multiple tables, which incur significant performance overhead, leading to memory overflows and excessively long processing times, thus failing to meet system performance requirements.
The Apache ShardingSphere middleware parses SQL statements to generate abstract syntax trees, extracts the parameters required for sharding, determines the routing path, rewrites the SQL statements into executable SQL statements for the path, distributes them to the corresponding data nodes for processing, and performs result set merging calculations in conjunction with the abstract syntax tree.
It achieves rapid processing and distribution of large amounts of data without consuming application server cache or database performance, thus ensuring the high availability of the distributed database.
Smart Images

Figure CN114443772B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and medium for processing distributed data. Background Technology
[0002] With the advent of the big data era, the amount of data stored in systems has increased dramatically. Traditional relational databases are prone to performance bottlenecks when processing large amounts of data, affecting the overall system throughput. This is especially true when dealing with complex scenarios, which often involve join operations between multiple tables, leading to significant performance overhead. In some scenarios, they may even fail to meet system performance requirements.
[0003] Currently, JAVA or other languages are typically used to retrieve data from the database all at once, and then process and summarize the data into balances for each time period based on customer identifiers, dates, and other dimensions.
[0004] However, this solution is resource-intensive and may lead to memory overflow. If the balance is aggregated for transaction data in the hundreds of millions and queried from the database all at once, memory overflow may occur; moreover, it needs to be processed one by one, which is time-consuming. Summary of the Invention
[0005] This invention provides a method, apparatus, device, and medium for processing distributed data, which can quickly process data from a database without occupying application server cache or consuming much database performance, thereby completing the data distribution process.
[0006] According to one aspect of the present invention, a method for processing distributed data is provided, the method comprising:
[0007] If an account information change event is detected, obtain the SQL statement and information change parameters sent by the client;
[0008] The SQL statement is parsed to obtain an abstract syntax tree, and the parameters required for sharding are extracted from the abstract syntax tree and the information change parameters;
[0009] Based on the parameters required for the sharding, determine the routing path for the SQL statement;
[0010] The SQL statement is rewritten into a path-executable SQL rewritten statement based on the routing path, and then distributed to the data nodes corresponding to the routing path for processing.
[0011] Optionally, after rewriting the SQL statement into a path-executable SQL rewritten statement according to the routing path and distributing it for processing, the method further includes:
[0012] Based on the abstract syntax tree, the result set of the distribution processing results is merged and calculated, and the merged result is fed back to the client.
[0013] Optionally, the required parameters for sharding include at least one of date, amount, account feature bits, and processing agency code.
[0014] Optionally, the routing path of the SQL statement is determined based on the parameters required for sharding, including:
[0015] The routing path of the SQL statement is determined based on at least one of the parameters required for sharding, including date, amount, account feature bits, and processing agency code, as well as pre-configured routing rules.
[0016] Optionally, the data node includes at least one database, which is any one of MySQL, PostgreSQL, Oracle, and SQL Server databases.
[0017] Optionally, after distributing the data to the data nodes corresponding to the routing path for processing, the method further includes:
[0018] The process of storing the rewritten SQL statement into the target database is divided into three processes: a single task, a task method, and a public method. The task method is used to provide daily average data calculation services when called by the single task, and the public method is used to provide services such as the start date, end date, and number of days in the current period when called by the task method.
[0019] Optionally, the single task is used to calculate at least one of the following: cumulative deposit balance, average daily deposit balance, cumulative loan balance, and average daily loan balance.
[0020] According to another aspect of the present invention, a distributed data processing apparatus is provided, the apparatus comprising:
[0021] The acquisition module is used to acquire the SQL statement and information change parameters sent by the client if an account information change event is detected.
[0022] The parameter extraction module is used to parse the SQL statement to obtain an abstract syntax tree, and extract the parameters required for sharding from the abstract syntax tree and the information change parameters;
[0023] The routing path determination module is used to determine the routing path of the SQL statement based on the parameters required for the sharding.
[0024] The distribution processing module is used to rewrite the SQL statement into a path-executable SQL rewritten statement according to the routing path, and distribute it to the data nodes corresponding to the routing path for processing.
[0025] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0026] At least one processor; and
[0027] A memory communicatively connected to the at least one processor; wherein,
[0028] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the distributed data processing method according to any embodiment of the present invention.
[0029] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the distributed data processing method according to any embodiment of the present invention.
[0030] The technical solution of this invention involves, upon detecting an account information change event, obtaining the SQL statement and information change parameters sent by the client; parsing the SQL statement to obtain an abstract syntax tree (API), and extracting sharding parameters from the API and the information change parameters; determining the routing path of the SQL statement based on the sharding parameters; rewriting the SQL statement into a path-executable SQL rewritten statement based on the routing path, and distributing it to the data nodes corresponding to the routing path for processing. This technical solution can quickly process data from the database without occupying application server cache and consuming minimal database performance, thereby completing the data distribution process.
[0031] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying 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.
[0033] Figure 1This is a flowchart of a distributed data processing method provided in Embodiment 1 of the present invention;
[0034] Figure 2 This is a flowchart of a distributed data processing method provided in Embodiment 2 of the present invention;
[0035] Figure 3 This is a diagram showing the overall structure of the storage procedure applicable to the distributed data processing method provided in Embodiment 2 of the present invention.
[0036] Figure 4 This is a schematic diagram of the structure of a distributed data processing device provided in Embodiment 3 of the present invention;
[0037] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the distributed data processing method of the present invention. Detailed Implementation
[0038] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0039] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0040] Example 1
[0041] Figure 1 This is a flowchart illustrating a distributed data processing method according to Embodiment 1 of the present invention. This embodiment is applicable to situations involving the processing of distributed data. The method can be executed by a distributed data processing device, which can be implemented in hardware and / or software and can be configured in an electronic device with data processing capabilities. Figure 1As shown, the method includes:
[0042] S110. If an account information change event is detected, obtain the SQL statement and information change parameters sent by the client.
[0043] The technical solution in this embodiment can be executed by a backend server. It can utilize Apache ShardingSphere middleware and database stored procedures to rapidly process large volumes of bank transaction detail data from heterogeneous data sources, including Sybase and MySQL databases, without consuming application server cache or placing significant pressure on database performance. This enables the aggregation and processing of data across different time periods, while ensuring high availability of the distributed database during the data aggregation process. In this embodiment, Apache ShardingSphere employs a data sharding scheme to provide the database with distributed storage capabilities.
[0044] Apache ShardingSphere is an ecosystem of distributed database solutions, comprised of three main parts: Sharding-JDBC, Sharding-Proxy, and Sharding-Sidecar. These components provide standardized horizontal scaling, distributed transactions, and distributed governance capabilities, making them suitable for diverse application scenarios, including Java homogeneous, heterogeneous, and cloud-native environments. As Apache ShardingSphere continues to explore query optimizers and distributed transaction engines, it has gradually broken down product boundaries, evolving into a platform-level solution that combines progressiveness and stability.
[0045] The account information change event can include events that cause real-time changes to user account information. For example, data resulting from user deposits or withdrawals that cause changes to account information. SQL statements are the standard query language for relational databases. In this embodiment, the SQL statement sent by the client can be the SQL statement generated by the server backend based on the user's deposit or withdrawal operations and needs to be executed. Information change parameters can be parameters such as the date of change, amount, and account number. In this embodiment, when the backend server detects a change in the user's account information, it obtains the generated SQL statement to be executed and the changed date, amount, and account number parameters by parsing the database protocol packet or using the Sharding-JDBC driver.
[0046] In this embodiment, the server's task processing can include two types: daytime tasks and end-of-day tasks. Daytime tasks handle data that changes in real time, while end-of-day tasks summarize data from the entire day. The server can process tasks in batches to invoke various individual tasks.
[0047] S120. Parse the SQL statement to obtain an abstract syntax tree, and extract the parameters required for sharding from the abstract syntax tree and the information change parameters.
[0048] An abstract syntax tree (AST) is a tree-like representation of the abstract syntactic structure of source code. Each node in the tree represents a structure in the source code. It's called abstract because the AST doesn't represent every detail of the actual syntax; for example, nested parentheses are implicit in the tree structure and not presented as nodes. The AST doesn't depend on the syntax of the source language, meaning it doesn't rely on the context-agnostic grammar used in the parsing phase. This is because grammar writing often involves equivalent transformations (eliminating left recursion, backtracking, ambiguity, etc.), which introduces redundant elements into parsing, negatively impacting subsequent stages and potentially causing confusion. Therefore, many compilers often construct their own parse trees to establish a clear interface between the front-end and back-end.
[0049] The parameters required for sharding can be keyword parameters extracted from the SQL statement. These parameters may include date, amount, account characteristic bits, and line break codes; the account characteristic bits can be the first few digits of the account number. Specifically, taking a date as an example, the system checks whether the current information belongs to the current year or the previous year, and then shards it according to the date. In this embodiment, the backend server can parse the acquired SQL statement using a lexical analyzer and a syntax analyzer to obtain an Abstract Syntax Tree (AST), and extract the keyword parameters required for sharding from the SQL statement and information variation parameters.
[0050] S130. Determine the routing path of the SQL statement based on the parameters required for sharding.
[0051] The routing path can be understood as the path where the SQL statement is fragmented. In this embodiment, the routing path of the SQL statement can be determined based on at least one of the parameters required for fragmentation: date, amount, account feature bits, and processing institution code.
[0052] S140. Rewrite the SQL statement into a path-executable SQL rewritten statement according to the routing path, and distribute it to the data nodes corresponding to the routing path for processing.
[0053] In this embodiment, the data nodes can be the data nodes in the abstract syntax tree corresponding to the routing path. A data node can include at least one database. In this embodiment, the backend server can rewrite SQL statements into path-executable SQL rewritten statements based on the obtained routing path, and then distribute them to the data nodes in the abstract syntax tree corresponding to the routing path for processing.
[0054] In this embodiment, executable SQL statements can be automatically routed to the corresponding data nodes according to the user-preset sharding algorithm, thereby achieving the purpose of operating multiple databases. Users can use multiple databases managed by Apache ShardingSphere as if they were using a single-machine database.
[0055] The technical solution of this invention involves, upon detecting an account information change event, obtaining the SQL statement and information change parameters sent by the client; parsing the SQL statement to obtain an abstract syntax tree (API), and extracting sharding parameters from the API and the information change parameters; determining the routing path of the SQL statement based on the sharding parameters; rewriting the SQL statement into a path-executable SQL rewritten statement based on the routing path, and distributing it to the data nodes corresponding to the routing path for processing. This technical solution can quickly process data from the database without occupying application server cache and consuming minimal database performance, thereby completing the data distribution process.
[0056] Example 2
[0057] Figure 2 This is a flowchart of a distributed data processing method provided in Embodiment 2 of the present invention. This embodiment is based on the above embodiment and optimized. Specifically, the optimization is as follows: after rewriting the SQL statement into a path-executable SQL rewritten statement according to the routing path and distributing it for processing, the method further includes: performing result set merging calculation on the distributed processing results based on the abstract syntax tree, and feeding back the merging result to the client.
[0058] like Figure 2 As shown, the method includes:
[0059] S210. If an account information change event is detected, obtain the SQL statement and information change parameters sent by the client.
[0060] S220. Parse the SQL statement to obtain an abstract syntax tree, and extract the parameters required for sharding from the abstract syntax tree and the information change parameters.
[0061] S230. Determine the routing path of the SQL statement based on the parameters required for the sharding.
[0062] S240. Rewrite the SQL statement into a path-executable SQL rewritten statement according to the routing path, and distribute it to the data nodes corresponding to the routing path for processing.
[0063] S250. Based on the abstract syntax tree, perform result set merging calculation on the distribution processing results, and feed the merging result back to the client.
[0064] The distribution processing result can be the result obtained by the server distributing executable SQL statements to data nodes corresponding to the routing path for processing. In this embodiment, the backend server can perform streaming or full-memory result set merging calculations based on the abstract syntax tree, and return the merged result to the client according to the encapsulated database protocol packet or JDBC result set.
[0065] For example, in this embodiment, the daily average balance can be divided into annual average balance and current year's daily average balance based on the abstract syntax tree, calculated separately, and the results combined and displayed to the customer. Here, the balance data summary can refer to the aggregation of bank transaction details with the balances of each period from the previous day to generate the current day's period balance data.
[0066] The technical solution of this invention involves obtaining the SQL statement and information change parameters issued by the client upon detecting an account information change event; parsing the SQL statement to obtain an abstract syntax tree (AST), and extracting sharding parameters from the AST and the information change parameters; determining the routing path of the SQL statement based on the sharding parameters; rewriting the SQL statement into a path-executable SQL rewritten statement based on the routing path, and distributing it to the data nodes corresponding to the routing path for processing; and performing result set merging calculation on the distributed processing results based on the AST, and feeding the merging result back to the client. This technical solution can quickly process large-scale bank transaction detail data from heterogeneous data sources in the database without occupying application server cache and consuming minimal database performance, thereby completing the data aggregation processing and ensuring the high availability of the distributed database during the data aggregation processing.
[0067] In this embodiment, optionally, the required parameters for sharding include at least one of date, amount, account feature bits, and processing agency code.
[0068] The account feature can be the first few digits of the account number; the processing agency code can be the branch code of the processing agency. In this embodiment, the parameters required for sharding may include at least one of the following: date, amount, the first few digits of the account number, and the branch code of the processing agency.
[0069] This solution allows for data segmentation based on keyword information, making data processing more convenient and efficient.
[0070] In this embodiment, optionally, determining the routing path of the SQL statement based on the sharding required parameters includes: determining the routing path of the SQL statement based on at least one of the date, amount, account feature bits and processing agency code included in the sharding required parameters, and pre-configured routing rules.
[0071] The pre-configured routing rules can be based on a user-defined algorithm to match the sharding key and calculate the routing path. In this embodiment, the backend server can determine the routing path of the SQL statement based on at least one of the parameters required for sharding, including date, amount, account feature bits, and processing institution code, as well as the user-defined algorithm to match the sharding key and calculate the routing path.
[0072] For example, the date in the parameters required for sharding can point to a specific database; the first few digits of the account number can also determine the database; and it can also indicate the product, such as personal, corporate, debit card, or credit card products. The shard key determines the distribution of documents in a collection's shards. The shard key is an index field or composite index field present in each document of the collection. The distributed data storage database MongoDB uses ranges of shard key values to partition the data in a collection. Each range defines a non-overlapping range of shard key values and is associated with a chunk. MongoDB can attempt to distribute chunks evenly across shards in the cluster. Furthermore, the effectiveness of chunk distribution is directly related to the shard key.
[0073] This solution allows SQL statements to be automatically routed to the appropriate data nodes based on the user-defined sharding algorithm, thus enabling operations on multiple databases.
[0074] In this embodiment, optionally, the data node includes at least one database, which is any one of MySQL, PostgreSQL, Oracle, and SQL Server databases.
[0075] In this embodiment, the data node includes at least one database. Users can use multiple databases managed by Apache ShardingSphere as if they were using a single-machine database. Currently, MySQL, PostgreSQL, Oracle, SQL Server, and any database that supports the SQL92 and JDBC standard protocols are supported.
[0076] This solution, through this configuration, is based on database stored procedures, does not occupy application cache, and consumes minimal database performance.
[0077] In this embodiment, optionally, after the data is distributed to the data node corresponding to the routing path for processing, the method further includes: dividing the process of storing the SQL rewritten statement in the target database into three processes: a single task, a task method, and a common method; wherein, the task method is used to provide daily average data calculation services when called by the single task, and the common method is used to provide services such as the start date, end date, and number of days in the current period when called by the task method.
[0078] This embodiment handles tasks in two ways: daytime and end-of-day processing. Daytime processing deals with data that changes in real time, while end-of-day processing summarizes data for the entire day. Batch task processing enables the handling of various individual tasks. Task methods, when called by a single task, provide daily average data calculation services, while public methods, when called by task methods, provide information such as the start and end dates of the period and the number of days in the current period.
[0079] The overall structure diagram of the stored procedure in this embodiment is as follows: Figure 3 As shown in the diagram. A single task can be invoked in batches at the end of the day to process specific tasks. Examples include data cleaning tasks, cumulative deposit balance tasks, cumulative loan balance tasks, daily average or business balance tasks, etc. A single task here can be understood as calculating only the cumulative deposit balance, or only the cumulative loan balance, etc., with each indicator constituting a single task.
[0080] The task method can be called by a single task stored procedure. Depending on the input parameters, it can process balance data with the same logic for different time patterns. For example, the method for processing the average daily deposit balance during a period has the following implementation steps: 1) Call the public method to obtain parameters such as the start date, end date, and interval days for this time pattern. 2) Delete the average daily deposit data for the current period from the intermediate table. 3) Insert the average daily deposit data for this time pattern into the intermediate table. 4) Delete the average daily deposit data for the current period from the target table. 5) Insert the data from the intermediate table into the target table.
[0081] The common methods can be those for retrieving frequently used parameters, such as the number of days in the current period, the beginning date of the current period, and the end date of the current period. They can also be methods for retrieving the average number of days in the current year and the number of days since the system went live.
[0082] For example, the stored procedure code logic for retrieving the number of days in the current period using a public method is as follows:
[0083]
[0084]
[0085]
[0086]
[0087] In this embodiment, the process of storing the rewritten SQL statement in the target database is divided into three logically independent stored procedures: a single-task stored procedure, a task-method stored procedure, and a public method stored procedure. Through mutual calls between these stored procedures, database join operations and code complexity are reduced, improving the speed of balance data aggregation and processing. Furthermore, without consuming application server cache or significant database performance, it can aggregate information such as each customer's balance at the end of the ten-day period, month, quarter, and year, as well as other daily average balance data.
[0088] In this embodiment, optionally, the single task is used to calculate at least one of the following: cumulative deposit balance, average daily deposit balance, cumulative loan balance, and average daily loan balance.
[0089] In this embodiment, the single task can be used to calculate cumulative deposit balance, average daily deposit balance, cumulative loan balance, and average daily loan balance, etc. This solution, through this configuration, designs a single task and invokes it using sharding technology, achieving support for multi-source data and high availability.
[0090] Example 3
[0091] Figure 4 This is a schematic diagram of a distributed data processing device provided in Embodiment 3 of the present invention. This device can execute the distributed data processing method provided in any embodiment of the present invention, and possesses the corresponding functional modules and beneficial effects for executing the method. For example... Figure 4 As shown, the device includes:
[0092] The acquisition module 410 is used to acquire the SQL statement and information change parameters sent by the client if an account information change event is detected.
[0093] The parameter extraction module 420 is used to parse the SQL statement to obtain an abstract syntax tree, and extract the parameters required for sharding from the abstract syntax tree and the information change parameters;
[0094] The routing path determination module 430 is used to determine the routing path of the SQL statement based on the parameters required for the sharding.
[0095] The distribution processing module 440 is used to rewrite the SQL statement into a path-executable SQL rewritten statement according to the routing path, and distribute it to the data nodes corresponding to the routing path for processing.
[0096] Optionally, the apparatus further includes: a result set calculation module, used for:
[0097] After rewriting the SQL statement into a path-executable SQL rewritten statement according to the routing path and distributing it for processing, the result set of the distribution processing is merged and calculated based on the abstract syntax tree, and the merged result is fed back to the client.
[0098] Optionally, the required parameters for sharding include at least one of date, amount, account feature bits, and processing agency code.
[0099] Optionally, the routing path determination module 430 is specifically used for:
[0100] The routing path of the SQL statement is determined based on at least one of the parameters required for sharding, including date, amount, account feature bits, and processing agency code, as well as pre-configured routing rules.
[0101] Optionally, the data node includes at least one database, which is any one of MySQL, PostgreSQL, Oracle, and SQL Server databases.
[0102] Optionally, the device further includes: a storage splitting module, used for:
[0103] After the SQL rewritten statement is distributed to the data node corresponding to the routing path for processing, the process of storing the SQL rewritten statement in the target database is divided into three processes: a single task, a task method, and a common method. The task method is used to provide daily average data calculation services when called by the single task, and the common method is used to provide services such as the start date, end date, and number of days in the current period when called by the task method.
[0104] Optionally, the single task is used to calculate at least one of the following: cumulative deposit balance, average daily deposit balance, cumulative loan balance, and average daily loan balance.
[0105] The distributed data processing apparatus provided in the embodiments of the present invention can execute the distributed data processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.
[0106] Example 4
[0107] Figure 5A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0108] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0109] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0110] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the processing of distributed data.
[0111] In some embodiments, the processing of method-distributed data may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the method-distributed data processing described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform method-distributed data processing by any other suitable means (e.g., by means of firmware).
[0112] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0113] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0114] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0115] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0116] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0117] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through a communication network. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0118] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0119] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method of processing distributed data, characterized by, The method comprises: If an account information change event is detected, obtaining a SQL statement and information change parameters sent by a client; wherein the information change parameters comprise date, amount, and account change parameters; Parsing the SQL statement to obtain an abstract syntax tree, and extracting required parameters for sharding from the abstract syntax tree and the information change parameters; Determining a routing path of the SQL statement according to the required parameters for sharding; Rewriting the SQL statement into a path-executable SQL rewritten statement according to the routing path, and distributing the SQL rewritten statement to a data node corresponding to the routing path for processing; After the SQL rewritten statement is distributed to the data node corresponding to the routing path for processing, the method further comprises: In a process of storing the SQL rewritten statement into a target database, splitting into a single task, a task method, and a common method; wherein the task method is used to provide daily average data calculation services when called by the single task, and the common method is used to provide services of a start date, an end date, and a number of days in the period when called by the task method; The single task is used to calculate at least one of an accumulated deposit balance, a daily average deposit balance, an accumulated loan balance, and a daily average loan balance; The required parameters for sharding comprise at least one of date, amount, account feature bits, and processing institution codes; Determining the routing path of the SQL statement according to the required parameters for sharding comprises: Determining the routing path of the SQL statement according to at least one of date, amount, account feature bits, and processing institution codes included in the required parameters for sharding, and a pre-configured routing rule; wherein the pre-configured routing rule is matched with a sharding key and calculates the routing path according to a user preset algorithm.
2. The method of claim 1, wherein, After the SQL statement is rewritten into the path-executable SQL rewritten statement according to the routing path and distributed for processing, the method further comprises: Based on the abstract syntax tree, performing result set merging calculation on a processing result, and feeding back a merging result to the client.
3. The method of claim 1, wherein, The data node comprises at least one database, and the database is any one of a MySQL database, a PostgreSQL database, an Oracle database, and a SQL Server database.
4. A processing apparatus of distributed data, characterized by, The apparatus comprises: An obtaining module is configured to, if an account information change event is detected, obtain a SQL statement and information change parameters sent by a client; wherein the information change parameters comprise date, amount, and account change parameters; A parameter extraction module is configured to parse the SQL statement to obtain an abstract syntax tree, and extract required parameters for sharding from the abstract syntax tree and the information change parameters; A routing path determination module is configured to determine a routing path of the SQL statement according to the required parameters for sharding; A distribution processing module is configured to rewrite the SQL statement into a path-executable SQL rewritten statement according to the routing path, and distribute the SQL rewritten statement to a data node corresponding to the routing path for processing; The storage splitting module is configured to split the process of storing the SQL rewriting statement into a single task, a task method and a common method after the SQL rewriting statement is distributed to a data node corresponding to a routing path for processing; the task method is configured to provide a daily average data calculation service when being called by the single task, and the common method is configured to provide a service of start day, end day and current period day information when being called by the task method; The single task is configured to calculate at least one of an accumulated deposit balance, a daily average deposit balance, an accumulated loan balance and a daily average loan balance; The shard required parameters include at least one of a date, an amount, an account feature bit and a processing agency code; The routing path determination module is specifically configured to: determine a routing path of the SQL statement according to at least one of the date, the amount, the account feature bit and the processing agency code included in the shard required parameters and a pre-configured routing rule; the pre-configured routing rule is matched with a shard key and a routing path is calculated according to a user preset algorithm.
5. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the processing method of distributed data according to any one of claims 1-3.
6. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for enabling the processor to execute the processing method of distributed data according to any one of claims 1-3 when executed.
Citation Information
Patent Citations
Method, device and system for executing stored procedure
CN110121704A
High-performance data access system and method of mimicry defense architecture
CN112131245A