A data acquisition accuracy detection and repair system and control method thereof
By designing a comparison and repair system in a multi-user real-time collection system and using the OLAP or Apache Spark framework for data comparison and repair, the problems of data loss and inconsistency in traditional solutions are solved, and efficient and low-cost data collection is achieved. Accuracy detection and repair ensure system availability and accuracy.
Patent Information
- Application Number
- CN202411010133.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-07-26
AI Technical Summary
In multi-user real-time collection systems, traditional data collection accuracy detection and repair solutions cannot detect problems in advance, and the processing process is complex and costly, affecting system availability and leading to data loss and inconsistency.
A data collection accuracy detection and repair system is designed, including a comparison system and a repair system. It runs through a configuration unit, a pull data unit, a comparison unit, a verification data unit and a data repair unit, and operates in an inspection or real-time manner. , use OLAP or Apache Spark framework for data comparison and repair, reducing resource consumption and system pressure.
It achieves lightweight data comparison and repair, reduces execution costs and impact on the system, ensures historical consistency and real-time accuracy of data, and improves business data processing speed and user experience.
Smart Images

Figure CN118550975B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data accuracy detection and repair in a multi-user real-time acquisition system, and in particular to a data acquisition accuracy detection and repair system and a control method thereof. Background Art
[0002] In a multi-user database real-time collection system, the data of each user database needs to be collected into a real-time data warehouse. The collection technology is usually based on mature binlog technology, that is, each database change operation will generate a corresponding binlog record. The real-time collection link parses and monitors the binlog changes and writes part of the data into the result table to complete the data collection. After the real-time data warehouse is collected, the corresponding data query and analysis capabilities are provided. These queries and analyses involve historical data, so the data on both sides (current data and historical data) must be completely consistent. The multi-user real-time collection system is a highly complex system, facing complex user database management, structural upgrades of user databases, grayscale releases, batch data transmission, etc., so data loss and data inconsistency are inevitable. The traditional solution is to re-initialize the problematic data, that is, to re-pull the database in full. This solution has several problems:
[0003] 1) Problems cannot be discovered in advance. Usually, customers discover the problem first, and at that time, it has already become a production problem;
[0004] 2) The processing flow is complex and requires a series of adjustments to the real-time acquisition link, which greatly increases the complexity of the acquisition system;
[0005] 3) The execution cost is high and consumes a lot of execution resources. The export of data from the user database and the writing of data to the real-time data warehouse will bring great pressure to the user database and the real-time data warehouse.
[0006] 4) Affecting availability, causing the business data processing speed of the user's customers to slow down, and the query and analysis functions of the real-time data warehouse to be temporarily unavailable; at the same time, it also affects the user experience of other customers who use the real-time data warehouse for query and analysis.
[0007] Therefore, there is an urgent need to provide a data acquisition accuracy detection and repair system and a control method thereof to solve the defects and shortcomings existing in the above-mentioned prior art. Summary of the invention
[0008] In order to solve the defects and shortcomings in the prior art, the present invention provides a data acquisition accuracy detection and repair system and a control method thereof.
[0009] The specific scheme provided by the present invention is:
[0010] A data acquisition accuracy detection and repair system, characterized in that: the system includes a comparison system and a repair system; wherein,
[0011] The comparison system includes a configuration unit, a data pulling unit and a comparison unit; wherein,
[0012] The configuration unit configures user information and task information, and stores the user information and task information in a metadata database connected thereto;
[0013] The data pulling unit obtains user information from the user library connected to it as needed, then starts the corresponding thread, and then pulls data from the real-time data warehouse connected to it;
[0014] The comparison unit obtains corresponding data from the configuration unit, performs individual comparisons according to the user after cleaning the data, and sends the comparison results to the storage unit connected thereto;
[0015] The repair system includes a read configuration unit, a check data unit and a data repair unit; wherein,
[0016] The reading configuration unit reacquires the comparison object from the comparison system connected thereto, and acquires the comparison result from the storage unit connected thereto;
[0017] The data verification unit determines whether the data is abnormal based on the time difference between obtaining user information from the user database and pulling data from the real-time data warehouse;
[0018] The data repair unit repairs the abnormal data in the comparison result accordingly, and sends the repaired data to the real-time data warehouse for data update;
[0019] The system is operated in a patrol mode or in a real-time mode.
[0020] When the inspection mode is adopted, all user databases are compared during the business idle period;
[0021] When running in real-time mode, when abnormal data is found, a round of real-time comparison and repair process is performed.
[0022] As a further preferred embodiment of the present invention, in the configuration unit,
[0023] The user information at least includes table information and link information of the user library;
[0024] The task information at least includes a user library list, a list to be compared, a comparison field and a table primary key.
[0025] As a further preferred embodiment of the present invention, in the data pulling unit, the pulled data includes a primary key, a time field for recording data changes, a business data field, and an identifier of a corresponding user library.
[0026] As a further preferred embodiment of the present invention, in the comparison unit, the comparison algorithm uses an OLAP framework or an Apache Spark distributed computing framework.
[0027] As a further preferred embodiment of the present invention, when the comparison algorithm uses the OLAP framework,
[0028] 1) First, create a user library table for loading user library data, a real-time data warehouse table for loading real-time data warehouse data, a comparison table for storing comparison structures, and a result table for storing comparison results.
[0029] 2) Map the user library data into the user library table, and map the real-time data warehouse data into the real-time data warehouse table;
[0030] 3) Clean the data;
[0031] 4) Compare the user library data and the real-time data warehouse data respectively, and send the comparison results to the storage unit.
[0032] As a further preferred embodiment of the present invention, the objects to be cleaned include null value data and date type data in the data, and the cleaning step is placed in a sub-query process in the comparison task.
[0033] As a further preferred embodiment of the present invention, when comparing the user library data with the real-time data warehouse data, only the primary key is retained; or while retaining the primary key, the time field and the custom comparison field are also retained.
[0034] As a further preferred embodiment of the present invention, in the verification data unit, the relationship between the time difference between obtaining user information from the user database and pulling data from the real-time data warehouse and the preset pulling time range is first determined:
[0035] When the time difference is less than or equal to the preset pull time range, the data is considered normal;
[0036] When the time difference is greater than the preset pull time range, the relationship between the time difference and the preset offset threshold is determined:
[0037] When the time difference is less than or equal to the preset offset threshold, the data is deemed normal;
[0038] When the time difference is greater than a preset offset threshold, the data is deemed abnormal.
[0039] As a further preferred embodiment of the present invention, in the data repair unit,
[0040] When the user library data and the real-time data warehouse data are inconsistent, the current time of the user library data is reduced by the interval time to update the user library data to the real-time data warehouse;
[0041] When data exists only in the real-time data warehouse but not in the user database, check in the user database whether the data really does not exist. If it does not exist, physically or logically delete the data from the real-time data warehouse.
[0042] Furthermore, the present invention also provides a control method for a data acquisition accuracy detection and repair system, which is characterized by comprising the following steps:
[0043] 1) Configure user information and task information and save them in the metadata database;
[0044] 2) Obtain user information from the user database, start the corresponding thread, and then pull data from the real-time data warehouse;
[0045] 3) Obtain the corresponding data, perform individual comparisons based on the user after cleaning the data, and send the comparison results to the storage unit;
[0046] 4) Obtain the comparison result from the storage unit;
[0047] 5) Determine whether the data is abnormal based on the time difference between obtaining user information from the user database and pulling data from the real-time data warehouse;
[0048] 6) Perform corresponding data repair based on the abnormal data in the comparison results, and send the repaired data to the real-time data warehouse for data update.
[0049] Compared with the prior art, the present invention can achieve the following technical effects:
[0050] 1) The present invention provides a data collection accuracy detection and repair system and a control method thereof, which finds abnormal data by comparing the user library data and the real-time data warehouse data according to the primary key and field. The primary keys and fields for comparison are limited, thereby ensuring that the data pulling is lightweight; the primary keys and fields for comparison are configurable and can flexibly meet the comparison requirements; the comparison process is a single user and a single table, and the required resources are very small. The overall cost is reduced, and the impact on the user library and the real-time data warehouse is minimal, reducing the execution cost while reducing the impact on availability.
[0051] 2) The present invention provides a data acquisition accuracy detection and repair system and a control method thereof. After abnormal data is found, a data repair unit is set up to send the repaired corresponding data to the real-time data warehouse for data update, thereby eliminating the need for real-time system modification.
[0052] 3) The present invention provides a data collection accuracy detection and repair system and a control method thereof, wherein the system operates in a patrol mode or an instant mode, thereby jointly forming a guarantee of data accuracy; when operating in a patrol mode, all user databases are compared during business idle periods, thereby ensuring the accuracy of historical data; when operating in an instant mode, when abnormal data is found, a round of instant comparison and repair process is performed, and the user's data can be repaired in a short time (minute level).
[0053] 4) The present invention provides a data collection accuracy detection and repair system and a control method thereof, which adopts a lightweight data pulling mechanism to minimize the pressure on the production environment; data processing is carried out in stages, so that the pulling process can be carried out independently and quickly, thereby reducing the duration of production-related queries and improving security.
[0054] 5) The present invention provides a data acquisition accuracy detection and repair system and a control method thereof, which adopts a concurrent pull method and a framework based on OALP or distributed computing, and can achieve scalability and simultaneous and rapid data comparison of multiple user libraries.
[0055] 6) The present invention provides a data acquisition accuracy detection and repair system and a control method thereof, which ensures data security through a data verification mechanism and does not cause erroneous processing; through comparison, only the required data is repaired, eliminating the pressure of data processing; there is no need to modify the acquisition link, and the data repair process is completely consistent with the regular business process. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 A schematic diagram of the logical structure of the system provided by the present invention. DETAILED DESCRIPTION
[0057] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0058] In the description of the present invention, it should be noted that the terms "upper", "lower", "inner", "outer", "front end", "rear end", "two ends", "one end", "the other end" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance.
[0059] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "provided with", "connected", etc. should be understood in a broad sense. For example, "connected" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0060] [First embodiment]
[0061] like Figure 1 The first embodiment of the present invention is shown, which provides a data acquisition accuracy detection and repair system, including a comparison system and a repair system; wherein,
[0062] The comparison system includes a configuration unit, a data pulling unit and a comparison unit; wherein,
[0063] The configuration unit configures user information and task information, and saves the user information and task information in the metadata database connected thereto; the scope of configuration includes user list, user list, and fields to be compared. Multiple user lists can be configured, and the configured information is saved to the metadata database. The metadata database stores user information configured for the user database and task information configured for each comparison task. In this embodiment, the user information at least includes table information and link information of the user database; the task information at least includes the user database list, the list to be compared, the comparison field, and the table primary key.
[0064] The data pulling unit obtains user information from the user database connected to it as needed, and then starts the corresponding thread. Each thread is responsible for pulling data from a user database and pulling data from the user database connected to it. After the thread is started, it connects to the user database according to the user information, assembles the corresponding SQL according to the configuration information, and then starts pulling data. The data pulling process has a small amount of calculation, mainly network bandwidth and data writing speed. The pulling program needs to be in the same network as the database to ensure that sufficient bandwidth can be obtained.
[0065] The pulled data can be stored on the local disk and written in batches, that is, the data is first cached in the memory, and when a certain amount is reached, it is written to the disk at once, thereby greatly reducing the number of IOs and reducing IO blocking. Data is stored separately by user, so that the subsequent comparison process can be carried out separately by user.
[0066] At the same time, a separate thread is set up to connect the user library and the real-time data warehouse to pull data from the real-time data warehouse. The data of multiple user libraries are pulled uniformly through this thread. Similarly, in the real-time data warehouse, the data of each user library is stored in a separate file. The file format uses the csv format to make the code implementation simplest and the operation efficiency fast. In order to reduce the pressure on the real-time data warehouse, the real-time data warehouse supports column storage, so that when reading, only the value of the required field needs to be read, without reading the entire row, which can greatly reduce the disk IO of the real-time data warehouse.
[0067] In this embodiment, in the data pulling unit, the pulled data includes the primary key, the time field for recording data changes, and the business data field. The business data field is usually a key indicator that the system or customer needs to care about. For example, in a sales order system, the status field of the document, the sales quantity of the document, etc. The business data field can be configured accordingly according to actual needs. Through such a design, the amount of data pulled can be kept as small as possible, and a large amount of IO will not be generated in the database. At the same time, the pulling can be completed quickly, and the impact time on the database will be minimized.
[0068] In addition, as a preferred embodiment, when writing data, an additional identifier of the corresponding user library can be added to each record for use in subsequent comparison. After the pull is completed, the pull result file is uploaded to the file server for use in the subsequent comparison process.
[0069] Table 1 A simple example table of pulling data
[0070] rent source table pk1_id create_time update_time 1 Rent test1 1 2024 / 1 / 1 10:10 2024 / 1 / 1 10:11 1 Rent test1 2 2024 / 1 / 2 10:10 2024 / 1 / 3 10:10
[0071] Among them, rent is the user number; source refers to the source of data, and the content of source can be Rent (that is, from the user library) or Ware (from the real-time data warehouse); table is the table name, which corresponds to the database table name where the tenant's business data is stored; pk1_id is the primary key or value in the table in the tenant library, which is a unique field. With this field, a unique piece of business data can be identified; create_time is the time when the business data is stored in the library table; update_time is the time when the business data is written to the library table when it is updated.
[0072] The comparison unit obtains the corresponding data from the configuration unit, performs a separate comparison according to the user after cleaning the data, and sends the comparison result to the storage unit connected to it; when comparing data, the configured user information and task information are first read to obtain the comparison field and the storage location of the data. The data comparison is performed by user. That is, the data of each user is compared separately, so that the comparison calculation is controlled within a very small resource range, with fast startup and comparison, and can be released after the comparison.
[0073] Different comparison algorithms can be used in the comparison unit. For example, the comparison algorithm in this embodiment can use the OLAP framework or the Apache Spark distributed computing framework.
[0074] When the comparison algorithm uses an OLAP framework (such as the open source Hive, or the OLAP engine provided by the cloud service),
[0075] 1) First, establish a user library table for loading user library data and a real-time data warehouse table for loading real-time data warehouse data. Both the user library table and the real-time data warehouse table are partitioned. To facilitate establishment and reading, the definition of the partitions is exactly the same. At the same time, the name and type of each in the table also remain the same, and the data storage partition name of each tenant library remains the same. In addition, it is necessary to establish a comparison table for storing comparison structures to store comparison structures, and a result table for storing comparison results to store comparison results.
[0076] 2) After the table is created, map the user library data into the user library table, and map the real-time data warehouse data into the real-time data warehouse table; you can upload files with user library data and real-time data warehouse data to a distributed file system (such as HDFS) or the OSS storage of each cloud service, and map them to the corresponding external table of Hive through HDFS in the OLAP engine, thereby simplifying data import. For Hive, different user libraries need to be stored in different directories, and the name of this directory is used as the partition value of the external table. For OLAP engines that do not support external table partitioning, you need to import the external table into the corresponding internal table, because the internal table is usually processed faster, so it can offset the import time;
[0077] 3) Clean the data. The cleansing targets include null value data and date data. The cleaning process consists of two steps. The first step is to process null value data into the same empty string. The second step is to clean the date data. This is mainly used to prevent differences in the data storage format of date type fields between the user database and the real-time data warehouse. The formats of the two need to be consistent through processing.
[0078] After cleaning, you can use OLAP sql join to compare data. Use partition fields when joining, so that the data of the same user will be sent to the same subtask to prevent unnecessary comparisons between different users, thereby improving the efficiency of comparison. When using sql join to compare data, you can put the cleaning steps in the comparison task. Specifically, you can provide a subquery in sql, complete the data cleaning in the subquery process, and then complete the comparison query. This reduces the independent running time of a cleaning task, thereby speeding up the overall data inspection efficiency;
[0079] 4) Compare the user database data and the real-time data warehouse data respectively, and send the comparison results to the storage unit;
[0080] When comparing user database data with real-time data warehouse data, a simple comparison method is to find inconsistent data. In this case, you only need to keep the primary key. Another method is to keep the time field and custom comparison field in addition to the primary key to observe the specific difference details and statistical analysis. Custom comparison fields are defined by the user and can include fields that the user needs to compare, such as the business data fields mentioned above.
[0081] Taking the following table as an example, we need to create two tables to map user library data and real-time data warehouse data, such as rent_sales and ware_sales. In addition, we need to create a comparison table to store the comparison structure. The table is as follows:
[0082] Table 2 Comparison structure storage table
[0083] rent source table Pk1_id rent_create_time rent_update_time wh_create_time wh_update_time Partition 1 Rent test1 1 2024 / 1 / 1 10:10 2024 / 1 / 1 10:11 2024 / 1 / 1 10:10 2024 / 1 / 1 10:10 1 1 Ware test1 3 2024 / 1 / 3 10:10 2024 / 1 / 3 10:10 1
[0084] Among them, rent is the user ID; source refers to the data source, and the content of source can be Rent (from the user library) or Ware (from the real-time data warehouse); table is the table name, which corresponds to the database table name where the tenant's business data is stored; pk1_id is the primary key or value in the table in the tenant library, which is a unique field. With this field, a unique piece of business data can be identified; rent_create_time stores the business library data write time create_time; rent_update_time stores the business library data change time update_tiem; wh_create_time stores the current corresponding create_time value in the data warehouse; wh_update_time stores the current corresponding update_time value in the data warehouse;
[0085] Name the result table as result, and the corresponding OLAP comparison statement is as follows:
[0086] INSERT OVERWRITE TABLE result PARTITION (partition)
[0087] SELECT ,a.rent
[0088] ,'Rent'
[0089] ,a.table
[0090] ,a.id
[0091] ,a.created_time
[0092] ,a.updated_time
[0093] ,b.created_time
[0094] ,b.updated_time
[0095] ,a.rent AS partition
[0096] FROM rent_sales
[0097] LEFT JOIN warehouse_sales b
[0098] ON a.`table` = b.`table`
[0099] AND a.`rent` = b.`rent`
[0100] AND a.id= b.id
[0101] AND a.id = b.id
[0102] WHERE b.id IS NULL
[0103] OR NVL(a.created_time,'A') != NVL(b.created_time,'A')
[0104] OR NVL(a.updated_time,'A') != NVL(b.updated_time,'A')
[0105] UNION
[0106] SELECT ,b.rent
[0107] ,'Warehouse'
[0108] ,b.table
[0109] ,b.id
[0110] ,''
[0111] ,''
[0112] ,b.created_time
[0113] ,b.updated_time
[0114] ,a.rent AS partition
[0115] FROM warehouse_sales b
[0116] LEFT JOIN rent_sales a
[0117] ON a.`table` = b.`table`
[0118] AND a.`rent` = b.`rent`
[0119] AND a.id= b.id
[0120] AND a.id = b.id
[0121] WHERE a.id IS NULL;
[0122] When using the Apache Spark distributed computing framework, you also need to specify the fields used for partitioning when processing input data. This should be consistent with the fields used to identify user information in the csv file that stores data, so that the data of the same user can be sent to the same RDD of Spark for processing. Using spark Shuffle Hash Join, the data of the same user can be completed in the same partition task.
[0123] Both of the above comparison processes require storing the comparison results, that is, writing inconsistent data into a result table for use in subsequent data repair processes.
[0124] like Figure 1 As shown, the repair system in this embodiment includes a read configuration unit, a check data unit and a data repair unit; wherein,
[0125] The reading configuration unit reacquires the comparison object from the comparison system connected thereto, and obtains the comparison result from the storage unit connected thereto; when repairing data, it is necessary to first obtain information such as the comparison object and the storage location of the comparison result;
[0126] The data verification unit determines whether the data is abnormal based on the time difference between obtaining user information from the user database and pulling data from the real-time data warehouse;
[0127] The results of data comparison include historical data and current data. Current data refers to data that is changing when it is pulled. There may be errors in the current data. This is because if the data changes when it is pulled, the comparison result may be wrong due to the time difference between pulling the user library and pulling the real-time data warehouse. At this time, we need to perform time verification on the data. When the difference in the time field value of a current data in a user library and the data in the real-time data warehouse is very small, and the difference is basically consistent with the time of the comparison process, or the data is newly created but does not exist in the data warehouse, it is very likely that the data is actually being processed in the collection link at that time, and the data is not abnormal data.
[0128] There is another situation, that is, the data does not exist in the user library, but exists in the real-time data warehouse, and the data creation time shown in the real-time data warehouse is within the comparison time range. In this case, it is possible that the data pulling from the user library is delayed at this time, and the data is not deleted in the user library and no longer exists. The data is not abnormal data.
[0129] Therefore, in the specific setting of the verification data unit, first determine the relationship between the time difference between obtaining user information from the user database and pulling data from the real-time data warehouse and the preset pulling time range:
[0130] When the time difference is ≤ the preset pull time range, the data is considered normal;
[0131] When the time difference is greater than the preset pull time range, the relationship between the time difference and the preset offset threshold is determined:
[0132] When the time difference is ≤ the preset offset threshold, the data is considered normal;
[0133] When the time difference is greater than the preset offset threshold, the data is considered abnormal.
[0134] The specific meaning of the preset offset threshold needs to be determined according to the delay of the real-time collection link. For example, if the delay is at the second level, we can usually set the preset offset threshold to 1 minute.
[0135] The data repair unit repairs the abnormal data in the comparison results and sends the repaired data to the real-time data warehouse for data update.
[0136] When the user database data is inconsistent with the real-time data warehouse data, an update operation is performed in the user database based on the user database, table, and primary key. The update operation does not change any business data, but only processes the change time field, reducing the current time of the user database data by the interval time (for example, 1 second), thereby triggering a processing operation from the user database to the collection link and to the real-time data warehouse that is completely consistent with the actual business, so as to update the user database data to the real-time data warehouse;
[0137] The following is an example of the process code:
[0138] Update sales
[0139] Set update_time=adddate(case when update_time is null or update_time='0000-00-0000:00:00' then update_time else create_time end, interval 1second)
[0140] Where id in (...);
[0141] When data exists only in the real-time data warehouse but not in the user database, asynchronous enhanced verification is required. That is, check in the user database whether the data does not really exist. If it does not exist, physically or logically delete the data from the real-time data warehouse. Physical deletion means directly deleting it. Logical deletion means setting the deletion flag field and setting its value to 1, indicating that the data has been deleted.
[0142] The system in this embodiment operates in a patrol mode or a real-time mode.
[0143] When running in patrol mode, all user databases are compared during business idle periods, usually a period at night, to ensure the accuracy of historical data; when running in real-time mode, when abnormal data is found, a round of real-time comparison and repair process is carried out, which can repair the user's data in a short time (minutes).
[0144] [Second embodiment]
[0145] The second embodiment of the present invention further provides a control method of a data acquisition accuracy detection and repair system, comprising the following steps:
[0146] 1) Configure user information and task information and save them in the metadata database;
[0147] 2) Obtain user information from the user database, start the corresponding thread, and then pull data from the real-time data warehouse;
[0148] 3) Obtain the corresponding data, perform individual comparisons based on the user after cleaning the data, and send the comparison results to the storage unit;
[0149] 4) Obtain the comparison result from the storage unit;
[0150] 5) Determine whether the data is abnormal based on the time difference between obtaining user information from the user database and pulling data from the real-time data warehouse;
[0151] 6) Perform corresponding data repair based on the abnormal data in the comparison results, and send the repaired data to the real-time data warehouse for data update.
[0152] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and scope of the equivalent elements of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.
Claims
1. A data acquisition accuracy detection and repair system, characterized in that: The system includes a comparison system and a repair system; wherein, The comparison system includes a configuration unit, a data pulling unit and a comparison unit; wherein, The configuration unit configures user information and task information, and stores the user information and task information in a metadata database connected thereto; The data pulling unit obtains user information from the user library connected to it as needed, then starts the corresponding thread, and then pulls data from the real-time data warehouse connected to it; The comparison unit obtains corresponding data from the configuration unit, performs individual comparisons according to the user after cleaning the data, and sends the comparison results to the storage unit connected thereto; The repair system includes a read configuration unit, a check data unit and a data repair unit; wherein, The reading configuration unit obtains the comparison object from the comparison system connected thereto, and obtains the comparison result from the storage unit connected thereto; The data verification unit determines whether the data is abnormal based on the time difference between obtaining user information from the user database and pulling data from the real-time data warehouse; The data repair unit repairs the abnormal data in the comparison result accordingly, and sends the repaired data to the real-time data warehouse for data update; The system is operated in a patrol mode or in a real-time mode. When the inspection mode is adopted, all user databases are compared during the business idle period; When running in real-time mode, when abnormal data is found, a round of real-time comparison and repair process is carried out; In the verification data unit, the relationship between the time difference between obtaining user information from the user database and pulling data from the real-time data warehouse and the preset pulling time range is first determined: When the time difference is less than or equal to the preset pull time range, the data is considered normal; When the time difference is greater than the preset pull time range, the relationship between the time difference and the preset offset threshold is determined: When the time difference is less than or equal to the preset offset threshold, the data is deemed normal; When the time difference is greater than the preset offset threshold, the data is considered abnormal; In the data repair unit, When the user library data and the real-time data warehouse data are inconsistent, the current time of the user library data is reduced by the interval time to update the user library data to the real-time data warehouse; When data exists only in the real-time data warehouse but not in the user database, check in the user database whether the data really does not exist. If it does not exist, physically or logically delete the data from the real-time data warehouse.
2. A data acquisition accuracy detection and repair system according to claim 1, characterized in that: In the configuration unit, The user information at least includes table information and link information of the user library; The task information at least includes a user library list, a list to be compared, a comparison field and a table primary key.
3. A data acquisition accuracy detection and repair system according to claim 1, characterized in that: In the data pulling unit, the pulled data includes a primary key, a time field for recording data changes, a business data field, and an identifier of a corresponding user library.
4. A data acquisition accuracy detection and repair system according to claim 1, characterized in that: In the comparison unit, the comparison algorithm uses an OLAP framework or an Apache Spark distributed computing framework.
5. A data acquisition accuracy detection and repair system according to claim 4, characterized in that: When the comparison algorithm uses the OLAP framework, 1) First, create a user library table for loading user library data, a real-time data warehouse table for loading real-time data warehouse data, a comparison table for storing comparison structures, and a result table for storing comparison results. 2) Map the user library data into the user library table, and map the real-time data warehouse data into the real-time data warehouse table; 3) Clean the data; 4) Compare the user library data and the real-time data warehouse data respectively, and send the comparison results to the storage unit.
6. A data acquisition accuracy detection and repair system according to claim 5, characterized in that: The objects of cleaning include null value data and date type data in the data, and the cleaning step is placed in the subquery process in the comparison task.
7. A data acquisition accuracy detection and repair system according to claim 5, characterized in that: When comparing user library data with real-time data warehouse data, only the primary key is retained; or the primary key is retained while also retaining the time field and custom comparison field.
8. A control method for a data acquisition accuracy detection and repair system according to any one of claims 1 to 7, characterized in that: The following steps are involved: 1) Configure user information and task information and save them in the metadata database; 2) Obtain user information from the user database, start the corresponding thread, and then pull data from the real-time data warehouse; 3) Obtain the corresponding data, perform individual comparisons based on the user after cleaning the data, and send the comparison results to the storage unit; 4) Obtain the comparison result from the storage unit; 5) Determine whether the data is abnormal based on the time difference between obtaining user information from the user database and pulling data from the real-time data warehouse; 6) Perform corresponding data repair based on the abnormal data in the comparison results, and send the repaired data to the real-time data warehouse for data update.
