System function migration method, device, computer equipment and storage medium
By initializing the database table data during the business system migration process, and writing pilot function data in the old and new databases at the same time, we can determine and handle functional abnormalities, solve the problems of data loss and low migration efficiency, and achieve efficient and stable functions. migrate.
Patent Information
- Application Number
- CN202111539887.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-15
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-12-15
AI Technical Summary
During the migration of business system functions, existing technology lacks effective solutions on how to ensure that data is not lost and achieve efficient migration, especially how to deal with functional abnormalities.
By obtaining the new database table data of the target migration system for initialization when receiving the initialization request, writing the pilot function data in the old database when receiving the pilot request and writing it synchronously in the new database, it is judged whether there is any functional abnormality in the migration system. And in the event of an exception, the new database will be cleared to restore the initial state to ensure data consistency and integrity.
It achieves efficient piloting and migration of data during the function migration process, reduces the development workload, avoids waste of resources, ensures the stability and reliability of the system, prevents the loss of old database data during migration, and improves migration efficiency. and accuracy.
Smart Images

Figure CN114218191B
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud technology, and in particular to a system function migration method, device, computer equipment and storage medium. Background Art
[0002] With the rapid development of information networks, more and more business data needs to be processed, and the amount of data to be processed is also increasing. At present, when migrating new system functions through business systems and migrating databases at the same time, there is no good solution for this scenario on how to ensure the function pilot and data is not lost or rolled back during the pilot process. Even if the gray release strategy is adopted, there is still a risk of partial data loss when an exception occurs. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a system function migration method, apparatus, computer equipment and storage medium to solve the technical problem of data migration loss.
[0004] In order to solve the above technical problems, the present application embodiment provides a system function migration method, which adopts the following technical solution:
[0005] Upon receiving the initialization request, obtaining new database table data of the target migration system, initializing the new database table data, and obtaining initialization data;
[0006] When receiving a pilot request, obtaining pilot function data corresponding to the pilot request, writing the pilot function data in an old database based on an old data interface to obtain old function data, and writing the pilot function data in a new database based on a new data interface and the initialization data to obtain new function data;
[0007] Determining whether the target migration system has a functional abnormality according to the old functional data and the new functional data;
[0008] When the target migration system has a functional anomaly, stop writing the pilot function data into the old database and the new database, clear all data in the new database, obtain an initial database, and rewrite the pilot function data based on the initial database and the old database;
[0009] When the pilot function data is successfully rewritten into the initial database, it is determined that the initial database has passed the verification, and all target function data corresponding to the old database are read based on the verified initial database.
[0010] Further, the step of obtaining the pilot function data corresponding to the pilot request includes:
[0011] Forwarding the initialization request to the old system, obtaining and returning a URL mapping set from the old system to the client based on the initialization request;
[0012] When it is determined that the client receives the pilot request, the pilot function data is obtained from the URL mapping set according to the pilot request.
[0013] Furthermore, the step of obtaining and returning the URL mapping set from the old system to the client based on the initialization request includes:
[0014] Parsing the pilot request to obtain pilot function parameters, and acquiring URL addresses corresponding to the pilot function parameters from the URL mapping set;
[0015] The pilot function data is read based on the URL address.
[0016] Furthermore, the step of writing the pilot function data into the new database based on the new data interface and the initialization data to obtain the new function data includes:
[0017] determining whether the pilot request is a write request, and if the pilot request is the write request, copying the write request and forwarding it to a new data interface of the target migration system;
[0018] The pilot function data is written into the new database synchronously with the old database based on the new data interface and the initialization data.
[0019] Further, the step of determining whether the pilot request is a write request includes:
[0020] acquiring an identifier of the pilot request, and when the identifier is a write identifier, determining that the pilot request is the write request;
[0021] When the identifier is a read identifier, it is determined that the pilot request is a read request.
[0022] Further, the step of determining whether the target migration system has a functional abnormality according to the old functional data and the new functional data includes:
[0023] Obtaining a target trial writing duration corresponding to the old function data or the new function data, and when the target trial writing duration is greater than or equal to a preset duration threshold, obtaining a pilot log generated based on the old function data and the new function data;
[0024] Determine whether the target migration system has functional abnormalities according to the pilot log.
[0025] Furthermore, the step of reading all target function data corresponding to the old database based on the verified initial database includes:
[0026] Selecting a preset number of the preset target clients from the target number of target clients corresponding to the old database as sub-clients, and reading the target function data of the sub-clients based on the verified initial database;
[0027] When the reading of the sub-clients is completed, the remaining clients in the preset target clients are obtained, and the target function data of the remaining clients are read based on the verified initial database.
[0028] In order to solve the above technical problems, the embodiment of the present application further provides a system function migration device, which adopts the following technical solution:
[0029] An acquisition module, configured to acquire new database table data of a target migration system upon receiving an initialization request, and initialize the new database table data to obtain initialization data;
[0030] A first writing module is used to, upon receiving a pilot request, obtain pilot function data corresponding to the pilot request, write the pilot function data into an old database based on an old data interface to obtain old function data, and write the pilot function data into a new database based on a new data interface and the initialization data to obtain new function data;
[0031] A confirmation module, used for determining whether the target migration system has a functional abnormality according to the old functional data and the new functional data;
[0032] A second writing module is used to stop writing the pilot function data into the old database and the new database when the target migration system has a functional abnormality, and to clear all data in the new database to obtain an initial database, and to rewrite the pilot function data based on the initial database and the old database;
[0033] The reading module is used to determine that the initial database has passed verification when the pilot function data is successfully rewritten into the initial database, and read all target function data corresponding to the old database based on the verified initial database.
[0034] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:
[0035] Upon receiving the initialization request, obtaining new database table data of the target migration system, initializing the new database table data, and obtaining initialization data;
[0036] When receiving a pilot request, obtaining pilot function data corresponding to the pilot request, writing the pilot function data in an old database based on an old data interface to obtain old function data, and writing the pilot function data in a new database based on a new data interface and the initialization data to obtain new function data;
[0037] Determining whether the target migration system has a functional abnormality according to the old functional data and the new functional data;
[0038] When the target migration system has a functional anomaly, stop writing the pilot function data into the old database and the new database, clear all data in the new database, obtain an initial database, and rewrite the pilot function data based on the initial database and the old database;
[0039] When the pilot function data is successfully rewritten into the initial database, it is determined that the initial database has passed the verification, and all target function data corresponding to the old database are read based on the verified initial database.
[0040] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:
[0041] Upon receiving the initialization request, obtaining new database table data of the target migration system, initializing the new database table data, and obtaining initialization data;
[0042] When receiving a pilot request, obtaining pilot function data corresponding to the pilot request, writing the pilot function data in an old database based on an old data interface to obtain old function data, and writing the pilot function data in a new database based on a new data interface and the initialization data to obtain new function data;
[0043] Determining whether the target migration system has a functional abnormality according to the old functional data and the new functional data;
[0044] When the target migration system has a functional anomaly, stop writing the pilot function data into the old database and the new database, clear all data in the new database, obtain an initial database, and rewrite the pilot function data based on the initial database and the old database;
[0045] When the pilot function data is successfully rewritten into the initial database, it is determined that the initial database has passed the verification, and all target function data corresponding to the old database are read based on the verified initial database.
[0046] The system function migration method proposed in the present application obtains the new database table data of the target migration system upon receiving an initialization request, initializes the new database table data, and obtains the initialization data, thereby making the new database table data and the old database table data completely consistent; then, upon receiving a pilot request, obtains the pilot function data corresponding to the pilot request, writes the pilot function data in the old database based on the old data interface to obtain the old function data, and writes the pilot function data in the new database based on the new data interface and the initialization data to obtain the new function data. By writing data in the new database and the old database at the same time, an efficient pilot of the new database is achieved, further improving the efficiency of function data migration; then, according to the old function data and the new function data, the pilot function data is written into the new database. data, determine whether there is any functional anomaly in the target migration system; when there is any functional anomaly in the target migration system, stop writing the pilot function data in the old database and the new database, and clear all the data in the new database to obtain the initial database, and rewrite the pilot function data based on the initial database and the old database, thereby reducing the development workload and avoiding waste of resources; when the pilot function data is successfully rewritten into the initial database, determine that the initial database verification has passed, and read all the target function data corresponding to the old database based on the verified initial database, ultimately, ensure the stability and reliability of the system during function migration, prevent the loss of old database data during migration, and further improve the efficiency and accuracy of system function migration. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0048] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0049] Figure 2 A flowchart of an embodiment of a system function migration method according to the present application;
[0050] Figure 3 is a structural schematic diagram of an embodiment of a system function migration device according to the present application;
[0051] Figure 4 It is a structural diagram of an embodiment of a computer device according to the present application.
[0052] Reference numerals: system function migration device 300 , acquisition module 301 , first writing module 302 , confirmation module 303 , second writing module 304 , and reading module 305 . DETAILED DESCRIPTION
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0054] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0055] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0056] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0057] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0058] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, etc.
[0059] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .
[0060] It should be noted that the system function migration method provided in the embodiment of the present application is generally executed by a server, and accordingly, the system function migration device is generally set in the server.
[0061] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0062] Continue to refer Figure 2 , shows a flow chart of an embodiment of a method for system function migration according to the present application. The system function migration method comprises the following steps:
[0063] Step S201, when an initialization request is received, new database table data of the target migration system is obtained, and the new database table data is initialized to obtain initialization data.
[0064] In this embodiment, the new database table data is the database table data of the target migration system, and the data is migrated from the old system to the target migration system. When migrating the data of the old system, the new database table data needs to be initialized first. Therefore, when the initialization request is received, the new database table data corresponding to the target migration system is obtained, and the new database table data is initialized to ensure that the data in the new database corresponding to the target migration system is consistent with the data in the old database corresponding to the old system. Specifically, when the new database table data is obtained, an initialization script is generated according to the table name corresponding to the new database table data and the database name corresponding to the new database table data, as well as the table name in the corresponding old database and the database name of the old database; the initialization script is executed by ETL (Extract-Transform-Load, data warehouse technology) tools such as KETTLE, and the data in various tables of the old database are completely written into the corresponding tables in the new database, wherein KETTLE is an open source ETL tool, and the data can be extracted, converted and loaded through the KETTLE tool. Thus, the initialization of the new database table data is finally realized, and the initialization data is obtained.
[0065] Step S202, when a pilot request is received, the pilot function data corresponding to the pilot request is obtained, the pilot function data is written into the old database based on the old data interface to obtain the old function data, and the pilot function data is written into the new database based on the new data interface and the initialization data to obtain the new function data.
[0066] In this embodiment, when the initialization of the new database table data in the new database is completed, the pilot function data is obtained. Among them, the pilot function data is the function data corresponding to the function identifier carried by the initialization request, such as the function data corresponding to the write function; the function identifier is the pilot function identifier for the current data migration. When performing data migration, it is necessary to test different functions in turn to determine whether the functions of the target migration system are normal. When obtaining the pilot function data, the pilot function data is written in the old database based on the old data interface of the old system to obtain the old function data; at the same time, based on the new data interface and initialization data of the target migration system, the pilot function data is written in the new database to obtain the new function data, so as to realize the process of simultaneous double writing in the new database and the old database.
[0067] Step S203: determining whether the target migration system has any functional abnormality according to the old functional data and the new functional data.
[0068] In this embodiment, when the new function data and the old function data are obtained, it is determined whether the target migration system has a functional abnormality according to the old function data and the new function data. Specifically, the new function data and the old function data are compared to determine whether the new function data and the old function data are consistent. If the new function data and the old function data are consistent, it is determined that the target migration system does not have a functional abnormality; if the new function data and the old function data are inconsistent, it is determined that the target migration system has a functional abnormality.
[0069] Step S204, when there is a functional abnormality in the target migration system, stop writing the pilot function data in the old database and the new database, clear all data in the new database to obtain an initial database, and rewrite the pilot function data based on the initial database and the old database.
[0070] In this embodiment, when the target migration system has a functional anomaly, the writing of the pilot function data in the old database and the new database is stopped, and all data in the new database is cleared, and the new database after the data is cleared is determined to be the initial database; the pilot function data is rewritten based on the initial database and the old database at the same time. If the target migration system does not have a functional anomaly, the pilot function data is directly written based on the new database and the old database at the same time.
[0071] Step S205 , when the pilot function data is successfully rewritten into the initial database, it is determined that the initial database has passed verification, and all target function data in the old database is read based on the verified initial database.
[0072] In this embodiment, when the pilot function data is successfully rewritten into the initial database, it is determined that the initial database has passed the verification, and all target function data of the old database are read based on the verified initial database and the new data interface, and the target function data is the function data corresponding to the read function. When the function data is read successfully, it is determined that the basic function verification of the target migration system is completed, and the function data migration is completed.
[0073] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned target function data, the above-mentioned target function data can also be stored in a node of a blockchain.
[0074] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0075] This application ensures the stability and reliability of the system during function migration, prevents the loss of old database data during migration, and further improves the efficiency and accuracy of system function migration.
[0076] In some optional implementations of this embodiment, the step of obtaining the pilot function data corresponding to the pilot request includes:
[0077] Forwarding the initialization request to the old system, obtaining and returning a URL mapping set from the old system to the client based on the initialization request;
[0078] When it is determined that the client receives the pilot request, the pilot function data is obtained from the URL mapping set according to the pilot request.
[0079] In this embodiment, upon receiving an initialization request, the data processing end forwards the initialization request to the old system, and based on the initialization request, obtains and returns a URL mapping set from the old system to the client. Specifically, the initialization request is a request sent by the client, and when the data processing end completes initialization of the new database table data of the new system, the data processing end forwards the initialization request to the old system. When it is determined that the old system has passed the verification of the initialization request, the old system returns the URL mapping set corresponding to all functions to the data processing end, and the data processing end returns the URL mapping set corresponding to all functions of the old system to the client, and the URL mapping set is the URL data corresponding to all functions in the old system. Then, when it is determined that the client receives a pilot request, the data processing end obtains the pilot function parameter according to the pilot request, and obtains the pilot function data from the URL mapping set according to the pilot function parameter. Among them, the pilot function parameter is an identification parameter associated with the pilot function data, and the corresponding pilot function data can be obtained from the URL mapping set according to the pilot function parameter.
[0080] This embodiment obtains pilot function data through a URL mapping set, so that the pilot function can be partially pilot-verified through the pilot function data, and further enables function rollback at any time during the data migration process, reducing data processing volume and avoiding data loss.
[0081] In some optional implementations of this embodiment, the step of obtaining and returning the URL mapping set from the old system to the client based on the initialization request includes:
[0082] Parsing the pilot request to obtain pilot function parameters, and acquiring URL addresses corresponding to the pilot function parameters from the URL mapping set;
[0083] The pilot function data is read based on the URL address.
[0084] In this embodiment, the pilot request is parsed to obtain the pilot function parameters of the pilot request, and the pilot function parameters are used as the key to read the corresponding URL address from the acquired URL mapping set. Based on the URL address, the pilot function data corresponding to the pilot function parameters can be obtained.
[0085] This embodiment reads the pilot function data through the URL address, so that the pilot function data can be accurately obtained through the URL address, further improving the accuracy of data acquisition.
[0086] In some optional implementations of this embodiment, the step of writing the pilot function data into the new database based on the new data interface and the initialization data to obtain the new function data includes:
[0087] determining whether the pilot request is a write request, and if the pilot request is the write request, copying the write request and forwarding it to a new data interface of the target migration system;
[0088] The pilot function data is written into the new database synchronously with the old database based on the new data interface and the initialization data.
[0089] In this embodiment, when the pilot function data is obtained, the pilot request is parsed to determine whether the pilot request is a write request. When the pilot request is a write request, the write request is copied and forwarded to the new data interface of the target migration system, and the pilot function data is synchronously written in the new database of the target migration system and the old database corresponding to the old system based on the new data interface and the initialization data. Specifically, the data can be written synchronously, that is, double writing, through nginx's ngx_http_mirror_module (traffic replication module). When it is determined that the pilot request is a write request, the write request is forwarded to the old system, and at the same time, the write request is copied and forwarded to the new system; when the new system and the old system receive the write request, the pilot function data is written in the corresponding database based on the write request at the same time. Among them, nginx is a proxy server, and load balancing can be achieved through this proxy server.
[0090] This embodiment writes the pilot function data into the new database synchronously with the old database through the new data interface and initialization data, realizes the traffic replication of the write request, reduces the development workload, avoids the waste of resources, and further improves the efficiency of data processing.
[0091] In some optional implementations of this embodiment, the step of determining whether the pilot request is a write request includes:
[0092] obtaining an identifier of the pilot request, and when the identifier is a write identifier, determining that the pilot request is a write request;
[0093] When the identifier is a read identifier, it is determined that the pilot request is a read request.
[0094] In this embodiment, the identifier of the pilot request is obtained. If the pilot request carries a write identifier, the pilot request is determined to be a write request; if the identifier carried by the pilot request is a read identifier, the pilot request is determined to be a read request. For example, if the URL of the pilot request carries / write / , it indicates that the pilot request is a write request; if the URL of the pilot request carries / read / , it indicates that the pilot request is a read request.
[0095] This embodiment determines the request type of the pilot request through the identifier of the pilot request, thereby achieving accurate judgment of the pilot request and further improving the efficiency of data reading and writing.
[0096] In some optional implementations of this embodiment, the step of determining whether the target migration system has a functional abnormality according to the old functional data and the new functional data includes:
[0097] Obtaining a target trial writing duration corresponding to the old function data or the new function data, and when the target trial writing duration is greater than or equal to a preset duration threshold, obtaining a pilot log generated based on the old function data and the new function data;
[0098] Determine whether the target migration system has functional abnormalities according to the pilot log.
[0099] In this embodiment, by obtaining the target trial writing time of the old function data or the new function data, it can be determined whether the target migration system has a functional abnormality according to the target trial writing time. The target trial writing time is the writing time of the pilot function data in the old database or the new database. Since the old database and the new database are written at the same time, the target trial writing time of the old database and the new database are the same. The target trial writing time corresponding to the old function data or the new function data is obtained. When the target trial writing time is greater than or equal to the preset time threshold, the pilot log generated by the old function data and the new function data is obtained. It is determined whether there is an error mark in the pilot log. When there is an error mark in the pilot log, it is determined that there is a functional abnormality in the target migration system; when there is no error mark in the pilot log, it is determined that there is no functional abnormality in the target migration system. If the target trial writing time is less than the preset time threshold, it is determined whether there is a functional abnormality in the target migration system by comparing whether the new function data and the old function data are consistent; if the new function data and the old function data are consistent, it is determined that there is no functional abnormality in the target migration system; if the new function data and the old function data are inconsistent, it is determined that there is a functional abnormality in the target migration system.
[0100] This embodiment obtains the target trial writing time of old function data or new function data, and determines whether there is any functional abnormality in the target migration system function according to the target trial writing time and the pilot log, thereby achieving efficient determination of the target migration system function, ensuring the stability and reliability of the system, and avoiding the loss of old database data.
[0101] In some optional implementations of this embodiment, the step of reading all target function data corresponding to the old database based on the verified initial database includes:
[0102] Selecting a preset number of preset target clients from the target number of preset target clients corresponding to the old database as sub-clients, and reading target function data of the sub-clients based on the verified initial database;
[0103] When the reading of the sub-clients is completed, the remaining clients in the preset target clients are obtained, and the target function data of the remaining clients are read based on the verified initial database.
[0104] In this embodiment, the preset target clients are all clients associated with the old database, and a preset number of preset target clients are selected from the target number of preset target clients as sub-clients, and the target function data of the sub-clients are read based on the initial database that has passed the verification. When the target function data of the sub-clients are all read, the remaining clients in the preset target clients are obtained, and the target function data of the remaining clients are read according to the initial database that has passed the verification, wherein the target function data of the sub-clients and the target function data of the remaining clients are combined into all the target function data corresponding to the above-mentioned old database. In addition, the number of the remaining clients is greater than the preset number corresponding to the sub-clients. The target function data of a small number of sub-clients are read through the initial database that has passed the verification, so that when the reading of a small number of clients is completed, the target function data of the remaining majority of the remaining clients are read through the initial database that has passed the verification, thereby improving the fault tolerance rate of the target function data reading.
[0105] This embodiment realizes pilot reading of target function data by reading target function data of sub-clients and target function data of remaining clients respectively, and the number of sub-clients is less than the number of remaining clients, thereby avoiding data loss and improving the fault tolerance of data reading.
[0106] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0107] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0108] Further references Figure 3 , as a response to the above Figure 2The present application provides an embodiment of a system function migration device, and the device embodiment is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0109] like Figure 3 As shown, the system function migration device 300 described in this embodiment includes: an acquisition module 301, a first writing module 302, a confirmation module 303, a second writing module 304 and a reading module 305. Among them:
[0110] The acquisition module 301 is used to acquire new database table data of the target migration system upon receiving an initialization request, and initialize the new database table data to obtain initialization data;
[0111] The first writing module 302 is used to, upon receiving a pilot request, obtain pilot function data corresponding to the pilot request, write the pilot function data into an old database based on an old data interface to obtain old function data, and write the pilot function data into a new database based on a new data interface and the initialization data to obtain new function data;
[0112] In some optional implementations of this embodiment, the first writing module 302 includes:
[0113] A forwarding unit, configured to forward the initialization request to the old system, obtain a URL mapping set from the old system based on the initialization request, and return the URL mapping set to the client;
[0114] The first confirmation unit is configured to obtain the pilot function data from the URL mapping set according to the pilot request when it is determined that the client has received the pilot request.
[0115] In some optional implementations of this embodiment, the forwarding unit includes:
[0116] A parsing unit, configured to parse the pilot request to obtain pilot function parameters, and obtain a URL address corresponding to the pilot function parameters from the URL mapping set;
[0117] The first reading unit is used to read the pilot function data based on the URL address.
[0118] In this embodiment, the new database table data is the database table data of the target migration system, and the data is migrated from the old system to the target migration system. When migrating the data of the old system, the new database table data needs to be initialized first. Therefore, when the initialization request is received, the new database table data corresponding to the target migration system is obtained, and the new database table data is initialized to ensure that the data in the new database corresponding to the target migration system is consistent with the data in the old database corresponding to the old system. Specifically, when the new database table data is obtained, an initialization script is generated according to the table name corresponding to the new database table data and the database name corresponding to the new database table data, as well as the table name in the corresponding old database and the database name of the old database; the initialization script is executed by ETL (Extract-Transform-Load, data warehouse technology) tools such as KETTLE, and the data in various tables of the old database are completely written into the corresponding tables in the new database, wherein KETTLE is an open source ETL tool, and the data can be extracted, converted and loaded through the KETTLE tool. Thus, the initialization of the new database table data is finally realized, and the initialization data is obtained.
[0119] In some optional implementations of this embodiment, the first writing module 302 further includes:
[0120] a copying unit, configured to determine whether the pilot request is a write request, and if the pilot request is the write request, copy the write request and forward it to a new data interface of the target migration system;
[0121] A writing unit is used to write the pilot function data in the new database synchronously with the old database based on the new data interface and the initialization data.
[0122] In some optional implementations of this embodiment, the copying unit further includes:
[0123] A first acquisition unit, configured to acquire an identifier of the pilot request, and when the identifier is a write identifier, determine that the pilot request is the write request;
[0124] The second confirmation unit is used to determine that the pilot request is a read request when the identifier is a read identifier.
[0125] In this embodiment, when the initialization of the new database table data in the new database is completed, the pilot function data is obtained. Among them, the pilot function data is the function data corresponding to the function identifier carried by the initialization request, such as the function data corresponding to the write function; the function identifier is the pilot function identifier for the current data migration. When performing data migration, it is necessary to test different functions in turn to determine whether the functions of the target migration system are normal. When obtaining the pilot function data, the pilot function data is written in the old database based on the old data interface of the old system to obtain the old function data; at the same time, based on the new data interface and initialization data of the target migration system, the pilot function data is written in the new database to obtain the new function data, so as to realize the process of simultaneous double writing in the new database and the old database.
[0126] A confirmation module 303 is used to determine whether the target migration system has a functional abnormality according to the old functional data and the new functional data;
[0127] In some optional implementations of this embodiment, the confirmation module 303 includes:
[0128] A second acquisition unit is used to acquire a target trial writing time corresponding to the old function data or the new function data, and when the target trial writing time is greater than or equal to a preset time threshold, acquire a pilot log generated based on the old function data and the new function data;
[0129] The third confirmation unit is used to determine whether the target migration system has a functional abnormality according to the pilot log.
[0130] In this embodiment, when the new function data and the old function data are obtained, it is determined whether the target migration system has a functional abnormality according to the old function data and the new function data. Specifically, the new function data and the old function data are compared to determine whether the new function data and the old function data are consistent. If the new function data and the old function data are consistent, it is determined that the target migration system does not have a functional abnormality; if the new function data and the old function data are inconsistent, it is determined that the target migration system has a functional abnormality.
[0131] The second writing module 304 is used to stop writing the pilot function data into the old database and the new database when the target migration system has a functional abnormality, and to clear all data in the new database to obtain an initial database, and to rewrite the pilot function data based on the initial database and the old database;
[0132] In this embodiment, when there is a functional abnormality in the target migration system, the writing of the pilot function data in the old database and the new database is stopped, and all data in the new database is cleared, and the new database after the data is cleared is determined to be the initial database; the pilot function data is rewritten based on the initial database and the old database respectively and simultaneously.
[0133] The reading module 305 is used to determine that the initial database has passed verification when the pilot function data is successfully rewritten into the initial database, and read all target function data corresponding to the old database based on the verified initial database.
[0134] In some optional implementations of this embodiment, the reading module 305 includes:
[0135] A second reading unit is used to select a preset number of preset target clients from the target number of target clients corresponding to the old database as sub-clients, and read the target function data of the sub-clients based on the verified initial database;
[0136] The third reading unit is used to obtain the remaining clients in the preset target clients when the reading of the sub-clients is completed, and read the target function data of the remaining clients based on the verified initial database.
[0137] In this embodiment, when the pilot function data is successfully rewritten into the initial database, it is determined that the initial database has passed the verification, and all target function data of the old database are read based on the verified initial database and the new data interface, and the target function data is the function data corresponding to the read function. When the function data is read successfully, it is determined that the basic function verification of the target migration system is completed, and the function data migration is completed.
[0138] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned target function data, the above-mentioned target function data can also be stored in a node of a blockchain.
[0139] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0140] The system function migration device proposed in this embodiment ensures the stability and reliability of the system when performing function migration, and prevents the loss of old database data during migration, thereby further improving the efficiency and accuracy of system function migration.
[0141] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0142] The computer device 6 includes a memory 61, a processor 62, and a network interface 63 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 6 with components 61-63, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0143] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0144] The memory 61 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 61 can be an internal storage unit of the computer device 6, such as a hard disk or memory of the computer device 6. In other embodiments, the memory 61 can also be an external storage device of the computer device 6, such as a plug-in hard disk equipped on the computer device 6, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. Of course, the memory 61 can also include both the internal storage unit of the computer device 6 and its external storage device. In this embodiment, the memory 61 is generally used to store the operating system and various application software installed on the computer device 6, such as computer-readable instructions of the system function migration method, etc. In addition, the memory 61 can also be used to temporarily store various types of data that have been output or are to be output.
[0145] The processor 62 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 62 is generally used to control the overall operation of the computer device 6. In this embodiment, the processor 62 is used to run computer-readable instructions or process data stored in the memory 61, such as computer-readable instructions for running the system function migration method.
[0146] The network interface 63 may include a wireless network interface or a wired network interface. The network interface 63 is generally used to establish a communication connection between the computer device 6 and other electronic devices.
[0147] The computer device proposed in this embodiment ensures the stability and reliability of the system when performing function migration, and prevents the loss of old database data during migration, thereby further improving the efficiency and accuracy of system function migration.
[0148] The present application also provides another implementation, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the system function migration method as described above.
[0149] The computer-readable storage medium proposed in this embodiment ensures the stability and reliability of the system when performing function migration, and prevents the loss of old database data during migration, further improving the efficiency and accuracy of system function migration.
[0150] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0151] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.
Claims
1. A system function migration method, characterized in that: The steps include: Upon receiving the initialization request, obtaining new database table data of the target migration system, initializing the new database table data, and obtaining initialization data; Upon receiving a pilot request, obtaining pilot function data corresponding to the pilot request, writing the pilot function data into an old database based on an old data interface to obtain old function data, and writing the pilot function data into a new database based on a new data interface and the initialization data to obtain new function data; determining whether the target migration system has a functional abnormality according to the old functional data and the new functional data; When the target migration system has a functional abnormality, stop writing the pilot function data into the old database and the new database, clear all data in the new database, obtain an initial database, and rewrite the pilot function data based on the initial database and the old database; When the pilot function data is successfully rewritten into the initial database, determining that the initial database has passed verification, and reading all target function data corresponding to the old database based on the verified initial database; The step of obtaining the pilot function data corresponding to the pilot request includes: Forwarding the initialization request to the old system, obtaining and returning a URL mapping set from the old system to the client based on the initialization request; When it is determined that the client receives the pilot request, obtaining the pilot function data from the URL mapping set according to the pilot request; The step of writing the pilot function data into the new database based on the new data interface and the initialization data to obtain the new function data includes: determining whether the pilot request is a write request, and if the pilot request is the write request, copying the write request and forwarding it to a new data interface of the target migration system; Writing the pilot function data into the new database synchronously with the old database based on the new data interface and the initialization data; The step of reading all target function data corresponding to the old database based on the verified initial database includes: Selecting a preset number of target clients as sub-clients from the target number of target clients corresponding to the old database, and reading target function data of the sub-clients based on the verified initial database; When all sub-clients are read, the remaining clients in the preset target clients are obtained, and the target function data of the remaining clients are read based on the verified initial database.
2. The system function migration method according to claim 1, characterized in that: The step of obtaining and returning the URL mapping set from the old system to the client based on the initialization request includes: Parsing the pilot request to obtain pilot function parameters, and obtaining URL addresses corresponding to the pilot function parameters from the URL mapping set; The pilot function data is read based on the URL address.
3. The system function migration method according to claim 1, characterized in that: The step of determining whether the pilot request is a write request comprises: obtaining an identifier of the pilot request, and when the identifier is a write identifier, determining that the pilot request is the write request; When the identifier is a read identifier, it is determined that the pilot request is a read request.
4. The system function migration method according to claim 1, characterized in that: The step of determining whether the target migration system has a functional abnormality according to the old functional data and the new functional data includes: Obtaining a target trial writing duration corresponding to the old function data or the new function data, and when the target trial writing duration is greater than or equal to a preset duration threshold, obtaining a pilot log generated based on the old function data and the new function data; Determine whether the target migration system has functional abnormalities based on the pilot log.
5. A system function migration device, characterized in that: The system function migration device, when executed, implements the steps of the system function migration method according to any one of claims 1 to 4, including: an acquisition module, configured to acquire new database table data of a target migration system upon receiving an initialization request, initialize the new database table data, and obtain initialization data; a first writing module, configured to, upon receiving a pilot request, obtain pilot function data corresponding to the pilot request, write the pilot function data into an old database based on an old data interface to obtain old function data, and write the pilot function data into a new database based on a new data interface and the initialization data to obtain new function data; a confirmation module, configured to determine whether the target migration system has any functional anomaly based on the old functional data and the new functional data; a second writing module configured to, when a functional abnormality occurs in the target migration system, stop writing the pilot function data into the old database and the new database, clear all data in the new database, obtain an initial database, and rewrite the pilot function data based on the initial database and the old database; The reading module is used to determine that the initial database has passed verification when the pilot function data is successfully rewritten into the initial database, and read all target function data corresponding to the old database based on the verified initial database.
6. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the system function migration method according to any one of claims 1 to 4 when executing the computer-readable instructions.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the system function migration method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Test method and apparatus for database migration
CN107133244A
Database migration method and device, electronic equipment and storage medium
CN111221800A
Data migration method and device, terminal equipment and storage medium
CN112256675A
Gray scale test method and device, electronic equipment and storage medium
CN113468064A
