Data storage method, data backtracking method and computer equipment

By constructing the first and second index chains in chronological order, the problems of large storage space occupied by binlog log files and low data backtracking efficiency are solved, and efficient data storage and fast data backtracking are achieved. It is suitable for high-concurrency, large-scale distributed database environments.

CN119003529BActive Publication Date: 2025-09-12WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411129726.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2025-09-12
Estimated Expiration
2044-08-16

AI Technical Summary

Technical Problem

In a high-concurrency, large-scale distributed database environment, the number and size of binlog log files increase dramatically, resulting in large storage space usage and low data backtracking efficiency, making it impossible to quickly locate and restore the data status at a specified time node.

Method used

Construct the first index chain and the second index chain based on time order. The first index chain contains the index information and data change records of the time node, and the second index chain records the initial data value and the changed data value. Through dual indexing, efficient arrangement and transmission are achieved, the number of data instruction records is reduced, and fast data backtracking is supported.

Benefits of technology

Store more data in limited storage space, achieve efficient data compression and storage, significantly improve data backtracking efficiency, and support large-scale data backtracking in distributed database environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003529B_ABST
    Figure CN119003529B_ABST
Patent Text Reader

Abstract

The present application belongs to the field of data processing technology and discloses a data storage method, a data backtracking method and a computer device. The scheme simulates the double helix structure of DNA, introduces a double-stranded structure and a data pairing principle, and constructs a first index chain and a second index chain corresponding to the first index chain. The first index chain contains multiple time nodes arranged in chronological order based on the time when the data change occurs, while the second index chain records the initial data values ​​of all fields in the time node of the corresponding first index chain that serves as the initial time node, as well as the changed data values ​​of the fields in the first index chain whose position number is after the initial time node and the data change occurs. The efficient arrangement of data is achieved, and more data can be stored in a limited storage space. At the same time, the data storage method of the present application provides technical support for large-scale data backtracking, and can complete data backtracking in a shorter time, significantly improving the efficiency of data backtracking.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data storage method, a data backtracking method, and a computer device. Background Art

[0002] Existing technology solutions store data in a binary log file (binlog). This log records all database modification operations, including insert, update, and delete commands. When data needs to be backtracked, these binlog files are parsed and reverse-translated into corresponding SQL (Structured Query Language) statements, enabling data backtracking.

[0003] Because binlog files are extremely large, especially in high-concurrency, large-scale distributed database environments, the number and size of binlog files can increase dramatically, requiring significant storage space. Furthermore, the binlog file storage method lacks efficient data alignment and transmission mechanisms. Parsing binlog files requires executing instructions one by one, making it impossible to quickly locate and restore the data state at a specific time point, resulting in inefficient data backtracking. Summary of the Invention

[0004] In order to solve the above problems, the present application provides a data storage method, a data backtracking method and a computer device.

[0005] According to one aspect of an embodiment of the present application, a data storage method is disclosed, the data storage method comprising:

[0006] A first index chain including multiple time nodes is constructed based on the time sequence of data changes. The time nodes are configured with index information. The index information includes an index chain identifier of the first index chain, the data change time when the data change occurred, a position number, and a data pairing code. The position number indicates the time sequence of the data changes at each time node in the first index chain. The data pairing code includes multiple code values, each of which corresponds to a field and indicates whether the data value of the field has changed.

[0007] A second index chain corresponding to the first index chain is constructed based on the index information and the data value of the time node, wherein the second index chain is configured with an index chain identifier of the corresponding first index chain, a data pairing code corresponding to each position number in the first index chain, initial data values ​​of all fields in a time node serving as an initial time node in the corresponding first index chain, and changed data values ​​of fields whose position numbers in the first index chain are after the initial time node and have undergone data changes, wherein the fields whose data have undergone data changes are fields whose data have undergone data changes in a subsequent time node with a subsequent position number relative to a previous time node with an earlier position number.

[0008] In some embodiments, constructing a second index chain corresponding to the first index chain based on the index information and the data value of the time node includes:

[0009] Constructing a second index chain including a main association index and a low-dimensional association index based on the index information and the data value of the time node;

[0010] Among them, the main association index includes the index chain identifier of the first index chain corresponding to the second index chain, the position number in the first index chain and the data pairing code, and the low-dimensional association index includes the data pairing code corresponding to the main association index, the initial data values ​​of all fields in the time node as the initial time node in the first index chain corresponding to the second index chain, and the changed data values ​​of the fields in the first index chain whose position number has changed at the time node after the initial time node.

[0011] According to one aspect of an embodiment of the present application, a computer device is disclosed, which includes one or more processors and a memory, wherein the memory is used to store one or more computer programs, and when the one or more computer programs are executed by the one or more processors, the processor implements the data storage method as described above.

[0012] According to one aspect of an embodiment of the present application, a data backtracking method is disclosed, the data backtracking method comprising:

[0013] A first index chain including multiple time nodes is constructed based on the time sequence of data changes. The time nodes are configured with index information. The index information includes an index chain identifier of the first index chain, the data change time when the data change occurred, a position number, and a data pairing code. The position number indicates the time sequence of the data changes at each time node in the first index chain. The data pairing code includes multiple code values, each of which corresponds to a field and indicates whether the data value of the field has changed.

[0014] A second index chain corresponding to the first index chain is constructed based on the index information and the data value of the time node. The second index chain is configured with an index chain identifier of the corresponding first index chain, a data pairing code corresponding to each position number in the first index chain, initial data values ​​of all fields in the time node that serves as the initial time node in the corresponding first index chain, and changed data values ​​of fields whose position numbers in the first index chain have changed data at time nodes after the initial time node, where the fields whose position numbers have changed data are fields whose position numbers have changed at a subsequent time node relative to a previous time node with an earlier position number.

[0015] The first index chain is queried based on the backtracking time for which data backtracking is required, and the time node corresponding to the backtracking time in the first index chain is obtained as the target time node. The index information configured for the target time node is then queried to obtain the index chain identifier of the first index chain where the target time node is located, the position number in the first index chain, and the corresponding data pairing code;

[0016] Based on the index chain identifier of the first index chain where the target time node is located and the position number in the first index chain, determine all previous time nodes at which data changes occurred before the target time node, and obtain data pairing codes corresponding to all the previous time nodes;

[0017] Based on the data pairing code corresponding to the target time node and the data pairing codes corresponding to all the previous time nodes, obtaining the field where data change occurs at the target time node;

[0018] Based on the index chain identifier of the first index chain where the target time node is located and the position number in the first index chain, the second index chain is searched to obtain a set of changed data values ​​of the fields where data changes occur at the target time node;

[0019] The data value of the backtracking time is obtained based on the changed data value set and the initial data values ​​of all fields in the time node serving as the initial time node in the first index chain where the target time node is located.

[0020] In some embodiments, the obtaining of the field where data change occurs at the target time node based on the data pairing code corresponding to the target time node and the data pairing codes corresponding to all previous time nodes includes:

[0021] Performing an XOR operation on the data pairing code corresponding to the target time node and the data pairing codes corresponding to all previous time nodes to obtain a change pairing code;

[0022] Based on the change pairing code, the field where the data change occurs at the target time node is known.

[0023] In some embodiments, constructing a second index chain corresponding to the first index chain based on the index information and the data value of the time node includes:

[0024] Set data pairing codes based on the data change situation at the time node where the data change occurs relative to the previous time node;

[0025] The data change status includes data change relative to the previous time node and data no change relative to the previous time node.

[0026] In some embodiments, setting the data pairing code based on the data change status of the time node where the data change occurs relative to the previous time node includes:

[0027] Setting the code value corresponding to the field at the time node where the data change occurred relative to the previous time node to one of 1 and 0;

[0028] The coding value corresponding to the field at the time node where the data change occurs relative to the previous time node where no data change occurs is set to the other one of 1 and 0.

[0029] In some embodiments, constructing a second index chain corresponding to the first index chain based on the index information and the data value of the time node includes:

[0030] Constructing a second index chain including a main association index and a low-dimensional association index based on the index information and the data value of the time node;

[0031] Among them, the main association index includes the index chain identifier of the first index chain corresponding to the second index chain, the position number in the first index chain and the data pairing code, and the low-dimensional association index includes the data pairing code corresponding to the main association index, the initial data values ​​of all fields in the time node as the initial time node in the first index chain corresponding to the second index chain, and the changed data values ​​of the fields in the first index chain whose position number has changed at the time node after the initial time node.

[0032] In some embodiments, querying the second index chain based on the index chain identifier of the first index chain where the target time node is located and the position number in the first index chain to obtain a set of changed data values ​​of fields where data changes occurred at the target time node includes:

[0033] Based on the index chain identifier of the first index chain where the target time node is located and the position number in the first index chain, the primary association index of the second index chain is searched to obtain the data pairing code corresponding to the target time node on the primary association index;

[0034] Obtaining a code value representing a data change in a data value of a field and a field corresponding to the code value representing a data change in the data pairing code corresponding to the target time node on the primary association index;

[0035] Based on the coded value of the data value representing the field where the data change occurs and the field corresponding to the coded value of the data value representing the field where the data change occurs, the low-dimensional associated index of the second index chain is queried to obtain the set of changed data values ​​of the field where the data change occurs at the target time node.

[0036] In some embodiments, obtaining the data value of the backtracking time based on the set of changed data values ​​and the initial data values ​​of all fields in the time node serving as the initial time node in the first index chain where the target time node is located includes:

[0037] Based on the relation D i (t i )=D0(t0)+ΔD(t i ), obtaining the data value of the backtracking time;

[0038] Wherein, D0(t0) represents the initial data value of all fields in the time node as the initial time node in the first index chain where the target time node is located, ΔD(t i ) represents the set of changed data values.

[0039] According to one aspect of an embodiment of the present application, a computer device is disclosed, which includes one or more processors and a memory, wherein the memory is used to store one or more computer programs. When the one or more computer programs are executed by the one or more processors, the processors implement the data backtracking method as described above.

[0040] The technical solutions provided by the embodiments of the present application include at least the following beneficial effects:

[0041] The solution disclosed in this application constructs a first index chain and a second index chain corresponding to the first index chain. The first index chain contains multiple time nodes arranged in chronological order based on the time when data changes occurred, while the second index chain records the initial data values ​​of all fields in the time node corresponding to the initial time node in the first index chain, as well as the changed data values ​​of fields whose position number in the first index chain has changed after the initial time node. Through dual indexing, efficient data arrangement and transmission are achieved, the number of data instruction records is significantly reduced, more data can be stored in a limited storage space, efficient data compression and storage are achieved, and the efficiency and density of data storage are improved.

[0042] At the same time, the data storage method of the present application also provides technical support for large-scale data backtracking in a distributed database environment. The first index chain contains multiple time nodes arranged in chronological order based on the time when the data changes. When tracing back the data, the first index chain is queried based on the backtracking time for which the data needs to be backtracked to obtain relevant index information, and then the second index chain is queried to further obtain the data value of the backtracking time. This can realize data backtracking at any time node where data changes occur, breaking the mode of executing data backtracking according to sequential instructions, and can complete data backtracking in a shorter time, significantly improving the efficiency of data backtracking. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The accompanying drawings are incorporated into and constitute a part of the specification, illustrating embodiments consistent with the present application and, together with the specification, explaining the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and those skilled in the art can derive other drawings based on these drawings without inventive effort. In the drawings:

[0044] Figure 1 A flow chart of a data backtracking method according to an embodiment of the present application is shown;

[0045] Figure 2 A schematic diagram of a second index chain according to an embodiment of the present application is shown;

[0046] Figure 3 A schematic diagram showing a data structure including two index chains according to an embodiment of the present application is shown;

[0047] Figure 4 Shown Figure 1 Detailed flowchart of step S150;

[0048] Figure 5 Shown Figure 1 Detailed flowchart of step S160;

[0049] Figure 6A block diagram showing the composition of a computer device according to an embodiment of the present application is shown;

[0050] Figure 7 A block diagram of a computer system structure for implementing some embodiments of the present application is shown.

[0051] The following are the descriptions of the reference numerals:

[0052] 600, computer equipment; 601, processor; 602, memory; 700, computer system; 701,

[0053] CPU; 702, ROM; 703, RAM; 704, bus; 705, I / O interface; 706, input part; 707, output part; 708, storage part; 709, communication part; 710, drive; 711, removable media. DETAILED DESCRIPTION

[0054] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these example embodiments are provided so that the description of this application will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art.

[0055] The terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of technical features indicated. Therefore, features specified as "first" or "second" may explicitly or implicitly include one or more features.

[0056] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner.In the following description, many specific details are provided so as to provide a full understanding of the embodiments of the present application. However, it will be appreciated by those skilled in the art that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps etc. can be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0057] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.

[0058] In this application, some professional terms are explained as follows:

[0059] Binary log: It is a log file that records all updates to the database. It is used to record changes to the database within MySQL and is mainly used for master-slave replication and incremental recovery of the database.

[0060] HBase: is a distributed, column-oriented open source database that is suitable for storing unstructured data.

[0061] DNA double helix structure: a conformation of nucleic acid in which two antiparallel polynucleotide chains are intertwined to form a right-handed double helix.

[0062] The existing technical solutions for data storage occupy a large amount of storage space and have low data backtracking efficiency. This is because all database modification operations, including insert, update, delete, and other SQL statement instructions, are recorded in binlog log files. Then, when backtracking data, it is necessary to parse a large number of binlog log files in sequence to find the log instruction set corresponding to the time node and perform replay and recovery operations one by one. Binlog log files are huge, instruction parsing is complex, replaying one by one is time-consuming, and there is a lack of efficient data arrangement and transmission mechanisms. Specifically, the method of using binlog technology for data storage and backtracking has technical defects:

[0063] Binlog log files are usually very large, especially in high-concurrency, large-scale distributed database environments such as MySQL, TiDB, and Oracle. The number and size of log files will increase dramatically, and parsing these log files requires a lot of computing resources and time.

[0064] The binlog logging method lacks an efficient data arrangement and transmission mechanism, resulting in the inability to quickly locate and restore the data status at a specified time point, and the backtracking speed is slow.

[0065] Binlog files are stored in binary format, requiring specialized tools and high technical complexity to parse. This is especially true for binlogs in row-based replication (ROW) format, where parsing changes to each row is even more complex. This format records changes to each SQL statement and is relatively secure, but it can be very expensive. For example, if a statement modifies 100 affected data items, 100 statements will be generated.

[0066] Among them, binlog is implemented through two files:

[0067] The index file (file name suffix is ​​.index) is used to record which log files are being used;

[0068] Log files (file name suffix is ​​.00000*) record all DDL and DML (except data query statements) statement events of the database.

[0069] The binlog status is checked through the MySQL command: MySQL>show master status; as shown in Table 1 below:

[0070] Table 1

[0071] File Position binlog_Do_DB binlog_ignore_db Mysql-bin.000005 1779 - -

[0072] By parsing the file Mysql-bin.000005 and using the location information Position 1779, the current data change location information can be retrieved. To query historical data, the historical data information in the log file must be retrieved and the target data instruction must be located. The SQL statement can then be reversed and inserted into the database. The following table shows the data format of the binlog log file:

[0073] Table 2

[0074]

[0075] When data needs to be traced back, the reverse derivation of SQL is:

[0076] insert into `test`.`binlog_demo`(@1,@2,@3)values(4,4,1593792000).

[0077] The above process has a high technical cost and has the problem of low efficiency in reverse deducing SQL statements.

[0078] In addition, the storage and backtracking methods of binlog log files are also limited by application scenarios and system load. When dealing with complex data backtracking requirements, especially in a distributed environment involving multiple databases including MySQL, TiDB, and Oracle, data backtracking efficiency is low, which can easily cause system performance bottlenecks and make it difficult to meet actual needs.

[0079] To this end, the present application provides a new data storage method, a data backtracking method, a computer device, and a computer-readable storage medium to store more data in a limited storage space and achieve efficient data compression and storage; at the same time, it realizes data backtracking at any time node where data changes occur, and can complete data backtracking in a shorter time, significantly improving the efficiency of data backtracking.

[0080] The following is a detailed description of the implementation details of the technical solution of the embodiment of the present application:

[0081] Figure 1 A flowchart of a data backtracking method according to an embodiment of the present application is shown. Figure 1 As shown, the data backtracking method includes at least a data storage step and a data backtracking step. The data storage step further includes a first index chain construction step and a second index chain construction step, which correspond to the following steps S110 and S120 respectively; the data backtracking step further includes a first index chain query step, a data change field determination step, a second index chain query step and a data value backtracking step, which correspond to the following steps S130, steps S140 to S150, step S160 and step S170 respectively.

[0082] First, the data storage steps are introduced in detail as follows:

[0083] In step S110, a first index chain including multiple time nodes is constructed based on the chronological order of data changes. The time nodes are configured with index information, including an index chain identifier of the first index chain in which the time node is located, the data change time at which the data change occurred at the time node, a position number of the time node, and a data pairing code.

[0084] The position number indicates the order in which data changes occur at each time node in the first index chain. For example, number 0 represents the position number corresponding to the initial time node in the first index chain. Number 1 represents the position number corresponding to the time node in the first index chain that has a data change after the initial time node and is adjacent to the initial time node. Number 2 represents the position number corresponding to the time node in the first index chain that has a data change after the initial time node and is one time node away from the initial time node. And so on.

[0085] The multiple time nodes included in the first index chain may be arranged in ascending order of time, and the initial time node represents the earliest time node in the first index chain. The first index chain includes the initial time node and one or more time nodes after the initial time node.

[0086] The data pairing code includes multiple code values, each of which corresponds to a field and indicates whether the data value of the field has changed. That is, the number of code values ​​of the data pairing code is the same as the number of fields corresponding to the time node. For example, if the data value corresponding to a time node has three fields, the data pairing code corresponding to the time node includes three code values, and the three code values ​​respectively indicate whether the data values ​​of the three fields have changed; if the data value corresponding to a time node has four fields, the data pairing code corresponding to the time node includes four code values, and the four code values ​​respectively indicate whether the data values ​​of the four fields have changed; if the data value corresponding to a time node has six fields, the data pairing code corresponding to the time node includes six code values, and the six code values ​​respectively indicate whether the data values ​​of the six fields have changed, and so on.

[0087] Different coding values ​​are set for fields with and without data changes. In one exemplary embodiment, the coding value corresponding to fields with data changes relative to the previous time node is set to either 1 or 0; the coding value corresponding to fields with data changes relative to the previous time node is set to the other of 1 and 0. Using 1 and 0 to represent coding values ​​makes setting data pairing coding simple and intuitive.

[0088] Specifically, it can be configured as follows: for fields that have changed data relative to the previous time node at a time node where data has changed, the corresponding code value is set to 1; for fields that have not changed data relative to the previous time node at a time node where data has changed, the corresponding code value is set to 0; and the code values ​​corresponding to all fields at the initial time node are set to 0. It can also be configured as follows: for fields that have changed data relative to the previous time node at a time node where data has changed, the corresponding code value is set to 0; for fields that have not changed data relative to the previous time node at a time node where data has changed, the corresponding code value is set to 1; and the code values ​​corresponding to all fields at the initial time node are set to 1.

[0089] For example, the data value of the first time node (8:00 on June 1, 2024, that is, the initial time node) is: [1, 2, 3, 4, 5, 6], the data value of the second time node (10:00 on June 1, 2024) is: [2, 3, 3, 4, 5, 6], and the data value of the third time node (8:00 on June 2, 2024) is: [2, 3, 3, 4, 6, 7]. Then: the data pairing code corresponding to the first time node is 000000, the data pairing code corresponding to the second time node is 110000, and the data pairing code corresponding to the third time node is 000011.

[0090] Of course, in other embodiments, other symbols may be used to represent the code value, and are not limited to using 1 and 0 to represent the code value.

[0091] Among them, the index information includes the index chain identifier of the first index chain where the time node is located, the data change time when the data change occurs at the time node, the position number of the time node and the data pairing code. It is only an exemplary embodiment of the present application. In other embodiments, the index information can further include other information.

[0092] Exemplarily, the index information further includes a chain type, which is used to distinguish whether the index chain is the first index chain or the second index chain. Exemplarily, the index information further includes a chain length, which is used to indicate the chain length corresponding to the time node at which the data change occurred. Exemplarily, the index information further includes the aforementioned chain type and chain length.

[0093] In an exemplary embodiment, the index information includes six elements, specifically: the index chain identifier of the first index chain where the time node is located, the chain type, the chain length, the data change time when the data change occurred at the time node, the position number of the time node, and the data pairing code. Multiple time nodes on the same first index chain have the same index chain identifier and chain type. For example, the data model of the first index chain can be defined as shown in Table 3 below:

[0094] Table 3

[0095] Where tid is the index chain identifier, ti_line_type is the chain type, ti_lenth is the chain length, ti_start_time is the data change time at the time node, ti_index is the position number of the time node, and ti_bp_code is the data pairing code. In an embodiment where the corresponding code value is set to 0 for fields where no data has changed at the time node where data has changed relative to the previous time node, if no data has changed at the corresponding time node, ti_bp_code is the binary state of the length bit. For example, if the length is 3, ti_bp_code is 000; if the length is 6, ti_bp_code is 000000.

[0096] For example, assuming that the first index chain includes the following time nodes, the first index chain stores index information of the following time nodes, as shown in Table 4:

[0097] Table 4

[0098]

[0099] Exemplarily, the steps of constructing the first index chain including the above index information are as follows:

[0100] First, define the data type of the first index chain, using the BuildTimeIndexFeature definition method. The name of the type schema is defined as the tid of the first index chain. The schema details include the definitions of the columns in Table 4. Other custom information includes the use of the compressed binary TWKB format to minimize space usage. Next, create an index for the ti_start_time column. Then, create specific objects based on the defined construction method, as follows:

[0101] BuildTimeIndexFeature.createType("user_info_a1","TI","ti_lenth","ti_start_time:Date","index:ti_start_time","*geom:Point:ti_index","name:ti_bp_code","st:twkb"); where "user_info_a1" represents the index chain identifier, "index:ti_start_time" indicates the index established for ti_start_time to facilitate obtaining ti_start_time, and "st:twkb" indicates the use of compressed binary TWKB format. The BuildTimeIndexFeature is the specific object created. This BuildTimeIndexFeature contains a time node index field (ti_start_time), an attribute field (ti_index for geom point feature types), a TWKB compressed format, and several other attribute fields (ti_bp_code).

[0102] Taking one of the time nodes shown in Table 4 as an example, the index information corresponding to the time node is configured as follows: [

[0104] tid: "user_info_a1"

[0105] ti_line_type: "TI"

[0106] ti_lenth: "1"

[0107] ti_start_time:"2024-06-01 08:00:00"

[0108] ti_index: "1"

[0109] ti_bp_code: "000000" ]

[0111] After the above steps, the BuildTimeIndexFeature is constructed. The encapsulated attribute structure information is converted into SimpleFeatureType through the serialization mechanism. The serialization process converts the tid and various attribute information into byte arrays, which are stored as Value values ​​in the RowValue object and finally stored in HBase to form the first index chain.

[0112] By building a time series index through the first index chain, linking the time nodes on the chain together, a chain is formed in the order of the time when the data changes occurred. This allows for quick positioning of any time node, facilitating rapid data backtracking.

[0113] In step S120, a second index chain corresponding to the first index chain is constructed based on the index information and the data values ​​of the time nodes. The second index chain is configured with an index chain identifier of the corresponding first index chain, data pairing codes corresponding to each position number in the first index chain, initial data values ​​of all fields at the time node that serves as the initial time node in the corresponding first index chain, and changed data values ​​of fields whose position numbers in the first index chain have changed at time nodes subsequent to the initial time node.

[0114] Among them, the field that has undergone data change is the field that has undergone data change in the subsequent time node with a later position number relative to the previous time node with an earlier position number. For example, the data value of the subsequent time node with a later position number is: [2,3,3,4,5,6], where 2,3,3,4,5,6 are the data values ​​corresponding to the first field to the sixth field respectively, and the data value of the previous time node with a previous position number is: [1,2,3,4,5,6], where 1,2,3,4,5,6 are the data values ​​corresponding to the first field to the sixth field respectively. The fields that have undergone data change are the first field and the second field. For example, the data value of the next time node with the later position number is: [2,3,3,4,6,7], where 2,3,3,4,6,7 are the data values ​​corresponding to the first field to the sixth field respectively, and the data value of the previous time node with the earlier position number is: [2,3,3,4,5,6], where 2,3,3,4,5,6 are the data values ​​corresponding to the first field to the sixth field respectively. The fields where data changes have occurred are the fifth field and the sixth field.

[0115] The second index chain has a two-layer index structure. In an exemplary embodiment, in step S120, a second index chain including a primary association index and a low-dimensional association index is constructed based on the index information and the data value of the time node, thereby constructing a second index chain corresponding to the first index chain.

[0116] Among them, the main association index includes the index chain identifier of the first index chain corresponding to the second index chain, the position number and data pairing code in the first index chain, and the low-dimensional association index includes the data pairing code corresponding to the main association index, the initial data values ​​of all fields in the time node of the first index chain corresponding to the second index chain as the initial time node, and the changed data values ​​of the fields in the first index chain whose position number has changed at the time node after the initial time node.

[0117] Figure 2 A schematic diagram of a second index chain according to an embodiment of the present application is shown, wherein (a) represents a primary association index and (b) represents a low-dimensional association index.

[0118] like Figure 2 As shown in (a), the primary association index includes the index chain identifier of the first index chain corresponding to the second index chain, that is, user_info_a1; includes the position number in the first index chain, that is, 0-7 (t-index) in the upward direction; and includes the data pairing code, that is, the column data corresponding to 0-7 in the upward direction.

[0119] Among them, the data pairing code corresponding to position number 0 is 000000, the data pairing code corresponding to position number 1 is 110000, the data pairing code corresponding to position number 2 is 000011, the data pairing code corresponding to position number 3 is 000110, the data pairing code corresponding to position number 4 is 111000, the data pairing code corresponding to position number 5 is 001000, the data pairing code corresponding to position number 6 is 000110, and the data pairing code corresponding to position number 7 is 101011.

[0120] Among them, a, b, c, d, e, and f represent six fields. For position number 0, the code values ​​corresponding to fields a, b, c, d, e, and f are all 0; for position number 1, the code values ​​corresponding to fields a and b are 1, indicating that data changes have occurred in fields a and b relative to the time node of position number 0; for position number 2, the code values ​​corresponding to fields e and f are 1, indicating that data changes have occurred in fields e and f relative to the time node of position number 1; for position number 3, the code values ​​corresponding to fields d and e are 1, indicating that data changes have occurred in fields d and e relative to the time node of position number 2; and so on.

[0121] like Figure 2 As shown in (b), the low-dimensional associative index is established on the attribute column corresponding to the data pairing code of the main associative index. The low-dimensional associative index does not record the data values ​​corresponding to all fields, but records the initial data values ​​of all fields in the time node as the initial time node in the first index chain corresponding to the second index chain, as well as the changed data values ​​of the fields whose position number in the first index chain has changed at the time node after the initial time node. This can reduce the storage space occupied by stored data.

[0122] For example, for position number 0, the data values ​​(v) corresponding to all fields a, b, c, d, e, and f are recorded: [1, 2, 3, 4, 5, 6]; for position number 1, only the data values ​​(v) corresponding to field a and field b that have undergone data changes relative to the time node of position number 0 are recorded: 2 and 3; for position number 2, only the data values ​​(v) corresponding to field e and field f that have undergone data changes relative to the time node of position number 1 are recorded: 6 and 7.

[0123] In an exemplary embodiment, at step S120, the data structure of the primary association index of the initial time node is first constructed as follows: [

[0125] RowKey: "user_info_a1"

[0126] TT-Value: z3("000000")

[0127] TT-index:"1" ]

[0129] Then, a low-dimensional association index is established for the attribute column corresponding to the data pairing code of the main association index, as follows: [

[0131] RowKey: z3("000000")+"user_info_a1"+"1", where "1" represents the position number;

[0132] TT-Low: {

[0133] k:"a",v:"1",

[0134] k:"b",v:"2",

[0135] k:"c",v:"3",

[0136] k:"d",v:"4",

[0137] k:"e",v:"5",

[0138] k:"f",v:"6"} ]

[0140] Then, by recording all the time nodes whose position numbers are after the initial time node in the first index chain, a second index chain can be constructed, thereby constructing a data structure model for storing data in this application.

[0141] For example, the data structure of the second index chain is shown in Table 5 below:

[0142] Table 5

[0143]

[0144] In Table 5 (primary relational index), RowKey represents the index chain identifier of the primary relational index record, SimpleFeature represents an HBase encapsulation format, and z31 and z32 represent data pairing codes. In Table 5 (lower-dimensional relational index), RowKey represents the index chain identifier of the lower-dimensional relational index record. r1 in Table 5 (lower-dimensional relational index) corresponds to r1(tid) in Table 5 (upper-dimensional relational index), and r2 in Table 5 (lower-dimensional relational index) corresponds to r2(tid) in Table 5 (upper-dimensional relational index). In other words, the RowKey, position number, and data pairing code of the primary relational index can be used to find the RowKey of the lower-dimensional relational index, and thus the corresponding data value. v1 and v2 represent the changed data values ​​corresponding to the fields where data has changed.

[0145] In an exemplary embodiment, in step S120, a data pairing code is set based on a data change condition at a time node where the data change occurs relative to a previous time node, wherein the data change condition includes a data change relative to the previous time node and a data no change relative to the previous time node.

[0146] In one exemplary embodiment, setting data pairing codes based on data changes at a data change time node relative to a previous time node includes: setting code values ​​corresponding to fields that have changed relative to the previous time node to one of 1 and 0; and setting code values ​​corresponding to fields that have not changed relative to the previous time node to the other of 1 and 0. Using 1 and 0 to represent code values ​​makes setting data pairing codes simple and intuitive.

[0147] In detail, it is set as follows: for the fields where data changes have occurred at the time node relative to the previous time node, the corresponding coding value is set to 1; for the fields where data changes have not occurred at the time node relative to the previous time node, the corresponding coding value is set to 0; the coding values ​​corresponding to all fields of the initial time node are set to 0.

[0148] The following describes the process of setting data pairing codes using a specific embodiment as an example:

[0149] Assume that the data value corresponding to any time node is D i (t i ), D i (t i The encoding value corresponding to the i-th field (starting from 1) can be expressed as:

[0150]

[0151] BP i Indicates the code value corresponding to the i-th field, so the data pairing code corresponding to the time node can be calculated using the following calculation formula 2:

[0152] ΔBP i =concat(BP i |len) Formula 2

[0153] Among them, ΔBP i It is the data pairing code corresponding to the time node, D1(t1) represents the data value of time node t1, D0(t0) represents the data value of time node t0, and len is the bit length corresponding to the data value.

[0154] Assume that at time node t0, the data value D0(t0) = [1, 2, 3, 4, 5, 6], and at time node t1, the data value becomes D1(t1) = [2, 3, 3, 4, 5, 6]. Calculate the code value BP of each field of the data value corresponding to time node t1 using the above formula 1 i :

[0155] BP a =D0[0]=1,D1[0]=2=>1

[0156] BP b =D0[1]=2,D1[1]=3=>1

[0157] BP c =D0[2]=3,D1[2]=3=>0

[0158] BP d =D0[3]=4,D1[3]=4=>0

[0159] BP e =D0[4]=5,D1[4]=5=>0

[0160] BP f =D0[5]=6,D1[5]=6=>0

[0161] That is, the data pairing code corresponding to the time node t1 is ΔBP1=110000.

[0162] Independent coding values ​​are set for each field. Through data pairing coding, each field with data changes is mapped to the corresponding coding value. Spatial compression technology is also used to remove redundant and unchanged data, retaining only the data values ​​of fields with data changes. This reduces the number of data instruction records, storage overhead, and parsing complexity. Data changes are converted into status queries for data pairing codes, enabling the perception and precise location of data changes. This allows for rapid retrieval and splicing of datasets, improving the efficiency and accuracy of data backtracking.

[0163] Through the above steps S110 and S120, a data structure of the present application including the first index chain and the second index chain is constructed, such as Figure 3 As shown in the figure, this data structure is used to store data. This data structure simulates the DNA double helix structure and introduces a double-stranded structure and data pairing principles. It can significantly reduce the number of data instruction records, store more data in a limited storage space, achieve efficient data compression and storage, and improve the efficiency and density of data storage. It also provides technical support for large-scale data backtracking in a distributed database environment, enabling data backtracking at any time point where data changes occurred, completing data backtracking in a shorter time and significantly improving data backtracking efficiency.

[0164] It should be noted that in the above embodiment, the construction of the first index chain and the construction of the second index chain in step S110 and step S120, respectively, is merely for the purpose of facilitating the description of the data storage steps of this application. In practice, the construction of the first index chain and the second index chain can be performed simultaneously, and the order in which they are constructed does not matter. In other words, step S110 and step S120 can be performed simultaneously.

[0165] The following is a detailed description of the data backtracking steps:

[0166] In step S130, the first index chain is queried based on the backtracking time of the data to be backtracked, and the time node corresponding to the backtracking time in the first index chain is obtained as the target time node, and the index information configured for the target time node is queried to obtain the index chain identifier of the first index chain where the target time node is located, the position number in the first index chain, and the corresponding data pairing code.

[0167] As described in the aforementioned data storage steps, the first index chain contains multiple time nodes arranged in chronological order based on the time when data changes occurred. After determining the backtracking time for which data needs to be backtracked, the first index chain is queried to obtain the time node corresponding to the backtracking time in the first index chain. The time node corresponding to the backtracking time in the first index chain is used as the target time node, and the index information configured for the target time node is further queried to obtain the index chain identifier of the first index chain where the target time node is located, the position number in the first index chain, and the corresponding data pairing code and other information. That is, the index chain identifier of the first index chain corresponding to the backtracking time, the position number in the first index chain, and the corresponding data pairing code and other information are obtained.

[0168] The time node corresponding to the backtracking time in the first index chain may be the same time node in the first index chain as the backtracking time. If there is no time node in the first index chain that is exactly the same as the backtracking time, the time node corresponding to the backtracking time in the first index chain is the time node in the first index chain that is before the backtracking time and closest to the backtracking time.

[0169] For example, the backtracking time for data backtracking is T: "2024-06-02 08:00:00", the first index chain contains time nodes t0: "2024-06-01 08:00:00", t1: "2024-06-01 10:00:00", t2: "2024-06-02 08:00:00", and the time node corresponding to the backtracking time in the first index chain is t2. For example, the backtracking time for data to be backtracked is T: "2024-06-01 11:00:00", the first index chain contains time nodes t0: "2024-06-01 08:00:00", t1: "2024-06-01 10:00:00", t2: "2024-06-02 08:00:00", and the time node corresponding to the backtracking time in the first index chain is t1.

[0170] In step S140, based on the index chain identifier of the first index chain where the target time node is located and the position number in the first index chain, all previous time nodes at which data changes occurred before the target time node are determined, and the data pairing codes corresponding to all previous time nodes are obtained.

[0171] As described in the aforementioned data storage step, the position number indicates the order in which data changes occur at each time node in the first index chain. After obtaining the position number of the target time node in the first index chain based on step S130, all previous time nodes with position numbers before the target time node can be further obtained, thereby further obtaining the data pairing codes corresponding to all the previous time nodes.

[0172] For example, if the target time node obtained in step S130 is numbered 3 in the first index chain, and if the position numbering starts at 0, then the data pairing codes corresponding to the time nodes numbered 0-2 need to be searched. For example, if the target time node obtained in step S130 is numbered 4 in the first index chain, and if the position numbering starts at 1, then the data pairing codes corresponding to the time nodes numbered 1-3 need to be searched. And so on.

[0173] In step S150 , based on the data pairing code corresponding to the target time node and the data pairing codes corresponding to all previous time nodes, the fields where data changes occur at the target time node are obtained.

[0174] Each code value of the data pairing code corresponds to a field and indicates whether the data value of the field has changed. After obtaining the data pairing code corresponding to the target time node and the data pairing codes corresponding to all previous time nodes, the field where the data change has occurred at the target time node can be further known based on the code values ​​of the data pairing codes corresponding to the target time node and all previous time nodes.

[0175] Figure 4 Shown Figure 1 The detailed flow chart of step S150 is as follows: Figure 4 As shown, in an exemplary embodiment, step S150 includes the following steps S410 and S420, which are described in detail as follows:

[0176] In step S410 , an XOR operation is performed on the data pairing code corresponding to the target time node and the data pairing codes corresponding to all previous time nodes to obtain a change pairing code.

[0177] Among them, the data pairing code corresponding to the target time node is XORed with the data pairing codes corresponding to all previous time nodes, that is, the data pairing code corresponding to the target time node is XORed with the code value mapped to the same field in the data pairing codes corresponding to all previous time nodes, so as to obtain the XOR operation results corresponding to the code values ​​of each field, and then the XOR operation results corresponding to the code values ​​of each field are spliced ​​together to obtain the change pairing code.

[0178] For example, the change pairing code can be calculated using the following calculation formula 3:

[0179]

[0180] Among them, ΔBP code ΔBP is the pairing code for the change of the change. i and ΔBP i+1Represents two different data pair codes, and n represents that there are n data pair codes to be XORed.

[0181] Assuming n = 2, ΔBP i =000000, ΔBP i+1 =110000, perform XOR operation using the above calculation formula 3 to calculate the change pairing code corresponding to the two data pairing codes:

[0182]

[0183] In step S420, based on the transaction change pairing code, the fields where data changes occur at the target time node are obtained.

[0184] After obtaining the change pairing code, the fields where data changes occurred at the target time node can be known from the various code values ​​of the change pairing code. For example, a code value of 0 indicates that no data changes occurred in the field, and a code value of 1 indicates that a data change occurred in the field. If the change pairing code obtained in step S410 is 110000, then the fields where data changes occurred at the target time node are the first field and the second field. For example, a code value of 0 indicates that no data changes occurred in the field, and a code value of 1 indicates that a data change occurred in the field. If the change pairing code obtained in step S410 is 100100, then the fields where data changes occurred at the target time node are the first field and the fourth field.

[0185] In step S160, the second index chain is searched based on the index chain identifier of the first index chain where the target time node is located and the position number in the first index chain to obtain a set of changed data values ​​of the fields where data changes occur at the target time node.

[0186] The second index chain is configured with the index chain identifier of the corresponding first index chain, the data pairing code corresponding to each position number in the first index chain, the initial data values ​​of all fields in the time node in the corresponding first index chain that serves as the initial time node, and the changed data values ​​of the fields whose data has changed at the time node whose position number in the first index chain is after the initial time node. After knowing the index chain identifier of the first index chain where the target time node is located and the position number in the first index chain, the changed data value set of the fields whose data has changed at the target time node can be obtained by querying the second index chain.

[0187] In an exemplary embodiment in which a second index chain includes a primary association index and a low-dimensional association index, Figure 5 As shown, step S160 includes the following steps S510 and S530, which are described in detail as follows:

[0188] In step S510, based on the index chain identifier of the first index chain where the target time node is located and the position number in the first index chain, the primary association index of the second index chain is searched to obtain the data pairing code corresponding to the target time node on the primary association index.

[0189] In step S520 , the code value representing the data value of the field having data changed and the field corresponding to the code value representing the data value of the field having data changed in the data pairing code corresponding to the target time node on the primary association index are obtained.

[0190] In step S530, based on the coded value representing the data change of the field and the field corresponding to the coded value representing the data change of the field, the low-dimensional associated index of the second index chain is queried to obtain the changed data value set of the field where the data change occurs at the target time node.

[0191] by Figure 2 Taking the second index chain shown as an example, if the index chain identifier of the first index chain where the target time node is located is user_info_a1, and the position number in the first index chain is 1, then in step S510, the data pairing code corresponding to the target time node on the primary association index can be obtained as 110000, and in step S520, the fields corresponding to the code values ​​representing the data changes in the data values ​​of the fields in the data pairing code corresponding to the target time node on the primary association index can be obtained as field a and field b. In step S530, by querying the low-dimensional association index of the second index chain, the changed data value set [2,3] can be obtained. If the index chain identifier of the first index chain where the target time node is located is user_info_a1 and the position number in the first index chain is 2, then in step S510, the data pairing code corresponding to the target time node on the primary association index is obtained as 000011. In step S520, the fields corresponding to the code values ​​representing data changes in the data pairing code corresponding to the target time node on the primary association index are obtained as fields e and f. In step S530, the low-dimensional association index of the second index chain is queried to obtain the set of changed data values ​​as [6,7]. This method can quickly obtain the set of changed data values ​​for the fields where data changes occurred at the target time node, and the results are accurate and reliable.

[0192] In step S170 , the data value of the backtracking time is obtained based on the changed data value set and the initial data values ​​of all fields in the time node as the initial time node in the first index chain where the target time node is located.

[0193] After obtaining the changed data value set through step S160, the data value of the target time node, that is, the data value of the backtracking time, can be obtained based on the obtained changed data value set and the initial data values ​​of all fields in the time node serving as the initial time node in the first index chain where the target time node is located.

[0194] In an exemplary embodiment, in step S170, based on the relation D i (t i )=D0(t0)+ΔD(t i ), obtain the data value of the backtracking time. Among them, D0(t0) represents the initial data value of all fields in the time node as the initial time node in the first index chain where the target time node is located, ΔD(t i ) indicates a set of changed data values.

[0195] In another exemplary embodiment, the data value of the backtracking time can be obtained by the following calculation formula 4:

[0196]

[0197] Among them, D(t i ) represents the data value of the backtracking time (target time node), D0(t0) represents the initial data value of the initial time node, (ΔBP code +r i +t i-index ) represents the set of changed data values, where ΔBP code Indicates the change pairing code, r i Indicates the RowKey of the primary associated index of the second index chain, that is, the index chain identifier of the first index chain, t i-index It represents the position number. That is, during the data backtracking process, the second index chain is queried to obtain the set of changed data values ​​based on the abnormal change pairing code, the index chain identifier of the first index chain, and the corresponding position number. Then, the data value of the backtracking time is further obtained based on the obtained set of changed data values ​​and the initial data value.

[0198] The following describes the backtracking process of the data backtracking method of the present application by taking a specific embodiment as an example:

[0199] Step S610, assuming that the initial data value is: D0(t0) = [1, 2, 3, 4, 5, 6];

[0200] In step S620, it is assumed that the backtracking time for data backtracking is "2024-06-02 08:00:00";

[0201] Step S630: query the first index chain according to the backtracking time and find the target time node: t2;

[0202] In step S640, it is found that the data pairing code ti_bp_code corresponding to the target time node is: "000011", and the position number ti_index is: "3".

[0203] Step S650, based on the position number ti_index: "3", it is necessary to search the positions with position number ti_index "1" and "2" (the position number starts from "1"), and obtain the data pairing codes of position number ti_index: "1" and position number ti_index: "2" as ti_bp_code: "000000" and ti_bp_code: "110000" respectively.

[0204] Step S660: Calculate ΔBP according to the above formula 3 code :

[0205]

[0206] That is, the change matching code is: 110011;

[0207] In step S670, it can be seen from the transaction change matching code: 110011 that data changes have occurred in fields a, b, e, and f corresponding to the target time node;

[0208] Step S680: Based on the position number ti_index: "3" and the index chain identifier tid of the first index chain, the second index chain is queried to obtain the changed data value set: ΔD(t2) = [2, 3, 6, 7]; that is, the fields corresponding to the target time node are a = 2, b = 3, e = 6, and f = 7;

[0209] Step S690, based on the calculation formula D2(t2)=D0(t0)+ΔD(t2), the data value corresponding to the target time node is obtained as D2(t2)=[1,2,3,4,5,6]+[2,3,6,7]=[2,3,3,4,6,7].

[0210] In summary, this application simulates a double helix structure to construct a first index chain and a second index chain corresponding to the first index chain, thereby achieving efficient data arrangement and transmission, significantly reducing the number of data instruction records, and being able to store more data in a limited storage space. This achieves efficient data compression and storage, and improves the efficiency and density of data storage. At the same time, it also provides technical support for large-scale data backtracking in a distributed database environment, enabling data backtracking at any time node where data changes occur, breaking the mode of executing data backtracking according to sequential instructions, and being able to complete data backtracking in a shorter time, significantly improving the efficiency of data backtracking.

[0211] See next Figure 6 This embodiment provides a computer device 600, which includes one or more processors 601 and a memory 602. The memory 602 is used to store one or more programs. When the one or more programs are executed by one or more processors 601, the computer device 600 implements the data storage method or data backtracking method of the present application.

[0212] Figure 7 A block diagram of a computer system structure for implementing some embodiments of the present application is shown. It should be noted that: Figure 7 The computer system shown is only an example and should not limit the functions and scope of use of the embodiments of the present application.

[0213] like Figure 7 As shown, the computer system 700 includes a CPU (Central Processing Unit) 701, which can perform various appropriate actions and processes according to the program stored in the ROM (Read-Only Memory) 702 or the program loaded from the storage part 708 into the RAM (Random Access Memory) 703, such as executing the data storage method or data backtracking method in the above embodiment. Various programs and data required for system operation are also stored in the RAM 703. The CPU 701, ROM 702 and RAM 703 are connected to each other via a bus 704. An I / O (Input / Output) interface 705 is also connected to the bus 704.

[0214] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, and the like; an output section 707 including devices such as a CRT (Cathode Ray Tube), an LCD (Liquid Crystal Display), and a speaker; a storage section 708 including devices such as a hard disk; and a communication section 709 including a network interface card such as a LAN (Local Area Network) card or a modem. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. Removable media 711, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 710 as needed, so that computer programs read from the removable media can be installed in the storage section 708 as needed.

[0215] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing all or part of the steps shown in the flowchart in the data storage method or the data backtracking method. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the various functions defined in the system of the present application are executed.

[0216] It should be noted that the computer-readable medium shown in the embodiments of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable computer program. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. A computer program embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, or any suitable combination thereof.

[0217] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. Among them, each box in the flowchart or block diagram can represent a module, program segment, or part of the code, and the above-mentioned module, program segment, or part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0218] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. In some cases, the names of these units do not constitute limitations on the units themselves.

[0219] As another aspect, the present application further provides a computer-readable medium, which may be included in the computer device described in the above embodiments, or may exist independently and not be incorporated into the computer device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the computer device, the computer device implements the method described in the above embodiments.

[0220] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiment of the application, the features and functions of two or more modules or units described above can be concretized in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.

[0221] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.

[0222] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered merely as exemplary, and the true scope and spirit of the present application are indicated by the appended claims.

Claims

1. A data backtracking method, characterized in that: include: A first index chain including multiple time nodes is constructed based on the time sequence of data changes. The time nodes are configured with index information. The index information includes an index chain identifier of the first index chain, the data change time when the data change occurred, a position number, and a data pairing code. The position number indicates the time sequence of the data changes at each time node in the first index chain. The data pairing code includes multiple code values, each of which corresponds to a field and indicates whether the data value of the field has changed. A second index chain corresponding to the first index chain is constructed based on the index information and the data value of the time node. The second index chain is configured with an index chain identifier of the corresponding first index chain, a data pairing code corresponding to each position number in the first index chain, initial data values ​​of all fields in the time node that serves as the initial time node in the corresponding first index chain, and changed data values ​​of fields whose position numbers in the first index chain have changed data at time nodes after the initial time node, where the fields whose position numbers have changed data are fields whose position numbers have changed at a subsequent time node relative to a previous time node with an earlier position number. The first index chain is queried based on the backtracking time for which data backtracking is required, and the time node corresponding to the backtracking time in the first index chain is obtained as the target time node. The index information configured for the target time node is then queried to obtain the index chain identifier of the first index chain where the target time node is located, the position number in the first index chain, and the corresponding data pairing code; Based on the index chain identifier of the first index chain where the target time node is located and the position number in the first index chain, determine all previous time nodes at which data changes occurred before the target time node, and obtain data pairing codes corresponding to all the previous time nodes; Based on the data pairing code corresponding to the target time node and the data pairing codes corresponding to all the previous time nodes, obtaining the field where data change occurs at the target time node; Based on the index chain identifier of the first index chain where the target time node is located and the position number in the first index chain, the second index chain is searched to obtain a set of changed data values ​​of the fields where data changes occur at the target time node; The data value of the backtracking time is obtained based on the changed data value set and the initial data values ​​of all fields in the time node serving as the initial time node in the first index chain where the target time node is located.

2. The method according to claim 1, characterized in that The obtaining, based on the data pairing code corresponding to the target time node and the data pairing codes corresponding to all the previous time nodes, of the field where data changes occur at the target time node includes: Performing an XOR operation on the data pairing code corresponding to the target time node and the data pairing codes corresponding to all previous time nodes to obtain a change pairing code; Based on the change pairing code, the field where the data change occurs at the target time node is known.

3. The method according to claim 2, characterized in that The constructing a second index chain corresponding to the first index chain based on the index information and the data value of the time node includes: Set data pairing codes based on the data change situation at the time node where the data change occurs relative to the previous time node; The data change status includes data change relative to the previous time node and data no change relative to the previous time node.

4. The method according to claim 3, characterized in that The step of setting the data pairing code based on the data change situation at the time node where the data change occurs relative to the previous time node includes: Setting the code value corresponding to the field at the time node where the data change occurred relative to the previous time node to one of 1 and 0; The coding value corresponding to the field at the time node where the data change occurs relative to the previous time node where no data change occurs is set to the other one of 1 and 0.

5. The method according to any one of claims 1 to 4, characterized in that The constructing a second index chain corresponding to the first index chain based on the index information and the data value of the time node includes: Constructing a second index chain including a main association index and a low-dimensional association index based on the index information and the data value of the time node; Among them, the main association index includes the index chain identifier of the first index chain corresponding to the second index chain, the position number in the first index chain and the data pairing code, and the low-dimensional association index includes the data pairing code corresponding to the main association index, the initial data values ​​of all fields in the time node as the initial time node in the first index chain corresponding to the second index chain, and the changed data values ​​of the fields in the first index chain whose position number has changed at the time node after the initial time node.

6. The method according to claim 5, characterized in that The querying the second index chain based on the index chain identifier of the first index chain where the target time node is located and the position number in the first index chain to obtain a set of changed data values ​​of the field where data changes occur at the target time node includes: Based on the index chain identifier of the first index chain where the target time node is located and the position number in the first index chain, the primary association index of the second index chain is searched to obtain the data pairing code corresponding to the target time node on the primary association index; Obtaining a code value representing a data change in a data value of a field and a field corresponding to the code value representing a data change in the data pairing code corresponding to the target time node on the primary association index; Based on the coded value of the data value representing the field where the data change occurs and the field corresponding to the coded value of the data value representing the field where the data change occurs, the low-dimensional associated index of the second index chain is queried to obtain the set of changed data values ​​of the field where the data change occurs at the target time node.

7. The method according to claim 6, characterized in that The obtaining the data value of the backtracking time based on the changed data value set and the initial data values ​​of all fields in the time node serving as the initial time node in the first index chain where the target time node is located includes: Based on the relation D i (t i )=D0(t0)+ΔD(t i ), obtaining the data value of the backtracking time; Wherein, D0(t0) represents the initial data value of all fields in the time node as the initial time node in the first index chain where the target time node is located, ΔD(t i ) represents the set of changed data values.

8. A data storage method, characterized in that: include: A first index chain including multiple time nodes is constructed based on the time sequence of data changes. The time nodes are configured with index information. The index information includes an index chain identifier of the first index chain, the data change time when the data change occurred, a position number, and a data pairing code. The position number indicates the time sequence of the data changes at each time node in the first index chain. The data pairing code includes multiple code values, each of which corresponds to a field and indicates whether the data value of the field has changed. A second index chain corresponding to the first index chain is constructed based on the index information and the data value of the time node, wherein the second index chain is configured with an index chain identifier of the corresponding first index chain, a data pairing code corresponding to each position number in the first index chain, initial data values ​​of all fields in a time node serving as an initial time node in the corresponding first index chain, and changed data values ​​of fields whose position numbers in the first index chain are after the initial time node and have undergone data changes, wherein the fields whose data have undergone data changes are fields whose data have undergone data changes in a subsequent time node with a subsequent position number relative to a previous time node with an earlier position number.

9. The method according to claim 8, characterized in that The constructing a second index chain corresponding to the first index chain based on the index information and the data value of the time node includes: Constructing a second index chain including a main association index and a low-dimensional association index based on the index information and the data value of the time node; Among them, the main association index includes the index chain identifier of the first index chain corresponding to the second index chain, the position number in the first index chain and the data pairing code, and the low-dimensional association index includes the data pairing code corresponding to the main association index, the initial data values ​​of all fields in the time node as the initial time node in the first index chain corresponding to the second index chain, and the changed data values ​​of the fields in the first index chain whose position number has changed at the time node after the initial time node.

10. A computer device, characterized in that: include: one or more processors; A memory for storing one or more computer programs, which, when executed by the one or more processors, enables the processors to implement the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Double-chain repair information safety control method and device for intelligent connected automobile

    CN112860716A

  • Intelligent contract inspection result mutual recognition method and system in block chain

    CN116206722A