Data management method and device, electronic equipment and readable storage medium

By increasing the priority of the write party in the two dimensions of version number and timestamp, determining the operation strategy of data recording in the target database, the problem of difficulty in ensuring data consistency in the existing technology is solved, and data is realized in different systems and Consistency between storage components improves user experience and data management efficiency.

CN119441179APending Publication Date: 2025-02-14BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411432075.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-14
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In the prior art, the user data synchronization is only performed by the version number and timestamp, making it difficult to ensure data consistency, especially in high concurrency situations, data is easily rewritten or overwritten, resulting in difficulty in ensuring consistency.

Method used

By increasing the priority of the write party in the version number and timestamp, we determine the operation strategy of data recording in the target database. The specific steps include obtaining multiple data records, determining operation behavior, and integrating data records of the same operation behavior. Select the data record with the highest priority of the writer as the target data record, and determine the operation policy based on the operation behavior and data record results, and finally execute the operation policy in the target database.

Benefits of technology

When the version number and timestamp are consistent, the operation strategy is determined according to the write party's priority, ensuring the consistency of data between different systems and storage components, improving user experience, and reducing the problem of experience decline caused by data inconsistency. And save manpower to repair data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441179A_ABST
    Figure CN119441179A_ABST
Patent Text Reader

Abstract

Embodiments of the invention provide a data management method and apparatus, an electronic device and a readable storage medium. The method comprises the steps of obtaining a plurality of data records; determining an operation behavior of the data record; the operation behavior comprises any one of addition, modification or deletion; when the version numbers and the timestamps corresponding to the multiple data records are the same and the priorities of the writers corresponding to the multiple data records are different, determining an operation strategy of the data records in the target database according to the data records and the operation behaviors; the operation strategy is used for representing whether to execute an operation behavior of the data record; and executing the operation strategy of the data record in the target database to obtain an execution result. According to the embodiment of the invention, the writing party priority is added in two dimensions of the version number and the timestamp, so that the consistency of the user data in different systems and different storage components is ensured, the user experience is ensured to be the same everywhere, and the problem that the user experience is reduced due to inconsistent data in different pages is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the technical field of data management, and in particular, to a data management method, a data management device, an electronic device, and a computer-readable storage medium. Background Art

[0002] Member rights and interests data includes VIP (Very Important Person) identity rights and interests data in the usual sense and other rights and interests data in a broad sense, such as movie viewing rights and interests of external partners. As the number of members exceeds 100 million, the corresponding data exceeds hundreds of millions. When the rights and interests data is distributed to various business teams and synchronized bidirectionally between different internal components, how to ensure the consistency of the rights and interests data is a great challenge, because the data distribution and synchronization process is not limited to data inconsistencies caused by business system anomalies, but may also be caused by network fluctuations, increased latency due to the long distance of the computer room where the storage is located, and other reasons.

[0003] In different storage components, a piece of data needs to synchronize data changes between components. The conventional practice is to add version numbers and timestamps to data records. When each component receives data changes, if there is a conflict, the data with the larger version number and timestamp will prevail. The version number has a larger granularity and can be used as a reference in low concurrency situations. Timestamp generation is generated by each component and may face clock dialback problems (even if the time is consistent in the physical sense, the timestamps generated by the components may be fast or slow). In high concurrency situations, data may be rewritten or overwritten, and it is difficult to ensure consistency. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a data management method, device, electronic device and computer-readable storage medium to solve the problem that the prior art only uses version numbers and timestamps to synchronize user data and it is difficult to ensure data consistency. The specific technical solution is as follows:

[0005] In a first aspect of the present invention, a data management method is provided, the method comprising:

[0006] Get multiple data records;

[0007] Determine the operation behavior of the data record; the operation behavior includes any one of adding, modifying or deleting;

[0008] When the version numbers and timestamps corresponding to the multiple data records are the same, and the writer priorities corresponding to the multiple data records are different, determining the operation strategy of the data record in the target database according to the data record and the operation behavior; the operation strategy is used to indicate whether to execute the operation behavior of the data record;

[0009] The operation strategy of the data record is executed in the target database to obtain an execution result.

[0010] Optionally, when the version numbers and timestamps corresponding to the plurality of data records are the same, and the writer priorities corresponding to the plurality of data records are different, determining the operation strategy for the data records in the target database according to the data records and the operation behavior includes:

[0011] According to the operation behavior, a plurality of data records of the same operation behavior are integrated into a data record set; the data record set is one of the data record set corresponding to the addition, the data record set corresponding to the modification, and the data record set corresponding to the deletion;

[0012] Determine a target data record in the data record set; the writer priority corresponding to the target data record is the highest in the data record set, and the target data record includes the target data record corresponding to the addition, the target data record corresponding to the modification, and the target data record corresponding to the deletion;

[0013] An operation strategy for recording the target data in the target database is determined.

[0014] Optionally, the determining the target data record in the data record set includes:

[0015] Comparing the writer priority corresponding to each data record in the data record set;

[0016] A data record with the highest writing priority is selected from the data record set as the target data record.

[0017] Optionally, the determining an operation strategy for recording the target data in the target database includes:

[0018] Determine a data record result corresponding to the target data record; the data record result is used to characterize the state of the target data record in the target database;

[0019] When the operation behavior is the modification or addition, and the data recording result is the first preset result, the operation strategy for recording the target data in the target database is determined to be the first operation strategy; the first preset result is used to indicate that the target data record exists in the target database, and the first operation strategy is used to indicate that the operation behavior is not performed on the target data record in the target database;

[0020] When the operation behavior is the modification or the addition, and the data recording result is the second preset result, the operation strategy for recording the target data in the target database is determined to be the second operation strategy; the second preset result is used to indicate that the target data record does not exist in the target database, and the second operation strategy is used to indicate that the operation behavior is performed on the target data record in the target database;

[0021] When the operation behavior is the deletion, and the data recording result is the third preset result, the operation strategy for recording the target data in the target database is determined to be the second operation strategy; the third preset result is used to indicate that the target data record in the target database has been deleted;

[0022] When the operation behavior is deletion and the data recording result is the fourth preset result, the operation strategy for recording the target data in the target database is determined to be the first operation strategy; the fourth preset result is used to indicate that the target data record in the target database has not been deleted.

[0023] Optionally, after determining the target data record in the data record set, the method further includes:

[0024] The execution order of the target data records in the target database is determined according to the priority of the operation behavior; wherein the priority of the modification is greater than the priority of the addition, and the priority of the addition is greater than the priority of the deletion.

[0025] Optionally, executing the operation strategy of the data record in the target database to obtain an execution result includes:

[0026] The operation strategies of the target data records are sequentially executed in the target database according to the execution order to obtain the execution result; the execution order is the target data records corresponding to the modification, the target data records corresponding to the addition, and the target data records corresponding to the deletion.

[0027] Optionally, the execution result is used to indicate whether the operation strategy of the target data record is executed successfully.

[0028] In a second aspect of the present invention, a data management device is provided, the device comprising:

[0029] An acquisition module, used to acquire multiple data records;

[0030] A determination module, used to determine the operation behavior of the data record; the operation behavior includes any one of adding, modifying or deleting;

[0031] An operation strategy module, used for determining the operation strategy of the data record in the target database according to the data record and the operation behavior when the version numbers and timestamps corresponding to the multiple data records are the same and the writer priorities corresponding to the multiple data records are different; the operation strategy is used to indicate whether to execute the operation behavior of the data record;

[0032] The execution result module is used to execute the operation strategy of the data record in the target database to obtain the execution result.

[0033] Optionally, the operation strategy module includes:

[0034] A data record integration submodule, for integrating multiple data records of the same operation behavior into a data record set according to the operation behavior; the data record set is one of the data record set corresponding to the addition, the data record set corresponding to the modification, and the data record set corresponding to the deletion;

[0035] A target data record determination submodule is used to determine a target data record in the data record set; the writer priority corresponding to the target data record is the highest in the data record set, and the target data record includes the target data record corresponding to the addition, the target data record corresponding to the modification, and the target data record corresponding to the deletion;

[0036] The operation strategy determination submodule is used to determine the operation strategy of recording the target data in the target database.

[0037] Optionally, the target data record determination submodule includes:

[0038] A writer priority comparison unit, used for comparing the writer priority corresponding to each data record in the data record set;

[0039] The target data record selection unit is used to select a data record with the highest writing priority from the data record set as the target data record.

[0040] Optionally, the operation strategy determination submodule includes:

[0041] A data record result determination unit, used to determine a data record result corresponding to the target data record; the data record result is used to characterize the state of the target data record in the target database;

[0042] A first preset result unit is used to determine the operation strategy for recording the target data in the target database as a first operation strategy when the operation behavior is the modification or the addition and the data recording result is the first preset result; the first preset result is used to indicate that the target data record exists in the target database, and the first operation strategy is used to indicate that the operation behavior is not performed on the target data record in the target database;

[0043] A second preset result unit is used to determine the operation strategy for recording the target data in the target database as a second operation strategy when the operation behavior is the modification or the addition and the data recording result is the second preset result; the second preset result is used to indicate that the target data record does not exist in the target database, and the second operation strategy is used to indicate that the operation behavior is performed on the target data record in the target database;

[0044] a third preset result unit, configured to determine the operation strategy for recording the target data in the target database as the second operation strategy when the operation behavior is the deletion and the data recording result is the third preset result; the third preset result is used to indicate that the target data record in the target database has been deleted;

[0045] A fourth preset result unit is used to determine the operation strategy for recording the target data in the target database as the first operation strategy when the operation behavior is the deletion and the data recording result is the fourth preset result; the fourth preset result is used to characterize that the target data record in the target database has not been deleted.

[0046] Optionally, the device further comprises:

[0047] An execution order determination module is used to determine the execution order of the target data records in the target database according to the priority of the operation behavior; wherein the priority of the modification is greater than the priority of the addition, and the priority of the addition is greater than the priority of the deletion.

[0048] Optionally, the execution result module includes:

[0049] An operation strategy execution module is used to execute the operation strategy of the target data record in the target database in sequence according to the execution order to obtain the execution result; the execution order is the target data record corresponding to the modification, the target data record corresponding to the addition, and the target data record corresponding to the deletion.

[0050] Optionally, the execution result is used to indicate whether the operation strategy of the target data record is executed successfully.

[0051] In another aspect of the present invention, an electronic device is provided, characterized in that it includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus;

[0052] Memory, used to store computer programs;

[0053] The processor is used to implement any of the above-mentioned data management methods when executing the program stored in the memory.

[0054] In another aspect of the present invention, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer executes any of the above-mentioned data management methods.

[0055] In yet another aspect of the present invention, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the above-mentioned data management methods.

[0056] The data management method provided by the embodiment of the present invention obtains multiple data records; determines the operation behavior of the data records; the operation behavior includes any one of adding, modifying or deleting; when the version numbers and timestamps corresponding to the multiple data records are the same, and the writer priorities corresponding to the multiple data records are different, the operation strategy of the data records in the target database is determined according to the data records and the operation behaviors; the operation strategy is used to characterize whether to execute the operation behavior of the data records; the operation strategy of the data records is executed in the target database to obtain the execution result. By adding the writer priority in the two dimensions of version number and timestamp, the operation strategy can be determined according to the writer priority when the version number and the timestamp of the data change are consistent, and then the specific operation strategy is executed to complete the data management for multiple data records, so as to ensure the consistency of data between different systems and different storage components, ensure that the user experience is the same everywhere, avoid the problem of the user's experience being reduced due to inconsistent data on different pages, and save manpower for repairing data. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0058] Figure 1 is a flowchart of a data management method provided in an embodiment of the present invention;

[0059] Figure 2It is a flowchart of a method for implementing data management provided in an embodiment of the present invention;

[0060] Figure 3 is a structural block diagram of a data management device provided in an embodiment of the present invention;

[0061] Figure 4 It is a schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention. DETAILED DESCRIPTION

[0062] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0063] In the embodiment of the present invention, in order to ensure the consistency of user data among various systems and components, a data management method is proposed, which mainly relies on three modules: data distribution, data decision and data execution.

[0064] The embodiment of the present invention faces the problem that in the prior art, user data is synchronized only through timestamps and version numbers, and it is difficult to ensure data consistency, that is, in concurrent scenarios where multiple data records have the same timestamps and version numbers. Therefore, in the embodiment of the present invention, the data record priority is judged by the writer priority to ensure user data synchronization in concurrent scenarios.

[0065] Reference Figure 1 , shows a flow chart of the steps of a data management method provided in an embodiment of the present invention, which may specifically include the following steps:

[0066] Step 101, obtaining multiple data records;

[0067] In an embodiment of the present invention, user data is recorded through a data distribution module to obtain multiple data records for the same user. When obtaining the data record, the version number, timestamp and data writer corresponding to the data record are recorded at the same time, and the writer priority is obtained based on the data writer. The version number is initially 0, and the version number increases by one each time it is changed.

[0068] Specifically, the data decision module receives multiple data records sent from the data distribution module.

[0069] The version number is used to track the change history of data. When there is a data conflict or update, the version number can help the system determine which data record is the latest, thereby ensuring data consistency. When data records corresponding to multiple writers try to update the data corresponding to the same user, the version number can be used to resolve the conflict. The system can compare the version numbers and select the latest data record to update.

[0070] Timestamps are used to provide the time point of data changes and record the creation or modification time of data records. This is crucial for determining the order of data records. In concurrent operations, timestamps can help the system determine which data record's corresponding operation should be executed first.

[0071] Writer priority is used to determine which writer's data should be given priority when data conflicts occur. This helps make more reasonable decisions when multiple writers try to update data at the same time. Writer priority can also be used in conjunction with permission control mechanisms to ensure that only writers with sufficient priority can update data.

[0072] Therefore, in order to effectively manage data changes and reduce data conflicts and inconsistencies, when the target data record is distributed by the data distribution module, it is necessary to ensure that the target data record carries the three required fields: target version number, target timestamp and target writer priority, to ensure the rationality of data update decisions and reduce erroneous or inappropriate data updates.

[0073] For example, when the version number and timestamp are the same, user data will be given the highest priority for writing to MySQL (relational database management system) and Redis (remote dictionary server).

[0074] In the embodiment of the present invention, when the data distribution module distributes data records to the data decision module, multiple data records can be distributed simultaneously. By processing multiple data records simultaneously, the efficiency of data distribution can be significantly improved, and the processing time and resource consumption can be reduced.

[0075] Step 102: Determine the operation behavior of the data record; the operation behavior includes any one of adding, modifying or deleting;

[0076] In the data management method, it is necessary to identify and decide the specific operations to be performed on the target data records, which usually include adding, modifying and deleting.

[0077] In the embodiment of the present invention, predefined rules and logic are applied to determine the operation behavior. For example, if the target data record contains a specific tag or field, it is determined whether to add, modify or delete data based on this information. In addition, the priority of the operation behavior is also considered. For example, the priority of the modification operation is higher than the priority of the addition operation, and the priority of the addition operation is higher than the deletion operation. This helps the system make more reasonable decisions when processing multiple concurrent operations.

[0078] Step 103: when the version numbers and timestamps corresponding to the plurality of data records are the same, and the writer priorities corresponding to the plurality of data records are different, determining the operation strategy of the data record in the target database according to the data record and the operation behavior; the operation strategy is used to indicate whether to execute the operation behavior of the data record;

[0079] In an embodiment of the present invention, it is first necessary to analyze the content of the target data record in detail, including key information such as the target version number, target timestamp, and target writer priority. The analysis results of the target data record are combined with the operation behavior (addition, modification, or deletion) to determine the most appropriate operation strategy. And check whether the same data records already exist in the target database, as well as the version number, timestamp, and writer priority corresponding to these data records. Subsequently, predefined rules and logic are applied to determine the operation strategy. For example, if the same data record already exists in the database, the system will compare the version number and timestamp, as well as the writer priority, to decide whether to accept the new data record or retain the existing data record.

[0080] Based on the above analysis and comparison, the final operation strategy will be determined, including data writing (accepting new data records, updating existing data records, deleting data records, etc.) or not processing data (anything other than data writing is called data not processing, such as rejecting operations).

[0081] Specifically, if the operation behavior is to add or modify, and there are no data records of the same user in the database, the operation strategy will be determined to directly add the data record; if the operation behavior is to add or modify, and there are data records of the same user in the database, the version number and timestamp of the target data record and the existing data record in the database, as well as the writer priority, will be compared to decide whether to update the data record; if the operation behavior is to delete, the status of the data record in the database will be checked to determine whether the data record can be deleted.

[0082] The embodiment of the present invention can ensure that the operation strategy of the target data record is consistent with the actual demand by accurately determining the operation strategy of the target data record, thereby avoiding erroneous data operations. Through correct operation behavior, the integrity and accuracy of the data are ensured. Through effective operation strategy determination, resources can be used more efficiently and unnecessary processing and storage can be reduced.

[0083] Step 104: Execute the operation strategy of the data record in the target database to obtain an execution result.

[0084] In an embodiment of the present invention, detailed information when executing the operation is recorded, including the start time, end time, execution status (success or failure) and any related log information of the operation, and then this information is integrated into an execution result, including the success status of the operation, the error information generated, the updated data record version number and timestamp, etc.

[0085] Specifically, if the operation strategy is to add data records, new data records will be inserted into the target database and the result of the insert operation will be obtained; if the operation strategy is to modify data records, the existing data records in the target database will be updated and the result of the update operation will be obtained; if the operation strategy is to delete data records, the specified data records will be removed from the target database and the result of the delete operation will be obtained.

[0086] The embodiment of the present invention can verify whether the data operation is successfully completed by recording the execution result, and can capture and handle any errors or abnormal situations to ensure the reliability and stability of the data operation.

[0087] In one embodiment of the present invention, the execution result is returned to the writer of the data record to complete the data management of the data record in the target database.

[0088] In an embodiment of the present invention, the prepared feedback information (execution result) needs to be sent to the writer of the target data record to ensure that the writer can promptly understand whether the data operation has been successfully processed. If the operation fails, the writer can perform error handling or retry the operation based on the returned error information to ensure the integrity and consistency of the data operation. At the same time, it is also necessary to record and maintain the target version number, target timestamp and target writer priority of the data.

[0089] By returning the execution result, the embodiment of the present invention allows the writer to understand whether their data operation is successful and the final status in the database, which enhances the transparency and traceability of the operation. In addition, since the writer can verify the correctness of the operation, its reliability can also be enhanced by returning the execution result.

[0090] In an embodiment of the present invention, multiple data records are obtained; the operation behavior of the data records is determined; the operation behavior includes any one of adding, modifying or deleting; when the version numbers and timestamps corresponding to the multiple data records are the same, and the writer priorities corresponding to the multiple data records are different, the operation strategy of the data records in the target database is determined according to the data records and the operation behavior; the operation strategy is used to characterize whether to execute the operation behavior of the data records; the operation strategy of the data records is executed in the target database to obtain the execution result. By adding the writer priority in the two dimensions of version number and timestamp, the operation strategy can be determined according to the writer priority when the version number and the timestamp of the data change are consistent, and then the specific operation strategy is executed to complete the data management for multiple data records, so as to ensure the consistency of data between different systems and different storage components, ensure that the user experience is the same everywhere, avoid the problem of reduced user experience due to inconsistent data on different pages, and save manpower for repairing data.

[0091] In one embodiment of the present invention, the step 103, when the version numbers and timestamps corresponding to the plurality of data records are the same, and the writer priorities corresponding to the plurality of data records are different, determining the operation strategy of the data record in the target database according to the data record and the operation behavior, includes:

[0092] According to the operation behavior, a plurality of data records of the same operation behavior are integrated into a data record set; the data record set is one of the data record set corresponding to the addition, the data record set corresponding to the modification, and the data record set corresponding to the deletion;

[0093] Determine a target data record in the data record set; the writer priority corresponding to the target data record is the highest in the data record set, and the target data record includes the target data record corresponding to the addition, the target data record corresponding to the modification, and the target data record corresponding to the deletion;

[0094] An operation strategy for recording the target data in the target database is determined.

[0095] When processing data records in the embodiments of the present invention, operation behaviors (such as adding, modifying, and deleting) are key factors in determining how data records are processed. Different operation behaviors may lead to different data processing logics. Therefore, it is first necessary to integrate multiple data records with the same operation behaviors into a data record set, which helps to simplify the subsequent processing flow. These sets can be to add corresponding data record sets, modify corresponding data record sets, or delete corresponding data record sets. The data records in each set have the same operation behavior.

[0096] Subsequently, in an embodiment of the present invention, a data concurrency scenario in which both the timestamp and the version number are the same is considered. Therefore, the writer priority is added as a judgment basis on the basis of the timestamp and the version number. That is, in each data record set, the data record with the highest writer priority is selected as the target data record. Specifically, the record with the highest priority will be regarded as the final operation record, while other records with the same operation behavior but lower priority will not be executed.

[0097] In a concurrent scenario, since only the data records with the highest priority on the writing side will be executed, and other data records with the same operation behavior but lower priority will not be executed, the embodiment of the present invention only considers the operation behavior (addition, modification, deletion) of the target data records and performs the corresponding operations in the target database.

[0098] The embodiment of the present invention can ensure that the operation strategy of the target data record is consistent with the actual demand by accurately determining the operation strategy of the target data record, thereby avoiding erroneous data operations. Through correct operation behavior, the integrity and accuracy of the data are ensured. Through effective operation strategy determination, resources can be used more efficiently and unnecessary processing and storage can be reduced.

[0099] In an embodiment of the present invention, the determining the target data record in the data record set includes:

[0100] Comparing the writer priority corresponding to each data record in the data record set;

[0101] A data record with the highest writing priority is selected from the data record set as the target data record.

[0102] When determining the target data record in the data record set, the embodiment of the present invention mainly relies on the priority of the writer to make the selection. Specifically, the system compares the writer priority corresponding to each data record in the data record set, and then selects the data record with the highest writer priority as the target data record, ensuring that when multiple data records have the same version number and timestamp, the data record with the highest writer priority can be correctly selected as the target data record, thereby avoiding data conflicts and inconsistencies.

[0103] In one embodiment of the present invention, the determining the operation strategy of recording the target data in the target database includes:

[0104] Determine a data record result corresponding to the target data record; the data record result is used to characterize the state of the target data record in the target database;

[0105] When the operation behavior is the modification or addition, and the data recording result is the first preset result, the operation strategy for recording the target data in the target database is determined to be the first operation strategy; the first preset result is used to indicate that the target data record exists in the target database, and the first operation strategy is used to indicate that the operation behavior is not performed on the target data record in the target database;

[0106] When the operation behavior is the modification or the addition, and the data recording result is the second preset result, the operation strategy for recording the target data in the target database is determined to be the second operation strategy; the second preset result is used to indicate that the target data record does not exist in the target database, and the second operation strategy is used to indicate that the operation behavior is performed on the target data record in the target database;

[0107] When the operation behavior is the deletion, and the data recording result is the third preset result, the operation strategy for recording the target data in the target database is determined to be the second operation strategy; the third preset result is used to indicate that the target data record in the target database has been deleted;

[0108] When the operation behavior is deletion and the data recording result is the fourth preset result, the operation strategy for recording the target data in the target database is determined to be the first operation strategy; the fourth preset result is used to indicate that the target data record in the target database has not been deleted.

[0109] In an embodiment of the present invention, if it is to add or modify, it is first necessary to determine whether the target data record exists in the target database. If so, that is, the data record result is the first preset result, then the operation strategy can be directly determined as the first operation strategy, that is, the target data record can be directly written into the target database, and the specific operation is determined according to the actual operation behavior; if not, that is, the data record result is the second preset result, then the operation strategy can be directly determined as the second operation strategy, and the target data record can be directly discarded.

[0110] In an embodiment of the present invention, if it is to be deleted, it is first necessary to determine whether the target data record in the target database has been deleted. If it has been deleted, that is, the data record result is the third preset result, it is considered to be a duplicate data record. At this time, the operation strategy can be directly determined as the second operation strategy, and the target data record can be directly discarded; if it has not been deleted, that is, the data record result is the fourth preset result, then the operation strategy can be directly determined as the first operation strategy, that is, the target data record in the target database can be directly deleted.

[0111] In an embodiment of the present invention, after determining the target data record in the data record set, the method further includes:

[0112] The execution order of the target data records in the target database is determined according to the priority of the operation behavior; wherein the priority of the modification is greater than the priority of the addition, and the priority of the addition is greater than the priority of the deletion.

[0113] In the embodiment of the present invention, after the target data records are determined according to the writer priority, the priority of the operation behavior is further introduced to determine the execution order of these target data records in the target database.

[0114] The priority rules of operation behaviors are predefined in the system. Specifically, the modification operation is defined as the highest priority, followed by the addition operation, and finally the deletion operation. According to the defined priority rules, the identified operation behaviors are sorted. This ensures that when processing multiple operation behaviors, the operations with higher priority are executed before the operations with lower priority.

[0115] In actual business scenarios, modification operations are usually more important than addition and deletion operations. By giving priority to modification operations, business logic and requirements can be better supported. By giving priority to modification operations, the latest state of data can be updated first, thereby reducing the risk of data inconsistency. Prioritizing addition and modification operations can ensure the integrity and accuracy of data and avoid data loss caused by deletion operations.

[0116] In the embodiment of the present invention, the system collects target data records corresponding to all operation behaviors, sorts these target data records according to the priority of the operation behaviors, and then executes the operations of these target data records in sequence according to the sorted order.

[0117] In general, the embodiments of the present invention can ensure that when multiple data records have the same version number and timestamp, the data records can still be processed correctly and executed in the order of priority of the operation behaviors to avoid data conflicts and inconsistencies. In addition, by giving priority to operations with higher priorities, resources can be used more efficiently, unnecessary processing and storage can be reduced, and the overall performance and response speed of data management can be improved, especially in a high-concurrency environment. In concurrent operations, giving priority to operations with higher priorities can reduce conflicts and errors between operations and improve the stability and reliability of data management.

[0118] In one embodiment of the present invention, the step 104 of executing the operation strategy of the data record in the target database to obtain the execution result includes:

[0119] The operation strategies of the target data records are sequentially executed in the target database according to the execution order to obtain the execution result; the execution order is the target data records corresponding to the modification, the target data records corresponding to the addition, and the target data records corresponding to the deletion.

[0120] In an embodiment of the present invention, the target data record in multiple data records of the same operation can be determined first according to the writer priority, and then the execution order among the multiple target data records can be determined according to the priority of the operation behavior. Combined with the writer priority and the priority of the operation behavior, the target data record can be executed in sequence among the multiple data records.

[0121] In an embodiment of the present invention, the execution result is used to indicate whether the operation strategy of the target data record is executed successfully.

[0122] The embodiment of the present invention can verify whether the data operation is successfully completed by recording the execution result, and can capture and handle any errors or abnormal situations to ensure the reliability and stability of the data operation.

[0123] The data management method provided by the embodiment of the present invention obtains multiple data records; determines the operation behavior of the data records; the operation behavior includes any one of adding, modifying or deleting; when the version numbers and timestamps corresponding to the multiple data records are the same, and the writer priorities corresponding to the multiple data records are different, the operation strategy of the data records in the target database is determined according to the data records and the operation behaviors; the operation strategy is used to characterize whether to execute the operation behavior of the data records; the operation strategy of the data records is executed in the target database to obtain the execution result. By adding the writer priority in the two dimensions of version number and timestamp, the operation strategy can be determined according to the writer priority when the version number and the timestamp of the data change are consistent, and then the specific operation strategy is executed to complete the data management for multiple data records, so as to ensure the consistency of data between different systems and different storage components, ensure that the user experience is the same everywhere, avoid the problem of the user's experience being reduced due to inconsistent data on different pages, and save manpower for repairing data.

[0124] Reference Figure 2, showing a flowchart of a data management method provided in an embodiment of the present invention, specifically, the data distribution module distributes multiple data records to the data decision module; when the data decision module receives multiple data records, it determines the operation behavior of the data record, and then integrates the data records with the same operation behavior into a data record set according to the operation behavior of the data record; in each data record set, the data record with the highest priority of the writer is determined as the target data record; then the operation strategy corresponding to the target data record is determined; after the specific operation strategy (the first operation strategy or the second operation strategy) is determined, the specific operation strategy is sent to the data execution module to execute the operation strategy in the data execution module to obtain the execution result. Among them, in the embodiment of the present invention, since the second operation strategy does not need to operate on the target data record, only when the operation strategy is the first operation strategy, the first operation strategy is sent to the data execution module to execute the first operation strategy to obtain the execution result.

[0125] The data management method provided by the embodiment of the present invention obtains multiple data records; determines the operation behavior of the data records; the operation behavior includes any one of adding, modifying or deleting; when the version numbers and timestamps corresponding to the multiple data records are the same, and the writer priorities corresponding to the multiple data records are different, the operation strategy of the data records in the target database is determined according to the data records and the operation behaviors; the operation strategy is used to characterize whether to execute the operation behavior of the data records; the operation strategy of the data records is executed in the target database to obtain the execution result. By adding the writer priority in the two dimensions of version number and timestamp, the operation strategy can be determined according to the writer priority when the version number and the timestamp of the data change are consistent, and then the specific operation strategy is executed to complete the data management for multiple data records, so as to ensure the consistency of data between different systems and different storage components, ensure that the user experience is the same everywhere, avoid the problem of the user's experience being reduced due to inconsistent data on different pages, and save manpower for repairing data.

[0126] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0127] Reference Figure 3, shows a structural block diagram of a data management device provided in an embodiment of the present invention, which may specifically include the following modules:

[0128] An acquisition module 301 is used to acquire multiple data records;

[0129] A determination module 302 is used to determine the operation behavior of the data record; the operation behavior includes any one of adding, modifying or deleting;

[0130] The operation strategy module 303 is used to determine the operation strategy of the data record in the target database according to the data record and the operation behavior when the version numbers and timestamps corresponding to the multiple data records are the same and the writer priorities corresponding to the multiple data records are different; the operation strategy is used to indicate whether to execute the operation behavior of the data record;

[0131] The execution result module 304 is used to execute the operation strategy of the data record in the target database to obtain an execution result.

[0132] In one embodiment of the present invention, the operation strategy module 303 includes:

[0133] A data record integration submodule, for integrating multiple data records of the same operation behavior into a data record set according to the operation behavior; the data record set is one of the data record set corresponding to the addition, the data record set corresponding to the modification, and the data record set corresponding to the deletion;

[0134] A target data record determination submodule is used to determine a target data record in the data record set; the writer priority corresponding to the target data record is the highest in the data record set, and the target data record includes the target data record corresponding to the addition, the target data record corresponding to the modification, and the target data record corresponding to the deletion;

[0135] The operation strategy determination submodule is used to determine the operation strategy of recording the target data in the target database.

[0136] In one embodiment of the present invention, the target data record determination submodule includes:

[0137] A writer priority comparison unit, used for comparing the writer priority corresponding to each data record in the data record set;

[0138] The target data record selection unit is used to select a data record with the highest writing priority from the data record set as the target data record.

[0139] In one embodiment of the present invention, the operation strategy determination submodule includes:

[0140] A data record result determination unit, used to determine a data record result corresponding to the target data record; the data record result is used to characterize the state of the target data record in the target database;

[0141] A first preset result unit is used to determine the operation strategy for recording the target data in the target database as a first operation strategy when the operation behavior is the modification or the addition and the data recording result is the first preset result; the first preset result is used to indicate that the target data record exists in the target database, and the first operation strategy is used to indicate that the operation behavior is not performed on the target data record in the target database;

[0142] A second preset result unit is used to determine the operation strategy for recording the target data in the target database as a second operation strategy when the operation behavior is the modification or the addition and the data recording result is the second preset result; the second preset result is used to indicate that the target data record does not exist in the target database, and the second operation strategy is used to indicate that the operation behavior is performed on the target data record in the target database;

[0143] a third preset result unit, configured to determine the operation strategy for recording the target data in the target database as the second operation strategy when the operation behavior is the deletion and the data recording result is the third preset result; the third preset result is used to indicate that the target data record in the target database has been deleted;

[0144] A fourth preset result unit is used to determine the operation strategy for recording the target data in the target database as the first operation strategy when the operation behavior is the deletion and the data recording result is the fourth preset result; the fourth preset result is used to characterize that the target data record in the target database has not been deleted.

[0145] In one embodiment of the present invention, the device further comprises:

[0146] An execution order determination module is used to determine the execution order of the target data records in the target database according to the priority of the operation behavior; wherein the priority of the modification is greater than the priority of the addition, and the priority of the addition is greater than the priority of the deletion.

[0147] In one embodiment of the present invention, the execution result module 304 includes:

[0148] An operation strategy execution module is used to execute the operation strategy of the target data record in the target database in sequence according to the execution order to obtain the execution result; the execution order is the target data record corresponding to the modification, the target data record corresponding to the addition, and the target data record corresponding to the deletion.

[0149] In an embodiment of the present invention, the execution result is used to indicate whether the operation strategy of the target data record is executed successfully.

[0150] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0151] The embodiment of the present invention further provides an electronic device, such as Figure 4 As shown, it includes a processor 41, a communication interface 42, a memory 43 and a communication bus 44, wherein the processor 41, the communication interface 42, and the memory 43 communicate with each other through the communication bus 44.

[0152] A memory 43, for storing computer programs;

[0153] The processor 41 is used to execute the program stored in the memory 43 to implement the following steps:

[0154] Get multiple data records;

[0155] Determine the operation behavior of the data record; the operation behavior includes any one of adding, modifying or deleting;

[0156] When the version numbers and timestamps corresponding to the multiple data records are the same, and the writer priorities corresponding to the multiple data records are different, determining the operation strategy of the data record in the target database according to the data record and the operation behavior; the operation strategy is used to indicate whether to execute the operation behavior of the data record;

[0157] The operation strategy of the data record is executed in the target database to obtain an execution result.

[0158] Optionally, when the version numbers and timestamps corresponding to the plurality of data records are the same, and the writer priorities corresponding to the plurality of data records are different, determining the operation strategy for the data records in the target database according to the data records and the operation behavior includes:

[0159] According to the operation behavior, a plurality of data records of the same operation behavior are integrated into a data record set; the data record set is one of the data record set corresponding to the addition, the data record set corresponding to the modification, and the data record set corresponding to the deletion;

[0160] Determine a target data record in the data record set; the writer priority corresponding to the target data record is the highest in the data record set, and the target data record includes the target data record corresponding to the addition, the target data record corresponding to the modification, and the target data record corresponding to the deletion;

[0161] An operation strategy for recording the target data in the target database is determined.

[0162] Optionally, the determining the target data record in the data record set includes:

[0163] Comparing the writer priority corresponding to each data record in the data record set;

[0164] A data record with the highest writing priority is selected from the data record set as the target data record.

[0165] Optionally, the determining an operation strategy for recording the target data in the target database includes:

[0166] Determine a data record result corresponding to the target data record; the data record result is used to characterize the state of the target data record in the target database;

[0167] When the operation behavior is the modification or addition, and the data recording result is the first preset result, the operation strategy for recording the target data in the target database is determined to be the first operation strategy; the first preset result is used to indicate that the target data record exists in the target database, and the first operation strategy is used to indicate that the operation behavior is not performed on the target data record in the target database;

[0168] When the operation behavior is the modification or the addition, and the data recording result is the second preset result, the operation strategy for recording the target data in the target database is determined to be the second operation strategy; the second preset result is used to indicate that the target data record does not exist in the target database, and the second operation strategy is used to indicate that the operation behavior is performed on the target data record in the target database;

[0169] When the operation behavior is the deletion, and the data recording result is the third preset result, the operation strategy for recording the target data in the target database is determined to be the second operation strategy; the third preset result is used to indicate that the target data record in the target database has been deleted;

[0170] When the operation behavior is deletion and the data recording result is the fourth preset result, the operation strategy for recording the target data in the target database is determined to be the first operation strategy; the fourth preset result is used to indicate that the target data record in the target database has not been deleted.

[0171] Optionally, after determining the target data record in the data record set, the method further includes:

[0172] The execution order of the target data records in the target database is determined according to the priority of the operation behavior; wherein the priority of the modification is greater than the priority of the addition, and the priority of the addition is greater than the priority of the deletion.

[0173] Optionally, executing the operation strategy of the data record in the target database to obtain an execution result includes:

[0174] The operation strategies of the target data records are sequentially executed in the target database according to the execution order to obtain the execution result; the execution order is the target data records corresponding to the modification, the target data records corresponding to the addition, and the target data records corresponding to the deletion.

[0175] Optionally, the execution result is used to indicate whether the operation strategy of the target data record is executed successfully.

[0176] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0177] The communication interface is used for communication between the above terminal and other devices.

[0178] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0179] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0180] In another embodiment provided by the present invention, a computer-readable storage medium is provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the data management method described in any one of the above embodiments.

[0181] In another embodiment of the present invention, a computer program product including instructions is provided, which, when executed on a computer, enables the computer to execute the data management method described in any one of the above embodiments.

[0182] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0183] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0184] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0185] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A data management method, characterized in that: The method comprises: Get multiple data records; Determine the operation behavior of the data record; the operation behavior includes any one of adding, modifying or deleting; When the version numbers and timestamps corresponding to the multiple data records are the same, and the writer priorities corresponding to the multiple data records are different, determining the operation strategy of the data record in the target database according to the data record and the operation behavior; the operation strategy is used to indicate whether to execute the operation behavior of the data record; The operation strategy of the data record is executed in the target database to obtain an execution result.

2. The method according to claim 1, characterized in that When the version numbers and timestamps corresponding to the plurality of data records are the same, and the writer priorities corresponding to the plurality of data records are different, determining the operation strategy of the data records in the target database according to the data records and the operation behavior includes: According to the operation behavior, a plurality of data records of the same operation behavior are integrated into a data record set; the data record set is one of the data record set corresponding to the addition, the data record set corresponding to the modification, and the data record set corresponding to the deletion; Determine a target data record in the data record set; the writer priority corresponding to the target data record is the highest in the data record set, and the target data record includes the target data record corresponding to the addition, the target data record corresponding to the modification, and the target data record corresponding to the deletion; An operation strategy for recording the target data in the target database is determined.

3. The method according to claim 2, characterized in that The determining of the target data record in the data record set includes: Comparing the writer priority corresponding to each data record in the data record set; A data record with the highest writing priority is selected from the data record set as the target data record.

4. The method according to claim 3, characterized in that The determining the operation strategy for recording the target data in the target database includes: Determine a data record result corresponding to the target data record; the data record result is used to characterize the state of the target data record in the target database; When the operation behavior is the modification or addition, and the data recording result is the first preset result, the operation strategy for recording the target data in the target database is determined to be the first operation strategy; the first preset result is used to indicate that the target data record exists in the target database, and the first operation strategy is used to indicate that the operation behavior is not performed on the target data record in the target database; When the operation behavior is the modification or the addition, and the data recording result is the second preset result, the operation strategy for recording the target data in the target database is determined to be the second operation strategy; the second preset result is used to indicate that the target data record does not exist in the target database, and the second operation strategy is used to indicate that the operation behavior is performed on the target data record in the target database; When the operation behavior is the deletion, and the data recording result is the third preset result, the operation strategy for recording the target data in the target database is determined to be the second operation strategy; the third preset result is used to indicate that the target data record in the target database has been deleted; When the operation behavior is deletion and the data recording result is the fourth preset result, the operation strategy for recording the target data in the target database is determined to be the first operation strategy; the fourth preset result is used to indicate that the target data record in the target database has not been deleted.

5. The method according to claim 2, characterized in that: After determining the target data record in the data record set, the method further includes: The execution order of the target data records in the target database is determined according to the priority of the operation behavior; wherein the priority of the modification is greater than the priority of the addition, and the priority of the addition is greater than the priority of the deletion.

6. The method according to claim 5, characterized in that The step of executing the operation strategy of the data record in the target database to obtain the execution result includes: The operation strategies of the target data records are sequentially executed in the target database according to the execution order to obtain the execution result; the execution order is the target data records corresponding to the modification, the target data records corresponding to the addition, and the target data records corresponding to the deletion.

7. The method according to claim 6, characterized in that The execution result is used to indicate whether the operation strategy of the target data record is executed successfully.

8. A data management device, characterized in that: The device comprises: An acquisition module, used to acquire multiple data records; A determination module, used to determine the operation behavior of the data record; the operation behavior includes any one of adding, modifying or deleting; An operation strategy module, used for determining the operation strategy of the data record in the target database according to the data record and the operation behavior when the version numbers and timestamps corresponding to the multiple data records are the same and the writer priorities corresponding to the multiple data records are different; the operation strategy is used to indicate whether to execute the operation behavior of the data record; The execution result module is used to execute the operation strategy of the data record in the target database to obtain the execution result.

9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 7 when executing a program stored in a memory.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.