A data comparison method and device
By supporting the selection of multiple data sources and multiple interfaces, and switching to other thread instances when a single-threaded instance is down, the universality and high availability of data comparison tools in the existing technology are solved, and data comparison efficiency is improved .
Patent Information
- Application Number
- CN202010785568.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-06
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2040-08-06
AI Technical Summary
Existing data comparison tools lack universality and need to be developed separately for different businesses and data sources. They are prone to downtime when memory or CPU load is too high, resulting in inefficient data processing.
Provide a data comparison method and device, which supports the selection of multiple data sources and multiple interfaces, and compares data through object determination modules and data comparison modules, and switches to other idle thread instances to continue processing when a single thread instance is down .
The universality and high availability of data comparison tools are realized, avoiding data reprocessing and improving efficiency.
Smart Images

Figure CN113760884B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data comparison method and device. Background Art
[0002] Currently, Internet companies or enterprise technology departments will develop tools to compare data in databases. By querying data in different databases and matching them according to corresponding business rules, they compare whether the data is consistent. This is the main means of verifying data consistency.
[0003] In the process of implementing the present invention, the inventors found that the prior art has at least the following problems:
[0004] 1. Data comparison tools are usually customized based on their respective business lines, and are highly dependent on the business and not universal. Even for similar businesses, they still need to be redeveloped;
[0005] 2. Data comparison tools currently mainly use single-threaded mode. However, during the data comparison process, downtime often occurs due to problems such as excessive memory or CPU load. Since the tool does not have the ability to resume transmission from breakpoints, the current data processing is interrupted after the downtime and needs to be reprocessed, which is inefficient. Summary of the invention
[0006] In view of this, an embodiment of the present invention provides a data comparison method and device, which can at least solve the problem that existing data comparison tools are all developed based on practicality and thus have poor versatility.
[0007] To achieve the above object, according to one aspect of an embodiment of the present invention, a data comparison method is provided, comprising:
[0008] Determine the first object and the second object based on the information of the first object and the information of the second object respectively input;
[0009] First data at a position in the first object is determined, and the first data is compared with second data at the same position in the second object to obtain a comparison result.
[0010] Optionally, the object is a table stored in the data source;
[0011] The determining the first object and the second object based on the information of the first object and the information of the second object respectively inputted comprises:
[0012] Based on the input first data source address, first data source name and first table name, read the first table located in the first data source; and
[0013] Based on the input second data source address, second data source name and second table name, a second table located in the second data source is read.
[0014] Optional, the object is the output parameter of the interface;
[0015] The determining the first object and the second object based on the information of the first object and the information of the second object respectively inputted comprises:
[0016] Determine a first method to be called in the first interface based on the input first interface address, first interface name and first method name; and
[0017] Determine a second method to be called in the second interface based on the input second interface address, the second interface name, and the second method name;
[0018] When the first interface receives a call request, the second interface is called based on the input parameter of the call request to obtain a first output parameter of the first interface and a second output parameter of the second interface; wherein the input parameter is associated with the first method and the second method.
[0019] Optionally, comparing the first data with second data at the same position in the second object to obtain a comparison result includes:
[0020] If the comparison result is the same, it is determined that the first data and the second data are the same; otherwise, it is determined whether the data types of the first data and the second data are the same;
[0021] If the judgment result is different, it is determined that the first data and the second data are different; otherwise, according to the hash table acquisition instruction corresponding to the data type, a first hash table corresponding to the first object and a second hash table corresponding to the second object are respectively acquired;
[0022] Obtain a first field name and a first field value corresponding to the first data from the first hash table, and obtain a second field name and a second field value corresponding to the second data from the second hash table, and compare the first field name and the second field name, and the first field value and the second field value;
[0023] If the comparison results are the same, then it is determined that the first data and the second data are the same, otherwise they are different.
[0024] Optionally, the comparing the first data with the second data at the same position in the second object to obtain a comparison result also includes: while using a thread instance to compare the first data with the second data, running multiple idle thread instances, so that when the one thread instance crashes, switching to an idle thread instance among the multiple idle thread instances to continue comparing the first data with the second data.
[0025] To achieve the above object, according to another aspect of an embodiment of the present invention, a data comparison device is provided, comprising:
[0026] An object determination module, configured to determine the first object and the second object based on the information of the first object and the information of the second object respectively inputted;
[0027] The data comparison module is used to determine first data at a position in the first object, compare the first data with second data at the same position in the second object, and obtain a comparison result.
[0028] Optionally, the object is a table stored in the data source;
[0029] The object determination module is used to:
[0030] Based on the input first data source address, first data source name and first table name, read the first table located in the first data source; and
[0031] Based on the input second data source address, second data source name and second table name, a second table located in the second data source is read.
[0032] Optional, the object is the output parameter of the interface;
[0033] The object determination module is used to:
[0034] Determine a first method to be called in the first interface based on the input first interface address, first interface name and first device name; and
[0035] Determine a second method to be called in the second interface based on the input second interface address, the second interface name, and the second device name;
[0036] When the first interface receives a call request, the second interface is called based on the input parameter of the call request to obtain a first output parameter of the first interface and a second output parameter of the second interface; wherein the input parameter is associated with the first device and the second device.
[0037] Optionally, the data comparison module is used to:
[0038] If the comparison result is the same, it is determined that the first data and the second data are the same; otherwise, it is determined whether the data types of the first data and the second data are the same;
[0039] If the judgment result is different, it is determined that the first data and the second data are different; otherwise, according to the hash table acquisition instruction corresponding to the data type, a first hash table corresponding to the first object and a second hash table corresponding to the second object are respectively acquired;
[0040] Obtain a first field name and a first field value corresponding to the first data from the first hash table, and obtain a second field name and a second field value corresponding to the second data from the second hash table, and compare the first field name and the second field name, and the first field value and the second field value;
[0041] If the comparison results are the same, then it is determined that the first data and the second data are the same, otherwise they are different.
[0042] Optionally, it also includes a thread instance switching module, which is used to: run multiple idle thread instances while using one thread instance to compare the first data and the second data, so that when the one thread instance crashes, switch to one of the multiple idle thread instances to continue comparing the first data and the second data.
[0043] To achieve the above objective, according to another aspect of an embodiment of the present invention, a data comparison electronic device is provided.
[0044] The electronic device of an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement any of the data comparison methods described above.
[0045] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, any of the above-mentioned data comparison methods is implemented.
[0046] According to the solution provided by the present invention, one embodiment of the above invention has the following advantages or beneficial effects: it can support the selection and free switching of multiple data sources and multiple interfaces, solving the problem of needing to develop data comparison tools separately for different data sources and different interfaces, and has universality; the self-developed task processing framework actively switches to other thread instances for processing when the current single-thread instance crashes, avoiding the problem of data reprocessing and greatly improving effectiveness.
[0047] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0049] Figure 1 is a schematic diagram of the main flow of a data comparison method according to an embodiment of the present invention;
[0050] Figure 2 is a specific flow chart for comparing first data and second data;
[0051] Figure 3 is a flow chart of an optional data comparison method according to an embodiment of the present invention;
[0052] Figure 4 is a flow chart of another optional data comparison method according to an embodiment of the present invention;
[0053] Figure 5 is a schematic diagram of main modules of a data comparison device according to an embodiment of the present invention;
[0054] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0055] Figure 7 It is a schematic diagram of the structure of a computer system of a mobile device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0056] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0057] See also Figure 1 , which shows a main flow chart of a data comparison method provided by an embodiment of the present invention, comprising the following steps:
[0058] S101: determining the first object and the second object based on information of the first object and the second object respectively input;
[0059] S102: Determine first data at a position in the first object, and compare the first data with second data at the same position in the second object to obtain a comparison result.
[0060] In the above implementation, for step S101, the platform (ie, the data comparison tool) supports two types of data comparison, namely, data comparison in the data source and data comparison in the interface output parameters.
[0061] The platform has set up different information input interfaces for different data comparisons. Tool users need to select the required data comparison type on the platform and fill in / enter the basis for obtaining data, such as Mqsql for database IP: port / database name + table name. Based on the information entered by the user, the platform can read the corresponding objects to be compared, including the first object and the second object.
[0062] It should be noted that although the platform can store information such as the reading path of the data source and / or interface output parameters, there are many data sources and interfaces. Whenever a data source or interface is added / deleted / modified in the platform, the corresponding reading path record needs to be updated again, which is complicated. Therefore, this solution preferably does not save the reading path of the data source and interface, and relies on user input.
[0063] For step S102, the storage location of the data is usually unchanged. The first data and the second data at the same location in the first object and the second object are compared, see Figure 2 As shown. First, directly compare:
[0064] 1) If they are the same, the two data are determined to be the same, and the comparison continues with the data at the next position;
[0065] 2) If they are different, a second deep comparison is required. In the second deep comparison, the data types of the two data are first determined to be consistent. For example, the data types of Redis are divided into String, List, Set, ZSet, and Hash:
[0066] ① If they are different, it means that the two data are different, the process ends, and the comparison result between the first object and the second object is directly output as different;
[0067] ② If they are the same, continue to compare. Assuming that the data type is a hash structure, execute the RedisHgetall command corresponding to the hash structure to obtain the first hash table corresponding to the first object and the second hash table corresponding to the second object respectively; wherein the Redis Hgetall command is used to return all the field names (field name) and field values (value) in the hash table.
[0068] The first field name and the first field value of the first data are compared with the second field name and the second field value of the second data. If the comparison results are the same, it means that the two data are the same, otherwise they are different.
[0069] Furthermore, the data comparison tool still uses a single-threaded mode to process data comparison. In order to solve the re-comparison problem caused by the downtime of the existing single-threaded instance, this solution uses a single-threaded instance to compare the first data and the second data while running multiple idle thread instances. When the current single-threaded instance crashes, other idle thread instances can detect the crash and select an idle thread instance to automatically take over the work of the crashed instance.
[0070] In addition, this solution also provides an alarm function, which is configured with two modes: "SMS alarm" and "Voice alarm". The user's enterprise can access SMS and voice services. When data inconsistency occurs, the user can be notified directly via SMS, email or voice.
[0071] The method provided in the above embodiment is a data comparison tool that supports data source data comparison and interface data comparison, and does not limit the types of data sources and interfaces, and is universally usable; when the current single-threaded instance crashes, it can quickly switch to other idle thread instances to continue processing, thereby improving the high availability of the data comparison tool.
[0072] See also Figure 3 , shows a schematic flow chart of an optional data comparison method according to an embodiment of the present invention, comprising the following steps:
[0073] S301: Reading a first table in a first data source based on an input first data source address, a first data source name, and a first table name;
[0074] S302: Reading a second table in a second data source based on the input second data source address, second data source name, and second table name;
[0075] S303: Determine first data at a position in the first table, compare the first data with second data at the same position in the second table, and obtain a comparison result.
[0076] In the above implementation, for step S303, see Figure 1 The description of step S103 is not repeated here.
[0077] In the above implementation, for steps S301 and S302, the data comparison tool provided by this solution can support multiple data sources, and currently the mainstream supports Mysql, Es, Redis, and MongoDB.
[0078] Each data source stores multiple tables, and subsequent data comparison needs to be performed according to the table dimension. Therefore, after the tool user selects the data source comparison function in the platform, in addition to entering the basis information for reading the data source, he also needs to enter the basis information for reading the table. For example, the basis information for reading the first table includes the reading address and name of the first data source, as well as the name of the first table, and the same applies to the second table.
[0079] Furthermore, the above method requires inputting three pieces of information at the same time to read a table. In actual operation, two pieces of information can also be input first, such as first inputting the reading address and name of the first data source to read the first data source. After that, the tool displays the names of all tables contained in the first data source in a cascade form for manual selection by the user.
[0080] It should be noted that although a data source may contain multiple tables, a user may only be responsible for some of the tables, and considering that the names of tables storing the same information in different data sources may be different, such as Table A and Table H, the user is required to clearly determine the name of the first table and the name of the second table to be compared.
[0081] In addition, the preprocessing operations for different data sources can be different. Taking Redis data comparison as an example, firstly, the array data in byte format is obtained through dump; wherein dump is an action in redis-API, and redis-API specifies the byte format of data.
[0082] The method provided in the above embodiment is that the data comparison tool is compatible with multiple data sources, and the data source can be freely switched by the user's choice, which solves the problem that different businesses and different data sources need to be developed separately.
[0083] See also Figure 4 , shows a schematic flow chart of another optional data comparison method according to an embodiment of the present invention, comprising the following steps:
[0084] S401: Determine a first method to be called in the first interface based on an input first interface address, a first interface name, and a first method name;
[0085] S402: Determine a second method to be called in the second interface based on the input second interface address, second interface name, and second method name;
[0086] S403: When the first interface receives a call request, the second interface is called based on the input parameter of the call request to obtain a first output parameter of the first interface and a second output parameter of the second interface; wherein the input parameter is associated with the first method and the second method;
[0087] S404: Determine first data at a position in the first output parameter, compare the first data with second data at the same position in the second output parameter, and obtain a comparison result.
[0088] In the above implementation, for step S404, see Figure 1 The description of step S103 is not repeated here.
[0089] In the above implementation, for steps S401 and S402, the data comparison tool provided by this solution not only supports Figure 2 The data in the data source shown is compared externally, and also supports comparison of online interface data.
[0090] An interface contains multiple methods, and a method is the smallest granularity of execution. Interface data comparison means calling methods in different interfaces for the same input parameter to obtain the output parameter and compare them. After the user selects the interface data comparison function in the platform, in addition to entering the interface call address and interface definition API (Application Program Interface), he also needs to enter the method name to be compared.
[0091] Furthermore, the above method requires inputting three pieces of information at the same time to determine a method. In practice, two pieces of information can also be input first, such as first inputting the calling address and name of the first interface to determine the first interface. After that, the tool will display all the method names contained in the first interface in a cascade form for the user to manually select.
[0092] It should be noted that although an interface may contain multiple methods, a user may only be responsible for some of the methods, and considering the differences in method names set for the same function in different interfaces, such as method name B and method name C, the user is required to clearly determine the first method name and the second method name to be compared.
[0093] For step S403, the user sets input parameters for the first method (or the second method) in advance, and after the setting is completed, calls the first interface based on the input parameters. The first interface receives an online user request, calls the first method corresponding to the input parameters, and obtains the processed first output parameters.
[0094] Based on the same input parameter, the second interface is called, the second interface receives the input parameter and calls the second method for processing, obtains the second output parameter, and then compares the data in the first output parameter and the second output parameter one by one to see if they are the same.
[0095] The data comparison tool uses the log4j log component to display the comparison process to the tool user in the form of log information, so that the user can intuitively know where the data is inconsistent. Specifically, the log information is printed separately in the compare.log file, and the front-end tool user grabs the compare.log file and displays it on the front-end page.
[0096] Among them, log4j is an open source project of Apache, which can control the destination of log information transmission, such as console, file, GUI component, or even socket server, NT event logger, UNIX Syslog daemon, etc.; it can also control the output format of each log information; by defining the level of each log information, it can control the log generation process more meticulously. Furthermore, these can be flexibly configured through a configuration file without modifying the application code.
[0097] In the method provided in the above embodiment, the data comparison tool can also compare interface data, and the interface can be switched freely by the user's choice, thus solving the problem that different services and different interfaces need to be developed separately.
[0098] See also Figure 5 , shows a schematic diagram of main modules of a data comparison device 500 provided in an embodiment of the present invention, including:
[0099] An object determination module 501 is used to determine the first object and the second object based on the information of the first object and the information of the second object respectively input;
[0100] The data comparison module 502 is used to determine first data at a position in the first object, compare the first data with second data at the same position in the second object, and obtain a comparison result.
[0101] In the implementation device of the present invention, the object is a table stored in a data source;
[0102] The object determination module 501 is used to:
[0103] Based on the input first data source address, first data source name and first table name, read the first table located in the first data source; and
[0104] Based on the input second data source address, second data source name and second table name, a second table located in the second data source is read.
[0105] In the implementation device of the present invention, the object is an output parameter of the interface;
[0106] The object determination module 501 is used to:
[0107] Determine a first method to be called in the first interface based on the input first interface address, first interface name and first device name; and
[0108] Determine a second method to be called in the second interface based on the input second interface address, the second interface name, and the second device name;
[0109] When the first interface receives a call request, the second interface is called based on the input parameter of the call request to obtain a first output parameter of the first interface and a second output parameter of the second interface; wherein the input parameter is associated with the first device and the second device.
[0110] In the implementation device of the present invention, the data comparison module 502 is used to:
[0111] If the comparison result is the same, it is determined that the first data and the second data are the same; otherwise, it is determined whether the data types of the first data and the second data are the same;
[0112] If the judgment result is different, it is determined that the first data and the second data are different, otherwise,
[0113] According to the hash table acquisition instruction corresponding to the data type, respectively acquire a first hash table corresponding to the first object and a second hash table corresponding to the second object;
[0114] Obtain a first field name and a first field value corresponding to the first data from the first hash table, and obtain a second field name and a second field value corresponding to the second data from the second hash table, and compare the first field name and the second field name, and the first field value and the second field value;
[0115] If the comparison results are the same, then it is determined that the first data and the second data are the same, otherwise they are different.
[0116] The implementation device of the present invention further includes a thread instance switching module 503 (not shown in the figure), which is used to:
[0117] While using a thread instance to compare the first data and the second data, multiple idle thread instances are run, so that when the thread instance crashes, switching to one of the multiple idle thread instances to continue comparing the first data and the second data.
[0118] In addition, the specific implementation content of the device described in the embodiment of the present invention has been described in detail in the method described above, so the repeated content will not be described again here.
[0119] Figure 6An exemplary system architecture 600 is shown in which embodiments of the present invention may be applied.
[0120] like Figure 6 As shown, the system architecture 600 may include terminal devices 601, 602, 603, a network 604 and a server 605 (just an example). The network 604 is used to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0121] The user can use the terminal devices 601, 602, 603 to interact with the server 605 through the network 604 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 601, 602, 603.
[0122] The terminal devices 601, 602, 603 may be various electronic devices having display screens and supporting web browsing, and the server 605 may be a server providing various services.
[0123] It should be noted that the method provided in the embodiment of the present invention is generally executed by the server 605 , and accordingly, the device is generally set in the server 605 .
[0124] It should be understood that Figure 6 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 implementation requirements.
[0125] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0126] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0127] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.
[0128] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.
[0129] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0130] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0131] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes an object determination module and a data comparison module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the object determination module may also be described as a "table or interface output parameter determination module".
[0132] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:
[0133] Determine the first object and the second object based on the information of the first object and the information of the second object respectively input;
[0134] First data at a position in the first object is determined, and the first data is compared with second data at the same position in the second object to obtain a comparison result.
[0135] The technical solution according to the embodiment of the present invention can support the selection and free switching of multiple data sources and multiple interfaces, solve the problem of needing to develop data comparison tools separately for different data sources and different interfaces, and has universality; the self-developed task processing framework actively switches to other thread instances for processing when the current single-thread instance crashes, avoiding the problem of data reprocessing and greatly improving effectiveness.
[0136] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A data comparison method, characterized in that: include: Determine the first object and the second object based on the information of the first object and the information of the second object respectively input; Determining first data at a position in the first object, comparing the first data with second data at the same position in the second object, and obtaining a comparison result, includes: If the comparison result is the same, it is determined that the first data and the second data are the same; otherwise, it is determined whether the data types of the first data and the second data are the same; If the judgment result is different, it is determined that the first data and the second data are different; otherwise, according to the hash table acquisition instruction corresponding to the data type, a first hash table corresponding to the first object and a second hash table corresponding to the second object are respectively acquired; Obtain a first field name and a first field value corresponding to the first data from the first hash table, and obtain a second field name and a second field value corresponding to the second data from the second hash table, and compare the first field name and the second field name, and the first field value and the second field value; If the comparison results are the same, then it is determined that the first data and the second data are the same, otherwise they are different.
2. The method according to claim 1, characterized in that The object is a table stored in the data source; The determining the first object and the second object based on the information of the first object and the information of the second object respectively inputted comprises: Based on the input first data source address, first data source name and first table name, read the first table located in the first data source; as well as Based on the input second data source address, second data source name and second table name, a second table located in the second data source is read.
3. The method according to claim 1, characterized in that: The object is the output parameter of the interface; The determining the first object and the second object based on the information of the first object and the information of the second object respectively inputted comprises: Determine a first method to be called in the first interface based on the input first interface address, first interface name and first method name; and Determine a second method to be called in the second interface based on the input second interface address, the second interface name, and the second method name; When the first interface receives a call request, the second interface is called based on the input parameter of the call request to obtain a first output parameter of the first interface and a second output parameter of the second interface; wherein the input parameter is associated with the first method and the second method.
4. The method according to claim 1, characterized in that: The comparing the first data with the second data at the same position in the second object to obtain a comparison result further includes: While using a thread instance to compare the first data and the second data, multiple idle thread instances are run, so that when the thread instance crashes, switching to one of the multiple idle thread instances to continue comparing the first data and the second data.
5. A data comparison device, characterized in that: include: An object determination module, configured to determine the first object and the second object based on the information of the first object and the information of the second object respectively inputted; A data comparison module, used to determine first data at a position in the first object, compare the first data with second data at the same position in the second object, and obtain a comparison result, including: If the comparison result is the same, it is determined that the first data and the second data are the same; otherwise, it is determined whether the data types of the first data and the second data are the same; If the judgment result is different, it is determined that the first data and the second data are different; otherwise, according to the hash table acquisition instruction corresponding to the data type, a first hash table corresponding to the first object and a second hash table corresponding to the second object are respectively acquired; Obtain a first field name and a first field value corresponding to the first data from the first hash table, and obtain a second field name and a second field value corresponding to the second data from the second hash table, and compare the first field name and the second field name, and the first field value and the second field value; If the comparison results are the same, then it is determined that the first data and the second data are the same, otherwise they are different.
6. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.
7. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
