Data processing method, target database system, and data processing system
By obtaining and simulating the SQL statements of the target database system, the problem of risk prediction in database system migration is solved, achieving efficient and reliable risk prediction and low-cost system switching, and supporting the simulation of different concurrency scenarios.
Patent Information
- Application Number
- CN202010747265.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-07-17
- Filing Date
- 2020-07-29
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2040-07-29
AI Technical Summary
During the database system migration process, it is impossible to effectively understand the operating status of the database system after the migration, which poses a risk when applications switch to the new system.
The system obtains SQL statements sent by the application to the source database system from the target database system, parses and simulates their execution to predict potential risks, utilizes collection nodes and proxy nodes for bypass deployment to reduce interference with the application system, and obtains and processes SQL statements in asynchronous transmission, supporting simulation of different numbers of concurrent threads.
It effectively reduces the actual risks when switching applications from the source database system to the target database system, improves the reliability of risk prediction and communication efficiency, and reduces the impact on application systems and communication costs.
Smart Images

Figure CN113946559B_ABST
Abstract
Description
[0001] This application claims priority to Chinese Patent Application No. 202010692252.0, filed on July 17, 2020, entitled "Method, Device, Server and Storage Medium for Migrating Application", the entire contents of which are incorporated herein by reference. TECHNICAL FIELD
[0002] The present application relates to the technical field of database, and particularly relates to a data processing method, a target database system and a data processing system. BACKGROUND
[0003] With the development of storage technology, the requirements of users for a database system providing storage services are also increasing. When a user wants to migrate the business of an application (also referred to as an application program) of an existing database system to another database system, there is a certain risk in switching the application to be served by the other database system, because the running status of the database system after the business migration cannot be understood. SUMMARY
[0004] Embodiments of the present application provide a data processing method, a target database system and a data processing system. The technical solution is as follows:
[0005] In a first aspect, a data processing method is provided. The method is applied to a data processing system, and the data processing system includes a source database system and a target database system. An application needs to be switched from the source database system to the target database system, so that the source database system provides services for the application, and the target database system provides services for the application. The method includes:
[0006] The target database system obtains a SQL statement, the SQL statement being obtained based on a data packet sent by the application to the source database system. The target database system obtains data associated with the SQL statement, the data being migrated from the source database system to the target database system. The target database system executes the SQL statement based on the data associated with the SQL statement, and an execution result of the SQL statement is used to feed back a risk of switching the application from the source database system to the target database system to provide services.
[0007] The data processing method provided by the embodiments of the present application can predict the corresponding risk before the application is switched from the source database system to the target database system to provide services, so that the system maintainer can maintain the target database system based on the execution result, thereby effectively reducing the actual risk of switching the application from the source database system to the target database system to provide services.
[0008] In addition, the SQL statement is obtained based on the data packet sent by the application to the source database system, and is the actual SQL statement sent by the application to the source database system, so that the working state of the target database system can be simulated based on the actual business data, thereby effectively predicting the risk and ensuring the reliability of the risk prediction result.
[0009] In an optional implementation, the method further includes: converting the obtained SQL statement into an SQL statement matched with the target database system.
[0010] By converting the obtained SQL statement into an SQL statement matched with the target database system, the execution efficiency of the SQL statement can be improved, and unnecessary execution errors can be avoided.
[0011] The SQL statement obtained by the target database system is obtained from the intercepted data packet sent by the application to the source database system. In actual implementation, the application communicates with the database system through a server end, and therefore the aforementioned SQL statement is obtained from the intercepted data packet sent by the application server to the source database system.
[0012] Since the data packet is generated based on a preset database protocol, the SQL statement is obtained based on the database protocol and the data packet. The database protocol is used to define the meaning of each byte of the data packet. Optionally, the data processing system further includes a collection node, and the collection node runs collection software. The collection software can be downloaded and installed on the collection node by a user. The collection node is used to intercept the data packet sent by the application server to the source database system. After intercepting the data packet, the collection node can parse the data packet to obtain the SQL statement, and store the parsed SQL statement. Compared with directly storing the data packet, the collection node extracts and stores the SQL statement, so that the storage of redundant information can be reduced, and the storage pressure of the collection node can be reduced.
[0013] The data processing system can further include at least one agent node, the number of the agent nodes being equal to the number of the application servers on which the applications are deployed, and each agent node being installed on an application server. The agent node can intercept the data packets transmitted by the application server to the source database system.
[0014] In an optional implementation, the agent node can be a network card installed on the application server, which can intercept the data packets transmitted by itself. Using a physical network card to intercept the data packets can improve the efficiency of intercepting the data packets.
[0015] In another optional implementation, the agent node can be an agent software downloaded and installed on the application server by a user. For example, the agent node can be installed at the network card of the application server to monitor and intercept the data packets transmitted at the network card.
[0016] The agent node can intercept the data packets, and the collection node can analyze the data packets to obtain the SQL statements, so that the bypass deployment of the device for obtaining the SQL statements (i.e., the agent node and the collection node) can be implemented, the application system is not intruded, the program in the application system does not need to be modified, the interference to the application system is reduced, the business impact on the application is avoided, and the complexity of obtaining the SQL statements is reduced.
[0017] In an optional example, the collection node and the agent node are communicatively connected through a wired or wireless manner. The two nodes can be in the same communication network, for example, the same wireless local area network or the same wireless fidelity (WiFi) network, so that the packet loss rate between the agent node and the collection node can be reduced, the collection node can collect more complete data, and the reliability of the data obtained by the collection node can be improved. In addition, the collection node and the agent node being located in the same network can reduce the data transmission delay between the two nodes and improve the data transmission efficiency.
[0018] After obtaining the SQL statements, the collection node can provide the SQL statements to the target database system through various manners, and the embodiments of the present application are described by way of example as follows:
[0019] In an optional manner, the collection node sends the obtained SQL statements to the target database system. Correspondingly, the target database system receives the SQL statements sent by the collection node.
[0020] In another optional manner, a staff member exports the SQL statements obtained by the collection node, and uploads the exported SQL statements to the target database system. Correspondingly, the target database system obtains the SQL statements exported from the collection node.
[0021] The target database system acquires the SQL statements by exporting the SQL statements from the collection node, is not limited by the communication network between the collection node and the target database system, avoids data loss caused by transmitting the SQL statements through the communication network, and thus improves the reliability of the acquired SQL statements.
[0022] In the foregoing two manners of providing the SQL statements to the target database system by the collection node, the collection node can provide the SQL statement to the target database system after a period of time after the SQL statement is parsed. That is, the interception of the data packet and the provision of the SQL statement to the target database system are performed asynchronously, and the SQL statement does not need to be transmitted to the target database system in real time. Because the time limit for transmitting the SQL statement is not high, the communication network between the collection node and the target database system does not have special requirements (for example, the special requirement that the two must be in the same communication network), which can effectively reduce the communication overhead and reduce the communication cost of the collection node and the target database system.
[0023] In the embodiment of the application, the simulation parameter of the target database system for executing the SQL statement is adjustable. The simulation parameter is a parameter for describing the working environment of the target database system when executing the SQL statement. The target database system can acquire the simulation parameter and execute the SQL statement based on the simulation parameter and the data associated with the SQL statement. In this way, by adjusting the simulation parameter, the execution of the SQL statement in different modes can be realized, thereby simulating different working states of the target database system.
[0024] The simulation parameter includes one or more of the following: a simulation period, application information, configuration information of the source database system, a number of concurrent threads, or information of a communication connection between the application and the source database system. The simulation period is a time period in which the target database system executes the SQL statement, that is, a time period in which the actual working state simulation is performed. The application information is used to describe the attributes of the application. For example, the application information includes at least one of the number of application servers or the upper limit of the computing resources occupied by the SQL statement during execution. The configuration information of the source database system is used to describe the configuration of the source database system during the working process. For example, the configuration information includes one or more of the following: whether to generate a log record after executing the SQL statement, the timing of disk flushing, or the frequency of disk flushing. The number of concurrent threads is the number of concurrent threads supported by the target database system when executing the SQL statement. The information of the communication connection between the application and the source database system is used to reflect the connection state of the application and the source database system, and can include the identification of the communication connection, and can also include the number of communication connections and / or the establishment time of the communication connection.
[0025] When the simulation parameters are all the same as the corresponding parameters of the source database system, the target database system can execute the SQL statement based on the simulation parameters and the data associated with the SQL statement, simulate the working state of the target database system when executing the same SQL statement as the source database system using the data associated with the SQL statement under the same parameters as the source database system, and thus feedback the risk of directly switching the application from being served by the source database system to being served by the target database system through the execution result of executing the SQL statement by the target database system. In this case, the simulation process of the target database system is equivalent to playing back the working process of executing the SQL statement by the source database system in the target database system, also known as equal playback.
[0026] When the number of concurrent threads of the target database system is multiple times the number of concurrent threads of the source database system in executing the SQL statement, and other simulation parameters are the same as the corresponding parameters of the source database system, the target database system can execute the SQL statement based on the simulation parameters and the data associated with the SQL statement, simulate the working state of the target database system when executing the same SQL statement as the source database system using the data associated with the SQL statement under a high-concurrency scenario, and thus obtain the execution result of executing the SQL statement by the target database system under the high-concurrency scenario, understand the pressure resistance of the target database system, and feedback the risk of switching the application from being served by the source database system to being served by the target database system to provide services under the high-concurrency scenario through the execution result. In this case, the simulation process of the target database system is equivalent to playing back the working process of executing the SQL statement by the source database system in the target database system after doubling the business load, also known as multiple playback.
[0027] In an optional manner, the target database can output the execution result of executing the SQL statement.
[0028] In another optional manner, the target database system compares the execution result of executing the SQL statement by the target database system with the execution result of executing the SQL statement by the source database system, and outputs the comparison result. Through the comparison of the two execution results, the risk can be more intuitively reflected.
[0029] The comparison result includes: a risk level, which is used to reflect the level of the risk of switching the application from being served by the source database system to being served by the target database system; and / or the comparison result includes: a risky SQL statement.
[0030] In an example, the risky SQL statement includes one or more of the following:
[0031] The first kind of SQL statement: the SQL statement whose execution result in the target database system and the execution result in the source database system are inconsistent in error type. For example, the error types include syntax error.
[0032] The second kind of SQL statement: the SQL statement whose execution result in the target database system and the execution result in the source database system are inconsistent in error type.
[0033] The third kind of SQL statement: the SQL statement whose execution time in the target database system and the execution time in the source database system are inconsistent in time difference. For example, the time difference threshold is 50ms to 100ms.
[0034] The fourth kind of SQL statement: the SQL statement whose execution time in the target database system and the execution time in the source database system are inconsistent in time difference and ratio. For example, the difference between the execution time of the first SQL statement in the target database system and the execution time in the source database system is greater than the time difference threshold, which indicates that the execution time of the first SQL statement in the target database system is much longer than the execution time in the source database system. The first SQL statement in the target database system is a slow SQL statement, which indicates that the target database system may have a risk of longer execution time for the first SQL statement.
[0035] The fifth kind of SQL statement: the SQL statement whose execution time in the target database system and the execution time in the source database system are inconsistent in time difference and ratio. For example, the difference between the execution time of the second SQL statement in the target database system and the execution time in the source database system is greater than the time difference threshold, and the ratio of the difference to the execution time in the target database system is greater than the ratio threshold. This indicates that the difference between the execution time of the second SQL statement in the target database system and the execution time in the source database system is large, and the difference is relatively long compared to the execution time in the source database system. From two dimensions, the slow SQL statement can be more accurately determined to be at high risk.
[0036] The sixth type of SQL statement: A high-frequency SQL statement whose execution time in the target database system differs from its execution time in the source database system by a value greater than a time difference threshold, and whose ratio of this difference to the execution time in the target database system is greater than a ratio threshold. This high-frequency SQL statement is one whose frequency of occurrence within its category exceeds a frequency threshold. For example, if the third SQL statement's execution time in the target database system differs from its execution time in the source database system by a value greater than a time difference threshold, and its ratio to the execution time in the target database system is greater than a ratio threshold, this indicates that the difference between the execution time of the third SQL statement in the target database system and its execution time in the source database system is significant, and this difference is relatively long compared to the execution time in the source database system. Furthermore, this third SQL statement is a high-frequency SQL statement. Defining slow SQL statements from these three dimensions allows for a more accurate identification of high-risk slow SQL statements.
[0037] The aforementioned risk level can be determined using one or more of the aforementioned risky SQL statements. For example, when the target database system executes SQL statements including risky statements, the risk level is determined by querying the correspondence between the SQL statement set and the risk level. For instance, the risk level corresponding to the first type of SQL statement and the third to sixth types of SQL statements is high, and the risk level corresponding to the second type of SQL statement is medium; or, the risk level corresponding to the first type of SQL statement and the sixth type of SQL statement is high, and the risk level corresponding to the second to fifth types of SQL statements is medium; when the target database system executes SQL statements without any risky SQL statements, the risk level is determined to be low.
[0038] Optionally, each agent node is also used to intercept data packets sent from the source database to the application server and send the intercepted data packets to the collection node.
[0039] In this application, after obtaining the execution result of the SQL statement executed by the source database system (i.e., the second execution result), the acquisition node can provide the second execution result to the target database system in various ways. The embodiments of this application will illustrate the following methods as examples:
[0040] In one alternative approach, the acquisition node sends the acquired second execution result to the target database system. Correspondingly, the target database system receives the second execution result sent by the acquisition node.
[0041] In another alternative approach, after exporting the second execution result obtained from the data acquisition node, the staff uploads the exported second execution result to the target database system. Correspondingly, the target database system retrieves the SQL statement exported from the data acquisition node.
[0042] The target database system acquires the second execution result by exporting the second execution result from the collection node, is not limited by a communication network between the collection node and the target database system, avoids data loss caused by transmitting the second execution result through the communication network, and thus improves reliability of the acquired second execution result.
[0043] Although the collection node has little influence on the application server by intercepting the data packet through the proxy node, in order to avoid affecting the service of the application server when the application server is under high load, the collection node can stop collecting the data packet sent by the application server to the source database system when the load of the application server is greater than a load threshold, and resume collecting the data packet sent by the application server to the source database system when the load of the application server is not greater than the load threshold; and / or stop collecting the data packet sent by the source database system to the application server when the load of the application server is greater than the load threshold, and resume collecting the data packet sent by the source database system to the application server when the load of the application server is not greater than the load threshold. In this way, by setting the protection mechanism, the pressure generated by the data packet interception operation performed by the collection node through the proxy node on the service of the application server can be reduced, and the normal work of the application server is ensured.
[0044] Optionally, the method further includes: switching the application from being served by the source database system to the target database system by the target database system.
[0045] In a second aspect, an embodiment of the present application provides a data processing method, which is applied to a data processing system, the data processing system includes a source database system, a target database system and a collection node, an application needs to be switched from the source database system to the target database system, and the application is served by the source database system and is switched to be served by the target database system, and the method includes:
[0046] The collection node obtains a SQL statement based on a data packet sent by the application to the source database system, provides the SQL statement to the target database system, so that the target database system executes the SQL statement based on data associated with the SQL statement after acquiring the data, and an execution result of the SQL statement is used to feed back a risk of switching the application from being served by the source database system to the target database system to provide the service, and the data associated with the SQL statement is migrated from the source database system to the target database system.
[0047] Optionally, the process of obtaining the SQL statement based on the data packet sent by the application to the source database system comprises: intercepting the data packet sent by the application to the source database system; and parsing the data packet to obtain the SQL statement of the source database system. In an example, the data processing system further comprises a proxy node, and the acquisition node can intercept the data packet sent by the application to the source database system through the proxy node. The process is described with reference to the corresponding process of the first aspect.
[0048] Optionally, the method further comprises: after intercepting the data packet sent by the source database system to the application, parsing the execution result of the SQL statement in the source database system; and sending the execution result of the SQL statement in the source database system to the target database system. In an example, the data processing system further comprises a proxy node, and the acquisition node can intercept the data packet sent by the source database system to the application through the proxy node. The process is described with reference to the corresponding process of the first aspect.
[0049] Although the acquisition node performs the data packet interception through the proxy node, which has little impact on the application server, in order to avoid affecting the business of the application server when the application server is under high load, the acquisition node can also stop collecting the data packet sent by the application server to the source database system when the load of the application server is greater than a load threshold, and resume collecting the data packet sent by the application server to the source database system when the load of the application server is not greater than the load threshold; and / or stop collecting the data packet sent by the source database system to the application server when the load of the application server is greater than the load threshold, and resume collecting the data packet sent by the source database system to the application server when the load of the application server is not greater than the load threshold. In this way, by setting this protection mechanism, the pressure generated by the data packet interception operation performed by the acquisition node through the proxy node on the business of the application server can be reduced, thereby providing protection for the normal work of the application server.
[0050] In a third aspect, the present application provides a target database system, which can comprise at least one module configured to implement the data processing method provided in the first aspect or any possible implementation of the first aspect.
[0051] In a fourth aspect, the present application provides an acquisition node, which can comprise at least one module configured to implement the data processing method provided in the second aspect or any possible implementation of the second aspect.
[0052] In a fifth aspect, the present application provides a computer device, comprising a processor and a memory. The memory stores computer instructions; and the processor executes the computer instructions stored in the memory, so that the computer device executes the method provided in the first aspect or the possible implementation of the first aspect, so that the computer device deploys the target database system provided in the third aspect or the possible implementation of the third aspect.
[0053] In a sixth aspect, the present application provides a computer device, comprising a processor and a memory. The memory stores computer instructions; and the processor executes the computer instructions stored in the memory, so that the computer device executes the method provided in the second aspect or the possible implementation of the second aspect, so that the computer device deploys the collection node provided in the fourth aspect or the possible implementation of the fourth aspect.
[0054] In a seventh aspect, the present application provides a computer readable storage medium, which stores computer instructions. The computer instructions instruct the computer device to execute the method provided in the first aspect or the possible implementation of the first aspect, or the computer instructions instruct the computer device to deploy the target database system provided in the third aspect or the possible implementation of the third aspect.
[0055] In an eighth aspect, the present application provides a computer readable storage medium, which stores computer instructions. The computer instructions instruct the computer device to execute the method provided in the second aspect or the possible implementation of the second aspect, or the computer instructions instruct the computer device to deploy the collection node provided in the fourth aspect or the possible implementation of the fourth aspect.
[0056] In a ninth aspect, the present application provides a computer program product, which comprises computer instructions stored in a computer readable storage medium. The processor of the computer device can read the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in the first aspect or the possible implementation of the first aspect, so that the computer device deploys the target database system provided in the third aspect or the possible implementation of the third aspect.
[0057] In a tenth aspect, a computer program product is provided, which includes computer instructions stored in a computer readable storage medium. A processor of a computer device can read the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the method provided in the second aspect or various possible implementations of the second aspect, so that the computer device deploys the collection node provided in the fourth aspect or various possible implementations of the fourth aspect.
[0058] In an eleventh aspect, a chip is provided, which can include programmable logic circuit and / or program instructions, and when the chip is running, is used to implement the data processing method in any of the first aspect.
[0059] In a twelfth aspect, a data processing system is provided, which includes a source database system and the target database system provided in the third aspect or various possible implementations of the third aspect.
[0060] Optionally, the data processing system further includes the collection node provided in the fourth aspect or various possible implementations of the fourth aspect.
[0061] The data processing method, the target database system and the data processing system provided in the embodiments of the present application can predict the corresponding risk before the application is switched from the source database system to the target database system to provide the service, so that the system maintainer can maintain the target database system based on the execution result, thereby effectively reducing the actual risk of switching the application from the source database system to the target database system to provide the service.
[0062] Moreover, the SQL statement is obtained based on the data packet sent by the application to the source database system, and is the actual SQL statement sent by the application to the source database system, so that the working state of the target database system can be simulated based on the actual business data, thereby effectively predicting the risk and ensuring the reliability of the risk prediction result.
[0063] When the data packet is intercepted and the SQL statement is executed in the target database system asynchronously, the SQL statement does not need to be transmitted to the target database system in real time. Thus, the time limit requirement for the transmission of the SQL statement is not high, and accordingly, the communication network between the collection node and the target database system does not have special requirements, so that the communication cost of the communication network between the collection node and the target database system can be effectively reduced.
[0064] Since the target database system supports different numbers of concurrent threads, it can simulate the working state of executing SQL statements under different business loads (such as the aforementioned process of playback or multiple playback), thereby providing comprehensive risk estimation results.
[0065] Further, by intercepting data packets by the proxy node and parsing the data packets by the collection node to obtain the SQL statements, the bypass deployment of the SQL statement acquisition device (i.e., the proxy node and the collection node) can be implemented, without invading the system where the application is located, without modifying the program in the system where the application is located, reducing the interference to the system where the application is located, avoiding the business impact on the application, and reducing the complexity of acquiring the SQL statements.
[0066] When the target database system is a cloud data system, the user can complete the function of simulating real business in the target database system through a cloud control platform and some simple operations, the operation is simple, and the reliability of business simulation is high.
[0067] The target database system in the embodiment of the present application supports multiple database types, and after obtaining the SQL statements, the obtained SQL statements are converted into SQL statements matched with the target database system, so that the SQL statements can be effectively parsed in different types of databases. BRIEF DESCRIPTION OF DRAWINGS
[0068] Figure 1 is an application environment schematic diagram of a data processing system related to the data processing method provided by the embodiment of the present application;
[0069] Figure 2 is a flow schematic diagram of a data processing method provided by the embodiment of the present application;
[0070] Figure 3 is another application environment schematic diagram of a data processing system related to the data processing method provided by the embodiment of the present application;
[0071] Figure 4 is still another application environment schematic diagram of a data processing system related to the data processing method provided by the embodiment of the present application;
[0072] Figure 5 is a block diagram of a target database system provided by the embodiment of the present application;
[0073] Figure 6 is a block diagram of another target database system provided by the embodiment of the present application;
[0074] Figure 7 is a block diagram of still another target database system provided by the embodiment of the present application;
[0075] Figure 8FIG. 1 is a possible basic hardware architecture schematic diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0076] To make the principles and technical solutions of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.
[0077] Currently, when a user wants to migrate the application of an existing database system to another database system, there is a certain risk in switching the application to be served by the another database system due to the inability to understand the running status of the database system after the migration. The database system originally providing services for the application is referred to as a source database system, and the database system to which the application is to be switched is referred to as a target database system. The target database system effectively reduces the risk of actually providing services for the application by simulating the actual working state of providing services for the application.
[0078] Figure 1 FIG. 1 is a possible basic hardware architecture schematic diagram of a computer device provided by an embodiment of the present application.
[0079] An example of the data processing method provided by an embodiment of the present application is described below with reference to FIG. 1. Figure 1 Suppose the data processing system includes a source database system 101 and a target database system 102, and the application needs to be switched from the source database system 101 to the target database system 102 to be served by the source database system 101 and switched to be served by the target database system 102.
[0080] The source database system can be a cloud database system or a local database system of a user, and the target database system can be a cloud database system. For example, the target database system can be a virtual private cloud (VPC) database system. The cloud database system refers to a database system deployed in a virtual computing environment. When the source database system is a local database system and the target database system is a cloud database system, the process of switching the application from the source database system to the target database system is also referred to as migration to the cloud. The cloud database system can realize functions such as pay-as-you-go, on-demand expansion, high availability, and storage integration.
[0081] In the source database system 101 and the target database system 102, each database system includes: a management node (also called a query engine, Structured Query Language (SQL) engine, database engine, or coordinator) and multiple data nodes. Each database system may include one or more databases (DBs), and correspondingly, it includes one or more management nodes. Each management node belongs to a database and is used to manage the data nodes in the corresponding database. Optionally, the aforementioned databases can be relational databases, which are databases that use a relational model to organize data. They store data in the form of rows and columns. Each relational model can be called a relational table.
[0082] For example, the management node can be a single node, or a specified or elected data node from among multiple data nodes. It can be a single server or a server cluster consisting of multiple servers. The management node is used to generate an execution plan for an SQL statement after receiving it from an application, and then controls the data nodes under its management to execute that execution plan.
[0083] In one implementation, each data node can be a server or a cluster of servers; in another implementation, each data node represents a defined minimum processing unit of the database system. For example, each data node can be a virtual machine or a container, an application instance that manages and / or stores data, or a database execution process.
[0084] In this embodiment, the target database system further includes a simulation node. This simulation node is used to simulate scenarios where the target database system actually provides services to the application, thereby providing feedback on the risks of switching the application from the source database system to the target database system. This simulation node can be integrated into the management node of the target database system or can be a separately configured node.
[0085] This application provides a data processing method that can be generated by... Figure 1 The target database system in the application environment shown is executed, for example, by a simulated node in the target database system. Figure 2 As shown, the method includes:
[0086] S201. The target database system obtains the SQL statement, which is based on the data packet sent by the application to the source database system.
[0087] The foregoing application includes a server end deployed in a server or a server cluster composed of multiple servers. In an optional manner, the server end can provide services to users in the form of a webpage. In another optional manner, the foregoing application further includes a client end deployed in user equipment (UE), and the server end can provide services to users in cooperation with the client end. The server in which the server end is deployed is referred to as an application server.
[0088] The SQL statement obtained by the target database system is obtained from a data packet sent by the intercepted application to the source database system. In actual implementation, the application communicates with the database system through the server end, and therefore the foregoing SQL statement is obtained from a data packet sent by the intercepted application server to the source database system.
[0089] Since the data packet is generated based on a preset database protocol, the SQL statement is obtained based on the database protocol and the data packet. Figure 3 is another application environment schematic diagram of the data processing system involved in the data processing method provided by the embodiment of the application. Figure 3 In the embodiment, the data processing system further includes a collection node 103. The collection node 103 can be a server or a server cluster composed of multiple servers. The collection node 103 runs a collection software. The collection software can be downloaded by a user and installed on the collection node 103. For example, when the target database system is a cloud database system, the user can download the collection software through a cloud control platform. The cloud control platform is used to manage resources in the target database system used for actual working state simulation, that is, resources related to the SQL statement obtained from the source database system. The collection node 103 is used to intercept a data packet sent by an application server to a source database system. After intercepting the data packet, the collection node 103 can parse the data packet to obtain a SQL statement and store the parsed SQL statement. The data packet includes a SQL statement and additional information such as authentication information or a timestamp, and is generated based on a preset database protocol. The database protocol is used to define the meaning of each byte of the data packet. For example, the database protocol is a Java Database Connectivity (JDBC) protocol or a c++ protocol. The collection node 103 can extract the SQL statement from the data packet based on the database protocol and store the SQL statement. Compared with directly storing the data packet, the storage of redundant information can be reduced, and the storage pressure of the collection node 103 can be reduced.
[0090] As Figure 3As shown, the data processing system can further include at least one agent node 104, the number of which is equal to the number of application servers 302 deployed by the application, and each agent node 104 is installed on an application server 302. The collection node 103 can intercept the data packet sent by the application server to the source database system through the agent node 104. Figure 3 It is assumed that the application-deployed device includes a user device 301 and an application server 302. In an example, the process of data packet interception includes that after the user sends a user request to the application server 302 through the user device 301, the application server 302 generates a data packet based on the user request and sends the data packet to the source database system 101 to execute the SQL statement carried in the data packet by the source database system 101, so as to realize the addition, deletion, modification or query of data. The agent node 104 intercepts the data packet sent by the installed application server 302 to the source database system and sends the intercepted data packet to the collection node 103. It should be noted that the Internet Protocol (IP) address and port of the collection node are pre-configured so that the agent node can send the intercepted data packet to it. Among them, the IP address of the collection node can be a public network IP address or an internal network IP address, such as a Virtual Private Network (VPN) IP address.
[0091] In an optional implementation, the agent node 104 can be a network card installed on the application server 302, which can intercept the data packet transmitted by itself. Using a physical network card to intercept the data packet can improve the interception efficiency of the data packet.
[0092] In another optional implementation, the agent node 104 can be an agent software downloaded and installed on the application server 302 by the user. In an example, the agent node 104 can be installed at the network card of the application server 302 to monitor and intercept the data packet transmitted at the network card. In an example, when the target database system is a cloud database system, the user can download the agent software through a cloud control platform.
[0093] By intercepting the data packet through the agent node and obtaining the SQL statement by analyzing the data packet through the collection node, the bypass deployment of the SQL statement acquisition device (i.e., the agent node and the collection node) can be realized, without invading the application system, without modifying the program in the application system, reducing the interference to the application system, avoiding the business impact on the application, and reducing the complexity of SQL statement acquisition.
[0094] In an optional example, the collection node 103 and the proxy node 104 are communicatively connected through wired or wireless manner. The two can be in the same communication network, for example, the same wireless local area network or the same wireless fidelity (WiFi) network, so as to reduce the packet loss rate between the proxy node 104 and the collection node 103, ensure that the collection node 103 collects more complete data, and improve the reliability of the data obtained by the collection node 103. In addition, the collection node 103 and the proxy node 104 are located in the same network, which can reduce the data transmission delay of the two and improve the data transmission efficiency of the two.
[0095] In the embodiment of the application, the collection node 103 can provide the SQL statement to the target database system in various ways after obtaining the SQL statement. The following examples are used for illustration:
[0096] In an optional manner, the collection node sends the obtained SQL statement to the target database system. Correspondingly, the target database system receives the SQL statement sent by the collection node. In an optional implementation manner, the collection node can send the SQL statement to the target database system in an idle period, so as to reduce the influence on other communication services of the target database system. When the collection node and the application server are in the same communication network, the influence on the application server can also be reduced. The idle period can be a period in which the frequency of sending data packets by the application server is less than a frequency threshold, or the idle period can be a pre-set period, for example, 0:00 to 5:00. In another optional implementation manner, the collection node sends the SQL statement to the target database system after receiving a sending instruction. In yet another optional implementation manner, the collection node sends the stored SQL statement to the target database system after the number of stored SQL statements reaches a number threshold. In an optional example, the collection node 103 can delete the sent SQL statement after sending the stored SQL statement to the target database system, so as to reduce the storage load; in another optional example, the collection node 103 stores the parsed SQL statement in a first storage space, and after sending the stored SQL statement to the target database system, the collection node 103 can delete the sent SQL statement from the first storage space and migrate the sent SQL statement to a second storage space, so as to perform backup of the sent SQL statement in the second storage space.
[0097] In another alternative, the worker exports the SQL statements obtained by the collection node, and then uploads the exported SQL statements to the target database system. Correspondingly, the target database system obtains the SQL statements exported from the collection node. For example, the SQL statements of the collection node can be exported to a storage device such as a solid state disk (SSD), a hard disk drive (HDD), or an optical disk, and then imported into the target database system by the storage device. In an alternative example, the collection node 103 can delete the exported SQL statements after exporting the stored SQL statements, so as to reduce the storage load. In another alternative example, the collection node 103 stores the parsed SQL statements in a first storage space, deletes the exported SQL statements from the first storage space after exporting the stored SQL statements, and migrates the exported SQL statements to a second storage space, so as to backup the exported SQL statements in the second storage space.
[0098] The target database system obtains the SQL statements by exporting the SQL statements from the collection node, which is not limited by the communication network between the collection node and the target database system, avoids the data loss phenomenon caused by transmitting the SQL statements through the communication network, and thus improves the reliability of the obtained SQL statements.
[0099] In the foregoing two ways of providing the SQL statements to the target database system by the collection node, the collection node can provide the SQL statements to the target database system after a period of time after parsing the SQL statements. That is, the interception of the data packets and the provision of the SQL statements to the target database system are executed asynchronously, and the SQL statements do not need to be transmitted to the target database system in real time. Since the time limit for transmitting the SQL statements is not high, the communication network between the collection node and the target database system does not have special requirements (for example, the special requirement that both must be in the same communication network), which can effectively reduce the communication overhead and reduce the communication cost of the collection node and the target database system.
[0100] It should be noted that, according to different working states of the target database system to be simulated to provide services for the application, the target database system can also collect other data associated with the SQL statements in the data packets, such as source information (such as the IP address of the application server) of the SQL statements, an identity (ID) of a communication connection, and / or a database identity. The ID of the communication connection is used to indicate through which communication connection the SQL statement is transmitted. The database identity is used to indicate the database in which the SQL statement is executed, for example, the database identity is the database name. The collection process of the other data is executed synchronously with the collection process of the SQL statement, and thus the collection process of the SQL statement can be referred to.
[0101] In the embodiments of the present application, the target database system can acquire the SQL statements collected within a specified time period for subsequent simulation (i.e., S202 to S205), and the specified time period can be set by a user or a system maintainer. The target database can also acquire all the collected SQL statements for subsequent simulation.
[0102] S202, the target database system acquires data associated with the SQL statements, which is migrated from the source database system to the target database system.
[0103] In order to ensure the accuracy of the simulation, the target database system needs to acquire the data associated with the SQL statements in the source database system to implement the execution of the SQL statements in the data environment, thereby effectively simulating the scenario in which the target database system actually provides services for the application.
[0104] Among them, the target database system can have multiple ways to acquire the data associated with the SQL statements, and the embodiments of the present application take the following acquisition methods as examples for illustration:
[0105] The first acquisition method is to migrate all the data of the application in the source database system to the target database system. The data in the source database system includes the data associated with the SQL statements. Through one-time full data migration, the overall data environment in which all the data in the source database system is migrated to the target database system can be simulated, so that the target database system can effectively simulate the working state of actually executing the SQL statements. For example, the application stores 10 million records in the source database system, and the 10 million records are migrated to the target database system through one-time full data migration.
[0106] The second acquisition method is to determine the data associated with the SQL statements in the source database system, and to incrementally migrate the determined data to the target database system. For example, the data associated with the SQL statements is the data of one or more databases, and the data of the one or more databases is migrated to the target database system. Optionally, the data associated with the SQL statements can be identified by the target database system or specified by a user. For example, the application stores 10 million records in the source database system, and 1 million records are data associated with the SQL statements, and the 1 million records are migrated to the target database system through incremental data migration.
[0107] S203, the target database system converts the acquired SQL statements into SQL statements matched with the target database system.
[0108] After the SQL statement is acquired, if the SQL statement does not match the target database system, the execution efficiency of the SQL statement is low or an execution error occurs. By converting the acquired SQL statement into an SQL statement that matches the target database system, the execution efficiency of the SQL statement can be improved, and unnecessary execution errors can be avoided.
[0109] The target database system includes one or more types of databases. Converting the acquired SQL statement into an SQL statement that matches the target database system means converting the acquired SQL statement into an SQL statement that matches a target database, which is a database in the target database system used to provide services for the application to be switched. For example, the target database is a database used to store data generated by the application. An SQL statement matches a certain database if the certain database can recognize the SQL statement, i.e., the format (also referred to as syntax) of the SQL statement is a format that the certain database can recognize. Therefore, the aforementioned conversion of the acquired SQL statement into an SQL statement that matches the target database means converting the format of the acquired SQL statement into a format that the target database can recognize.
[0110] In an example, the target database system can include one or more of a Gauss database, a MySQL database, a greenplum database, or a GaussDB. The greenplum DB is referred to as gpdb.
[0111] In S204, the target database system executes the SQL statement based on the data associated with the SQL statement, and an execution result of the SQL statement is used to feed back a risk of switching the application from the source database system to the target database system to provide services.
[0112] In an embodiment of the present application, the simulation parameter for the target database system to execute the SQL statement is adjustable. The simulation parameter is a parameter used to describe the working environment of the target database system when executing the SQL statement. The target database system can acquire the simulation parameter and execute the SQL statement based on the simulation parameter and the data associated with the SQL statement. In this way, by adjusting the simulation parameter, the execution of the SQL statement in different modes can be realized, thereby simulating different working states of the target database system.
[0113] Optionally, the target database system can provide a receiving interface for the simulation parameter through a user interface or a connected management device, and receive the simulation parameter through the receiving interface. In an optional example, the aforementioned receiving interface can provide a setting option for the simulation parameter, and the user can select the simulation parameter. In another optional example, the aforementioned receiving interface can provide an input box for the simulation parameter, and the user can input the simulation parameter.
[0114] The simulation parameter comprises one or more of the following: a simulation period, application information, configuration information of the source database system, a number of concurrent threads, or information of a communication connection between the application and the source database system. The simulation period is a time period in which the target database system executes the SQL statement, i.e., a time period in which actual working state simulation is performed. For example, a user sets 13:00 to 19:00 as the simulation period.
[0115] The application information is used to describe the attributes of the application. For example, the application information comprises at least one of the number of application servers or an upper limit of computing resources occupied by the SQL statement during execution. The computing resources can comprise CPU resources, memory resources, and / or hard disk resources, etc. By setting the number of application servers, the target database system can create the same number of execution nodes when performing working state simulation, and the created execution nodes correspond to the application servers one by one. The SQL statement is sent to the target database by the created execution nodes, each execution node simulates a scenario in which a corresponding application server interacts with the target database, thereby simulating a real business scenario of the application and improving the reliability of the execution result of the SQL statement.
[0116] The configuration information of the source database system is used to describe the configuration of the source database system during working. For example, the configuration information comprises one or more of the following: whether to generate a log record after executing the SQL statement, a time for flushing, or a frequency of flushing. The target database system can set its configuration information to be the same as the configuration information of the source database system, so that the real scenario in which the SQL statement is executed in the source database system can be restored.
[0117] The number of concurrent threads is the number of concurrent threads supported by the target database system when executing the SQL statement. In the embodiments of the present application, the target database system can support multiple numbers of concurrent threads. For example, the number of concurrent threads is an integer multiple of the number of concurrent threads of the source database system when executing the SQL statement, such as one or more multiples. When the number of concurrent threads is one multiple of the number of concurrent threads of the source database system when executing the SQL statement, i.e., the number of concurrent threads is the same as the number of concurrent threads of the source database system when executing the SQL statement, the target database system has the same business load as the source database system when executing the same SQL statement. When the number of concurrent threads is a multiple of the number of concurrent threads of the source database system when executing the SQL statement, the business load of the target database system is multiple times of the business load of the source database system when executing the same SQL statement. For example, the receiving interface can provide a setting option for the number of concurrent threads, and the user sets the number of concurrent threads.
[0118] The information of the communication connection between the application and the source database system is used to reflect the connection state of the application and the source database system, which can include the identification of the communication connection, and can also include the number of communication connections and / or the establishment time of the communication connection. Since the application is connected to the source database system through the application server, the aforementioned communication connection between the application and the source database system refers to the communication connection between the application server and the source database system. For example, when there are x communication connections established between an application server and a certain database in the source database system, the identification of any communication connection in the x communication connections can be represented by the identification of the application server that establishes the communication connection, the identification of the database, and the serial number of the any communication connection, which is used to indicate the ordering of the any communication connection in the x communication connections.
[0119] Suppose that there are m application servers, and each application server establishes n communication connections with the source database system. Then, when simulating the working state, the target database system can create m execution nodes, and establish n communication connections between each execution node and the target database, each of which simulates one communication connection between the application and the source database system. The target database system sends the SQL statements to the target database through the m x n communication connections in parallel, thereby simulating the real business scenario of the application and improving the reliability of the execution result of the SQL statements.
[0120] When the aforementioned simulation parameters are all the same as the corresponding parameters of the source database system, the target database system can execute the SQL statements based on the simulation parameters and the data associated with the SQL statements, simulate the working state of the target database system when executing the same SQL statements as the source database system using the data associated with the SQL statements under the same parameters as the source database system, and thereby feedback the risk of directly switching the application from the source database system to the target database system to provide services through the execution result of the SQL statements executed by the target database system. In this case, the simulation process of the target database system is equivalent to playing back the working process of the source database system executing the SQL statements, also known as the equal playback.
[0121] When the number of concurrent threads of the target database system is multiple times of the number of concurrent threads of the source database system in executing the SQL statement, and other simulation parameters are the same as corresponding parameters of the source database system, the target database system can execute the SQL statement based on the simulation parameters and data associated with the SQL statement, simulate a working state of the target database system in a high-concurrency scenario, and execute the same SQL statement as the source database system using the data associated with the SQL statement, so as to obtain an execution result of the target database system in executing the SQL statement in the high-concurrency scenario, understand the pressure resistance of the target database system, and feed back a risk of switching an application from being served by the source database system to being served by the target database system in the high-concurrency scenario through the execution result. In this case, the simulation process of the target database system is equivalent to playing back a working process of the source database system in executing the SQL statement after the business load is doubled in the target database system, which is also called multiple times playback.
[0122] It should be noted that the foregoing simulation parameters can also be other parameters, and the embodiments of the present application are only illustrative. By setting different simulation parameters, the working state of the target database system in executing the same SQL statement as the source database system using the data associated with the SQL statement in different scenarios can be simulated, so as to facilitate a user to comprehensively understand the actual working state of the target database system.
[0123] In addition, since the target database system uses the same SQL statement as the source database system, that is, the actual business data, to simulate the actual working state, an execution result of the SQL statement that is closer to an actual scenario of providing services for the application can be obtained, so as to realize that the execution result of the SQL statement more accurately feeds back the risk of switching the application from being served by the source database system to being served by the target database system.
[0124] For simplicity of description, the following embodiments refer to the execution result of the target database system executing the SQL statement as the first execution result, and refer to the execution result of the source database system executing the SQL statement as the second execution result. Each execution result can include one or more of the following: indication information indicating whether the SQL statement is executed successfully, or the execution duration of the SQL statement, or the SQL statement with an error, or the type of error. The indication information can be indicated by a status bit, for example, the status bit is 1, indicating that the SQL statement is executed successfully; the status bit is 0, indicating that the SQL statement is not executed successfully. The execution duration of the SQL statement can be the duration from the start of the database system executing the SQL statement to the end of the database system executing the SQL statement, which can also be indicated by the start time stamp of the SQL statement and the end time stamp of the SQL statement. The type of error is used to identify the type of error, for example, including syntax error, access permission problem, unique key conflict (or primary key conflict), network problem or deadlock rollback, etc.
[0125] In the embodiments of the present application, the risk of switching the application from being served by the source database system to being served by the target database system can be evaluated based on the execution result of the SQL statement in various implementation manners. In a first optional implementation manner, when the first execution result meets a preset condition, the target database system determines that the risk of switching the application from being served by the source database system to being served by the target database system is high, and sends a prompt information indicating that the risk of switching the application from being served by the source database system to being served by the target database system is high; when the first execution result does not meet the preset condition, the target database system determines that the risk of switching the application from being served by the source database system to being served by the target database system is low, and sends a prompt information indicating that the risk of switching the application from being served by the source database system to being served by the target database system is low. The preset condition includes one or more of the following:
[0126] The first condition is that there is an SQL statement with an error type including a syntax error. When the first execution result meets the first condition, it indicates that there may be a compatibility problem of the SQL statement, and the risk of the target database system serving the application is relatively high.
[0127] The second condition is that there is a slow SQL statement. For example, the slow SQL statement is an SQL statement with an execution duration greater than a duration threshold, for example, the duration threshold is 10 ms (milliseconds); or the slow SQL statement is a high-frequency SQL statement with an execution duration greater than a duration threshold. The high-frequency SQL statement is an SQL statement of a category with a frequency higher than a frequency threshold.
[0128] The target database system can classify the SQL statements with the execution duration greater than the duration threshold to obtain multiple categories of SQL statements. For each category of SQL statements, the target database system obtains a ratio of the number of SQL statements in the category to the number of all executed SQL statements to obtain an occurrence frequency of the SQL statements in the category. When the occurrence frequency of the SQL statements in the category is higher than a frequency threshold, it indicates that all the SQL statements in the category are high-frequency SQL statements. All the SQL statements belonging to the category are slow SQL statements. When the first execution result satisfies the second condition, it indicates that there is a SQL statement with a long execution delay, and the risk of using the target database system to provide services for the application is higher.
[0129] The third condition is that there is a SQL statement occupying computing resources greater than a resource threshold in the target database system. The target database system can monitor the consumption of computing resources during the execution of the SQL statement. When there is a period in which the computing resources are greater than the resource threshold, it indicates that there is a large occupation of computing resources during the execution of the SQL statement, and the risk of using the target database system to provide services is higher. Optionally, the prompt information can also include the SQL statement executed in the period in which the computing resources are greater than the resource threshold. The SQL statement belongs to a high-risk SQL statement, so that the system maintenance personnel can locate the SQL statement.
[0130] The fourth condition is that there is a SQL statement with a performance index greater than an index threshold in the target database system. The target database system can monitor the performance index of each SQL statement during the execution of the SQL statement. When there is a SQL statement with a performance index greater than an index threshold, it indicates that there is a high performance index during the execution of the SQL statement, and the risk of using the target database system to provide services is higher. Optionally, the prompt information can also include the SQL statement with the performance index greater than the index threshold. The SQL statement belongs to a high-risk SQL statement, so that the system maintenance personnel can locate the SQL statement. In an example, the performance index can include one or more of the following: an input / output (IO) index of the SQL statement, a delay, an error information, or an execution times.
[0131] The IO index refers to the number of IOs generated by the execution of the SQL statement; the delay refers to the delay generated by the execution of the SQL statement; the error information refers to the proportion of different types of errors generated by the execution of the SQL statement in the overall errors, that is, the ratio of the number of each type of error to the number of overall errors; and the execution times refer to the number of times the SQL statement is executed.
[0132] Optionally, the target database system can also output the first execution result.
[0133] In the second optional implementation, the target database system can compare the first execution result and the second execution result, and reflect the risk of switching the application from the service of the source database system to the service of the target database system by the comparison result. By comparing the two execution results, the size of the risk can be more intuitively reflected. The process is described with reference to subsequent S205 to S207.
[0134] S205, the target database system obtains the execution result of the SQL statement executed by the source database system.
[0135] The execution result of the SQL statement executed by the source database system obtained by the target database system is obtained from the data packet sent by the source database system to the application. In actual implementation, the application communicates with the database system through the server side, and therefore, the execution result of the SQL statement executed by the source database system is obtained from the data packet sent by the source database system to the application server.
[0136] Since the data packet is generated based on the preset database protocol, the execution result of the SQL statement executed by the source database system is obtained based on the database protocol and the data packet.
[0137] Reference Figure 3 The collection node 103 is further configured to intercept the data packet sent by the source database system to the application server. After intercepting the data packet, the collection node 103 can parse the data packet to obtain the execution result of the SQL statement, and store the parsed execution result of the SQL statement. The data packet includes the execution result of the SQL statement and additional information such as verification result or timestamp, and is generated based on the preset database protocol. For example, the database protocol is JDBC protocol or c++ protocol (it should be noted that the database protocol is the same as the protocol used by the application server to send the data packet to the source database system). The collection node 103 can extract the execution result of the SQL statement from the data packet based on the database protocol, and store the execution result of the SQL statement. Compared with directly storing the data packet, the storage of redundant information can be reduced, and the storage pressure of the collection node 103 can be reduced.
[0138] Optionally, each proxy node 104 is further configured to intercept the data packet sent by the source database to the application server, and send the intercepted data packet to the collection node 103.
[0139] The collection node 103 can provide the second execution result to the target database system in multiple ways after obtaining the execution result of the SQL statement executed by the source database system, i.e., the second execution result. The embodiments of the present application are described by taking the following ways as examples:
[0140] In an alternative, the collection node sends the obtained second execution result to the target database system. Correspondingly, the target database system receives the second execution result sent by the collection node. In an alternative implementation, the collection node can send the second execution result to the target database system in an idle period, so as to reduce the influence on other communication services of the target database system. When the collection node and the application server are in the same communication network, the influence on the application server can also be reduced. The idle period can be defined according to the definition of the idle period in the foregoing embodiments.
[0141] In an alternative example, after sending the stored second execution result to the target database system, the collection node 103 can delete the sent second execution result, so as to reduce the storage load. In another alternative example, the collection node 103 stores the parsed second execution result in the third storage space, and after sending the stored second execution result to the target database system, the collection node 103 can delete the sent second execution result from the third storage space and migrate the sent second execution result to the fourth storage space, so as to back up the sent second execution result in the fourth storage space.
[0142] It should be noted that any SQL statement and its corresponding second execution result can be sent by using different messages respectively or sent synchronously by using the same message. Any SQL statement and its corresponding second execution result can be sent in the same period or sent in different periods, which is not limited in the embodiments of the application.
[0143] In another alternative, after exporting the second execution result obtained by the collection node, the worker uploads the exported second execution result to the target database system. Correspondingly, the target database system obtains the SQL statement exported from the collection node. For example, the second execution result obtained by the collection node can be exported to an SSD, an HDD, an optical disc or other storage devices. The target database system obtains the second execution result by exporting the second execution result from the collection node, which is not limited by the communication network between the collection node and the target database system, and avoids the data loss phenomenon caused by transmitting the second execution result by using the communication network, so as to improve the reliability of the obtained second execution result. In an alternative example, after exporting the stored second execution result, the collection node 103 can delete the exported second execution result, so as to reduce the storage load. In another alternative example, the collection node 103 stores the parsed second execution result in the third storage space, and after exporting the stored second execution result, the collection node 103 can delete the exported second execution result from the third storage space and migrate the exported second execution result to the fourth storage space, so as to back up the exported second execution result in the fourth storage space.
[0144] It should be noted that in the foregoing S201 and S205, although the interception of the data packet by the collection node through the proxy node has less impact on the application server, in order to avoid affecting the business of the application server when the application server is under high load, the collection node can also stop collecting the data packet sent by the application server to the source database system when the load of the application server is greater than the load threshold, and resume collecting the data packet sent by the application server to the source database system when the load of the application server is not greater than the load threshold; and / or, stop collecting the data packet sent by the source database system to the application server when the load of the application server is greater than the load threshold, and resume collecting the data packet sent by the source database system to the application server when the load of the application server is not greater than the load threshold. In this way, by setting this protection mechanism, the pressure on the business of the application server caused by the data packet interception operation performed by the collection node through the proxy node can be reduced, and the normal work of the application server is guaranteed.
[0145] S206, the target database system compares the execution result of the target database system executing the SQL statement with the execution result of the source database system executing the SQL statement.
[0146] Since the SQL statement executed by the source database system can be multiple, after the target database system obtains the first execution result and the second execution result of the multiple SQL statements, the target database system can compare the first execution result and the second execution result corresponding to the same SQL statement respectively to obtain a comparison result.
[0147] In the embodiment of the present application, the comparison result is used to reflect the difference between the execution of the SQL statement by the source database system and the execution of the SQL statement by the target database system, thereby reflecting the risk of switching the service of the application from the source database system to the target database system.
[0148] The representation form of the comparison result can be various, and the embodiment of the present application assumes that the comparison result includes one or more of the following forms:
[0149] The first form, the comparison result includes: a risky SQL statement.
[0150] Among them, the risky SQL statement includes one or more of the following:
[0151] The first kind of SQL statement: a SQL statement that has an error in the execution result in the target database system and has no error in the execution result in the source database system, or has no error in the execution result in the target database system and has an error in the execution result in the source database system. For example, a SQL statement that has an error in the execution result in the target database system and has no error in the execution result in the source database system; or a SQL statement that has no error in the execution result in the target database system and has an error in the execution result in the source database system. For example, the error types include syntax errors. When a certain SQL statement has a syntax error in the execution result in the target database system and has no error in the execution result in the source database system, it indicates that the target database system may have a risk of incompatibility with the certain SQL statement.
[0152] The second kind of SQL statement: a SQL statement that has inconsistent error types in the execution result in the target database system and in the execution result in the source database system. For example, for a certain SQL statement, one of the error types in the execution result in the source database system and in the target database system includes a relational table incompatibility, and the other error type includes an access permission problem, which indicates that the target database system may have a risk of incompatibility with the certain SQL statement.
[0153] The third kind of SQL statement: a slow SQL statement. In different application scenarios, the definition of a slow SQL statement is different. The embodiments of the present application take the following definitions as examples for illustration:
[0154] The first definition: a slow SQL statement is a SQL statement whose execution time difference between the target database system and the source database system is greater than a time difference threshold. For example, the value range of the time difference threshold is 50 ms to 100 ms. For example, the execution time difference of a first SQL statement between the target database system and the source database system is greater than the time difference threshold, which indicates that the execution time of the first SQL statement in the target database system is much longer than the execution time in the source database system. The first SQL statement is a slow SQL statement in the target database system, which indicates that the target database system may have a risk of longer execution time for the first SQL statement.
[0155] The second definition is that the difference between the execution duration in the target database system and the execution duration in the source database system (i.e., the absolute difference between the two execution durations) is greater than a duration difference threshold value, and the ratio of the difference to the execution duration in the target database system (i.e., the relative difference between the two execution durations) is greater than a ratio threshold value. In an example, the duration difference threshold value is in a range of 50 ms, and the ratio threshold value is 15%. For example, the difference between the execution duration of the second SQL statement in the target database system and the execution duration in the source database system is greater than the duration difference threshold value, and the ratio of the difference to the execution duration in the target database system is greater than the ratio threshold value, which indicates that the difference between the execution duration of the second SQL statement in the target database system and the execution duration in the source database system is large, and the difference is relatively long with respect to the execution duration in the source database system. The slow SQL statement is defined from two dimensions, and the slow SQL statement with high risk can be more accurately determined.
[0156] The third definition is that the high-frequency SQL statement, which is a SQL statement with a frequency of occurrence in the category higher than a frequency threshold value, has a difference between the execution duration in the target database system and the execution duration in the source database system greater than a duration difference threshold value, and a ratio of the difference to the execution duration in the target database system greater than a ratio threshold value. For example, the difference between the execution duration of the third SQL statement in the target database system and the execution duration in the source database system is greater than the duration difference threshold value, and the ratio of the difference to the execution duration in the target database system is greater than the ratio threshold value, which indicates that the difference between the execution duration of the third SQL statement in the target database system and the execution duration in the source database system is large, and the difference is relatively long with respect to the execution duration in the source database system, and the third SQL statement is a high-frequency SQL statement. The slow SQL statement is defined from three dimensions, and the slow SQL statement with high risk can be more accurately determined.
[0157] In an example, the target database system can classify the SQL statement with a difference between the execution duration and the execution duration in the source database system greater than a duration difference threshold value, and a ratio of the difference to the execution duration in the target database system greater than a ratio threshold value, to obtain multiple categories of SQL statements. For each category of SQL statements, a ratio of the number of SQL statements in the category to the number of all executed SQL statements is obtained to obtain the frequency of occurrence of the SQL statements in the category. When the frequency of occurrence of the SQL statements in the category is higher than a frequency threshold value, it indicates that the SQL statements in the category are all high-frequency SQL statements. The SQL statements belonging to the category are all slow SQL statements.
[0158] Optionally, the execution result can further include the SQL statements executed in the period when the occupied computing resource is greater than the resource threshold, and / or the SQL statements whose performance indicators are greater than the indicator threshold when executed in the target database system. The SQL statements can be obtained in the manner described in the first optional implementation manner. Embodiments of the present application do not repeat the description here.
[0159] In the second form, the comparison result includes a risk level, which is used to reflect the level of risk of switching the application from being served by the source database system to being served by the target database system. Optionally, the risk level can be determined by one or more of the risky SQL statements. For example, when the SQL statements executed by the target database system include the risky SQL statements, the set of SQL statements is queried in correspondence with the risk level to determine the risk level. For example, the first and third SQL statements correspond to a high risk level, the second SQL statement corresponds to a medium risk level, and when the SQL statements executed by the target database system do not include the risky SQL statements, the risk level is determined to be low.
[0160] S207. The target database system outputs the comparison result.
[0161] Optionally, the target database system can provide an output interface of the comparison result through a user interface or a connected management device. The user can clearly understand the difference between the source database system and the target database system in executing the same SQL statements through the comparison result.
[0162] It is worth noting that the target database system can also output suggestion information based on the execution result or the comparison result of the target database system executing the SQL statements, and the suggestion information includes one or more of the following: maintenance suggestion for the system where the application is located, modification suggestion for the format of the SQL statements, or modification suggestion for the kernel of the target database. For example, when the target database system is a relational database system, the maintenance suggestion includes a suggestion to add an index or a suggestion to modify an index.
[0163] The suggestion information can enable the user to more intuitively understand the adjustments needed to switch the application from being served by the source database system to being served by the target database system.
[0164] S208. The target database system switches the application from being served by the source database system to being served by the target database system.
[0165] When the first execution result or the comparison result indicates that the risk of switching the application from the source database system to the target database system is high (e.g., the risk is high or the risk level is high), the system maintainer can perform maintenance on the target database system based on the first execution result or the comparison result or the suggestion information. For example, the system maintainer can analyze the SQL statements one by one to determine whether the SQL statements are actually risky. For example, if the error type of the SQL statement includes a primary key conflict, a table does not exist, or an access permission problem, the SQL statement is not actually risky and does not need to be repaired. If the error type of the SQL statement includes a syntax error or the SQL statement is a slow SQL statement, the SQL statement is actually a high-risk SQL statement, and the system maintainer can repair the unstable factors based on the SQL statement, such as modifying the kernel of the target database, adjusting the code, or modifying the parameters, to reduce the risk of the target database system providing services. After the maintenance is completed, the application is switched from the source database system to the target database system. When the first execution result or the comparison result indicates that the risk of switching the application from the source database system to the target database system is low (e.g., the risk is low or the risk level is low), the application can be directly switched from the source database system to the target database system.
[0166] The switching of the application from the source database system to the target database system can refer to that the application server is switched from communicating with the source database system to communicating with the target database system. For example, the application server is switched from sending a data packet to the source database system to sending a data packet to the target database system.
[0167] In summary, the data processing method provided by the embodiments of the present application can predict the risk of switching the application from the source database system to the target database system before the application is switched from the source database system to the target database system, and the system maintainer can perform maintenance on the target database system based on the execution result, thereby effectively reducing the actual risk of switching the application from the source database system to the target database system.
[0168] And, since the SQL statements are obtained based on the data packets sent by the application to the source database system, and are actual SQL statements sent by the application to the source database system, the working state of the target database system can be simulated based on actual business data, so that effective risk estimation can be performed, and the reliability of the risk estimation result can be ensured.
[0169] In the foregoing interception of the data packet and asynchronous execution of the SQL statement provided to the target database system, the SQL statement does not need to be transmitted to the target database system in real time. Thus, the time limit requirement for the transmission of the SQL statement is not high, and accordingly, there is no special requirement for the communication network of the collection node and the target database system, so that the communication cost of the communication network of the collection node and the target database system can be effectively reduced.
[0170] Since the target database system supports different numbers of concurrent threads, the working state of the execution of the SQL statement under different business loads (such as the foregoing playback or multiple playback process) can be simulated, so that comprehensive risk estimation results can be provided.
[0171] Further, the SQL statement can be obtained by intercepting the data packet by the proxy node and analyzing the data packet by the collection node, so that the bypass deployment of the SQL statement obtaining device (i.e., the proxy node and the collection node) can be implemented, the system where the application is located is not intruded, the program in the system where the application is located does not need to be modified, the interference on the system where the application is located is reduced, the business impact on the application is avoided, and the complexity of the SQL statement acquisition is reduced.
[0172] When the target database system is a cloud data system, a user can complete the function of real business simulation in the target database system through a cloud control platform and some simple operations, the operation is simple, and the reliability of the business simulation is high.
[0173] The target database system in the embodiment of the application supports multiple database types, and after the SQL statement is obtained, the obtained SQL statement is converted into a SQL statement matched with the target database system, so that the SQL statement can be effectively parsed in different types of databases.
[0174] It should be noted that the order of the steps of the data processing method provided in the embodiment of the application can be appropriately adjusted, and the steps can be appropriately increased or reduced according to the situation. For example, S203 can not be executed, and the two optional implementation manners of evaluating the risk of switching the application from the service of the source database system to the service of the target database system based on the execution result of the SQL statement can be executed only in one manner or in combination. Any person skilled in the art can easily think of a method of change within the technical range disclosed in the application, which should be covered in the protection range of the application, and thus will not be described in detail.
[0175] Figure 4 is another application environment of the data processing system involved in the data processing method provided by the embodiments of the present application. Figure 4 In the application environment, the target database system 102 includes a cloud control platform 1021, a scheduling center 1022, one or more execution nodes 1023, and a target database 1024.
[0176] The cloud control platform 1021 is configured to manage resources in the target database system for performing actual working state simulation, i.e., resources related to the SQL statements obtained from the source database system. A user can download software, such as the collection software or the agent software, through the cloud control platform 1021. Alternatively, the control platform 1021 can provide a user interface, and the user can also set simulation parameters through the cloud control platform 1021. For example, the control platform 1021 can create the scheduling center 1022 before starting the simulation, and create the same number of execution nodes 1023 based on the number of application servers in the simulation parameters.
[0177] The scheduling center 1022 is configured to perform S201, for example, obtaining the SQL statements sent by the collection node 103 or the SQL statements derived from the collection node 103.
[0178] The target database 1024 is a database in the target database system for providing services for the application to be switched, and is configured to perform S202, for example, obtaining the data obtained by the full data migration.
[0179] The scheduling center 1022, the execution node 1023, and the target database 1024 cooperatively perform S204. For example, the scheduling center 1022 sends the SQL statements to the execution node 1023, and the execution node 1023 executes the SQL statements to obtain the data, and then sends the data to the target database 1024. Figure 4As shown, the execution nodes 1023 correspond to the application servers 302 one by one. The scheduling center 1022 is configured to schedule the SQL statements to the corresponding execution nodes 1023 based on the application servers from which the SQL statements are obtained, and the one or more execution nodes 1023 are configured to send the SQL statements to the target database 1024 concurrently, so that the target database 1024 executes the concurrent SQL statements. For example, assuming that the fourth SQL statement is any SQL statement obtained by the scheduling center 1022 from the collection node 103, after obtaining the fourth SQL statement, the scheduling center 1022 parses the fourth SQL statement, determines the application server (i.e., the source of the fourth SQL statement) from which the fourth SQL statement is sent, schedules the fourth SQL statement to the execution node 1023 corresponding to the determined application server, and sends the fourth SQL statement to the target database 1024 by the execution node 1023, so that the target database 1024 executes the fourth SQL statement. Optionally, the number of communication connections between the execution nodes and the target database is equal to the number of communication connections between the application servers and the source database system. After obtaining the fourth SQL statement, the scheduling center 1022 can also determine the communication connection (i.e., the first communication connection) to which the SQL statement belongs, and after scheduling the fourth SQL statement to the execution node 1023 corresponding to the determined application server, the fourth SQL statement is sent to the target database 1024 by the execution node 1023 through the communication connection to which the SQL statement belongs.
[0180] It should be noted that the IP address and port of the target database are pre-configured, so that the execution nodes send the SQL statements thereto. The IP address and port of the target database can be configured by the cloud control platform 1021.
[0181] The embodiment of the present application provides a target database system 50, as shown in the figure, the target database system 50 comprises: Figure 5
[0182] The statement obtaining module 501 is configured to obtain a structured query language (SQL) statement, the SQL statement being obtained based on a data packet sent by an application to a source database system; the data obtaining module 502 is configured to obtain data associated with the SQL statement, the data being migrated from the source database system to the target database system; and the execution module 503 is configured to execute the SQL statement based on the data associated with the SQL statement, and an execution result of the SQL statement is used to feed back a risk of switching the application from being served by the source database system to being served by the target database system.
[0183] In summary, the target database system provided by the embodiments of the present application executes the SQL statement based on the obtained SQL statement and the data associated with the SQL statement. The execution result of the SQL statement is used to feed back the risk of switching the application from being served by the source database system to being served by the target database system. Therefore, the corresponding risk can be predicted before the application is switched from being served by the source database system to being served by the target database system, and the system maintainer can maintain the target database system based on the execution result, thereby effectively reducing the actual risk of switching the application from being served by the source database system to being served by the target database system.
[0184] Optionally, the target database system 50 further comprises a conversion module configured to convert the obtained SQL statement into an SQL statement matched with the target database system 50.
[0185] Optionally, the statement obtaining module 501 is configured to receive the SQL statement sent by the collection node or obtain the SQL statement derived from the collection node, wherein the SQL statement is obtained by the collection node by parsing the data packet after intercepting the data packet sent by the application to the source database system.
[0186] Optionally, the execution module 503 is configured to obtain simulation parameters, wherein the simulation parameters comprise one or more of the following: a simulation period, information of the application, configuration information of the source database system, a number of concurrent threads, or information of a communication connection between the application and the source database system; and execute the SQL statement based on the simulation parameters and the data associated with the SQL statement.
[0187] Optionally, as shown in Figure 6 the target database system 50 further comprises a comparison module 504 configured to compare the execution result of the SQL statement executed by the target database system 50 with the execution result of the SQL statement executed by the source database system; and an output module 505 configured to output the comparison result.
[0188] Optionally, the comparison result comprises: a risk level, wherein the risk level is used to reflect the level of the risk of switching the application from being served by the source database system to being served by the target database system 50; and / or a risky SQL statement.
[0189] Optionally, the risky SQL statement comprises one or more of the following:
[0190] a SQL statement that causes an error in one of the execution result in the target database system 50 and the execution result in the source database system, and does not cause an error in the other;
[0191] or, the SQL statement whose error type in the execution result in the target database system 50 is inconsistent with the error type in the execution result in the source database system;
[0192] or, the SQL statement whose execution duration difference between the target database system 50 and the source database system is greater than the duration difference threshold value;
[0193] or, the SQL statement whose ratio of the execution duration difference between the target database system 50 and the source database system to the execution duration in the target database system 50 is greater than the ratio threshold value;
[0194] or, the SQL statement whose execution duration difference between the target database system 50 and the source database system is greater than the duration difference threshold value, and whose ratio of the execution duration difference to the execution duration in the target database system 50 is greater than the ratio threshold value;
[0195] or, the high-frequency SQL statement whose execution duration difference between the target database system 50 and the source database system is greater than the duration difference threshold value, and whose ratio of the execution duration difference to the execution duration in the target database system 50 is greater than the ratio threshold value, the high-frequency SQL statement being a SQL statement whose appearance frequency in the category is higher than the frequency threshold value.
[0196] Optionally, as shown in Figure 7 the target database system 50 further includes a result obtaining module 506 configured to receive the execution result of the SQL statement executed by the source database system from the collection node or obtain the execution result of the SQL statement executed by the source database system derived from the collection node, the execution result of the SQL statement executed by the source database system being obtained by the collection node after intercepting the data packet sent by the source database system to the application.
[0197] The embodiment of the present application provides a data processing system, including a source database system and the target database system in any of the foregoing embodiments. The structure of the data processing system can refer to the structure of the data processing system shown in the foregoing Figure 1 .
[0198] Optionally, Figure 8 is a possible basic hardware architecture schematic diagram of the computer device provided by the embodiment of the present application.
[0199] Referring to Figure 8 , the computer device 800 includes a processor 801, a memory 802, a communication interface 803 and a bus 804.
[0200] In the computer device 800, the number of the processor 801 can be one or more,Figure 8 Only one processor 801 is shown. Optionally, the processor 801 can be a central processing unit (CPU). If the computer device 800 has multiple processors 801, the types of the multiple processors 801 can be different, or can be the same. Optionally, the multiple processors 801 of the computer device 800 can also be integrated into a multi-core processor.
[0201] The memory 802 stores computer instructions and data; the memory 802 can store computer instructions and data required to implement the data processing method provided in the present application, for example, the memory 802 stores instructions for implementing the steps of the data processing method. The memory 802 can be any one or any combination of the following storage media: non-volatile memory (such as read-only memory (ROM), solid-state disk, hard disk, optical disk), volatile memory.
[0202] The communication interface 803 can be any one or any combination of the following devices: network interface (such as Ethernet interface), wireless network card, and the like devices with network access function.
[0203] The communication interface 803 is used for data communication between the computer device 800 and other computer devices or terminals.
[0204] The bus 804 can connect the processor 801 with the memory 802 and the communication interface 803. In this way, the processor 801 can access the memory 802, and also can interact with other computer devices or terminals for data exchange by using the communication interface 803.
[0205] In the present application, the computer device 800 executes computer instructions in the memory 802, so that the computer device 800 implements the data processing method provided in the present application, or so that the computer device 800 deploys a database system.
[0206] In the exemplary embodiments, a non-transitory computer readable storage medium including instructions is also provided, for example, a memory including instructions, the above instructions can be executed by the processor of the server to complete the data processing method shown in various embodiments of the present application. For example, the non-transitory computer readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0207] In the above embodiments, all or part of the implementation can be achieved by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the implementation can be implemented in the form of a computer program product including one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer readable storage medium of the computer, or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transferred from one website node, computer, server or data center to another website node, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be magnetic media (such as floppy disk, hard disk, magnetic tape), optical media, or semiconductor media (such as solid state disk) and the like.
[0208] In this application, the terms "first", "second" and "third" are only for descriptive purposes, and cannot be understood as indicating or implying relative importance. The term "at least one" means one or more, and the term "multiple" means two or more, unless otherwise explicitly limited. A refers to B, which means that A is the same as B or A is a simple transformation of B.
[0209] It should be noted that: the target database system provided by the above embodiments in executing the data processing method is only exemplified by the division of the above functional modules, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the target database system and the data processing method provided by the above embodiments belong to the same concept, and the specific implementation process is described in the method embodiment, which will not be repeated here.
[0210] Those of ordinary skill in the art can understand that all or part of the steps of the above embodiments can be completed by hardware, or by program instructions to relevant hardware, and the program can be stored in a computer readable storage medium. The storage medium mentioned above can be read only memory, disk or optical disk, etc.
[0211] The above is only an optional embodiment of the present application, and does not limit the present application. Any modification, equivalent replacement, improvement, etc. made within the concept and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A data processing method, characterized by, The data processing method is applied to a data processing system, the data processing system comprising a source database system, a target database system, an application server and a collection node, the application server being deployed with an application and a proxy node, and the method comprising: The target database system receives an SQL statement sent by the collection node or acquires an SQL statement derived from the collection node, the SQL statement being obtained by the collection node from parsing a data packet, the data packet being intercepted by the proxy node from the application sent to the source database system through the application server; The target database system acquires data associated with the SQL statement, the data being migrated from the source database system to the target database system; The target database system acquires simulation parameters through a user interface or a receiving interface of simulation parameters provided by a connected management device, the simulation parameters comprising one or more of a simulation period, information of the application, configuration information of the source database system, a number of concurrent threads or information of a communication connection between the application and the source database system, wherein the simulation period is used to indicate a time period for the target database system to execute the SQL statement, the information of the application comprises at least one of a number of the application servers or an upper limit of computing resources occupied by the SQL statement when running, the configuration information is used to describe a configuration of the source database system in a working process, and the configuration information comprises one or more of whether to generate a log record after executing the SQL statement, a timing of disk flushing and a frequency of disk flushing, the number of concurrent threads is a number of concurrent threads supported by the target database system when executing the SQL statement, and the information of the communication connection is used to reflect a connection state of the application server and the source database system. The target database system executes the SQL statement based on the simulation parameters and the data associated with the SQL statement, and an execution result of executing the SQL statement is used to feed back a risk of switching the application from being served by the source database system to being served by the target database system.
2. The method of claim 1, wherein, The method further comprises: the target database system converting the acquired SQL statement into an SQL statement matched with the target database system.
3. The method of claim 1, wherein, The method further comprises: The target database system compares an execution result of the target database system executing the SQL statement with an execution result of the source database system executing the SQL statement; The target database system outputs a comparison result.
4. The method of claim 3, wherein, The comparison result comprises: a risk level, the risk level being used to reflect a level of a risk of switching the application from being served by the source database system to being served by the target database system; and / or, an SQL statement with a risk. The SQL statement with a risk comprises one or more of:
5. The method of claim 4, wherein, An SQL statement with one of an execution result in the target database system and an execution result in the source database system being an error and the other being no error; Or, the SQL statement whose error type in the execution result in the target database system is inconsistent with the error type in the execution result in the source database system; Or, the SQL statement whose execution duration difference between the target database system and the source database system is greater than a duration difference threshold value; Or, the SQL statement whose ratio of the execution duration difference between the target database system and the source database system to the execution duration in the target database system is greater than a ratio threshold value; Or, the SQL statement whose execution duration difference between the target database system and the source database system is greater than a duration difference threshold value, and whose ratio of the execution duration difference to the execution duration in the target database system is greater than a ratio threshold value; Or, the high-frequency SQL statement whose execution duration difference between the target database system and the source database system is greater than a duration difference threshold value, and whose ratio of the execution duration difference to the execution duration in the target database system is greater than a ratio threshold value, the high-frequency SQL statement being a SQL statement whose appearance frequency in the category is higher than a frequency threshold value.
6. The method according to any one of claims 3 to 5, characterized in that, The method further comprises: The target database system receives the execution result of the SQL statement executed by the source database system sent by the collection node or acquires the execution result of the SQL statement executed by the source database system derived from the collection node, the execution result of the SQL statement executed by the source database system being obtained by the collection node after intercepting the data packet sent by the source database system to the application.
7. A target database system, characterized by The target database system belongs to a data processing system, the data processing system further comprising a source database system, an application server and a collection node, the application server being deployed with an application and a proxy node, and the target database system comprising: A statement acquisition module configured to receive the SQL statement sent by the collection node or acquire the SQL statement derived from the collection node, the SQL statement being obtained by the collection node by analyzing a data packet, and the data packet being a data packet sent by the application through the application server to the source database system and intercepted by the proxy node. a data acquisition module configured to acquire data associated with the SQL statement, the data being migrated from the source database system to the target database system; an execution module configured to execute the SQL statement based on the simulation parameters and the data associated with the SQL statement, an execution result of the SQL statement being used to reflect a risk of switching the application from being served by the source database system to being served by the target database system.
8. The target database system of claim 7, wherein, The target database system further comprises a conversion module configured to convert the acquired SQL statement into an SQL statement that matches the target database system.
9. The target database system of claim 7, wherein, The target database system further comprises: a comparison module configured to compare an execution result of the SQL statement executed by the target database system with an execution result of the SQL statement executed by the source database system; an output module configured to output a comparison result.
10. The target database system of claim 9, wherein, The comparison result comprises a risk level, the risk level being used to reflect a level of the risk of switching the application from being served by the source database system to being served by the target database system. and / or, a risky SQL statement.
11. The target database system of claim 10, wherein, The risky SQL statement comprises one or more of: an SQL statement that one of the execution result in the target database system and the execution result in the source database system is an error, and the other is not an error; or, an SQL statement that a type of error in the execution result in the target database system is inconsistent with a type of error in the execution result in the source database system; or, an SQL statement that a difference between an execution time length in the target database system and an execution time length in the source database system is greater than a time length difference threshold value; or, an SQL statement that a ratio of the difference between the execution time length in the target database system and the execution time length in the source database system to the execution time length in the target database system is greater than a ratio threshold value. or, the SQL statement whose execution duration in the target database system minus the execution duration in the source database system is greater than a duration difference threshold, and whose ratio of the difference to the execution duration in the target database system is greater than a ratio threshold; or, the high-frequency SQL statement whose execution duration in the target database system minus the execution duration in the source database system is greater than a duration difference threshold, and whose ratio of the difference to the execution duration in the target database system is greater than a ratio threshold, the high-frequency SQL statement being a SQL statement whose frequency of occurrence in the category is higher than a frequency threshold.
12. The target database system according to any of claims 9 to 11, characterized by The target database system further comprises: a result obtaining module, configured to receive an execution result of the SQL statement executed by the source database system sent by the collection node or obtain the execution result of the SQL statement executed by the source database system derived from the collection node, the execution result of the SQL statement executed by the source database system being obtained by the collection node after intercepting the data packet sent by the source database system to the application.
13. A data processing system, characterized by comprise: a source database system and a target database system as claimed in any one of claims 7 to 12.
14. A computer device, comprising: comprise: a processor and a memory; the memory, configured to store computer instructions; the processor, configured to execute the computer instructions stored in the memory, so that the computer device executes the data processing method as claimed in any one of claims 1 to 6.
15. A computer-readable storage medium, characterized in that, The computer readable storage medium comprises computer instructions, which instruct the computer device to execute the data processing method as claimed in any one of claims 1 to 6. The computer readable storage medium comprises computer instructions, which instruct the computer device to execute the data processing method as claimed in any one of claims 1 to 6.
Citation Information
Patent Citations
Database switching method and device
CN108920563A
Database migration evaluation method and device, storage medium and computer equipment
CN111258989A
Universal database synchronization method
CN111339180A