Data migration monitoring method and device, computer equipment and storage medium
Recording data identification during the data migration process through bitmaps solves the problem of transmission progress and integrity control during massive data migration, and improves the accuracy and efficiency of data migration.
Patent Information
- Application Number
- CN202410271074.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-08
- Publication Date
- 2024-09-17
AI Technical Summary
In the process of massive data migration, the transmission progress and data transmission integrity are difficult to control, resulting in inaccurate data migration. Existing technology detection costs are high and accuracy is low.
By obtaining the data identification of the data to be migrated, recording it into a bitmap based on the results of the current migration phase, and obtaining the data migration monitoring results based on the bitmap recording, the migration process can be monitored and optimized.
It improves the accuracy of data migration, reduces data storage space, simplifies analysis in multiple migration stages, and reduces the difficulty of data analysis and the efficiency of result acquisition.
Smart Images

Figure CN118656277A
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data migration monitoring method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] With the development of Internet technology, the data in service industries such as communications, shopping, and finance has increased exponentially every year. In the process of business processing, migrating data from one carrier to another is a common operation. Using message queues (MQ) can achieve asynchronous communication, decouple systems, reduce traffic peaks, and improve system scalability and reliability. Summary of the invention
[0003] Based on this, it is necessary to provide a data migration monitoring method, device, computer equipment, computer-readable storage medium and computer program product that can improve the accuracy of data migration in response to the above technical problems.
[0004] In a first aspect, the present application provides a data migration monitoring method. The method comprises:
[0005] Obtain the data identifier of the source data to be migrated;
[0006] According to the migration result of the source data in the current data migration phase, the data identifier is recorded in the bitmap of the current data migration phase; the current data migration phase refers to any data migration phase in the process of migrating the source data to the target storage space;
[0007] Based on the record status of the data identifier in the bitmap, the data migration monitoring result of the source data is obtained.
[0008] In a second aspect, the present application also provides a data migration monitoring device. The device comprises:
[0009] An identification acquisition module, used to acquire the data identification of the source data to be migrated;
[0010] an identification recording module, configured to record the data identification into a bitmap of the current data migration stage according to a migration result of the source data in the current data migration stage; the current data migration stage refers to any data migration stage in the process of migrating the source data to the target storage space;
[0011] The monitoring result obtaining module is used to obtain the data migration monitoring result of the source data based on the record status of the data identifier in the bitmap.
[0012] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0013] Obtain the data identifier of the source data to be migrated;
[0014] According to the migration result of the source data in the current data migration phase, the data identifier is recorded in the bitmap of the current data migration phase; the current data migration phase refers to any data migration phase in the process of migrating the source data to the target storage space;
[0015] Based on the record status of the data identifier in the bitmap, the data migration monitoring result of the source data is obtained.
[0016] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0017] Obtain the data identifier of the source data to be migrated;
[0018] According to the migration result of the source data in the current data migration phase, the data identifier is recorded in the bitmap of the current data migration phase; the current data migration phase refers to any data migration phase in the process of migrating the source data to the target storage space;
[0019] Based on the record status of the data identifier in the bitmap, the data migration monitoring result of the source data is obtained.
[0020] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0021] Obtain the data identifier of the source data to be migrated;
[0022] According to the migration result of the source data in the current data migration phase, the data identifier is recorded in the bitmap of the current data migration phase; the current data migration phase refers to any data migration phase in the process of migrating the source data to the target storage space;
[0023] Based on the record status of the data identifier in the bitmap, the data migration monitoring result of the source data is obtained.
[0024] The above-mentioned data migration monitoring method, device, computer equipment, storage medium and computer program product obtain the data identifier of the source data to be migrated, and record the data identifier in the bitmap of the current data migration stage according to the migration result of the source data in the current data migration stage. The current data migration stage refers to any data migration stage in the process of migrating the source data to the target storage space. Based on the recording of the data identifier in the bitmap, the data migration monitoring result of the source data is obtained. Based on the data migration monitoring result, corresponding data migration optimization processing can be performed, that is, the data migration stage in the data migration process is monitored, so as to improve the accuracy of data migration; in addition, by recording the data identifier in the bitmap of the current data migration stage, the data migration monitoring result of the source data can be obtained based on the recording of the data identifier in the bitmap, that is, the data migration monitoring result is obtained by storing the corresponding data identifier in the bitmap and analyzing the result stored in the bitmap, which can reduce data storage space, facilitate analysis of migration conditions of multiple data migration stages, reduce the difficulty of data analysis, and improve the efficiency of obtaining data migration monitoring results. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for describing the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative labor.
[0026] FIG1 is a diagram of an application environment of a data migration monitoring method according to an embodiment;
[0027] FIG2 is a schematic diagram of a flow chart of a data migration monitoring method in one embodiment;
[0028] FIG3 is a schematic diagram of a bitmap storage structure in one embodiment;
[0029] FIG4 is a schematic diagram of a storage structure of a compressed bitmap in one embodiment;
[0030] FIG5 is a schematic diagram of a process of migrating source data from a source address to a target storage space through a message queue in one embodiment;
[0031] FIG6 is a schematic diagram of a data migration monitoring process in one embodiment;
[0032] FIG7 is a structural block diagram of a data migration monitoring device in one embodiment;
[0033] FIG. 8 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0035] In the migration of massive data, the relevant technology pushes and transmits the source data through the message queue middleware, and decouples it through the queue mode. As the producer of the queue, the upstream service reads the business data to be transmitted in the database of the source data and pushes it to the middleware queue server. As the consumer of the queue, the downstream service involves the business logic processing process of data reception, conversion, and data writing, which is relatively slow, so multiple consumers may be added for parallel reception and processing to jointly complete the conversion and write the data to the target storage space. However, in the process of massive data transmission, the progress of the transmission and the integrity of the data transmission cannot be controlled. It is too costly to detect whether some data is lost during the transmission process by querying and comparing the source data with the target storage space, and the detection accuracy is low, which leads to inaccurate data migration.
[0036] Based on the problem of inaccurate data migration in traditional technologies, an embodiment of the present application provides a data migration monitoring method. According to the migration result of the source data to be migrated in the current data migration stage, the data identifier of the source data is recorded in the bitmap of the current data migration stage. Based on the records in the bitmap, the data migration monitoring result of the source data is obtained, that is, the monitoring of the migration stage in the migration process is realized, and the data migration status can be obtained, so that corresponding migration optimization processing can be performed according to the data migration status, which can improve the accuracy of data migration.
[0037] The data migration monitoring method provided in the embodiment of the present application can be applied to the application environment shown in FIG. 1. The first device 102 communicates with the second device 104 through a network, and the third device 106 communicates with the first device 102 and the second device 104 through a network respectively. The source data on the first device 102 can be migrated to the target storage space on the second device 104. The third device 106 can obtain the data identifier of the source data to be migrated on the first device 102, and record the data identifier of the source data in the bitmap of the current data migration stage according to the migration result of the source data in the current data migration stage. The current data migration stage refers to any data migration stage in the migration process of migrating the source data on the first device 102 to the target storage space on the second device 104. The migration process of the source data on the first device 102 to the target storage space on the second device 104 includes at least two data migration stages. The third device 106 obtains the data migration monitoring result of the source data based on the record of the data identifier in the bitmap of each data migration stage in the data migration process.
[0038] The first device 102, the second device 104 and the third device 106 may be, but are not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The first device 102, the second device 104 and the third device 106 may be servers or terminals.
[0039] It should be noted here that the data migration monitoring method provided in the embodiment of the present application is not only applicable to the application scenario in which the first device 102, the second device 104 and the third device 106 interact with each other, but also applicable to the application scenario in which the first device 102 and the second device 104 interact with each other. For example, the first device 102 is in communication connection with the second device 104, and the first device 102 can obtain the data identifier of the source data to be migrated on the first device 102. The first device 102 records the data identifier in the bitmap of the current data migration stage according to the migration result of the source data in the current data migration stage. The current data migration stage refers to any data migration stage in the process of migrating the source data on the first device 102 to the target storage space on the second device 104. The first device 102 obtains the data migration monitoring result of the source data based on the recording of the data identifier in the bitmap of each data migration stage in the data migration process. Alternatively, the second device 104 may obtain the data identifier of the source data to be migrated on the first device 102, and record the data identifier of the source data in the bitmap of the current data migration stage according to the migration result of the source data in the current data migration stage, where the current data migration stage refers to any data migration stage in the process of migrating the source data on the first device 102 to the target storage space on the second device 104. The second device 104 obtains the data migration monitoring result of the source data based on the recording of the data identifier in the bitmap of each data migration stage.
[0040] In one embodiment, as shown in FIG. 2 , a data migration monitoring method is provided, which is described by taking the method applied to the third device in FIG. 1 as an example, and includes the following steps 202 to 206 .
[0041] Step 202: Obtain the data identifier of the source data to be migrated.
[0042] The electronic device obtains the data identifier of the source data to be migrated. Among them, the data identifier refers to the identifier of the source data, which is used to uniquely identify the source data, and different source data have different data identifiers. The source data refers to the data to be migrated, and the source data can be one piece of data or multiple pieces of data. Specifically, whether one piece of source data corresponds to one data identifier or multiple pieces of source data correspond to one data identifier can be set according to the actual application scenario, and is not specifically limited here. A piece of data can be the smallest data migration unit in the data migration process, or it can be the data for a customized data migration. The source data is the data to be migrated, and the source data can be migrated from the source address to the target address of the target storage space. The target storage space can be located in the device where the source data is located, or it can be located in other devices different from the device where the source data is located. The source data can be operating system data, application data, database data, etc.
[0043] Optionally, the data identifier includes a data primary key identifier, which refers to a data primary key identifier of a database, that is, the source data is stored in the form of a database, and the source data can be distinguished according to the data primary key identifier in the database where the source data is stored. A table in a database often has a column or a combination of columns, whose values can uniquely identify each row in the table. Such a column or columns are called the primary key of the table, through which the entity integrity of the table can be enforced.
[0044] Optionally, the data identifier may be a numerical identifier or a non-numerical identifier. The numerical identifier may be a digital identifier, and the non-numerical identifier may be, for example, a text identifier, a symbol identifier, or a pattern identifier.
[0045] The electronic device can obtain the data identifier of the source data from the source address where the source data is stored, or it can receive the data identifier of the source data sent from the source address by other electronic devices. The data identifier of the source data is set in advance, and the data identifier of the source data can be obtained when the electronic device is in communication with the device where the source data is located. If the electronic device is the device where the source data is located, the electronic device can directly obtain the data identifier of the source data.
[0046] Step 204, recording the data identifier into the bitmap of the current data migration stage according to the migration result of the source data in the current data migration stage; the current data migration stage refers to any data migration stage in the process of migrating the source data to the target storage space.
[0047] The electronic device records the data identifier in the bitmap of the current data migration stage according to the result of the source data corresponding to the acquired data identifier in the current data migration stage. In this embodiment, the process of migrating the source data from the source address to the target storage space can be called a data migration process. The data migration process can include at least two data migration stages, that is, the data migration process can include 2 data migration stages, 3 data migration stages, 4 data migration stages or other more data migration stages. The number of specific data migration stages can be set according to the actual data migration scenario and the data migration method. The current data migration stage can be any data migration stage in the data migration process. Among them, the result of the source data in the current data migration stage can include migration success and migration failure. Migration success refers to the successful completion of the migration process of the current data migration stage, and migration failure refers to the unsuccessful completion of the migration process of the current data migration stage. For example, migration failure may be data loss in the current data migration stage, or there is a difference in data between two nodes in the current data migration stage.
[0048] A bitmap is a data structure that uses a bit to mark the value corresponding to an element, and the key is the element. Using bits as units to store data can save storage space. A bit refers to the basic unit of a computer, representing the smallest unit of binary information. A bit can have two states: 1 and 0. If an element exists, the corresponding bit is 1, otherwise, if an element does not exist, the corresponding bit is 0. It can be understood that the smallest unit of data storage is a bit, 8 bits are a byte, and the electronic device saves the acquired data identifier in the form of bits in the bitmap of the current data migration stage. The bitmap can include compressed bitmaps and uncompressed bitmaps. In an example, the default value of the bitmap is 0. Assuming that the numbers {1, 2, 4, 6} are to be represented, each bit can represent a number, 0 represents non-existence, and 1 represents existence; if the numbers {12, 13, 15} are to be represented, they need to be represented on another 8 bits, as shown in Figure 3. Each 8 bits can be equivalent to an array, such as the first 8 bits are array b[0], and the second 8 bits are array b[1]. To find out whether a number is stored in the bitmap, it is only necessary to determine whether the value of the corresponding bit is 1. If the value of the corresponding bit is 1, it indicates that the number exists. If the value of the corresponding bit is 0, it indicates that the number does not exist. It can be understood that recording the data identifier into the bitmap of the current data migration phase can be to set the bit corresponding to the data identifier in the corresponding bitmap to 1.
[0049] Optionally, based on the migration result of the source data in the current data migration stage, determine whether to record the data identifier of the source data in the bitmap of the current data migration stage. For example, if the migration result of the source data in the current data migration stage is a successful migration, the data identifier is recorded in the bitmap of the current data migration stage. If the migration result of the source data in the current data migration stage is a failed migration, the data identifier is not recorded in the bitmap of the current data migration stage. Alternatively, if the migration result of the source data in the current data migration stage is a successful migration, the data identifier is not recorded, that is, the data identifier is not recorded in the bitmap of the current data migration stage. If the migration result of the data corresponding to the data identifier in the current data migration stage is a failed migration, the data identifier is recorded in the bitmap of the current data migration stage.
[0050] In this embodiment, different data migration stages correspond to corresponding bitmaps, that is, one data migration stage corresponds to one bitmap. Different bitmaps can be distinguished by bitmap identifiers, and the bitmap identifiers can be associated with the corresponding data migration stages.
[0051] Step 206: obtaining the data migration monitoring result of the source data based on the record status of the data identifier in the bitmap.
[0052] Based on the records of the data identifiers in the bitmap, the electronic device can process the records in the bitmap to obtain the data migration monitoring results of the source data. The data migration monitoring results are monitoring results that characterize the data integrity or migration progress during the data migration process. The data migration monitoring results are used to optimize the data migration process or handle exceptions. For example, if the data migration monitoring result shows that the data migration of the corresponding source data is incomplete, the source data can be re-migrated based on this result, or the source data can be manually entered into the target storage space, etc.
[0053] Optionally, the data migration monitoring result of the source data can be obtained based on the records of the data identifiers in the bitmaps of the various data migration stages during the data migration process. The data migration monitoring result of the source data can be obtained based on the records of the data identifiers in the bitmaps of all the data migration stages during the data migration process, or it can be obtained based on the records of the data identifiers in the bitmaps of some of the data migration stages during the data migration process. The data migration monitoring result of the source data can include the successful migration of the source data, the abnormal migration of the source data, or the data migration stage corresponding to the abnormal migration of the source data, and can also include the duration of the abnormal migration stage corresponding to the source data from the current moment, etc.
[0054] Optionally, the data migration monitoring result of the source data can be obtained based on the XOR result of the recording status of the data identifier in the bitmap of each data migration stage. For example, if the XOR result of the recording status of the data identifier in the bitmap of each data migration stage is 1, it means that the recording status of the data identifier in the bitmap of different data migration stages is different. Then, the data migration monitoring result of the source data can be obtained that there is an abnormality in the data migration.
[0055] In the above data migration monitoring method, by obtaining the data identifier of the source data to be migrated and the migration result of the source data in the current data migration stage, the data identifier is recorded in the bitmap of the current data migration stage. The current data migration stage refers to any data migration stage in the process of migrating the source data to the target storage space. Based on the recording of the data identifier in the bitmap, the data migration monitoring result of the source data is obtained. Based on the data migration monitoring result, the data migration process can be optimized, such as supplementary migration of the source data where the data migration is abnormal, etc., which can improve the accuracy of data migration; in addition, by recording the data identifier in the bitmap of the current data migration stage, the data migration monitoring result of the source data can be obtained based on the recording of the data identifier in the bitmap, that is, the corresponding data identifier is stored in the bitmap and the result of the bitmap storage is analyzed to obtain the data migration monitoring result, which can reduce data storage space, facilitate the analysis of the migration conditions of multiple data migration stages, reduce the difficulty of data analysis, and improve the efficiency of obtaining data migration monitoring results.
[0056] In some embodiments, in step 204, according to the migration result of the source data in the current data migration phase, recording the data identifier into the bitmap of the current data migration phase includes:
[0057] If the migration result of the source data in the current data migration stage is successful, the data identifier is recorded in the bitmap of the current data migration stage; if the migration result of the source data in the current data migration stage is failed, the data identifier is not recorded in the bitmap of the current data migration stage.
[0058] In this embodiment, the electronic device can obtain the migration result of the source data in the current data migration stage. For example, the data transmission node in the data migration process will send a migration success message after completing the migration of the current data migration stage. The data transmission node is a node in the data migration process, and the data transmission stage is between two transmission nodes, that is, the data transmission node is the starting position and the end position of the data migration stage. If the migration result of the source data in the current data migration stage is a successful migration, the data identifier of the source data is recorded in the bitmap of the current data migration stage. If the migration result of the source data in the current data migration stage is a failed migration, the data identifier is not recorded, that is, the data identifier of the source data is not recorded in the bitmap of the current data migration stage. It can be understood that the data identifier recorded in the bitmap is the data identifier of the source data that has been successfully migrated in the data migration stage corresponding to the bitmap. If there is no data recorded in the bitmap, the value of the corresponding bit in the bitmap is 0.
[0059] In an actual application scenario, when a data transmission node in the data migration process successfully receives the source data transmitted by the previous transmission node, it sends a message that the data identifier corresponding to the source data has been successfully migrated in the current data migration stage. The electronic device obtains the migration result of the source data in the current data migration stage as a successful migration, and then records the data identifier in the bitmap of the current data migration stage. Correspondingly, if a data transmission node in the data migration process has not received the source data transmitted by the previous transmission node, it will not send a message that the source data has been successfully migrated in the current data migration stage. Then, the electronic device will not obtain the message that the source data has been successfully migrated in the current data migration stage, and will not record the data identifier of the source data in the bitmap of the current data migration stage, that is, the data identifier will not be recorded in the bitmap of the current data migration stage.
[0060] In this embodiment, if the migration result of the source data in the current data migration stage is successful, the data identifier is recorded in the bitmap of the current data migration stage. If the migration result of the source data in the current data migration stage is failed, the data identifier is not recorded in the bitmap of the current data migration stage. The data identifier of the successful migration in the data migration stage can be clearly determined from the corresponding bitmap, and the data identifier of the failed migration in the data migration stage can also be determined. By recording the data identifier in the bitmap of each data migration stage in the data migration process, the data migration monitoring result of the source data can be obtained more accurately.
[0061] In some embodiments, the bitmap includes a compressed bitmap; the compressed bitmap includes a first container, and the first container includes a second container; and recording the data identifier into the bitmap of the current data migration stage in step 204 includes:
[0062] From the bit data corresponding to the data identifier, obtain the first bit data of a preset number of bits in a bit-by-bit direction from high to low, and use the first bit data as the container identifier of the first container; obtain the second bit data in the bit data corresponding to the data identifier; the second bit data is obtained based on the bit data and the first bit data; and store the second bit data in a second container corresponding to the first container.
[0063] In this embodiment, the bitmap includes a compressed bitmap (Roaring Bitmap). The principle of the compressed bitmap is to divide the 32-bit unsigned integer data into multiple containers, each container contains a certain range of integers, and each container can use a different data structure to store the elements therein. For example, the 32-bit unsigned integer data is divided into 2 16 containers, that is, there may be at most 2 16 =65536 containers, that is, the compressed bitmap may include 65536 first containers, each first container includes 65536 second containers. When storing and querying data, the stored data is divided into high 16 bits and low 16 bits, the high 16 bits are taken as the container identifier to find the first container, and then the value of the low 16 bits is stored in the second container corresponding to the first container. According to the migration result of the source data in the current data migration stage, the data identifier of the source data is recorded in the compressed bitmap of the current data migration stage. For example, if the migration result of the source data in the current data migration stage is a successful migration, the data identifier is recorded in the compressed bitmap of the current data migration stage. If the migration result of the source data in the current data migration stage is a failed migration, the data identifier is not recorded in the compressed bitmap of the current data migration stage.
[0064] Optionally, all source data can be divided into multiple data intervals according to the data size, and the source data of each data interval is stored in a first container. The compressed bitmap may include at least two first containers, and the first container may include multiple second containers. The first bit data of a preset number of bits is obtained from the bit data corresponding to the data identifier in the direction from high to low bits, the first bit data is used as the container identifier of the first container, the second bit data in the bit data corresponding to the data identifier is obtained, and the second bit data is stored in the second container corresponding to the first container. The preset number of bits can be 4 bits, 8 bits or 16 bits, etc., and the preset number of bits can be set according to the data size of the source data and the number of divided data intervals. The second bit data is obtained based on the bit data and the first bit data. For example, the second bit data is the bit data in the bit data except the first bit data.
[0065] In one example, the structure of the compressed bitmap is shown in FIG4 , and the compressed bitmap includes 4 first containers, each of which includes 9 second containers. Since the data identifier is regarded as a 32-bit integer, the 32-bit integer is divided into high 16 bits and low 16 bits, that is, the preset number of bits is 16 bits, and for the convenience of calculation, the data identifier is converted into hexadecimal for calculation, and the first 4 bits in the hexadecimal correspond to the high 16 bits of the 32-bit integer, and the last 4 bits correspond to the low 16 bits of the 32-bit integer. Assume that the data identifier 31 is recorded in the compressed bitmap of the current data migration stage, the hexadecimal number of 31 is 0000001F, where F represents 15. The first bit data of 16 bits is 0000 obtained from 0000001F in the direction of the bit from high to low, and the first bit data 0000 is used as the container identifier of the first container 402. The second bit data 001F excluding the first bit data 0000 in 0000001F is obtained, and the second bit data 001F is stored in the second container 404 corresponding to the first container 402. Since the hexadecimal 001F is converted to decimal 31, the data stored in the second container 404 is 31.
[0066] Assume that the data identifier 55 is recorded in the compressed bitmap of the current data migration stage, the hexadecimal number of 55 is 00000037, and the first bit data of 16 bits obtained from 00000037 in the direction of high bit to low bit is 0000, and the first bit data 0000 is used as the container identifier of the first container 402, and the second bit data 0037 excluding the first bit data 0000 in 00000037 is obtained, and the second bit data 0037 is stored in the second container 406 corresponding to the first container 402. Since the hexadecimal 0037 is converted to decimal 55, the data stored in the second container 404 is 55.
[0067] For another example, assuming that the data identifier 65538 is recorded in the compressed bitmap of the current data migration stage, the hexadecimal number of 65538 is 00010002, and the first bit data of 16 bits obtained from 00010002 in the direction of the bit from high to low is 0001, then the first bit data 0001 is used as the container identifier of the first container 408, and the second bit data 0002 excluding the first bit data 0001 in 00010002 is stored in the second container 410 corresponding to the first container 408. By analogy, 0, 12, 14, 43, 44, 67 and 89 in FIG. 4 can be stored in different second containers in the first container 402, respectively. That is, the data identifiers from 00000001 to 0000FFFF can be stored in the first container 402, the data identifiers from 00010000 to 000FFFF can be stored in the first container 408, and so on, the data identifiers in a certain interval can be stored in the corresponding first container. The storage method of the second container in the first container is not specifically limited in this embodiment. It can be understood that in addition to converting the data identifier into hexadecimal, the data identifier can also be converted into other bases, so as to facilitate the selection of the upper 16 bits and lower 16 bits of the data identifier, such as binary, octal, etc.
[0068] In this embodiment, by recording the data identifier in the compressed bitmap of the current data migration stage according to the migration result of the data corresponding to the data identifier in the current data migration stage, data storage space can be saved more, and the efficiency of recording the data identifier in the compressed bitmap of the current data migration stage can be improved. It is easy to obtain the stored data information from the compressed bitmap, and it is convenient to obtain the data migration monitoring result of the source data based on the recording of the data identifier in the bitmap of each data migration stage, thereby improving the efficiency of obtaining the data migration monitoring result.
[0069] In one embodiment, based on the record of the data identifier in the bitmap, the data migration monitoring result of the source data is obtained, including:
[0070] An XOR operation is performed on the records of the data identifiers in the bitmap to obtain an XOR result; based on the XOR result, a data migration monitoring result of the source data is obtained.
[0071] In this embodiment, the records of the same data identifier in different bitmaps are subjected to an XOR operation to obtain an XOR result, and the data migration monitoring result of the source data is obtained according to the XOR result. Different bitmaps are bitmaps of different data migration stages in the data migration process. The records in the bitmaps of all data migration stages in the data migration process can be subjected to an XOR operation to obtain an XOR result, or the records in the bitmaps of some data migration stages in the data migration process can be subjected to an XOR operation to obtain an XOR result. Among them, the XOR operation is a logical operation. If the two XOR values are different, the XOR result is 1. If the two XOR values are the same, the XOR result is 0. In this embodiment, when performing an XOR operation, the records of the same data identifier in different bitmaps are subjected to an XOR operation. In essence, the values of the bits representing the same data identifier in different bitmaps are subjected to an XOR operation. For example, if a data identifier is recorded in the bitmap, the value of the bit corresponding to the data identifier is 1. If the data identifier is not recorded in the bitmap, the value of the bit corresponding to the data identifier is 0.
[0072] It can be understood that if the XOR result is 1, it means that the data identifier is recorded differently in the bitmap at different data migration stages, that is, the data identifier is sometimes recorded and sometimes not recorded, indicating that there is a data migration anomaly in the data migration stage that is not recorded in the bitmap.
[0073] Optionally, the records in the bitmap of the starting stage of the data migration process and the records in the bitmap of the ending stage can be XORed to obtain a first XOR result, and the first XOR result is used to characterize the difference between the data of the corresponding data identifier in the starting stage and the ending stage. If the first XOR result is 1, it means that the data corresponding to the data identifier is different between the starting stage and the ending stage. If the first XOR result is 0, it means that the data corresponding to the data identifier is not different between the starting stage and the ending stage. Alternatively, the starting stage and other stages of the data migration process can be XORed in sequence to determine the abnormal migration stage where the migration abnormality occurs, and then determine whether to issue a prompt message based on the length of time from the start timestamp of the abnormal migration stage to the current moment. The prompt message includes at least one of a re-migration prompt and an alarm prompt.
[0074] In this embodiment, an XOR operation is performed on the records of the data identifiers in the bitmap of each data migration stage in the data migration process to obtain an XOR result, and the data migration monitoring result of the source data is obtained based on the XOR result. Since the bitmap stores values corresponding to 0 or 1, it is convenient to perform an XOR operation, and the XOR calculation is relatively simple, which can improve the efficiency of obtaining the data migration monitoring result, thereby improving the efficiency of monitoring the data migration situation.
[0075] In some embodiments, the data migration phase includes a reading phase and a writing phase; the reading phase refers to the phase of reading source data from a source address; the writing phase refers to the phase of writing the migrated data into a target storage space; performing an XOR operation on the records of the data identifiers in the bitmap to obtain an XOR result includes:
[0076] Performing an XOR operation on the record status of the data identifier in the bitmap in the reading phase and the record status in the bitmap in the writing phase to obtain a first XOR result;
[0077] According to the XOR result, the data migration monitoring results of the source data are obtained, including:
[0078] If the first XOR result is a preset value, the data migration monitoring result is that there is a difference between the source data and the target data in the target storage space.
[0079] In this embodiment, the data migration stage includes at least a reading stage and a writing stage. The data reading stage refers to the stage of reading source data from a source address, and the writing stage refers to the stage of writing the migrated data into a target storage space. The data reading stage is the starting stage of the data migration process, and the writing stage is the ending stage of the data migration process. In actual application scenarios, the reading stage is the stage of reading source data from a source address, and the source address is the address where the source data is stored. Under normal circumstances, the data reading process in the reading stage will not be abnormal. Therefore, this embodiment is implemented under the assumption that the migration result of the reading stage is a successful migration, and the data identifier is recorded in the bitmap of the reading stage. The recording of the data identifier in the bitmap of the reading stage is XORed with the recording of the data identifier in the bitmap of the writing stage to obtain a first XOR result. If the first XOR result is a preset value, the data migration monitoring result is that there is a difference between the source data and the target data in the target storage space, wherein the preset value includes 1. It can be understood that the data identifier is recorded in the bitmap of the reading phase. If the data identifier is not recorded in the bitmap of the writing phase, it means that the data identified by the data has not passed the writing phase or the writing phase has not been successfully migrated, and the data migration monitoring result obtained is that there is a difference between the source data and the target data in the target storage space.
[0080] Optionally, if the first XOR result is a preset value, when the data migration monitoring result is that there is a difference between the source data and the target data of the target storage space, the electronic device can obtain the start timestamp of the write phase, and if the time from the current moment to the start timestamp of the write phase reaches the time threshold, an abnormal alarm prompt is issued, which is used to prompt the staff to manually re-enter the abnormal migration data. The time threshold can be set according to the actual application scenario, for example, the time threshold is 20 minutes, 30 minutes or 1 hour, etc.
[0081] In this embodiment, an XOR operation is performed on the record status of the data identifier in the bitmap of the reading phase and the record status in the bitmap of the writing phase to obtain a first XOR result, and a data migration monitoring result of the source data is obtained according to the first XOR result. If the first XOR result is a preset value, the data migration monitoring result is that there is a difference between the source data and the target data in the target storage space, that is, by performing an XOR operation on the record status in the bitmap corresponding to the starting phase and the ending phase of the data migration process, a data migration monitoring result of whether the source data and the target data in the target storage space are consistent can be obtained, which can reduce the complexity of data processing and improve the efficiency of obtaining the data migration monitoring result.
[0082] In some embodiments, the data migration phase includes a reading phase; performing an XOR operation on the records of the data identifiers in the bitmap to obtain an XOR result, including:
[0083] The first record of the data identifier in the bitmap of the reading phase is XORed with the second record of the bitmap of other data migration phases in sequence according to the order of the data migration phases to obtain a second XOR result;
[0084] According to the XOR result, the data migration monitoring result of the source data is obtained, including:
[0085] The data migration phase corresponding to the preset value of the first and second XOR results is used as the abnormal migration phase of the data identification.
[0086] In this embodiment, the data migration stage includes a reading stage and other data migration stages, and the other data migration stages are data migration stages other than the reading stage in all data migration stages in the data migration process. The other data migration stages include at least one. The electronic device identifies the first record situation of the data in the bitmap of the reading stage, and performs an XOR operation with the second record situation in the bitmap of the other data migration stages in the order from front to back in the data migration stage to obtain a second XOR result. For example, the data migration stage includes a reading stage, a B stage, and a C stage in the order of data migration, then the record situation in the bitmap of the reading stage is XORed with the record situation in the bitmap of the B stage and the record situation in the bitmap of the C stage in turn to obtain a second XOR result. Then, the data migration stage corresponding to the first second XOR result of the second XOR result being the preset value is taken as the abnormal stage of the data identification. To continue with the above example, if the second XOR result obtained by performing an XOR operation on the record situation in the bitmap of the reading stage and the record situation in the bitmap of the B stage is the preset value, and the second XOR result obtained by performing an XOR operation on the record situation in the bitmap of the reading stage and the record situation in the bitmap of the C stage in turn is the preset value, then the B stage corresponding to the first second XOR result being the preset value is taken as the abnormal migration stage of the data identification. The preset value includes 0 or 1.
[0087] It can be understood that the first second XOR result is a preset value, which means that in the result of the XOR operation of the record in the bitmap of the data migration stage experienced in the order of data migration and the record in the bitmap of the reading stage, the first second XOR result is a preset value, and the data migration stage corresponding to the first second XOR result being the preset value is used as the abnormal migration stage of the data identification. The abnormal migration stage will not record the data identification into the corresponding bitmap, and the bitmap of the data migration stage after the abnormal migration stage will not record the data identification. Optionally, the electronic device can obtain the start timestamp of the abnormal migration stage, and if the current moment reaches a preset time from the start timestamp of the abnormal migration stage, an abnormal alarm prompt is issued. The preset time can be set according to the actual application scenario. In one example, if the data migration process is implemented through a message queue, including a reading phase, an enqueuing phase, an outqueuing phase, and a writing phase, the start timestamp of the reading phase is 9:00, the start timestamp of the enqueuing phase is 9:01, the start timestamp of the outqueuing phase is 9:02, and the start timestamp of the writing phase is 9:03. Assuming that the current time is 9:30 and the preset duration is 1 hour, if the abnormal migration phase is the enqueuing phase, the time from the current time to the start timestamp of the enqueuing phase is 29 minutes. If the preset duration is not reached, no alarm will be issued; if the current time is 10:10, the time from the current time to the start timestamp of the enqueuing phase is 1 hour and 9 minutes. If the preset duration is reached, an alarm will be issued. The preset duration can be set according to the queue accumulation time of the balanced message queue and the time consuming of data migration. The current time in this example refers to the time when the data identifier is XORed in the bitmap of each data migration phase in the data migration process to obtain the XOR result.
[0088] In this embodiment, the first record situation of the data identifier in the bitmap of the reading phase is XORed with the second record situation in the bitmap of other data migration phases in the order of the data migration phase to obtain a second XOR result, and the data migration phase corresponding to the preset value of the first and second XOR results is used as the abnormal migration phase of the data identifier. That is, by performing an XOR operation on the record situation in the bitmap of the first data migration phase and the record situation in the bitmap of other data migration phases, the abnormal migration phase corresponding to the corresponding data identifier can be determined, which can achieve rapid and accurate determination of the abnormal migration phase, improve the efficiency of data migration monitoring, and further improve the accuracy of data migration.
[0089] In one embodiment, the method further includes: obtaining the current moment and the start timestamp of the abnormal migration phase; and issuing a data re-migration prompt for the data identifier if the current moment is separated from the start timestamp of the abnormal migration phase by a first preset time length.
[0090] In this embodiment, the electronic device can obtain the start timestamp of the data migration phase, which is the timestamp that characterizes the data migration in the data migration phase. The electronic device obtains the start timestamp of the abnormal migration phase, and if the current moment is from the start timestamp of the abnormal migration phase to the first preset time length, a data re-migration prompt of the data identifier is issued. The first preset time length can be set according to the actual application scenario. Among them, the data re-migration prompt can indicate that the source data of the corresponding data identifier is re-migrated, and the electronic device records the data identifier in the bitmap of the current data migration phase according to the migration result of the source data corresponding to the data identifier in the current data migration phase, performs an XOR operation on the record of the data identifier in the bitmap of each data migration phase in the data migration process to obtain an XOR result, and obtains the data migration monitoring result of the source data according to the XOR result. Optionally, if the current moment is from the start timestamp of the abnormal migration phase to the first preset time length, an abnormal warning prompt and a re-migration prompt are issued. It can be understood that the re-migration prompt and the abnormal warning prompt can be a message prompt, a pop-up prompt or a voice prompt.
[0091] It should be noted here that the duration threshold, the first preset duration, the second preset duration and the preset duration in the embodiment of the present application may be the same or different, and the duration threshold, the first preset duration, the second preset duration and the preset duration may be set respectively according to the actual application scenario.
[0092] In this embodiment, by obtaining the current moment and the start timestamp of the abnormal migration phase, if the current moment reaches a first preset time length from the start timestamp of the abnormal migration phase, a data re-migration prompt of the data identifier is issued, thereby achieving timely processing of the abnormal migration phase, improving the efficiency of data migration monitoring, and further improving the accuracy of data migration.
[0093] In some embodiments, the above method also includes: if the data identified by the data re-appears an abnormal migration phase during the re-migration process, then obtaining the start timestamp of the re-appearing abnormal migration phase, wherein the re-migration process is a migration process based on the data re-migration prompt; if the current moment is away from the start timestamp of the re-appearing abnormal migration phase to a second preset time length, then issuing an abnormal alarm message.
[0094] In this embodiment, when the electronic device issues a re-migration prompt for data re-migration of a data identifier, if the source data corresponding to the data identifier re-emerges an abnormal migration phase during the re-migration process, the start timestamp of the abnormal migration phase re-emerging is obtained, and if the current moment is away from the start timestamp of the abnormal migration phase re-emerging to a second preset time length, an abnormal alarm message is issued. It can be understood that the method for determining the re-emergence of the abnormal migration phase can be the same as the method for determining the abnormal migration phase in the above embodiment, and the abnormal migration phase re-emerging can be the same as the abnormal migration phase that occurred last time, or it can be different. Among them, the second preset time length can be set according to the actual application scenario. Based on the data re-migration prompt for the source data of the data identifier, the source data of the data identifier is re-migrated, that is, the re-migration process is a migration process based on the data re-migration prompt.
[0095] In an optional application scenario, the electronic device performs an XOR operation on the record status of the data identifier in the bitmap of the reading phase and the record status in the bitmap of other data migration phases in the data migration process in the order of the data migration phases to obtain a second XOR result, and uses the data migration phase corresponding to the preset value of the first XOR result as the abnormal migration phase of the data identifier, and the abnormal migration phase is the abnormal migration phase of the first run; obtains the start timestamps of the current moment and the abnormal migration phase of the first run, and if the current moment is away from the start timestamp of the abnormal migration phase of the first run to a first preset time length, a data re-migration prompt of the corresponding data identifier is issued. Based on the data re-migration prompt, the source data of the corresponding data identifier can be re-migrated, and the records of the source data of the corresponding data identifier in the bitmap of the data reading phase of the re-migration process are XORed with the records of the bitmaps of other data migration phases in the re-migration process in the order of the data migration phases to obtain the XOR result, and the data migration phase corresponding to the first XOR result as the preset value is used as the abnormal migration phase of the source data of the corresponding data identifier in the re-migration process, and the current moment and the start timestamp of the abnormal migration phase in the re-migration process are obtained. If the current moment is away from the start timestamp of the abnormal migration phase in the re-migration process by a second preset time length, an abnormal alarm message is issued, and the abnormal alarm message is used to prompt the staff to perform manual re-entry processing to ensure the data integrity and consistency in the data migration process, thereby improving the accuracy of data migration. Among them, the abnormal migration phase of the first run and the abnormal migration phase in the re-migration process can be the same data migration phase in the data migration process, or they can be different data migration phases.
[0096] In the present embodiment, when an abnormal migration phase occurs during the data migration process, and the start time of the abnormal migration phase reaches a first preset time, a data re-migration prompt is issued to re-migrate the data of the corresponding data identifier, and then the data migration phase of the re-migration according to the data re-migration prompt is monitored; if the same data identifier again encounters an abnormal migration phase during the re-migration process corresponding to the re-migration prompt, and the current moment is away from the start timestamp of the abnormal migration phase that occurs again to a second preset time, an alarm message is issued, which can improve the degree of automation of data migration, and at the same time, can perform more comprehensive migration monitoring of the data migration process, improve the accuracy of data migration monitoring, and thereby improve the accuracy of data migration.
[0097] In one embodiment, migrating source data to a target storage space includes:
[0098] The source data is migrated from the source address to the target storage space through the message queue. The data migration stage includes the reading stage, the queue entry stage, the dequeue stage and the writing stage. Among them, the reading stage refers to the process of reading the source data from the source address to the queue production end; the queue entry stage refers to the process of pushing data from the queue production end to the queue service end; the dequeue stage refers to the process of pushing data from the queue service end to the queue consumer end; the writing stage refers to the process of writing data from the queue consumer end to the target storage space.
[0099] A message queue is a container that stores messages during their transmission. A message queue can also be called a message middleware or a message queue middleware. For example, a message queue can be any of ActiveMQ (Apache ActiveMQ, an open source message middleware), RabbitMQ (Rabbit Message Queue), ZeroMQ, Kafka, MetaMQ, and RocketMQ. Among them, ZeroMQ is a multi-threaded network library based on message queues. It does not directly handle message transmission itself, but provides an underlying abstraction that can handle various protocols and transmission methods, allowing developers to choose the appropriate transmission protocol and mode according to their needs. Kafka is a high-throughput distributed publish-subscribe messaging system. MetaMQ is an scalable distributed message queue system based on Ethereum. RocketMQ is a distributed message middleware.
[0100] In this embodiment, the source data is migrated from the source address to the target storage space through the message queue, and the data migration process of migrating the source data from the source address to the target storage space through the message queue includes a reading stage, an enqueue stage, a dequeue stage and a writing stage, that is, the data migration stage includes a reading stage, an enqueue stage, a dequeue stage and a writing stage. Among them, the message queue includes a queue production end, a queue service end and a queue consumer end, the queue production end is used to produce messages, the queue service end is used to store and process messages, and the queue consumer end is responsible for consuming messages. The reading stage refers to the process of reading the source data from the source address to the queue production end, the enqueue stage refers to the process of pushing data from the queue production end to the queue service end, the dequeue stage refers to the process of pushing data from the queue service end to the queue consumer end, and the writing stage refers to the process of writing data from the queue consumer end to the target storage space.
[0101] In one example, a flow chart of migrating source data from a source address to a target storage space through a message queue is shown in FIG5 , where a queue production end 504 reads source data 502 from a source address and pushes the source data 502 to a queue service end 506, which sends the data to a queue consumer end 508, which writes the data in the queue server to a target database 510 of the target storage space. The queue consumer end 508 involves the processing of data reception, conversion, and writing, which is relatively slow, and multiple queue consumers may be added for parallel processing, such as queue consumer end 1 and queue consumer end 2.
[0102] In this embodiment, the source data is migrated from the source address to the target storage space through the message queue, which facilitates the monitoring of the data migration status in the data migration phase of the data migration process and can improve the accuracy of the obtained data migration monitoring results.
[0103] In some embodiments, according to the migration result of the source data in the current data migration phase, recording the data identifier into the bitmap of the current data migration phase includes:
[0104] If the migration result of the source data in the reading phase is successful, the data identifier is recorded in the bitmap of the reading phase; if the migration result of the source data in the enqueuing phase is successful, the data identifier is recorded in the bitmap of the enqueuing phase; if the migration result of the source data in the dequeuing phase is successful, the data identifier is recorded in the bitmap of the dequeuing phase; if the migration result of the source data in the writing phase is successful, the data identifier is recorded in the bitmap of the writing phase;
[0105] Based on the records of data identifiers in the bitmap, the data migration monitoring results of the source data are obtained, including: based on the records of data identifiers in the bitmaps corresponding to the reading stage, the enqueuing stage, the dequeuing stage and the writing stage, the data migration monitoring results of the source data are obtained.
[0106] In this embodiment, if the migration result of the source data in the reading phase is successful migration, the queue production end returns the data migration success flag corresponding to the data identifier of the source data, the electronic device obtains the migration success flag returned by the queue production end, and records the data identifier in the bitmap of the reading phase. If the migration result of the data corresponding to the data identifier of the source data in the enqueue phase is successful migration, the electronic device obtains the data migration success flag corresponding to the data identifier returned by the queue service end, and records the corresponding data identifier in the bitmap of the enqueue phase. If the migration result of the source data in the dequeue phase is successful migration, the electronic device obtains the data migration success flag corresponding to the data identifier returned by the queue consumer end, and records the data identifier of the source data in the bitmap of the dequeue phase. If the migration result of the source data in the writing phase is successful migration, the electronic device obtains the data migration success flag corresponding to the data identifier returned by the target storage space, and records the data identifier of the source data in the bitmap of the writing phase, thereby obtaining the data migration monitoring result of the source data based on the message queue for data migration based on the reading phase, the enqueue phase, the dequeue phase and the writing phase.
[0107] In this embodiment, if the migration result of the data corresponding to the data identifier in the reading stage, the enqueue stage, the dequeue stage and the writing stage is successful, the data identifier is recorded in the bitmaps corresponding to the reading stage, the enqueue stage, the dequeue stage and the writing stage respectively, and based on the record of the data identifier in the bitmaps corresponding to the reading stage, the enqueue stage, the dequeue stage and the writing stage respectively, the data migration monitoring result of the source data is obtained, so that the migration process of data migration through the message queue can be monitored, and the migration monitoring result can be obtained, which can improve the accuracy of data migration based on the message queue.
[0108] In one embodiment, a schematic diagram of the data migration monitoring process is shown in FIG6 , in which data migration is performed through a message queue, that is, the source data is migrated from the source address to the target storage space through a message queue. The data identifier of the source data to be migrated is obtained, and according to the migration result of the source data in the current data migration stage, the data identifier of the source data is recorded in the bitmap of the current data migration stage. The specific process is as follows: the total amount of source data to be migrated is counted, and the data primary key identifier of the source data is obtained according to the storage situation of the source data in the database table; all source data are divided into intervals according to the data size to obtain multiple interval source data. For example, the interval division can be performed according to 100 million data, 1 billion data or 2 billion data as an interval. Assuming that 1 billion data is an interval, there are 4.5 billion data in total, then 5 interval source data are obtained. The data corresponding to interval source data 1 is the data corresponding to the data identifier of 0-1 billion, the data corresponding to interval source data 2 is the data corresponding to the data identifier of 1 billion-2 billion, the data corresponding to interval source data 3 is the data corresponding to the data identifier of 2 billion-3 billion, the data corresponding to interval source data 4 is the data corresponding to the data identifier of 3 billion-4 billion, and the data corresponding to interval source data 5 is the data corresponding to the data identifier of 4 billion-4.5 billion, as shown in Table 1 below.
[0109] Table 1
[0110]
[0111] In the message queue, if each data is successfully migrated from the source address and written into the target database, it will go through four stages: reading stage, queue entry stage, dequeue stage and writing stage. The corresponding status and execution process of each stage are shown in Table 2 below.
[0112] Table 2
[0113]
[0114] Optionally, the bitmap identifier of the data migration stage bitmap can be defined according to the state of the data migration stage, each data migration stage has a corresponding bitmap, the number of data migration stages is consistent with the number of bitmaps, and the bitmap identifier can uniquely identify the corresponding bitmap. Taking the bitmap identifier of the data migration stage corresponding to interval source data 1 as an example, a definition method of the bitmap identifier of the data migration stage of interval source data 1 during the data migration process can be shown in Table 3 below.
[0115] Table 3
[0116]
[0117] In the bitmap identifier in Table 3, "source" represents the upstream service, that is, the queue production end, and "Target" represents the downstream service, that is, the queue consumption end; "Table name" can be the name of the database table of the source data in the source address, such as the order table; "10RBTM" represents the 1 billion in the interval source data 1, and if it is the interval source data 2, it corresponds to 20RBTM, RBTM is the abbreviation of RoaringBitmap; "start", "inMQ", "executing", and "finished" are the four states in the data migration process. The above is the definition method of the bitmap identifier of the data migration stage corresponding to the interval source data 1. The interval source data 1 uses four bitmaps to store the corresponding data identifiers. By analogy, the corresponding bitmap identifiers of the data migration stage can be obtained for other interval source data, which will not be repeated here.
[0118] For each data in each interval of source data, the data migration process is tracked and recorded through the data primary key identifier of the data. If the migration result of the data corresponding to the data primary key identifier in the data migration stage is successful, the data primary key identifier is recorded in the bitmap of the corresponding data migration stage. For example, if the data primary key identifier is 31, determine the interval where the data primary key identifier 31 is located. Since 0<31<1 billion, if the migration result of the data corresponding to the data primary key identifier 31 in the reading stage is successful migration, the electronic device obtains the flag that the source data corresponding to the primary key identifier 31 has successfully migrated in the reading stage, and then records the data primary key identifier 31 in the bitmap Source-table name-10RBTM-start corresponding to the reading stage of the corresponding interval. If the migration result of the source data corresponding to the data primary key identifier 31 in the enqueue stage is successful migration, the electronic device obtains the flag that the source data corresponding to the primary key identifier 31 has successfully migrated in the enqueue stage, and then records the data primary key identifier 31 in the compressed bitmap Source-table name-10RBTM-inMQ of the enqueue stage. If the migration result of the source data corresponding to the data primary key identifier 31 in the dequeue stage is successful migration, the electronic device obtains the flag that the source data corresponding to the primary key identifier 31 has successfully migrated in the dequeue stage, and then records the data primary key identifier 31 in the compressed bitmap Source-table name-10RBTM-inMQ of the dequeue stage. In executing, if the migration result of the source data corresponding to the data primary key identifier 31 in the writing stage is successful, the electronic device obtains the identifier of the successful migration of the source data corresponding to the primary key identifier 31 in the writing stage, and records the data primary key identifier 31 in the compression bitmap Source-table name-10RBTM-finished in the writing stage. Similarly, if the data primary key identifier is 1000000001, and the migration result of the source data corresponding to the data primary key identifier 1000000001 in the data reading stage is successful, the data primary key identifier 1000000001 is recorded in the compression bitmap Source-table name-20RBTM-start corresponding to the reading stage of the corresponding interval, etc. If the migration of the source data of the data primary key identifier is abnormal in the data migration stage, that is, the migration result is a migration failure, the data primary key identifier of the source data will not be recorded in the corresponding compression bitmap.
[0119] The electronic device can obtain the records in the compressed bitmap of the data migration phase of the interval source data at preset intervals, and the preset time is, for example, 5 minutes, 10 minutes or 20 minutes. The records in the bitmap of each data migration phase with the same data primary key are XORed to obtain the XOR result, and the migration status of the data identified by the corresponding data primary key can be obtained according to the XOR result. For example, if the XOR result is 1, it means that there are differences in the data involved in the XOR data migration phase.
[0120] The electronic device can also obtain the start timestamp of the data migration phase, for example, the start timestamp of the reading phase is Source-table name-10RBTM-start-startTime, the start timestamp of the queue entry phase is Source-table name-10RBTM-inMQ-startTime, the start timestamp of the queue exit phase is Target-table name-10RBTM-executing-startTime, and the start timestamp of the writing phase is Target-table name-10RBTM-finished-startTime. If the time from the current moment to the start timestamp of the data migration phase where the abnormality occurs reaches the time threshold, the time threshold is, for example, 1 hour, then an alarm message is issued, for example, an alarm message or an alarm email can be sent to the administrator's mailbox, and the abnormality can be located manually and the data can be supplemented, so as to achieve consistency and integrity of the migrated data.
[0121] In an actual application scenario, the first server and the second server communicate through a network, and the data in the first database on the first server can be migrated to the second database on the second server through a message queue. The first server may obtain a data primary key identifier of source data to be migrated in the first database. If the migration result of the data corresponding to the data primary key identifier in the reading phase, the queue entry phase, the queue exit phase, and the writing phase during the migration process is successful, the data primary key identifier is recorded in the bitmaps of the reading phase, the queue entry phase, the queue exit phase, and the writing phase. If the migration result of the source data corresponding to the data primary key identifier in the reading phase, the queue entry phase, the queue exit phase, and the writing phase during the migration process is a migration failure, the data primary key identifier is not recorded in the bitmaps of the reading phase, the queue entry phase, the queue exit phase, and the writing phase. An exclusive OR operation is performed according to the records in the bitmaps corresponding to the reading phase, the queue entry phase, the queue exit phase, and the writing phase, respectively, to obtain a data migration monitoring result of the source data. If the data migration monitoring result of the source data is that the data migration is abnormal, an alarm prompt is issued. The alarm prompt is used to prompt manual positioning of the migration abnormality and supplementing the data with the migration abnormality into the second database, thereby avoiding the situation where the data in the second database is inconsistent with the data in the first database, ensuring the integrity of the data in the second database, and thus improving the integrity of the data migration from the first database to the second database.
[0122] In an optional application scenario, the data migration process refers to the process of migrating historical data from a first storage medium to a second storage medium, wherein the historical data refers to data stored for a long time. The electronic device communicates with the first storage medium and the second storage medium respectively, and the electronic device can obtain the data identifier of the historical data on the first storage medium, obtain the migration result of the historical data corresponding to the data identifier in the current data migration stage, if the migration result of the historical data corresponding to the data identifier in the current data migration stage is successful migration, then record the data identifier in the bitmap of the current data migration stage, and obtain the data migration monitoring result of the historical data according to the record of the data identifier in the bitmap of each data migration stage in the data migration process, if the data identifier is recorded in the bitmap of each data migration stage in the data migration process, then the data migration monitoring result of the historical data is successful migration of the historical data, if the data identifier is not recorded in the bitmap of any data migration stage in the data migration process, then the data migration monitoring result of the historical data is abnormal migration of the historical data, and obtain the current time, if the current time reaches the time length threshold from the start timestamp of the data migration process, then issue an alarm prompt, wherein the start timestamp of the data migration process refers to the timestamp of starting the migration of the historical data of the corresponding data identifier. The alarm prompt will prompt the staff to locate the abnormality and re-record the abnormal data, so as to ensure the integrity of the data in the second storage medium and the consistency of the data in the first storage medium and the second storage medium, which can improve the accuracy of data migration.
[0123] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0124] Based on the same inventive concept, the embodiment of the present application also provides a data migration monitoring device for implementing the data migration monitoring method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more data migration monitoring device embodiments provided below can refer to the limitations of the data migration monitoring method above, and will not be repeated here.
[0125] In one embodiment, as shown in FIG. 7 , a data migration monitoring device is provided, including: an identification acquisition module 702 , an identification recording module 704 , and a monitoring result obtaining module 706 , wherein:
[0126] The identification acquisition module 702 is used to obtain the data identification of the source data to be migrated;
[0127] The identification recording module 704 is used to record the data identification into the bitmap of the current data migration stage according to the migration result of the source data in the current data migration stage; the current data migration stage refers to any data migration stage in the process of migrating the source data to the target storage space;
[0128] The monitoring result obtaining module 706 is used to obtain the data migration monitoring result of the source data based on the record status of the data identifier in the bitmap.
[0129] In one embodiment, the identification recording module 704 is also used to record the data identification in the bitmap of the current data migration stage if the migration result of the source data in the current data migration stage is successful migration; if the migration result of the source data in the current data migration stage is failed migration, then the data identification is not recorded in the bitmap of the current data migration stage.
[0130] In one embodiment, the bitmap includes a compressed bitmap; the compressed bitmap includes a first container, and the first container includes a second container; the identification recording module 704 is further used to obtain a first bit data of a preset number of bits from the bit data corresponding to the data identifier in a bit direction from high to low, and use the first bit data as the container identifier of the first container; obtain the second bit data in the bit data corresponding to the data identifier; the second bit data is obtained based on the bit data and the first bit data; and store the second bit data in the second container corresponding to the first container.
[0131] In one embodiment, the monitoring result obtaining module 706 is further used to perform an XOR operation on the record status of the data identifier in the bitmap to obtain an XOR result; and obtain the data migration monitoring result of the source data according to the XOR result.
[0132] In one embodiment, the data migration stage includes a reading stage and a writing stage; the reading stage refers to the stage of reading the source data from the source address; the writing stage refers to the stage of writing the migrated data into the target storage space; the monitoring result obtaining module 706 is also used to perform an XOR operation on the record status of the data identifier in the bitmap of the reading stage and the record status in the bitmap of the writing stage to obtain a first XOR result; if the first XOR result is a preset value, the data migration monitoring result is that there is a difference between the source data and the target data in the target storage space.
[0133] In one embodiment, the data migration stage includes a reading stage; the monitoring result obtaining module 706 is also used to perform an XOR operation on the first record situation of the data identifier in the bitmap of the reading stage and the second record situation in the bitmap of other data migration stages in sequence according to the order of the data migration stages to obtain a second XOR result; the data migration stage corresponding to the first and second XOR results being preset values is used as the abnormal migration stage of the data identifier.
[0134] In one embodiment, the data migration monitoring device also includes a re-migration module for obtaining the current time and the start timestamp of the abnormal migration phase; if the current time reaches a first preset time length from the start timestamp of the abnormal migration phase, a data re-migration prompt of the data identifier is issued.
[0135] In one embodiment, the data migration monitoring device also includes an abnormal alarm module, which is used to obtain the start timestamp of the abnormal migration phase that occurs again if the data identified by the data re-emerges during the re-migration process; the re-migration process is a migration process based on the data re-migration prompt; if the current time is away from the start timestamp of the abnormal migration phase that occurs again to a second preset time length, an abnormal alarm message is issued.
[0136] In one embodiment, the data migration monitoring device further includes a data migration module, which is used to:
[0137] The source data is migrated from the source address to the target storage space through the message queue. The data migration stage includes a reading stage, an enqueue stage, a dequeue stage and a writing stage. The reading stage refers to the process of reading the source data from the source address to the queue production end; the enqueue stage refers to the process of pushing data from the queue production end to the queue service end; the dequeue stage refers to the process of pushing data from the queue service end to the queue consumer end; the writing stage refers to the process of writing data from the queue consumer end to the target storage space.
[0138] In one embodiment, the identification recording module 704 is further used to record the data identification in the bitmap of the reading phase if the migration result of the source data in the reading phase is successful migration; record the data identification in the bitmap of the enqueuing phase if the migration result of the source data in the enqueuing phase is successful migration; record the data identification in the bitmap of the dequeuing phase if the migration result of the source data in the dequeuing phase is successful migration; record the data identification in the bitmap of the dequeuing phase if the migration result of the source data in the writing phase is successful migration;
[0139] The monitoring result obtaining module 706 is further used to obtain the data migration monitoring result of the source data based on the record status of the data identifier in the bitmap corresponding to the reading stage, the queue entry stage, the queue exit stage and the writing stage.
[0140] Each module in the above data migration monitoring device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0141] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG8. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data identifiers of source data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a data migration monitoring method is implemented.
[0142] Those skilled in the art will understand that the structure shown in FIG. 8 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0143] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps of the data migration monitoring method in the above embodiments when executing the computer program.
[0144] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the data migration monitoring method in the above embodiments are implemented.
[0145] In one embodiment, a computer program product is provided, including a computer program, which implements the steps of the data migration monitoring method in the above embodiments when executed by a processor.
[0146] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws and regulations and standards.
[0147] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0148] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0149] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A data migration monitoring method, characterized in that: The method comprises: Obtain the data identifier of the source data to be migrated; According to the migration result of the source data in the current data migration phase, the data identifier is recorded in the bitmap of the current data migration phase; the current data migration phase refers to any data migration phase in the process of migrating the source data to the target storage space; Based on the record status of the data identifier in the bitmap, the data migration monitoring result of the source data is obtained.
2. The method according to claim 1, characterized in that The step of recording the data identifier into a bitmap of the current data migration phase according to the migration result of the source data in the current data migration phase includes: If the migration result of the source data in the current data migration phase is successful, recording the data identifier in the bitmap of the current data migration phase; If the migration result of the source data in the current data migration phase is migration failure, the data identifier is not recorded in the bitmap of the current data migration phase.
3. The method according to claim 1, characterized in that The bitmap includes a compressed bitmap, the compressed bitmap includes a first container, and the first container includes a second container; recording the data identifier into the bitmap of the current data migration stage includes: From the bit data corresponding to the data identifier, obtain the first bit data of a preset number of bits from the high bit to the low bit direction, and use the first bit data as the container identifier of the first container; Acquire second bit data in the bit data corresponding to the data identifier; the second bit data is obtained based on the bit data and the first bit data; The second bit data is stored in a second container corresponding to the first container.
4. The method according to claim 1, characterized in that The obtaining the data migration monitoring result of the source data based on the record status of the data identifier in the bitmap includes: Performing an XOR operation on the record status of the data identifier in the bitmap to obtain an XOR result; According to the XOR result, the data migration monitoring result of the source data is obtained.
5. The method according to claim 4, characterized in that The data migration phase includes a reading phase and a writing phase; the reading phase refers to the phase of reading the source data from the source address; the writing phase refers to the phase of writing the migrated data into the target storage space; The performing an XOR operation on the record status of the data identifier in the bitmap to obtain an XOR result includes: Performing an XOR operation on the record status of the data identifier in the bitmap in the reading phase and the record status of the data identifier in the bitmap in the writing phase to obtain a first XOR result; The obtaining the data migration monitoring result of the source data according to the XOR result includes: If the first XOR result is a preset value, the data migration monitoring result is that there is a difference between the source data and the target data in the target storage space.
6. The method according to claim 4, characterized in that The data migration phase includes a reading phase; performing an XOR operation on the records of the data identifiers in the bitmap to obtain an XOR result includes: Performing an XOR operation on the first record of the data identifier in the bitmap of the reading phase and the second record of the bitmap of other data migration phases in sequence according to the order of the data migration phases to obtain a second XOR result; The obtaining the data migration monitoring result of the source data according to the XOR result includes: The first data migration phase corresponding to the preset value of the second XOR result is used as the abnormal migration phase of the data identifier.
7. The method according to claim 6, characterized in that The method further comprises: Obtain the current time and the start timestamp of the abnormal migration phase; If the distance between the current time and the start timestamp of the abnormal migration phase reaches a first preset time length, a data re-migration prompt of the data identifier is issued.
8. The method according to claim 7, characterized in that The method further comprises: If the data identified by the data reappears an abnormal migration phase during the re-migration process, obtaining a start timestamp of the abnormal migration phase that reappears; the re-migration process is a migration process based on the data re-migration prompt; If the time between the current time and the start timestamp of the abnormal migration phase that occurs again reaches a second preset time length, an abnormal alarm message is issued.
9. The method according to claim 1, characterized in that: Migrating the source data to the target storage space includes: The source data is migrated from the source address to the target storage space through the message queue, and the data migration phase includes a reading phase, an enqueue phase, a dequeue phase, and a writing phase, wherein: The reading phase refers to the process of reading the source data from the source address to the queue production end; The queue entry phase refers to the process of pushing data from the queue production end to the queue service end; The dequeue phase refers to the process of pushing data from the queue server to the queue consumer; The writing phase refers to the process of writing data from the queue consumer end to the target storage space.
10. The method according to claim 9, characterized in that The step of recording the data identifier into a bitmap of the current data migration phase according to the migration result of the source data in the current data migration phase includes: If the migration result of the source data in the reading phase is successful, the data identifier is recorded in the bitmap of the reading phase; If the migration result of the source data in the enqueuing phase is successful, the data identifier is recorded in the bitmap of the enqueuing phase; If the migration result of the source data in the dequeue phase is successful, the data identifier is recorded in the bitmap of the dequeue phase; If the migration result of the source data in the writing phase is successful, the data identifier is recorded in the bitmap of the writing phase; The data migration monitoring result of the source data is obtained based on the record of the data identifier in the bitmap, including: the data migration monitoring result of the source data is obtained based on the record of the data identifier in the bitmap corresponding to the reading stage, the enqueuing stage, the dequeuing stage and the writing stage.
11. A data migration monitoring device, characterized in that: The device comprises: An identification acquisition module, used to acquire the data identification of the source data to be migrated; an identification recording module, configured to record the data identification into a bitmap of the current data migration stage according to a migration result of the source data in the current data migration stage; the current data migration stage refers to any data migration stage in the process of migrating the source data to the target storage space; The monitoring result obtaining module is used to obtain the data migration monitoring result of the source data based on the record status of the data identifier in the bitmap.
12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
Citation Information
Cited By
Data migration correction method, device, equipment and program product
CN121166655A
