CN116414908A - Table data synchronization processing method, electronic equipment and medium - Google Patents
Table data synchronization processing method, electronic equipment and medium Download PDFInfo
- Publication number
- CN116414908A CN116414908A CN202111659143.XA CN202111659143A CN116414908A CN 116414908 A CN116414908 A CN 116414908A CN 202111659143 A CN202111659143 A CN 202111659143A CN 116414908 A CN116414908 A CN 116414908A
- Authority
- CN
- China
- Prior art keywords
- synchronization
- table data
- data
- batches
- log information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
- G06F16/285—Clustering or classification
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请提供了一种表数据同步处理方法、电子设备及介质,该表数据同步处理方法包括:获取数据同步日志信息,数据同步日志信息中存储有不同批次的表数据的同步状态,不同批次的表数据通过将目标源表数据进行分批处理后得到,基于数据同步日志信息中表数据批次的同步状态,将对应的表数据批次进行同步,并且将同步状态实时更新至数据同步日志信息中。本申请的表数据同步处理方法,实现了表数据的分批同步处理,通过数据同步日志信息记录了表数据同步处理的进程,防止表数据同步中断后需要全量数据重新同步,实际应用中有效减少了表数据同步处理所需的时间,提高了表数据同步处理的效率。
The application provides a table data synchronization processing method, electronic equipment and media. The table data synchronization processing method includes: obtaining data synchronization log information, the data synchronization log information stores the synchronization status of different batches of table data, different batches The second table data is obtained by batch processing the target source table data. Based on the synchronization status of the table data batches in the data synchronization log information, the corresponding table data batches are synchronized, and the synchronization status is updated to the data synchronization status in real time. in the log information. The table data synchronization processing method of the present application realizes batch synchronization processing of table data, records the table data synchronization processing process through data synchronization log information, prevents the need for full data re-synchronization after table data synchronization is interrupted, and effectively reduces The time required for table data synchronization processing is shortened, and the efficiency of table data synchronization processing is improved.
Description
技术领域technical field
本申请涉及数据处理技术领域,特别涉及一种表数据同步处理方法、电子设备及介质。The present application relates to the technical field of data processing, in particular to a table data synchronization processing method, electronic equipment and media.
背景技术Background technique
电动汽车的大规模普及使得电动汽车的补能需求暴增,在此背景下,换电模式被大规模推广应用。换电模式不仅能够实现像加油一样实现快速补能,还能实现对电池地监控、管理,由此产生的数据是巨量的。例如:换电站为电池充电的过程中设有监控机制,每隔一段时间上报一次正在充电中的电池状态数据。截止到当前,电池充电过程表已累计达60多亿条数据。The large-scale popularization of electric vehicles has led to a sharp increase in the demand for energy supplements for electric vehicles. In this context, the battery swap mode has been widely promoted and applied. The battery swap mode can not only realize fast energy replenishment like refueling, but also realize the monitoring and management of the battery, and the resulting data is huge. For example: a monitoring mechanism is set up in the process of charging the battery at the power station, and the status data of the battery being charged is reported every once in a while. Up to now, the battery charging process table has accumulated more than 6 billion pieces of data.
现有的从数据源中抽取数据(数据同步)入库的过程中,往往会由于网络原因或者数据本身的原因导致数据抽取失败,数据抽取失败后,传统的方式只能重新再次全量对数据抽取,将数据源中的数据原封不动的从数据库中抽取出来,这样就会耗费大量的时间和资源去做重复的工作。现有的数据同步处理的方法比较简单,但任务量巨大、造成时间和资源的浪费,特别是对数据量过亿的大型数据库,其工作效率比较低下。In the existing process of extracting data from data sources (data synchronization) into the database, data extraction often fails due to network reasons or data itself. After data extraction fails, the traditional method can only re-extract the full amount of data , Extract the data in the data source from the database intact, which will consume a lot of time and resources to do repetitive work. The existing data synchronization processing method is relatively simple, but the task is huge, resulting in a waste of time and resources, especially for large databases with a data volume of over 100 million, and its work efficiency is relatively low.
发明内容Contents of the invention
本申请的主要目的在于,提供一种表数据同步处理方法、电子设备及介质,以改善现有技术中存在的上述缺陷。The main purpose of the present application is to provide a table data synchronization processing method, electronic equipment and media, so as to improve the above-mentioned defects in the prior art.
本申请是通过下述技术方案来解决上述技术问题:The application solves the above-mentioned technical problems through the following technical solutions:
作为本申请的一方面,提供一种表数据同步处理方法,包括:As an aspect of the present application, a table data synchronization processing method is provided, including:
获取数据同步日志信息,所述数据同步日志信息中存储有不同批次的表数据的同步状态,其中,所述不同批次的表数据通过将目标源表数据进行分批处理后得到;Obtaining data synchronization log information, the data synchronization log information stores the synchronization status of different batches of table data, wherein the different batches of table data are obtained by batch processing the target source table data;
基于所述数据同步日志信息中表数据批次的同步状态,将对应的表数据批次进行同步,并且将同步状态实时更新至所述数据同步日志信息中。Based on the synchronization status of the table data batches in the data synchronization log information, the corresponding table data batches are synchronized, and the synchronization status is updated in the data synchronization log information in real time.
本申请中的表数据同步处理方法,通过获取数据同步日志信息,数据同步日志信息中存储有不同批次的表数据的同步状态,不同批次的表数据通过将目标源表数据进行分批处理后得到,基于数据同步日志信息中表数据批次的同步状态,将对应的表数据批次进行同步,并且将同步状态实时更新至数据同步日志信息中,实现了表数据的分批同步处理,通过数据同步日志信息记录了表数据同步处理的进程,防止表数据同步中断后需要全量数据重新同步,实际应用中有效减少了表数据同步处理所需的时间,提高了表数据同步处理的效率。In the table data synchronization processing method in this application, by obtaining data synchronization log information, the synchronization status of different batches of table data is stored in the data synchronization log information, and different batches of table data are processed in batches by target source table data Afterwards, based on the synchronization status of table data batches in the data synchronization log information, the corresponding table data batches are synchronized, and the synchronization status is updated to the data synchronization log information in real time, realizing the batch synchronization processing of table data. The process of table data synchronization processing is recorded through the data synchronization log information to prevent the need for full data re-synchronization after table data synchronization is interrupted. In practical applications, the time required for table data synchronization processing is effectively reduced, and the efficiency of table data synchronization processing is improved.
可选地,所述基于所述数据同步日志信息中表数据批次的同步状态,将对应的表数据批次进行同步,并且将同步状态实时更新至所述数据同步日志信息中的步骤,包括:Optionally, the step of synchronizing corresponding table data batches based on the synchronization status of table data batches in the data synchronization log information, and updating the synchronization status to the data synchronization log information in real time, includes :
将所述数据同步日志信息中表数据批次的同步状态为未同步的表数据批次进行同步;Synchronize the table data batches whose synchronization status is unsynchronized in the data synchronization log information;
当所述表数据批次完成同步时,将所述数据同步日志信息中所述表数据批次的同步状态更新为已同步。When the synchronization of the batch of table data is completed, the synchronization status of the batch of table data in the data synchronization log information is updated to be synchronized.
本申请的表数据同步处理方法,通过将数据同步日志信息中表数据批次的同步状态为未同步的表数据批次进行同步,当表数据批次完成同步时,将数据同步日志信息中表数据批次的同步状态更新为已同步,实现了对未同步表数据的同步处理,提供了数据表同步进程的记录方式,仅同步未同步的表数据批次,实现了数据的续传,提高了表数据同步处理的效率。The table data synchronization processing method of the present application synchronizes the table data batches whose synchronization status is unsynchronized in the data synchronization log information. The synchronization status of the data batch is updated to synchronized, which realizes the synchronization processing of unsynchronized table data, provides a recording method for the data table synchronization process, and only synchronizes the unsynchronized table data batches, realizing the continuous transmission of data and improving Improve the efficiency of table data synchronization processing.
可选地,所述将同步状态实时更新至所述数据同步日志信息中的步骤,还包括:Optionally, the step of updating the synchronization status to the data synchronization log information in real time also includes:
当所述表数据批次正在进行同步时,将所述数据同步日志信息中所述表数据批次的同步状态更新为同步中。When the batch of table data is being synchronized, the synchronization status of the batch of table data in the data synchronization log information is updated as synchronizing.
本申请的表数据同步处理方法,当表数据批次正在进行同步时,将数据同步日志信息中表数据批次的同步状态更新为同步中,实现了对表数据同步处理过程的监控,方便监控人员及时得知表数据同步处理的进程。In the table data synchronization processing method of the present application, when the table data batches are being synchronized, the synchronization status of the table data batches in the data synchronization log information is updated to be synchronizing, which realizes the monitoring of the table data synchronization processing process and facilitates monitoring Personnel are informed of the progress of table data synchronization processing in a timely manner.
可选地,所述将同步状态实时更新至所述数据同步日志信息中的步骤,还包括:Optionally, the step of updating the synchronization status to the data synchronization log information in real time also includes:
当所述表数据批次的同步出现异常时,将所述数据同步日志信息中所述表数据批次的同步状态更新为同步异常。When the synchronization of the table data batches is abnormal, the synchronization state of the table data batches in the data synchronization log information is updated to synchronization abnormality.
本申请的表数据同步处理方法,当表数据批次的同步出现异常时,将数据同步日志信息中表数据批次的同步状态更新为同步异常,实现了对表数据同步处理过程中出现异常的批次进行标记,同时能够实现异常状态的监控,方便监控人员和开发人员及时定位出现异常的表数据批次,为数据修复和再次同步提供依据,提高了表数据同步处理的效率。In the table data synchronization processing method of the present application, when the synchronization of table data batches is abnormal, the synchronization status of the table data batches in the data synchronization log information is updated to synchronization abnormality, and the abnormality in the table data synchronization processing process is realized. Batches are marked, and abnormal status monitoring can be realized at the same time, which is convenient for monitors and developers to locate abnormal table data batches in time, provides a basis for data repair and re-synchronization, and improves the efficiency of table data synchronization processing.
可选地,所述方法还包括:Optionally, the method also includes:
当所述表数据批次的同步出现异常时,停止对出现异常当前批次的表数据同步,并且将所述数据同步日志信息中出现异常当前批次的表数据的同步状态更新为同步异常。When the synchronization of the batch of table data is abnormal, stop synchronizing the table data of the current batch of abnormal occurrence, and update the synchronization status of the abnormal current batch of table data in the data synchronization log information to synchronization abnormal.
本申请的表数据同步处理方法,当表数据批次的同步出现异常时,停止对出现异常当前批次的表数据同步,并且将数据同步日志信息中出现异常当前批次的表数据的同步状态更新为同步异常,实现了对表数据同步处理过程异常状态的监控,方便监控人员及时得知表数据同步处理的异常进程,并在表数据同步处理出现异常时及时停止数据同步,以防异常数据进入服务器(或数据仓),优化了表数据同步处理的进程。In the table data synchronization processing method of the present application, when an abnormality occurs in the synchronization of table data batches, stop synchronizing the table data of the current batch in which the abnormality occurs, and record the synchronization status of the table data in the current batch in which the abnormality occurs in the data synchronization log information It is updated to Synchronization Abnormal, which realizes the monitoring of the abnormal state of the table data synchronization process, which is convenient for the monitoring personnel to know the abnormal process of the table data synchronization process in time, and stops the data synchronization in time when the table data synchronization process is abnormal, so as to prevent abnormal data Enter the server (or data warehouse), and optimize the process of synchronous processing of table data.
可选地,所述方法还包括:Optionally, the method also includes:
响应于停止对出现异常当前批次的表数据同步,继续同步所述数据同步日志信息中表数据批次的同步状态为未同步的其余表数据批次。In response to stopping the table data synchronization of the abnormal current batch, continue to synchronize the remaining table data batches whose synchronization status of the table data batches in the data synchronization log information is unsynchronized.
本申请的表数据同步处理方法,当表数据批次的同步出现异常时,停止对出现异常当前批次的表数据同步,并且将数据同步日志信息中出现异常当前批次的表数据的同步状态更新为同步异常,响应于停止对出现异常当前批次的表数据同步,继续同步数据同步日志信息中表数据批次的同步状态为未同步的其余表数据批次,提供了跳过异常表数据批次继续完成剩余批次表数据的方法,避免同步过程被异常数据打断,提高了表数据同步处理的自动化程度,提高了表数据同步处理的效率。In the table data synchronization processing method of the present application, when an abnormality occurs in the synchronization of table data batches, stop synchronizing the table data of the current batch in which the abnormality occurs, and record the synchronization status of the table data in the current batch in which the abnormality occurs in the data synchronization log information Update to synchronization exception, in response to stop synchronizing the table data of the current batch where the exception occurs, continue to synchronize the data synchronization log information, the synchronization state of the table data batch is the rest of the table data batches that are not synchronized, and provide skip exception table data The batch continues to complete the method of remaining batch table data, avoiding the interruption of the synchronization process by abnormal data, improving the automation of table data synchronization processing, and improving the efficiency of table data synchronization processing.
可选地,还包括:Optionally, also include:
响应于停止对出现异常当前批次的表数据同步,对出现异常的表数据批次进行异常修复;In response to stopping the table data synchronization of the abnormal current batch, performing abnormal repair on the abnormal table data batch;
将异常修复后的表数据批次的同步状态更新为未同步,并且同步异常修复后的表数据批次。Update the synchronization status of the batches of table data after exception repair to unsynchronized, and synchronize the batches of table data after exception repair.
本申请的表数据同步处理方法,当表数据批次的同步出现异常时,停止对出现异常当前批次的表数据同步,并且将数据同步日志信息中出现异常当前批次的表数据的同步状态更新为同步异常;响应于停止对出现异常当前批次的表数据同步,对出现异常的表数据批次进行异常修复;将异常修复后的表数据批次的同步状态更新为未同步,并且同步异常修复后的表数据批次;由此,实现了异常排除后的表数据续传,续传的表数据不包括已完成同步的批次,优化了表数据同步处理的进程,减少了表数据同步处理所需的时间,提高了表数据同步处理的效率。In the table data synchronization processing method of the present application, when an abnormality occurs in the synchronization of table data batches, stop synchronizing the table data of the current batch in which the abnormality occurs, and record the synchronization status of the table data in the current batch in which the abnormality occurs in the data synchronization log information Update to a synchronization exception; in response to stopping the synchronization of the table data of the current batch with the exception, perform abnormal repair on the abnormal table data batch; update the synchronization status of the abnormally repaired table data batch to unsynchronized, and synchronize Batches of table data after the exception is repaired; thus, the continued transfer of table data after the exception is eliminated, the resumed table data does not include the batches that have been synchronized, optimizes the process of table data synchronization processing, and reduces the number of table data The time required for synchronous processing improves the efficiency of table data synchronous processing.
可选地,所述获取数据同步日志信息的步骤之前,所述方法还包括:Optionally, before the step of obtaining data synchronization log information, the method further includes:
根据预设字段信息将目标源表数据进行分批处理以生成不同批次的表数据。According to the preset field information, the target source table data is processed in batches to generate different batches of table data.
本申请的表数据同步处理方法,根据预设字段信息将目标源表数据进行分批处理以生成不同批次的表数据,根据目标源表数据的特点,提供了对目标源表数据的分批处理的依据,保证将目标源数据在分批处理时不会遗漏和混乱,提高了表数据同步处理的可靠性。The table data synchronous processing method of the present application performs batch processing on the target source table data according to the preset field information to generate different batches of table data, and provides batching of the target source table data according to the characteristics of the target source table data The basis for processing ensures that the target source data will not be missed or confused during batch processing, which improves the reliability of synchronous processing of table data.
可选地,所述字段信息包括时间信息、分类信息、序号信息中的任意一种或多种。Optionally, the field information includes any one or more of time information, classification information, and sequence number information.
本申请的表数据同步处理方法,根据预设字段信息将目标源表数据进行分批处理以生成不同批次的表数据,字段信息包括时间信息、分类信息、序号信息中的任意一种或多种。根据目标源表数据的特点,选择了对目标源表数据的分批处理的依据,保证将目标源数据在分批处理时不会遗漏和混乱,提高了表数据同步处理的可靠性。根据换电站电池监控数据的特点,选择表数据划分批次的依据,不仅能够防止数据遗漏和混乱,而且保证了不同批次的表数据的数据量相近,根据字段信息的含义,也能帮助维护和开发人员清楚了解表数据批次中包含数据的内容;可见,不仅有利于数据同步,还有利于系统维护和开发。The table data synchronous processing method of the present application processes the target source table data in batches according to preset field information to generate different batches of table data, and the field information includes any one or more of time information, classification information, and serial number information kind. According to the characteristics of the target source table data, the basis for batch processing of the target source table data is selected to ensure that the target source data will not be missed and confused during batch processing, and the reliability of table data synchronization processing is improved. According to the characteristics of the battery monitoring data of the power station, the basis for selecting table data to divide batches can not only prevent data omission and confusion, but also ensure that the data volume of table data in different batches is similar. According to the meaning of field information, it can also help maintenance And developers clearly understand the content of the data contained in the table data batches; it can be seen that it is not only beneficial to data synchronization, but also beneficial to system maintenance and development.
可选地,所述数据同步日志信息中还存储有表数据批次的同步顺序;Optionally, the synchronization order of table data batches is also stored in the data synchronization log information;
所述基于所述数据同步日志信息中表数据批次的同步状态,将对应的表数据批次进行同步的步骤,包括:The step of synchronizing corresponding table data batches based on the synchronization status of table data batches in the data synchronization log information includes:
基于所述数据同步日志信息中表数据批次的同步状态及同步顺序,将对应的表数据批次进行同步。Based on the synchronization state and synchronization order of the table data batches in the data synchronization log information, the corresponding table data batches are synchronized.
本申请的表数据同步处理方法,基于数据同步日志信息中表数据批次的同步状态及同步顺序,将对应的表数据批次进行同步;由此,实现了有序地对表数据批次进行同步,一方面可以防止同步中数据的遗漏,另一方面也为开发人员提供了控制表数据同步过程的可能性。The table data synchronization processing method of the present application, based on the synchronization state and synchronization order of the table data batches in the data synchronization log information, synchronizes the corresponding table data batches; thus, the orderly table data batches are realized. Synchronization, on the one hand, can prevent the omission of data in synchronization, and on the other hand, it also provides developers with the possibility to control the table data synchronization process.
可选地,在所述获取数据同步日志信息的步骤中,Optionally, in the step of obtaining data synchronization log information,
所述数据同步日志信息中存储有基于表名分类的多个目标源表数据的不同批次的表数据的同步状态。The data synchronization log information stores synchronization states of different batches of table data of multiple target source table data classified based on table names.
本申请的表数据同步处理方法,同一个数据同步日志信息中可以同时保存多个目标源表数据的不同批次的表数据的同步状态,这使得该方法具有共用性和扩展性,对于新增加的目标源表数据的同步需求,同样能够实现可断点续传的数据同步。In the table data synchronization processing method of the present application, the synchronization status of different batches of table data of multiple target source table data can be saved in the same data synchronization log information at the same time, which makes the method have commonality and scalability. For newly added The synchronization requirements of the target source table data can also achieve data synchronization that can be resumed from breakpoints.
作为本申请的另一方面,提供一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行计算机程序时实现上述中任一所述的表数据同步处理方法。As another aspect of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory and operable on the processor. When the processor executes the computer program, any of the above-mentioned Table data synchronization processing method.
作为本申请的另一方面,其上存储有计算机指令,所述计算机指令在由处理器执行时实现上述中任一所述的表数据同步处理方法。As another aspect of the present application, computer instructions are stored thereon, and when the computer instructions are executed by a processor, any one of the table data synchronization processing methods described above can be realized.
根据本申请内容,本领域技术人员可以理解本申请内容的其它方面。According to the contents of the present application, those skilled in the art can understand other aspects of the contents of the present application.
本申请的积极进步效果在于:The positive progress effect of this application is:
本申请的表数据同步处理方法,通过获取数据同步日志信息,数据同步日志信息中存储有不同批次的表数据的同步状态,不同批次的表数据通过将目标源表数据进行分批处理后得到,基于数据同步日志信息中表数据批次的同步状态,将对应的表数据批次进行同步,并且将同步状态实时更新至数据同步日志信息中,实现了表数据的分批同步处理,通过数据同步日志信息记录了表数据同步处理的进程,防止表数据同步中断后需要全量数据重新同步,实际应用中有效减少了表数据同步处理所需的时间,提高了表数据同步处理的效率。In the table data synchronization processing method of the present application, by obtaining data synchronization log information, the synchronization status of different batches of table data is stored in the data synchronization log information, and different batches of table data are processed in batches by target source table data Obtained, based on the synchronization status of the table data batches in the data synchronization log information, the corresponding table data batches are synchronized, and the synchronization status is updated to the data synchronization log information in real time, realizing the batch synchronization processing of the table data, through The data synchronization log information records the process of table data synchronization processing to prevent the need for full data re-synchronization after table data synchronization is interrupted. In practical applications, the time required for table data synchronization processing is effectively reduced and the efficiency of table data synchronization processing is improved.
附图说明Description of drawings
在结合以下附图阅读本申请的实施例的详细描述之后,能够更好地理解本申请的所述特征和优点。在附图中,各组件不一定是按比例绘制,并且具有类似的相关特性或特征的组件可能具有相同或相近的附图标记。The features and advantages of the present application can be better understood after reading the detailed description of the embodiments of the present application in conjunction with the following drawings. In the drawings, components are not necessarily drawn to scale, and components with similar related properties or characteristics may have the same or similar reference numerals.
图1为本申请实施例1提供的一种表数据同步处理方法的流程示意图;FIG. 1 is a schematic flow diagram of a method for synchronizing table data provided by Embodiment 1 of the present application;
图2为本申请实施例1提供的步骤102中的一种表数据同步处理方法的流程示意图;FIG. 2 is a schematic flowchart of a table data synchronization processing method in
图3为本申请实施例1提供的一种表数据同步处理方法的流程示意图;FIG. 3 is a schematic flowchart of a table data synchronization processing method provided in Embodiment 1 of the present application;
图4为本申请实施例1提供的一种表数据同步处理方法的流程示意图;FIG. 4 is a schematic flowchart of a table data synchronization processing method provided in Embodiment 1 of the present application;
图5为本申请实施例1提供的一种表数据同步处理方法的流程示意图;FIG. 5 is a schematic flowchart of a table data synchronization processing method provided in Embodiment 1 of the present application;
图6为本申请实施例1提供的一种表数据同步处理方法的流程示意图;FIG. 6 is a schematic flowchart of a table data synchronization processing method provided in Embodiment 1 of the present application;
图7为本申请实施例1提供的一种表数据同步处理方法的流程示意图;FIG. 7 is a schematic flowchart of a table data synchronization processing method provided in Embodiment 1 of the present application;
图8为本申请实施例2提供的一种电子设备的结构示意图。FIG. 8 is a schematic structural diagram of an electronic device provided in Embodiment 2 of the present application.
具体实施方式Detailed ways
下面通过实施例的方式进一步说明本申请,但并不因此将本申请限制在所述的实施例范围之中。The present application will be further described below by means of examples, but the present application is not limited to the scope of the examples.
应当注意,在说明书中对“一实施例”、“可选实施例”、“另一实施例”等的引用指示所描述的实施例可以包括特定的特征、结构或特性,但是每个实施例可能不一定包括该特定的特征、结构或特性。而且,这样的短语不一定指代相同的实施例。此外,当结合实施例描述特定特征、结构或特性时,无论是否被明确描述,结合其它实施例来实现这样的特征、结构或特性都在相关领域的技术人员的知识范围内。It should be noted that references in the specification to "an embodiment," "an alternative embodiment," "another embodiment," etc. indicate that the described embodiments may include a particular feature, structure, or characteristic, but each embodiment The specific feature, structure or characteristic may not necessarily be included. Moreover, such phrases are not necessarily referring to the same embodiment. Furthermore, when a particular feature, structure or characteristic is described in conjunction with an embodiment, it is within the purview of those skilled in the relevant arts to implement such feature, structure or characteristic in conjunction with other embodiments, whether or not explicitly described.
在本申请内容的描述中,需要理解的是,术语“中心”、“横向”、“上”、“下”、“左”、“右”、“竖直”、“水平”、“顶”、“底”、“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本申请内容和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本申请内容的限制。此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本申请内容的描述中,除非另有说明,“多个”的含义是两个或两个以上。另外,术语“包括”及其任何变形,意图在于覆盖不排他的包含。In the description of the content of the present application, it should be understood that the terms "central", "lateral", "upper", "lower", "left", "right", "vertical", "horizontal", "top" , "bottom", "inner", "outer" and other indicated orientations or positional relationships are based on the orientations or positional relationships shown in the drawings, and are only for the convenience of describing the content of the application and simplifying the description, rather than indicating or implying Any device or element must have a specific orientation, be constructed and operate in a specific orientation, and therefore should not be construed as limiting the content of the application. In addition, the terms "first" and "second" are used for descriptive purposes only, and cannot be interpreted as indicating or implying relative importance or implicitly specifying the quantity of indicated technical features. Thus, a feature defined as "first" and "second" may explicitly or implicitly include one or more of these features. In the description of the contents of this application, unless otherwise specified, "plurality" means two or more. Additionally, the term "comprise" and any variations thereof, are intended to cover a non-exclusive inclusion.
在本申请内容的描述中,需要说明的是,除非另有明确的规定和限定,术语“安装”、“相连”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或一体地连接;可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连,可以是两个元件内部的连通。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本申请内容中的具体含义。In the description of the content of this application, it should be noted that, unless otherwise clearly specified and limited, the terms "installation", "connection", and "connection" should be understood in a broad sense, for example, it can be a fixed connection or a flexible connection. Detachable connection, or integral connection; it can be mechanical connection or electrical connection; it can be direct connection or indirect connection through an intermediary, and it can be the internal communication of two components. Those of ordinary skill in the art can understand the specific meanings of the above terms in the content of this application in specific situations.
这里所使用的术语仅仅是为了描述具体实施例而不意图限制示例性实施例。除非上下文明确地另有所指,否则这里所使用的单数形式“一个”、“一项”还意图包括复数。还应当理解的是,这里所使用的术语“包括”和/或“包含”规定所陈述的特征、整数、步骤、操作、单元和/或组件的存在,而不排除存在或添加一个或更多其他特征、整数、步骤、操作、单元、组件和/或其组合。The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of example embodiments. As used herein, the singular forms "a", "an" and "an" are intended to include the plural unless the context clearly dictates otherwise. It should also be understood that the terms "comprising" and/or "comprising" as used herein specify the presence of stated features, integers, steps, operations, units and/or components, but do not exclude the presence or addition of one or more Other features, integers, steps, operations, units, components and/or combinations thereof.
实施例1Example 1
本实施例提供一种表数据同步处理方法,图1为本实施例提供的一种表数据同步处理方法的流程示意图,该数据同步处理方法包括:This embodiment provides a table data synchronization processing method. FIG. 1 is a schematic flowchart of a table data synchronization processing method provided by this embodiment. The data synchronization processing method includes:
步骤101、获取数据同步日志信息。
本步骤中的数据同步日志信息中存储有不同批次的表数据的同步状态,其中,不同批次的表数据通过将目标源表数据进行分批处理后得到。The data synchronization log information in this step stores the synchronization status of different batches of table data, wherein the table data of different batches is obtained by batch processing the target source table data.
即对目标源表数据进行分批处理后得到不同批次的表数据,不同批次的表数据的同步状态信息保存在数据同步日志信息,数据同步日志信息中的每一个条目即为对应批次的表数据的同步状态。That is, different batches of table data are obtained after the target source table data is processed in batches, and the synchronization status information of different batches of table data is stored in the data synchronization log information, and each entry in the data synchronization log information is the corresponding batch The synchronization status of the table data.
步骤102、基于数据同步日志信息中表数据批次的同步状态,将对应的表数据批次进行同步,并且将同步状态实时更新至数据同步日志信息中。
本步骤中的同步状态包括多种状态,例如未同步状态、同步中状态、同步异常状态及已同步状态。根据数据同步日志信息中表数据批次的同步状态,将对应的表数据批次进行同步,并且将同步状态实时更新至数据同步日志信息中。The synchronization state in this step includes multiple states, such as an unsynchronized state, a synchronizing state, a synchronous abnormal state, and a synchronized state. According to the synchronization status of the table data batches in the data synchronization log information, the corresponding table data batches are synchronized, and the synchronization status is updated to the data synchronization log information in real time.
本实施例中的表数据同步处理方法,通过获取数据同步日志信息,数据同步日志信息中存储有不同批次的表数据的同步状态,不同批次的表数据通过将目标源表数据进行分批处理后得到,基于数据同步日志信息中表数据批次的同步状态,将对应的表数据批次进行同步,并且将同步状态实时更新至数据同步日志信息中,实现了表数据的分批同步处理,通过数据同步日志信息记录了表数据同步处理的进程,防止表数据同步中断后需要全量数据重新同步,实际应用中有效减少了表数据同步处理所需的时间,提高了表数据同步处理的效率。In the table data synchronization processing method in this embodiment, by obtaining data synchronization log information, the synchronization status of different batches of table data is stored in the data synchronization log information, and different batches of table data are obtained by batching the target source table data After processing, based on the synchronization status of table data batches in the data synchronization log information, the corresponding table data batches are synchronized, and the synchronization status is updated to the data synchronization log information in real time, realizing batch synchronization processing of table data , the process of table data synchronization processing is recorded through data synchronization log information to prevent the need for full data re-synchronization after table data synchronization is interrupted. In practical applications, the time required for table data synchronization processing is effectively reduced, and the efficiency of table data synchronization processing is improved. .
在一可选的实施方式中,图2为本实施方式提供的步骤102中的一种表数据同步处理方法的流程示意图,如图2所示,上述步骤102具体包括:In an optional implementation manner, FIG. 2 is a schematic flowchart of a method for synchronizing table data in
步骤1021、将数据同步日志信息中表数据批次的同步状态为未同步的表数据批次进行同步。
在本步骤中,数据同步日志信息中该表数据批次的同步状态为未同步状态,将未同步状态对应的表数据批次进行同步。例如,对数据同步日志信息中表数据的同步状态进行编码,未同步状态对应的编码为0,同步中状态对应的编码为1,同步异常状态对应的编码为2,已同步状态对应的编码为3,则本步骤中的表数据批次的未同步状态对应的编码为0。In this step, the synchronization state of the table data batch in the data synchronization log information is an unsynchronized state, and the table data batches corresponding to the unsynchronized state are synchronized. For example, to encode the synchronization state of the table data in the data synchronization log information, the code corresponding to the unsynchronized state is 0, the code corresponding to the synchronization state is 1, the code corresponding to the synchronization abnormal state is 2, and the code corresponding to the synchronized state is 3, the code corresponding to the unsynchronized state of the table data batch in this step is 0.
步骤1022、当表数据批次完成同步时,将数据同步日志信息中表数据批次的同步状态更新为已同步。
在本步骤中,当对未同步状态的表数据批次完成同步时,将该表数据批次的同步状态更新为已同步状态,即对表数据批次的未同步状态对应的编码为0的表数据批次完成同步更新后,将该表数据批次的同步状态对应的编码为更新为3。In this step, when the synchronization of the unsynchronized state of the table data batch is completed, the synchronization state of the table data batch is updated to the synchronized state, that is, the code corresponding to the unsynchronized state of the table data batch is 0 After the table data batch is updated synchronously, the code corresponding to the synchronization status of the table data batch is updated to 3.
例如,目标源表数据换电站为电池充电过程中的相关电池状态数据,对电池充电过程进行监控,每10秒上报一次正在充电中的电池状态数据,当电池充电过程表(即表数据)已累计达60多亿数据时,在把数据接入到服务器或数仓中,需要把历史数据初始化到服务器,若采用传统的数据同步方法去初始化数据,在遇到数据同步(异常抽取)失败时,需要重新再次全量抽取充电过程数据,这样消耗了时间和资源。For example, the target source meter data replacement station is the relevant battery status data during the battery charging process, monitors the battery charging process, and reports the battery status data that is being charged every 10 seconds. When the accumulated data reaches more than 6 billion, when the data is connected to the server or data warehouse, the historical data needs to be initialized to the server. If the traditional data synchronization method is used to initialize the data, when the data synchronization (abnormal extraction) fails , it is necessary to extract the full amount of charging process data again, which consumes time and resources.
若采用本实施方式的表数据同步处理方法,则目标源表数据包括了电池充电过程中的相关历史数据,对目标源表数据按照预设分批规则进行分批处理后得到不同批次的表数据,并将不同批次的表数据存储在数据同步日志信息中,数据同步日志信息中存储有不同批次的表数据的同步状态。当某一批次的表数据遇到数据同步失败时,可以将该表数据批次的同步状态更新为同步异常状态,以便后续处理。If the table data synchronization processing method of this embodiment is adopted, the target source table data includes relevant historical data in the battery charging process, and different batches of table data are obtained after the target source table data is processed in batches according to the preset batching rules. data, and store different batches of table data in data synchronization log information, and the data synchronization log information stores the synchronization status of different batches of table data. When a batch of table data encounters a data synchronization failure, the synchronization status of the batch of table data can be updated to a synchronization exception status for subsequent processing.
本实施方式的表数据同步处理方法,通过将数据同步日志信息中表数据批次的同步状态为未同步的表数据批次进行同步,当表数据批次完成同步时,将数据同步日志信息中表数据批次的同步状态更新为已同步,实现了对未同步表数据的同步处理,提供了数据表同步进程的记录方式,仅同步未同步的表数据批次,实现了数据的续传,提高了表数据同步处理的效率。The table data synchronization processing method in this embodiment synchronizes the table data batches whose synchronization state is unsynchronized in the data synchronization log information. When the synchronization of the table data batches is completed, the data synchronization log information The synchronization status of the table data batch is updated to synchronized, which realizes the synchronization processing of unsynchronized table data, provides a recording method for the data table synchronization process, only synchronizes the unsynchronized table data batches, and realizes the continuous transmission of data. The efficiency of synchronous processing of table data has been improved.
在一可选地实施方式中,图3为本实施方式提供的一种表数据同步处理方法的流程示意图,如图3所示,该表数据同步处理方法包括:In an optional implementation manner, FIG. 3 is a schematic flowchart of a table data synchronization processing method provided in this embodiment. As shown in FIG. 3 , the table data synchronization processing method includes:
步骤201、根据预设字段信息将目标源表数据进行分批处理以生成不同批次的表数据。Step 201: Process target source table data in batches according to preset field information to generate different batches of table data.
其中,字段信息包括时间信息、分类信息、序号信息中的任意一种或多种。Wherein, the field information includes any one or more of time information, classification information, and serial number information.
步骤202、获取数据同步日志信息。
本步骤对应上述步骤101。This step corresponds to step 101 above.
数据同步日志信息中存储有不同批次的表数据的同步状态,其中,不同批次的表数据通过将目标源表数据进行分批处理后得到。The synchronization status of different batches of table data is stored in the data synchronization log information, wherein the different batches of table data are obtained by batch processing the target source table data.
数据同步日志信息中还存储有表数据批次的同步顺序,基于数据同步日志信息中表数据批次的同步状态及同步顺序,将对应的表数据批次进行同步,并且将同步状态实时更新至数据同步日志信息中。The data synchronization log information also stores the synchronization order of the table data batches. Based on the synchronization status and synchronization order of the table data batches in the data synchronization log information, the corresponding table data batches are synchronized, and the synchronization status is updated in real time to Data synchronization log information.
步骤203、将数据同步日志信息中表数据批次的同步状态为未同步的表数据批次进行同步。Step 203: Synchronize the table data batches whose synchronization status is unsynchronized in the data synchronization log information.
本步骤对应上述步骤1021。This step corresponds to step 1021 above.
步骤209、当检测到表数据批次完成同步时,将数据同步日志信息中表数据批次的同步状态更新为已同步。
本步骤对应上述步骤1022。This step corresponds to step 1022 above.
本实施方式的表数据同步处理方法,根据预设字段信息将目标源表数据进行分批处理以生成不同批次的表数据,获取数据同步日志信息,将数据同步日志信息中表数据批次的同步状态为未同步的表数据批次进行同步,当检测到表数据批次完成同步时,将数据同步日志信息中表数据批次的同步状态更新为已同步,实现了对未同步表数据的同步处理,提供了数据表同步进程的记录方式,仅同步未同步的表数据批次,实现了数据的续传,提高了表数据同步处理的效率。In the table data synchronization processing method of this embodiment, the target source table data is processed in batches according to the preset field information to generate different batches of table data, the data synchronization log information is obtained, and the table data batches in the data synchronization log information The synchronization status is synchronized for unsynchronized table data batches. When it is detected that the table data batches have been synchronized, the synchronization status of the table data batches in the data synchronization log information is updated to synchronized, realizing the synchronization of unsynchronized table data. Synchronization processing provides a recording method for the synchronization process of the data table, and only synchronizes unsynchronized table data batches, which realizes data continuation and improves the efficiency of table data synchronization processing.
在一可选的实施方式中,上述步骤102中将同步状态实时更新至数据同步日志信息中的步骤还包括:当表数据批次正在进行同步时,将数据同步日志信息中表数据批次的同步状态更新为同步中。In an optional embodiment, the step of updating the synchronization status to the data synchronization log information in the
图4为本实施方式提供的一种表数据同步处理方法的流程示意图,如图4所示,上述步骤203之后还包括:FIG. 4 is a schematic flowchart of a table data synchronization processing method provided in this embodiment. As shown in FIG. 4 , after the
步骤204、当检测到表数据批次正在进行同步时,将数据同步日志信息中表数据批次的同步状态更新为同步中。
在本实施方式中,表数据批次的未同步状态对应的编码为0,对该表数据批次进行同步,当该表数据批次正在进行同步时,则数据同步日志信息中表数据批次的同步状态为同步中状态,而同步中状态对应的编码为1,即将表数据批次的同步状态对应的编码更新为1。In this embodiment, the code corresponding to the unsynchronized state of the table data batch is 0, and the table data batch is synchronized. When the table data batch is being synchronized, the table data batch in the data synchronization log information The synchronization state of is the synchronization state, and the code corresponding to the synchronization state is 1, that is, the code corresponding to the synchronization state of the table data batch is updated to 1.
本实施方式中的表数据同步处理方法,当表数据批次正在进行同步时,将数据同步日志信息中表数据批次的同步状态更新为同步中,实现了对表数据同步处理过程的监控,方便监控人员及时得知表数据同步处理的进程。In the table data synchronization processing method in this embodiment, when the table data batches are being synchronized, the synchronization status of the table data batches in the data synchronization log information is updated to be synchronizing, so as to realize the monitoring of the table data synchronization processing process, It is convenient for monitoring personnel to know the progress of synchronous processing of table data in time.
在一可选的实施方式中,上述步骤102中将同步状态实时更新至数据同步日志信息中的步骤还包括:当表数据批次的同步出现异常时,将数据同步日志信息中表数据批次的同步状态更新为同步异常。在本实施方式中,表数据批次的未同步状态对应的编码为0,对该表数据批次进行同步,当该表数据批次的同步出现异常时,则数据同步日志信息中表数据批次的同步状态为同步异常状态,而同步异常状态对应的编码为2,即将表数据批次的同步状态对应的编码更新为2。In an optional embodiment, the step of updating the synchronization status to the data synchronization log information in the
本实施方式中的表数据同步处理方法,当表数据批次的同步出现异常时,将数据同步日志信息中表数据批次的同步状态更新为同步异常,实现了对表数据同步处理过程中出现异常的批次进行标记,同时能够实现异常状态的监控,方便监控人员和开发人员及时定位出现异常的表数据批次,为数据修复和再次同步提供依据,提高了表数据同步处理的效率。In the table data synchronization processing method in this embodiment, when an abnormality occurs in the synchronization of table data batches, the synchronization status of the table data batches in the data synchronization log information is updated to a synchronization exception, which realizes the synchronization of table data that occurs during the table data synchronization process. Abnormal batches are marked, and at the same time, abnormal state monitoring can be realized, which is convenient for monitors and developers to locate abnormal table data batches in time, provides a basis for data repair and re-synchronization, and improves the efficiency of table data synchronization processing.
在一可选的实施方式中,上述步骤102中将同步状态实时更新至数据同步日志信息中的步骤还包括:当表数据批次的同步出现异常时,停止对出现异常当前批次的表数据同步,并且将数据同步日志信息中出现异常当前批次的表数据的同步状态更新为同步异常。In an optional embodiment, the step of updating the synchronization status to the data synchronization log information in the
图5为本实施方式提供的一种表数据同步处理方法的流程示意图,如图5所示,上述步骤204之后还包括:FIG. 5 is a schematic flowchart of a table data synchronization processing method provided in this embodiment. As shown in FIG. 5 , after the
步骤205、当检测到表数据批次的同步出现异常时,停止对出现异常当前批次的表数据同步,并且将数据同步日志信息中出现异常当前批次的表数据的同步状态更新为同步异常。
在本实施方式中,在本实施方式中,表数据批次的未同步状态对应的编码为0,对该表数据批次进行同步,当该表数据批次的同步出现异常时,则停止对出现异常当前批次的表数据同步,此时,数据同步日志信息中表数据批次的同步状态为同步异常状态,而同步异常状态对应的编码为2,即将表数据批次的同步状态对应的编码更新为2。例如,出现同步异常状态的情况可能是数据同步过程中网络断开或同步数据本身出现数据异常。In this embodiment, in this embodiment, the code corresponding to the unsynchronized state of the table data batch is 0, and the table data batch is synchronized. When the synchronization of the table data batch is abnormal, the synchronization of the table data batch is stopped. The table data synchronization of the current batch is abnormal. At this time, the synchronization state of the table data batch in the data synchronization log information is the synchronization abnormal state, and the code corresponding to the synchronization abnormal state is 2, that is, the synchronization state of the table data batch corresponds to Coding updated to 2. For example, the situation where the synchronization abnormal state occurs may be that the network is disconnected during the data synchronization process or data abnormality occurs in the synchronization data itself.
本实施方式中的表数据同步处理方法,当表数据批次的同步出现异常时,停止对出现异常当前批次的表数据同步,并且将数据同步日志信息中出现异常当前批次的表数据的同步状态更新为同步异常,实现了对表数据同步处理过程异常状态的监控,方便监控人员及时得知表数据同步处理的异常进程,并在表数据同步处理出现异常时及时停止数据同步,以防异常数据进入服务器,优化了表数据同步处理的进程。In the table data synchronization processing method in this embodiment, when an abnormality occurs in the synchronization of the table data batches, stop synchronizing the table data of the current batch in which the abnormality occurs, and record the table data of the current batch in which the abnormality occurs in the data synchronization log information. The synchronization status is updated to Synchronization Abnormal, which realizes the monitoring of the abnormal status of the table data synchronization process, which is convenient for the monitoring personnel to know the abnormal process of the table data synchronization process in time, and stops the data synchronization in time when the table data synchronization process is abnormal, so as to prevent Abnormal data enters the server, optimizing the process of table data synchronization.
在一可选的实施方式中,上述步骤102中将同步状态实时更新至数据同步日志信息中的步骤还包括:当表数据批次的同步出现异常时,停止对出现异常当前批次的表数据同步,并且将数据同步日志信息中出现异常当前批次的表数据的同步状态更新为同步异常;响应于停止对出现异常当前批次的表数据同步,继续同步数据同步日志信息中表数据批次的同步状态为未同步的其余表数据批次。In an optional embodiment, the step of updating the synchronization status to the data synchronization log information in the
图6为本实施方式提供的一种表数据同步处理方法的流程示意图,如图6所示,上述步骤205之后还包括:FIG. 6 is a schematic flowchart of a table data synchronization processing method provided in this embodiment. As shown in FIG. 6 , after the
步骤206、响应于停止对出现异常当前批次的表数据同步,继续同步数据同步日志信息中表数据批次的同步状态为未同步的其余表数据批次。
在本实施方式中,表数据批次的未同步状态对应的编码为0,对该表数据批次进行同步,当该表数据批次的同步出现异常时,则停止对出现异常当前批次的表数据同步,此时,数据同步日志信息中表数据批次的同步状态为同步异常状态,而同步异常状态对应的编码为2,即将表数据批次的同步状态对应的编码更新为2;当表数据批次的同步状态为同步异常状态2时,停止对当前批次的表数据(即同步异常状态的表数据批次)同步,继续同步数据同步日志信息中下一批的表数据批次的同步状态为未同步的其余表数据批次。In this embodiment, the code corresponding to the unsynchronized state of the table data batch is 0, and the table data batch is synchronized. When the synchronization of the table data batch is abnormal, the synchronization of the abnormal current batch is stopped. Table data synchronization, at this time, the synchronization state of the table data batch in the data synchronization log information is the synchronization abnormal state, and the code corresponding to the synchronization abnormal state is 2, that is, the code corresponding to the synchronization state of the table data batch is updated to 2; when When the synchronization state of the table data batch is synchronization exception state 2, stop synchronizing the current batch of table data (that is, the table data batch in the synchronization abnormal state), and continue to synchronize the next batch of table data batches in the data synchronization log information The rest of the table data batches whose synchronization status is not synchronized.
本实施方式中,当存在多个表数据批次的同步状态为未同步状态时,按照顺序依次执行同步任务,若当前表数据批次的同步出现异常时,该表数据批次的同步状态为同步异常状态2,则执行下一个表数据批次的同步状态为未同步的其余表数据批次。In this embodiment, when the synchronization status of multiple table data batches is unsynchronized, the synchronization tasks are executed sequentially. If the synchronization of the current table data batches is abnormal, the synchronization status of the table data batches is If the synchronization exception status is 2, then the synchronization status of the next table data batch is executed for the rest of the table data batches that are not synchronized.
本实施方式中的表数据同步处理方法,当表数据批次的同步出现异常时,停止对出现异常当前批次的表数据同步,并且将数据同步日志信息中出现异常当前批次的表数据的同步状态更新为同步异常,响应于停止对出现异常当前批次的表数据同步,继续同步数据同步日志信息中表数据批次的同步状态为未同步的其余表数据批次,提供了跳过异常表数据批次继续完成剩余批次表数据的方法,避免同步过程被异常数据打断,提高了表数据同步处理的自动化程度,提高了表数据同步处理的效率。In the table data synchronization processing method in this embodiment, when an abnormality occurs in the synchronization of the table data batches, stop synchronizing the table data of the current batch in which the abnormality occurs, and record the table data of the current batch in which the abnormality occurs in the data synchronization log information. Synchronization status is updated to synchronization exception, in response to stop synchronizing the table data of the current batch where the exception occurs, continue to synchronize the data synchronization log information, the synchronization status of the table data batch is the rest of the table data batches that are not synchronized, and skip exception is provided Table data batches continue to complete the remaining batches of table data, avoiding the interruption of the synchronization process by abnormal data, improving the automation of table data synchronization processing, and improving the efficiency of table data synchronization processing.
在一可选的实施方式中,上述步骤102中将同步状态实时更新至数据同步日志信息中的步骤还包括:当表数据批次的同步出现异常时,停止对出现异常当前批次的表数据同步,并且将数据同步日志信息中出现异常当前批次的表数据的同步状态更新为同步异常;响应于停止对出现异常当前批次的表数据同步,对出现异常的表数据批次进行异常修复;将异常修复后的表数据批次的同步状态更新为未同步,并且同步异常修复后的表数据批次。In an optional embodiment, the step of updating the synchronization status to the data synchronization log information in the
图7为本实施方式提供的一种表数据同步处理方法的流程示意图,如图7所示,上述步骤205之后还包括:FIG. 7 is a schematic flowchart of a table data synchronization processing method provided in this embodiment. As shown in FIG. 7 , after the
步骤207、响应于停止对出现异常当前批次的表数据同步,对出现异常的表数据批次进行异常修复。
步骤208、将异常修复后的表数据批次的同步状态更新为未同步,并且同步异常修复后的表数据批次。
在本实施方式中,表数据批次的未同步状态对应的编码为0,对该表数据批次进行同步,当该表数据批次的同步出现异常时,则停止对出现异常当前批次的表数据同步,此时,数据同步日志信息中表数据批次的同步状态为同步异常状态,而同步异常状态对应的编码为2,即将表数据批次的同步状态对应的编码更新为2;当表数据批次的同步状态为同步异常状态2时,停止对出现异常当前批次的表数据同步,并对出现异常的表数据批次进行异常修复,将异常修复后的表数据批次的同步状态更新为未同步,即将该表数据批次的同步状态编码更新为未同步状态对应的编码0,并且同步异常修复后的表数据批次,即在完成某一批次的表数据批次同步后,若在其顺序之前存在已经修复后的未同步表数据批次,则对该已经修复后的未同步表数据批次进行同步。In this embodiment, the code corresponding to the unsynchronized state of the table data batch is 0, and the table data batch is synchronized. When the synchronization of the table data batch is abnormal, the synchronization of the abnormal current batch is stopped. Table data synchronization, at this time, the synchronization state of the table data batch in the data synchronization log information is the synchronization abnormal state, and the code corresponding to the synchronization abnormal state is 2, that is, the code corresponding to the synchronization state of the table data batch is updated to 2; when When the synchronization state of the table data batch is synchronization exception state 2, stop synchronizing the table data of the current batch with the exception, and repair the exception of the table data batch with the exception, and synchronize the table data batch after the exception repair The status is updated to unsynchronized, that is, the synchronization status code of the table data batch is updated to the code 0 corresponding to the unsynchronized state, and the table data batch after the abnormality is repaired is synchronized, that is, after a certain batch of table data batch synchronization is completed Afterwards, if there is a batch of unsynchronized table data that has been repaired before its sequence, the batch of unsynchronized table data that has been repaired will be synchronized.
本实施方式中的表数据同步处理方法,当表数据批次的同步出现异常时,停止对出现异常当前批次的表数据同步,并且将数据同步日志信息中出现异常当前批次的表数据的同步状态更新为同步异常;响应于停止对出现异常当前批次的表数据同步,对出现异常的表数据批次进行异常修复;将异常修复后的表数据批次的同步状态更新为未同步,并且同步异常修复后的表数据批次;由此,实现了异常排除后的表数据续传,续传的表数据不包括已完成同步的批次,优化了表数据同步处理的进程,减少了表数据同步处理所需的时间,提高了表数据同步处理的效率。In the table data synchronization processing method in this embodiment, when an abnormality occurs in the synchronization of the table data batches, stop synchronizing the table data of the current batch in which the abnormality occurs, and record the table data of the current batch in which the abnormality occurs in the data synchronization log information. The synchronization status is updated to synchronization exception; in response to stopping the synchronization of the table data of the current batch with the exception, the exception repair is performed on the abnormal table data batch; the synchronization status of the table data batch after the exception repair is updated to unsynchronized, And synchronize the batches of table data after the abnormality is repaired; thus, the table data after the abnormality is eliminated can be resumed. The time required for table data synchronization processing improves the efficiency of table data synchronization processing.
在一可选的实施方式中,在步骤101之前还包括:根据预设字段信息将目标源表数据进行分批处理以生成不同批次的表数据。In an optional implementation manner, before
本实施方式中的表数据同步处理方法,根据预设字段信息将目标源表数据进行分批处理以生成不同批次的表数据,根据目标源表数据的特点,提供了对目标源表数据的分批处理的依据,保证将目标源数据在分批处理时不会遗漏和混乱,提高了表数据同步处理的效率。The table data synchronous processing method in this embodiment performs batch processing on the target source table data according to the preset field information to generate different batches of table data, and provides the synchronization of the target source table data according to the characteristics of the target source table data. The basis for batch processing ensures that the target source data will not be missed or confused during batch processing, which improves the efficiency of synchronous processing of table data.
在一可选的实施方式中,字段信息包括时间信息、分类信息、序号信息中的任意一种或多种。In an optional implementation manner, the field information includes any one or more of time information, classification information, and serial number information.
表一为本实施方式提供的一种表数据同步处理方法中目标源表数据的示意表。Table 1 is a schematic table of target source table data in a table data synchronization processing method provided in this embodiment.
如表一所示,时间信息即表一中的month(月份),分类信息即表一中的province(省份)及city(城市),序号信息即表一种的id(Identity document,身份标识号码),字段信息包括时间信息、分类信息、序号信息中的任意一种或多种,根据预设字段信息将目标源表数据进行分批处理以生成不同批次的表数据,可以仅根据序号信息或仅根据时间信息或仅根据分类信息对目标源表数据进行分批处理,也可以根据序号信息和时间信息,或者根据序号信息和分类信息,或者根据时间信息和分类信息,或者根据时间信息、分类信息和序号信息对目标源表数据进行分批处理。As shown in Table 1, the time information is the month (month) in Table 1, the classification information is the province (province) and city (city) in Table 1, and the serial number information is the id (Identity document) in Table 1. ), the field information includes any one or more of time information, classification information, and serial number information. According to the preset field information, the target source table data is processed in batches to generate different batches of table data. Either process the data in the target source table in batches based only on time information or classification information, or based on sequence number information and time information, or sequence number information and classification information, or time information and classification information, or time information, Classification information and serial number information perform batch processing on the target source table data.
表一表数据同步处理方法中目标源表数据的示意表Schematic diagram of target source table data in table 1 table data synchronization processing method
本实施方式中的表数据同步处理方法,根据预设字段信息将目标源表数据进行分批处理以生成不同批次的表数据,字段信息包括时间信息、分类信息、序号信息中的任意一种或多种;根据目标源表数据的特点,提供了对目标源表数据的分批处理的依据,保证将目标源数据在分批处理时不会遗漏和混乱,提高了表数据同步处理的可靠性。根据换电站电池监控数据的特点,选择表数据划分批次的依据,不仅能够防止数据遗漏和混乱,而且保证了不同批次的表数据的数据量相近,根据字段信息的含义,也能帮助维护和开发人员清楚了解表数据批次中包含数据的内容;可见,不仅有利于数据同步,还有利于系统维护和开发。In the table data synchronization processing method in this embodiment, the target source table data is processed in batches according to the preset field information to generate different batches of table data, and the field information includes any one of time information, classification information, and serial number information or more; according to the characteristics of the target source table data, it provides the basis for the batch processing of the target source table data, ensuring that the target source data will not be missed and confused during batch processing, and improves the reliability of table data synchronization processing sex. According to the characteristics of the battery monitoring data of the power station, the basis for selecting table data to divide batches can not only prevent data omission and confusion, but also ensure that the data volume of table data in different batches is similar. According to the meaning of field information, it can also help maintenance And developers clearly understand the content of data contained in table data batches; it can be seen that it is not only beneficial to data synchronization, but also beneficial to system maintenance and development.
在一可选的实施方式中,数据同步日志信息中还存储有表数据批次的同步顺序;上述步骤102中具体包括:基于数据同步日志信息中表数据批次的同步状态及同步顺序,将对应的表数据批次进行同步。In an optional implementation, the synchronization sequence of the table data batches is also stored in the data synchronization log information; the
表二为本实施方式提供的一种表数据同步处理方法中数据同步日志信息的示意表。Table 2 is a schematic table of data synchronization log information in a table data synchronization processing method provided in this embodiment.
表二表数据同步处理方法中数据同步日志信息的示意表Table 2 shows the schematic diagram of data synchronization log information in the data synchronization processing method
如表二所示,同步顺序即为表二中的ID,同步状态为表二中的status(同步状态),status为0表示该表数据批次的同步状态为未同步状态。As shown in Table 2, the synchronization sequence is the ID in Table 2, and the synchronization status is the status (synchronization status) in Table 2. A status of 0 indicates that the synchronization status of the batch of data in this table is not synchronized.
表二中的batch(批次)为表数据批次。基于数据同步日志信息中表数据批次的同步状态及同步顺序,即基于ID和status,对数据同步日志信息中表数据批次进行同步。The batch in Table 2 is the batch of table data. Based on the synchronization status and synchronization order of the table data batches in the data synchronization log information, that is, based on the ID and status, the table data batches in the data synchronization log information are synchronized.
本实施方式中的表数据同步处理方法,基于数据同步日志信息中表数据批次的同步状态及同步顺序,将对应的表数据批次进行同步;由此,实现了有序地对表数据批次进行同步,一方面可以防止同步中数据的遗漏,另一方面也为开发人员提供了控制表数据同步过程的可能性。The table data synchronization processing method in this embodiment, based on the synchronization state and synchronization order of the table data batches in the data synchronization log information, synchronizes the corresponding table data batches; On the one hand, it can prevent the omission of data in the synchronization, and on the other hand, it also provides developers with the possibility to control the table data synchronization process.
在一可选的实施方式中,上述步骤101中获取数据同步日志信息的步骤中,数据同步日志信息中存储有基于表名分类的多个目标源表数据的不同批次的表数据的同步状态。In an optional implementation manner, in the step of obtaining data synchronization log information in the
在本实施方式中,数据同步日志信息中存储有多个源表数据的不同批次的表数据的同步状态,多个目标源表数据的不同批次的表数据基于表名分类,当需要新表数据时,不需要额外创建新的数据同步日志信息,只需在原数据同步日志信息中基于表名新增不同批次的表数据和该不同批次的表数据的同步状态。In this embodiment, the synchronization status of different batches of table data of multiple source table data is stored in the data synchronization log information, and table data of different batches of multiple target source table data are classified based on the table name. For table data, there is no need to create new data synchronization log information, just add different batches of table data and the synchronization status of the different batches of table data based on the table name in the original data synchronization log information.
本本实施方式中的表数据同步处理方法,数据同步日志信息中存储有基于表名分类的多个目标源表数据的不同批次的表数据的同步状态,通过将多个目标源表数据的不同批次的表数据整合在同一数据同步日志信息中,将对应的表数据批次进行同步,实现了对目标源表数据的分批处理以获取数据同步日志信息,这使得该方法具有共用性和扩展性,对于新增加的目标源表数据的同步需求,同样能够实现可断点续传的数据同步。实施例2In the table data synchronization processing method in this embodiment, the synchronization status of different batches of table data of multiple target source table data classified based on the table name is stored in the data synchronization log information. Batches of table data are integrated into the same data synchronization log information, and the corresponding table data batches are synchronized to achieve batch processing of target source table data to obtain data synchronization log information, which makes the method common and Scalability, for the synchronization requirements of the newly added target source table data, it can also realize the data synchronization that can resume the breakpoint. Example 2
本实施例提供一种电子设备,图8为本实施例提供的一种电子设备的结构示意图。电子设备包括存储器、处理器及存储在存储器上并可在处理器上执行的计算机程序,处理器执行程序时实现如上实施例中的表数据同步处理方法。图8显示的电子设备80仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。This embodiment provides an electronic device, and FIG. 8 is a schematic structural diagram of the electronic device provided by this embodiment. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the table data synchronization processing method in the above embodiment is implemented. The
如图8所示,电子设备80可以以通用计算设备的形式表现,例如其可以为服务器设备。电子设备80的组件可以包括但不限于:上述至少一个处理器81、上述至少一个存储器82、连接不同系统组件(包括存储器82和处理器81)的总线83。As shown in FIG. 8, the
总线83包括数据总线、地址总线和控制总线。The
存储器82可以包括易失性存储器,例如随机存取存储器(RAM)821和/或高速缓存存储器822,还可以进一步包括只读存储器(ROM)823。The
存储器82还可以包括具有一组(至少一个)程序模块824的程序/实用工具825,这样的程序模块824包括但不限于:操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。
处理器81通过执行存储在存储器82中的计算机程序,从而执行各种功能应用以及数据处理,例如本申请如上实施例中的表数据同步处理方法。The
电子设备80也可以与一个或多个外部设备84(例如键盘、指向设备等)通信。这种通信可以通过输入/输出(I/O)接口85进行。并且,模型生成的设备80还可以通过网络适配器86与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络,例如因特网)通信。如图8所示,网络适配器86通过总线83与模型生成的设备80的其它模块通信。应当明白,尽管图中未示出,可以结合模型生成的设备80使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理器、外部磁盘驱动阵列、RAID(磁盘阵列)系统、磁带驱动器以及数据备份存储系统等。
应当注意,尽管在上文详细描述中提及了电子设备的若干单元/模块或子单元/模块,但是这种划分仅仅是示例性的并非强制性的。实际上,根据本申请的实施方式,上文描述的两个或更多单元/模块的特征和功能可以在一个单元/模块中具体化。反之,上文描述的一个单元/模块的特征和功能可以进一步划分为由多个单元/模块来具体化。It should be noted that although several units/modules or subunits/modules of an electronic device are mentioned in the above detailed description, such division is only exemplary and not mandatory. Actually, according to the embodiment of the present application, the features and functions of two or more units/modules described above may be embodied in one unit/module. Conversely, the features and functions of one unit/module described above can be further divided to be embodied by a plurality of units/modules.
实施例3Example 3
本实施例提供了一种计算机可读存储介质,其上存储有计算机程序,程序被处理器执行时实现如上实施例中的表数据同步处理方法中的步骤。This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the steps in the method for synchronizing table data in the above embodiment are implemented.
其中,可读存储介质可以采用的更具体可以包括但不限于:便携式盘、硬盘、随机存取存储器、只读存储器、可擦拭可编程只读存储器、光存储器件、磁存储器件或上述的任意合适的组合。Wherein, the readable storage medium may more specifically include but not limited to: portable disk, hard disk, random access memory, read-only memory, erasable programmable read-only memory, optical storage device, magnetic storage device or any of the above-mentioned the right combination.
在可能的实施方式中,本申请还可以实现为一种程序产品的形式,其包括程序代码,当程序产品在终端设备上执行时,程序代码用于使终端设备执行实现如上实施例中的表数据同步处理方法中的步骤。In a possible implementation, the present application can also be implemented in the form of a program product, which includes program code. When the program product is executed on the terminal device, the program code is used to make the terminal device execute the table in the above embodiment. Steps in a data synchronization process method.
其中,可以以一种或多种程序设计语言的任意组合来编写用于执行本申请的程序代码,程序代码可以完全地在用户设备上执行、部分地在用户设备上执行、作为一个独立的软件包执行、部分在用户设备上部分在远程设备上执行或完全在远程设备上执行。Wherein, the program code for executing the application can be written in any combination of one or more programming languages, and the program code can be completely executed on the user equipment, partially executed on the user equipment, as an independent software Package execution, partly on the user device and partly on the remote device, or entirely on the remote device.
虽然以上描述了本申请的具体实施方式,但是本领域的技术人员应当理解,这仅是举例说明,本申请的保护范围是由所附权利要求书限定的。本领域的技术人员在不背离本申请的原理和实质的前提下,可以对这些实施方式做出多种变更或修改,但这些变更和修改均落入本申请的保护范围。Although the specific implementation manners of the present application have been described above, those skilled in the art should understand that this is only an example, and the protection scope of the present application is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principle and essence of the present application, but these changes and modifications all fall within the protection scope of the present application.
Claims (13)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111659143.XA CN116414908A (en) | 2021-12-30 | 2021-12-30 | Table data synchronization processing method, electronic equipment and medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111659143.XA CN116414908A (en) | 2021-12-30 | 2021-12-30 | Table data synchronization processing method, electronic equipment and medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN116414908A true CN116414908A (en) | 2023-07-11 |
Family
ID=87048273
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202111659143.XA Pending CN116414908A (en) | 2021-12-30 | 2021-12-30 | Table data synchronization processing method, electronic equipment and medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116414908A (en) |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101511078A (en) * | 2009-03-10 | 2009-08-19 | 中兴通讯股份有限公司 | Method for hanging-up and recovering mobile terminal synchronization terminal data |
| CN101778134A (en) * | 2010-01-11 | 2010-07-14 | 青岛海信移动通信技术股份有限公司 | Data synchronization method and mobile communication terminal |
| CN109101622A (en) * | 2018-08-10 | 2018-12-28 | 北京奇虎科技有限公司 | Method of data synchronization, calculates equipment and computer storage medium at device |
| CN113094439A (en) * | 2021-04-23 | 2021-07-09 | 深圳前海微众银行股份有限公司 | Log synchronization method, log synchronization device and computer-readable storage medium |
| US20210271659A1 (en) * | 2020-02-28 | 2021-09-02 | Netapp Inc. | Maintaining timestamp parity of objects with alternate data streams during transition phase to synchronous state |
-
2021
- 2021-12-30 CN CN202111659143.XA patent/CN116414908A/en active Pending
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101511078A (en) * | 2009-03-10 | 2009-08-19 | 中兴通讯股份有限公司 | Method for hanging-up and recovering mobile terminal synchronization terminal data |
| CN101778134A (en) * | 2010-01-11 | 2010-07-14 | 青岛海信移动通信技术股份有限公司 | Data synchronization method and mobile communication terminal |
| CN109101622A (en) * | 2018-08-10 | 2018-12-28 | 北京奇虎科技有限公司 | Method of data synchronization, calculates equipment and computer storage medium at device |
| US20210271659A1 (en) * | 2020-02-28 | 2021-09-02 | Netapp Inc. | Maintaining timestamp parity of objects with alternate data streams during transition phase to synchronous state |
| CN113094439A (en) * | 2021-04-23 | 2021-07-09 | 深圳前海微众银行股份有限公司 | Log synchronization method, log synchronization device and computer-readable storage medium |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN103345470B (en) | A kind of database disaster recovery method, system and server | |
| CN102929600B (en) | Monitoring system version recognition methods based on ELF | |
| CN107656749A (en) | A kind of device version management-control method and device | |
| CN110178121A (en) | A kind of detection method and its terminal of database | |
| CN117874141A (en) | Management method, system and storage medium for data in cloud primary environment | |
| CN114706870A (en) | Database and cache consistency synchronization method, device, equipment and storage medium | |
| CN119130723A (en) | Automatic management method and device for power supply guarantee work order, electronic equipment, and storage medium | |
| CN117076196A (en) | A management and control method and device for database disaster recovery | |
| CN111680053B (en) | A meter reading task execution method of a meter reading task instance | |
| CN107357809A (en) | Magnanimity platform Hisoon real-time database metric data access system | |
| CN111628924B (en) | E-mail sending method, system, storage medium and electronic device | |
| CN115145870A (en) | Method, device, electronic device and storage medium for locating cause of failed task | |
| CN115794485A (en) | Data recovery method, device, equipment and storage medium based on disaster recovery backup | |
| CN116414908A (en) | Table data synchronization processing method, electronic equipment and medium | |
| CN116107993A (en) | Data migration evaluation method and system in MySQL protocol database | |
| CN107257373A (en) | A kind of grid model data maintenance management method based on CIM/E files | |
| CN114896100A (en) | Data recovery method and device | |
| CN114810512A (en) | Wind turbine fault diagnosis method, system and computer readable storage medium | |
| CN110515955B (en) | Data storage and query method and system, electronic equipment and storage medium | |
| CN103605766A (en) | Method and device for accessing power transformation data to real-time or historical database | |
| CN119537096A (en) | Data backup and recovery method, device, computer equipment and storage medium | |
| CN105930223A (en) | Method for reducing size of check point file | |
| CN111581013A (en) | System information backup and reconstruction method based on metadata and shadow files | |
| CN118689862A (en) | Heterogeneous database data migration method, device, equipment and storage medium | |
| CN117149738B (en) | Data warehouse storage space reclamation methods and electronic devices |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| CB02 | Change of applicant information |
Country or region after: China Address after: 510700 Room 606, No. 1, Yichuang street, Zhongxin Guangzhou Knowledge City, Huangpu District, Guangzhou, Guangdong Province (Part 1) (office only) Applicant after: Aodong New Energy Co.,Ltd. Address before: Room 606, No. 1 Yichuang Street, Zhongxin Guangzhou Knowledge City, Huangpu District, Guangzhou City, Guangdong Province (Part 1) (Office only) Applicant before: AULTON NEW ENERGY AUTOMOTIVE TECHNOLOGY Group Country or region before: China |
|
| CB02 | Change of applicant information |


