Data Processing Method, Apparatus and Electronic Device
By obtaining the associated storage of target data update instructions and differential data, a chain storage structure is formed, which solves the problem of wasted memory in full backup and realizes efficient recovery of data to target entity data at any time point.
Patent Information
- Application Number
- CN202110292290.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-18
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2041-03-18
AI Technical Summary
In the prior art, the full backup data update process wastes memory space and reduces data query efficiency, making it impossible to efficiently restore data to any point in time.
By obtaining the target data update instructions, the difference data of the entity data is determined and associated with the update record address is stored to form a chain storage structure to achieve the recovery of the target entity data.
It realizes efficient recovery of target entity data to any point in time under a small memory space, reducing storage requirements and improving data query efficiency.
Smart Images

Figure CN115114301B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of data storage, and particularly to a data processing method, an apparatus, an electronic device, and a computer-readable storage medium. Background Art
[0002] With the advent of the big data era, the amount of data used has been increasing exponentially, and there are increasingly high requirements for data backup and recovery, as well as for the integrity and efficiency of data recovery.
[0003] In the prior art, the entire data update process is usually backed up in full to obtain data at any past point in time. However, this method greatly wastes memory space and reduces the data query efficiency.
[0004] Therefore, a database storage method that can perform data recovery with a relatively small amount of memory becomes very important for user use.
[0005] It should be noted that the information disclosed in the above background art section is only used to enhance the understanding of the background of the present disclosure, and thus may include information that does not constitute the prior art known to those of ordinary skill in the art. Summary of the Invention
[0006] An object of the present disclosure is to provide a data processing method, an apparatus, and an electronic device, according to which a time series database can be generated so that the target entity data in the time series database can be restored to any past point in time.
[0007] Other features and advantages of the present disclosure will become apparent from the following detailed description, or will be partially learned through the practice of the present disclosure.
[0008] An embodiment of the present disclosure provides a data processing method, including: obtaining a target data update instruction for the target entity data; according to the target data update instruction, obtaining the target entity data and a first update record address corresponding to the target entity data from the entity data repository, where the first update record address is the storage address of the latest update record corresponding to the target entity data in the update record repository; updating the target entity data in the entity data repository according to the target data update instruction to generate updated target entity data in the entity data repository; determining target difference data between the updated target entity data and the target entity data, and determining a first target update record of the updated target entity data according to the target difference data; storing the first target update record and the first update record address in a second target update record address in the update record repository; and associatively storing the second target update record address with the updated target entity data in the entity data repository to complete the update of the target database.
[0009] An embodiment of the present disclosure provides a data processing apparatus, including: a target data update instruction obtaining module, a target entity data obtaining module, an entity data updating module, a first target update record determining module, a first target update record storing module, and a second target update record address associating module.
[0010] Wherein, the target data update instruction obtaining module is configured to obtain a target data update instruction for the target entity data; the target entity data obtaining module may be configured to obtain the target entity data and a first update record address corresponding to the target entity data from the entity data repository according to the target data update instruction, where the first update record address is the storage address of the latest update record corresponding to the target entity data in the update record repository; the entity data updating module may be configured to update the target entity data in the entity data repository according to the target data update instruction to generate updated target entity data in the entity data repository; the first target update record determining module may be configured to determine target difference data between the updated target entity data and the target entity data, and determine a first target update record of the updated target entity data according to the target difference data; the first target update record storing module may be configured to store the first target update record and the first update record address in a second target update record address in the update record repository; and the second target update record address associating module may be configured to associatively store the second target update record address with the updated target entity data in the entity data repository to complete the update of the target database.
[0011] In some embodiments, the first target update record determination module may include: an update record tracing sub-module, a target entity data snapshot determination sub-module, and a first target update record determination first module.
[0012] Among them, the update record tracing sub-module may be configured to trace back N update records of the target entity data in the update record repository according to the first update record address, where the N update records are difference value type data or entity snapshot type data, and N is an integer greater than or equal to 1; the first target entity data snapshot determination sub-module may be configured to, if the Nth update record traced back is the entity snapshot type data, determine the target entity data snapshot corresponding to the updated target entity data according to the N update records and the target difference data; the first target update record determination first module may be configured to use the target entity data snapshot of the updated target entity data as the first target update record.
[0013] In some embodiments, the target entity data snapshot determination sub-module may include: a target entity data recovery unit and a target entity data snapshot determination unit.
[0014] Among them, the target entity data recovery unit may be configured to determine the target entity data according to the N update records; the target entity data snapshot determination unit may be configured to determine the target entity data snapshot corresponding to the updated target entity data according to the target entity data and the target difference data.
[0015] In some embodiments, the target entity data includes a first sub-entity, the first sub-entity corresponds to a first identification code, and the target entity data is associated with the first sub-entity through the first identification code; among them, the target entity data snapshot determination unit may include: a first sub-entity update sub-unit, a second sub-entity snapshot determination unit, and an identification code re-association unit.
[0016] Among them, the first sub-entity update sub-unit may be configured to determine that the first sub-entity in the target entity data is updated to a second sub-entity according to the target difference data; the second sub-entity snapshot determination unit may be configured to generate a second sub-entity snapshot according to the second sub-entity, and the second sub-entity snapshot corresponds to a second identification code; the identification code re-association unit may be configured to remove the association relationship between the target entity data and the first identification code, and associate the target entity data with the second sub-entity snapshot through the second identification code to generate the target entity data snapshot.
[0017] In some embodiments, the first target update record determination module may further include: a target entity data snapshot determination second sub-module.
[0018] Wherein, the target entity data snapshot determination second sub-module may be configured to, if the Nth update record traced upward is the differential value type data, use the target differential data as the first target update record.
[0019] In some embodiments, the data processing device may further include: a target addition instruction determination module, an addition storage module, a first update record address generation module, and a first update record address association storage module.
[0020] Wherein, the target addition instruction determination module may be configured to obtain a target addition instruction, and the target addition instruction includes the target entity data; the addition storage module may be configured to add and store the target entity data in the entity data repository according to the target addition instruction; the first update record address generation module may be configured to store the target entity data as a snapshot at the first update record address in the update record repository; the first update record address association storage module may be configured to associatively store the first update record address with the target entity data in the entity data repository to complete the addition operation of the target entity data.
[0021] In some embodiments, the first update record address includes the data update system time corresponding to the latest update record; wherein, the first target update record storage module may include: a real-time determination sub-module, a system time determination sub-module, and a first storage sub-module.
[0022] Wherein, the real-time determination sub-module may be configured to obtain the real time when the updated target entity data is generated; the system time determination sub-module may be configured to determine the system time when the updated target entity data is generated according to the real time when the updated target entity data is generated, wherein the time granularity of the system time is M times the time granularity of the real time, and M is an integer greater than or equal to 1; the first storage sub-module may be configured to determine that the system time when the updated target entity data is generated is different from the data update system time corresponding to the latest update record, and then store the first target update record and the first update record address at the second target update record address in the update record repository.
[0023] In some embodiments, the storage address of the previous update record of the target entity data is stored in the first update record address; wherein the first target update record storage module may include: a second storage sub-module.
[0024] Wherein, the second storage sub-module may be configured to determine that the system time for generating the updated target entity data is the same as the data update system time corresponding to the latest update record, and then update the latest update record corresponding to the target entity data in the first update record address with the first target update record.
[0025] In some embodiments, the data processing device may further include: a data recovery instruction determination module, a first update record address determination module, a second target update record tracing module, and a snapshot type data determination module.
[0026] Wherein, the data recovery instruction determination module may be configured to obtain a data recovery instruction for the target entity data at a target system time point; the first update record address determination module may be configured to determine a first update record address corresponding to the target entity data in the entity data repository; the second target update record tracing module may be configured to trace upward according to the first update record address to obtain a second target update record corresponding to the target entity data at the target system time point; the snapshot type data determination module may be configured to determine that if the second target update record corresponding to the target entity data at the target system time point is entity snapshot type data, then the second target update record is the data corresponding to the target entity data at the target system time point.
[0027] In some embodiments, the data processing device may further include: a difference value type data determination module and a data recovery module.
[0028] Wherein, the difference value type data determination module may be configured to continue tracing upward until the snapshot type data of the target entity data that is closest to the second target update record in terms of time if the second target update record corresponding to the target system time point is difference value type data; the data recovery module may be configured to determine the data corresponding to the target entity data at the target system time point according to all the update records between the second target update record and the snapshot type data of the target entity data that is closest to the second target update record in terms of time.
[0029] An embodiment of the present disclosure provides an electronic device, which includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the data processing method described in any one of the above.
[0030] An embodiment of the present disclosure provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the data processing method described in any one of the above.
[0031] An embodiment of the present disclosure provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to enable the computer device to execute the above data processing method.
[0032] On the one hand, the data processing method provided by the embodiment of the present disclosure records the update record data of the target entity data by updating the record repository, so as to recover the target entity data; on the other hand, by associatively storing the storage address of the update record data with the target entity data, it is convenient to find the latest update record of the target entity data in the update record repository in a timely manner according to the target entity data; finally, by associatively storing the address of the previous update record of the target entity data (i.e., the first update record address) with the current update record data (i.e., the first target update record), a chained storage structure can be formed for the update records of the target entity data, so as to trace back all the update records of the target entity data upward. In short, through the technical solution provided by the present disclosure, the target entity data can be restored to any point in time.
[0033] It should be understood that the above general description and the following detailed description are only exemplary and do not limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present disclosure and used together with the specification to explain the principles of the present disclosure. Obviously, the accompanying drawings in the following description are only some embodiments of the present disclosure, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings.
[0035] Figure 1 A schematic diagram showing an exemplary system architecture to which the data processing method or data processing device in the embodiment of the present disclosure is applied.
[0036] Figure 2 A schematic diagram showing the structure of an electronic device suitable for implementing the embodiment of the present disclosure.
[0037] Figure 3 A flowchart of a data processing method shown according to an exemplary embodiment.
[0038] Figure 4 An architecture diagram of a target database shown according to an exemplary embodiment.
[0039] Figure 5 is Figure 3 A flowchart of step S4 in an exemplary embodiment.
[0040] Figure 6 It is a schematic diagram of a storage structure for updating records shown according to an exemplary embodiment.
[0041] Figure 7 It is a schematic diagram of an entity structure shown according to an exemplary embodiment.
[0042] Figure 8 is Figure 3 The flowchart of step S6 in [a certain context] according to an exemplary embodiment.
[0043] Figure 9 It is a schematic diagram of a modified timeline shown according to an exemplary embodiment.
[0044] Figure 10 It is a flowchart of a data processing shown according to an exemplary embodiment.
[0045] Figure 11 It is a data recovery method shown according to an exemplary embodiment.
[0046] Figure 12 It is a data processing method shown according to an exemplary embodiment.
[0047] Figure 13 It is a block diagram of a data processing device shown according to an exemplary embodiment. Detailed implementation manners
[0048] Example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. Like reference numerals in the figures denote like or similar parts, and thus their repetitive description will be omitted.
[0049] The features, structures, or characteristics described in this disclosure can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of this disclosure. However, those skilled in the art will realize that one or more of the specific details can be omitted in practicing the technical solutions of this disclosure, or other methods, components, devices, steps, etc. can be adopted. In other cases, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of this disclosure.
[0050] The accompanying drawings are only schematic illustrations of the present disclosure. The same reference numerals in the drawings denote the same or similar parts, and thus repeated descriptions thereof will be omitted. Some of the block diagrams shown in the drawings do not necessarily have to correspond to physically or logically independent entities. These functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0051] The flowcharts shown in the accompanying drawings are only exemplary illustrations, and do not necessarily include all contents and steps, nor do they necessarily have to be executed in the described order. For example, some steps can be decomposed, while some steps can be combined or partially combined. Therefore, the actual execution order may change according to the actual situation.
[0052] In this specification, the terms "a", "one", "the", "said" and "at least one" are used to indicate the presence of one or more elements / components / etc.; the terms "comprising", "including" and "having" are used to mean an open inclusion and mean that there may be additional elements / components / etc. in addition to the listed elements / components / etc.; the terms "first", "second" and "third", etc. are only used as labels and are not a limitation on the quantity of their objects.
[0053] The exemplary embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0054] Figure 1 A schematic diagram of an exemplary system architecture to which the data processing method or data processing device according to the embodiments of the present disclosure can be applied is shown.
[0055] As Figure 1 shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0056] Users can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages (such as target data update instructions, data recovery instructions, or target addition instructions, etc.). Among them, the terminal devices 101, 102, 103 may be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, wearable devices, virtual reality devices, smart homes, etc.
[0057] Server 105 can be a server that provides various services, such as a background management server that supports the operations performed by users using terminal devices 101, 102, and 103. The background management server can analyze and process data such as received requests, and feedback the processing results to the terminal devices.
[0058] The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The present disclosure does not limit this.
[0059] Server 105 can, for example, obtain a target data update instruction for the target entity data; Server 105 can, for example, according to the target data update instruction, obtain the target entity data and the storage address of the first update record corresponding to the target entity data in the entity data repository from the entity data repository, where the first update record address is the storage address of the latest update record corresponding to the target entity data in the update record repository; Server 105 can, for example, update the target entity data in the entity data repository according to the target data update instruction to generate updated target entity data in the entity data repository; Server 105 can, for example, determine the target difference data between the updated target entity data and the target entity data, and determine the first target update record of the updated target entity data according to the target difference data; Server 105 can, for example, store the first target update record and the first update record address in the second target update record address of the update record repository; Server 105 can, for example, associate and store the second target update record address with the updated target entity data in the entity data repository to complete the update of the target database.
[0060] It should be understood that Figure 1 the numbers of the terminal devices, networks, and servers in
[0061] Figure 2 are merely illustrative. Server 105 can be a single physical server or composed of multiple servers. According to actual needs, there can be any number of terminal devices, networks, and servers. Figure 2 The structural schematic diagram of the electronic device shown in
[0062] is suitable for use in implementing the terminal device or server of the embodiments of the present disclosure. It should be noted that Figure 2As shown, the electronic device 200 includes a central processing unit (CPU) 201, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 202 or programs loaded from a storage section 208 into a random access memory (RAM) 203. In the RAM 203, various programs and data required for the operation of the electronic device 200 are also stored. The CPU 201, ROM 202, and RAM 203 are connected to each other via a bus 204. An input / output (I / O) interface 205 is also connected to the bus 204.
[0063] The following components are connected to the I / O interface 205: an input section 206 including a keyboard, a mouse, etc.; an output section 207 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 208 including a hard disk, etc.; and a communication section 209 including a network interface card such as a LAN card, a modem, etc. The communication section 209 performs communication processing via a network such as the Internet. A drive 210 is also connected to the I / O interface 205 as needed. A removable medium 211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 210 as needed so that a computer program read from it can be installed into the storage section 208 as needed.
[0064] Specifically, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains program codes for performing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 209, and / or installed from the removable medium 211. When the computer program is executed by a central processing unit (CPU) 201, the above functions defined in the system of the present application are executed.
[0065] It should be noted that the computer-readable storage medium shown in this disclosure can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can 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 or 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 this application, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries the computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable storage medium other than the computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable storage medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination of the above.
[0066] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code that 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 blocks can occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0067] The modules and / or sub-modules and / or units and / or sub-units involved in the embodiments of the present application can be implemented in software or in hardware. The described modules and / or sub-modules and / or units and / or sub-units can also be provided in a processor. For example, it can be described as: a processor includes a sending unit, an obtaining unit, a determining unit, and a first processing unit. Among them, the names of these modules and / or sub-modules and / or units and / or sub-units do not constitute a limitation to the modules and / or sub-modules and / or units and / or sub-units themselves in some cases.
[0068] As another aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium can be included in the device described in the above embodiments; or it can exist alone without being assembled into the device. The above computer-readable storage medium carries one or more programs. When the above one or more programs are executed by the device, the functions that the device can implement include: obtaining a target data update instruction for the target entity data; according to the target data update instruction, obtaining the target entity data and the storage address of the first update record corresponding to the target entity data in the entity data repository from the entity data repository, where the first update record address is the storage address of the latest update record corresponding to the target entity data in the update record repository; updating the target entity data in the entity data repository according to the target data update instruction to generate updated target entity data in the entity data repository; determining the target difference data between the updated target entity data and the target entity data, and determining the first target update record of the updated target entity data according to the target difference data; storing the first target update record and the first update record address in the second target update record address of the update record repository; and associatively storing the second target update record address and the updated target entity data in the entity data repository to complete the update of the target database.
[0069] The four-dimensional physical world includes three-dimensional space plus one-dimensional time (the high-dimensional space mentioned in modern microphysics means something else and has only mathematical significance). In the four-dimensional space, as humans, we can move freely to a limited extent in three-dimensional space, but in the dimension of time, we can only go with the flow.
[0070] In various scientific conjectures, as well as in movies and science fiction novels, people are not satisfied with going with the flow of time and hope to be able to freely switch the time point they are in through some means. A common point of such conjectures is that the switching of time points is through some kind of "transmission" (faster than light, through a black hole), so that they can reach another time and space different from the current time point.
[0071] Change your thinking. First of all, the real world is composed of matter. In fact, time itself can also be understood as being composed of matter. A time point has its meaning because the matter that makes up the real world at this time point is different from all other time points.
[0072] Therefore, time actually reflects the state of all the matter that makes up the real world. If we restore all the matter that makes up the current world to the state n years ago, then the real world will go back n years. If we restore all the matter that makes up the current world to the state n years ago, but maintain the matter that makes up a certain person in the current time state, then this person has completed "time travel".
[0073] However, it is impossible to change the material state of the entire world or the entire universe with the current technological level. Even changing the material state in a small piece of space completely seems impossible at present, because the change needs to be complete, but we still cannot confirm what the smallest particles that make up matter are, nor can we achieve a complete "atomization" change. But at the software level, or in a digital system level, this design concept can be fully realized, because all variables are finite, known, and controllable. As long as the state of all variables at each time point can be recorded, then the software or system can be restored to the state at any past time point, just like we can drag the progress bar of a video at will. And in a software or system, what bears this "going back to the past" ability is a database that supports backtracking data to any time point to be realized by the present invention.
[0074] How can we achieve backtracking data to any past time point? The most intuitive implementation method is to save the data of each time point. For a video, it is to completely save the picture of each frame at each time point. The data of a frame of picture can be saved by a matrix. For example, for a 1080P video, each frame of picture is a 1920*1080 matrix, and each element in the matrix is a group of three values representing RGB values.
[0075] For our real world, assuming that the entire universe is finite in size, the space of the universe can be described by a 3D coordinate system, with a size of X*Y*Z, and the unit is an unknown smallest particle. Assuming that the state of the smallest particle is also finite and can be described by K, and then assuming that there is also a smallest granularity for time, then in this way, we can also use a set of data to describe each time point in the real world, and the data volume of each time point is X*Y*Z*K.
[0076] However, directly storing the state at each time point will ultimately lead to an extremely large amount of data. Taking a 90-minute video as an example, an average video has 30 frames per second. So, in 30 minutes, there are 90 * 60 * 30 frames; each frame has 1920 * 1080 data points, and the data of each data point consists of 3 numerical values representing RGB values. A numerical value can take values from 0 to 256 and requires 2 bytes to store. Then the cumulative data volume is: 90 * 30 * 60 * 1920 * 1080 * 3 * 2 = 1.88TB. However, in reality, the size of a movie is approximately one-thousandth of this data because there are various compression algorithms for pictures and various compression algorithms for videos, and there is no need to save the value of each pixel one by one. Similarly, in the design of a database, a suitable way also needs to be found to record the data snapshot at each time point at a relatively low cost.
[0077] Currently, there are relatively many products of time-series databases on the market. However, the time-series database and the database of the present invention are only similar in name, and their actual characteristics and the problem scenarios they can solve are different. The time-series database in the prior art is a series of data based on time, connecting these data points into a line in the time coordinate. Looking back in time, multi-dimensional reports can be made to reveal its trends, regularities, and anomalies. The time-series database focuses on the changes in data over time and needs to solve the storage of massive data over time and the reading of data within a sequential time period sorted by time.
[0078] The database of the present invention focuses on the recoverability of data at any past time point. The goal to be achieved is that the products or systems using this database can restore the data state at any past time point.
[0079] Figure 3 It is a flowchart of a data processing method shown according to an exemplary embodiment. The method provided by the embodiments of the present disclosure can be executed by any electronic device with computing and processing capabilities. For example, this method can be executed by the server or terminal device in the above Figure 1 embodiment, or can be jointly executed by the server and the terminal device. In the following embodiments, the server is taken as the execution entity for example, but the present disclosure is not limited thereto.
[0080] As Figure 4 shown, the target database in the embodiments of the present disclosure may include an entity data repository and an update record repository. Among them, the entity data repository is used to store entity data and the update record address corresponding to the entity data, and the update record repository is used to store the update records of the entity data. Among them, the entity data stored in the entity data repository includes target entity data.
[0081] The entity data repository and the update record repository can be stored on the same disk or on different disks, and the present disclosure does not limit this.
[0082] It should be noted that the update record address corresponding to the entity data is the storage address of the previous update record of the entity data in the update record repository.
[0083] An entity is an objectively existing and distinguishable thing. In terms of a database, an entity often refers to a collection of certain types of things. It can be a specific person, thing, or an abstract concept, relationship, etc.
[0084] Refer to Figure 3 , the data processing method provided by the embodiments of the present disclosure may include the following steps.
[0085] Step S1, obtain a target data update instruction for the target entity data.
[0086] Step S2, according to the target data update instruction, obtain the target entity data and the first update record address corresponding to the target entity data from the entity data repository, where the first update record address is the storage address of the latest update record corresponding to the target entity data in the update record repository.
[0087] The target entity data can be retrieved from the entity data repository according to the target data update instruction, and then the first update record address associated with the target entity data is determined. Among them, the first update record address is the storage address of the latest update record corresponding to the target entity data (that is, the update record closest to the previous system time (including the update record corresponding to the previous system time)) in the update record repository.
[0088] Among them, the time granularity of the system time can be the same as that of the real time, for example, both are one second, and the time granularity of the system time can also be different from that of the real time. For example, the time granularity of the real time is 1 second, while the time granularity of the system time is one month, and the present disclosure does not limit this.
[0089] Step S3, update the target entity data in the entity data repository according to the target data update instruction to generate updated target entity data in the entity data repository.
[0090] Step S4, determine the target difference data between the updated target entity data and the target entity data, and determine the first target update record of the updated target entity data according to the target difference data;
[0091] In an embodiment, the target difference data may be determined based on the updated target entity data and the target entity data, or the target difference data may be determined according to the target data update instruction. The present disclosure places no limitation thereon.
[0092] Step S5: Store the first target update record and the first update record address in the second target update record address of the update record repository.
[0093] In an embodiment, the first target update record and the first update record address may be stored sequentially (append) on the disk where the update record repository is located after being associated, or the first target update record and the first update record address may be stored randomly on the disk where the update record repository is located after being associated. The present disclosure places no limitation thereon. Among them, the storage address of the first target update record in the update record repository is the second target update record address.
[0094] It should be understood that the purpose of associatively storing the first target update record and the first update record address in the second target update record address is to store all the update records of the target entity data in a chained manner in chronological order, so as to perform chained queries on the update records of the target entity data.
[0095] As Figure 4 shown in the update record storage architecture in the lower right corner, the update records of each entity are stored in a chained manner. All the update records of an entity can be traced upward in a chained manner through the latest record of the entity. For example, when the address of the latest update record "Data X" of entity 1 is determined, the previous update record "Data X + 1" of entity 1 can be traced upward.
[0096] Step S6: Associatively store the second target update record address and the updated target entity data in the entity data repository to complete the update of the target database.
[0097] It should be understood that associatively storing the second target update record address and the updated target entity data can facilitate the user to promptly find the latest update record corresponding to the updated target entity data after finding the updated target entity data, and then perform chained queries on the update records of the updated target entity data arranged in chronological order.
[0098] The technical solution provided by the embodiments of the present disclosure, on the one hand, records the update record data of the target entity data by updating the record repository, so as to recover the target entity data; on the other hand, stores the record address of the update record data in association with the target entity data, so as to find the latest update record of the target entity data in the update record repository in a timely manner; finally, stores the previous update record address (i.e., the first update record address) of the target entity data in association with the current update record data (i.e., the first target update record), which can form a chained storage structure for the update records of the target entity data, so as to trace back all the update records of the target entity data upward. Through the technical solution provided by the embodiments of the present disclosure, the target entity data can be restored to any time point.
[0099] Figure 5 Yes Figure 3 It is a flowchart of step S4 in an exemplary embodiment.
[0100] For the target entity data, if a full copy of the data is saved for each system time point, the final data volume of the system will be extremely large. Therefore, the present disclosure proposes the following methods to save database memory.
[0101] 1. Update only when there is a change, that is, save the update record only when there is an update.
[0102] 2. Adopt the (N - 1)*1 method as shown in Figure 6 to save the update record, that is, first record a snapshot of the target entity, and then record (N - 1) differences (OperLog). The difference is also the different part of the updated target entity data corresponding to the target entity data. If (N - 1) differences have been recorded, when the next update record arrives, calculate a complete data snapshot based on the previous (N - 1) differences and the previous snapshot.
[0103] For a large entity composed of sub-entities, the update method is similar. Only the combination of the snapshot IDs of the sub-entities is updated.
[0104] Adopt the (N - 1)*1 method as shown in Figure 6 to save the update record, and the solution may include the steps as shown in Figure 5 and specifically may include the following process.
[0105] In step S41, trace back N update records of the target entity data upward in the update record repository according to the first update record address. The N update records are difference value type data or entity snapshot type data, and N is an integer greater than or equal to 1.
[0106] In some embodiments, since each update record address in the update record repository stores not only the update record data but also the address of the previous update record of the update record, the association of all update records of the target entity data can be realized through chained storage. For example, for the target entity data, if the first update record of the target entity data is stored at the first address and the second update record of the target entity data is stored at the second address, then the first address information will also be stored at the second address correspondingly.
[0107] Therefore, after obtaining the storage address (the first update address) of the latest update record corresponding to the target entity data, the update records of N target entity data can be traced upwards in a chain.
[0108] Among them, the differential value type data refers to the data that stores the differential change situation of the target entity data before and after the data update. For example, if the target entity data includes the attribute information of a certain user, and the attribute information includes the weight information of the user, then the differential change situation of the target entity data before and after the update may only include the weight change situation of the user, which can be recorded as "Weight: 60 - 70" (that is, the weight changes from 60 to 70).
[0109] The snapshot type data refers to the data that describes all the data situations of the target entity data at a certain moment, that is, all the attribute information of the above-mentioned user will be presented in the snapshot, that is, it will not only include the changed weight information, but also may include the unchanged name information, etc.
[0110] For example, assume that we have an entity called person_status, which describes a person's physical status, and it has 3 attributes: name, weight, and body fat. The snapshot of a person in March 2020 can be:
[0111] {
[0112] “Name”:”Jhon”,
[0113] “Weight”:70,
[0114] “BodyFat”:0.20,
[0115] “Date”:202003
[0116] }
[0117] After Jhon lost weight for a year, his snapshot in March 2021 can be:
[0118] {
[0119] “Name”:”Jhon”,
[0120] "Weight": 60,
[0121] "BodyFat": 0.10,
[0122] "Date": 202103
[0123] }。
[0124] In step S42, if the Nth update record traced upward is the entity snapshot class data, then determine the target entity data snapshot corresponding to the updated target entity data according to the N update records and the target difference data.
[0125] Generally speaking, the Nth update record is snapshot class data, and the 1st to (N - 1)th update records can all be difference value class data. Then, the target entity data can be restored according to the N update records; then, determine the target entity data snapshot corresponding to the updated target entity data according to the target entity data and the target difference data.
[0126] An entity is the basic unit of data. A large entity is composed of multiple small entities, and the smallest entity is composed of basic data types (such as integer, floating point, string, etc.). In this way, it is natural to support viewing the historical data versions of specified entities. The division of entities is determined according to specific business types and is not restricted.
[0127] In some embodiments, a target entity may include multiple sub-entities, and a sub-entity may also include multiple grandchild entities. As Figure 7 shown, entity 0 may include sub-entity 1 and sub-entity 2, and sub-entity 2 may further include grandchild entity 3. When modifying data, the smallest entity can be used as the unit for data modification. Then, when generating snapshot class data from difference value class data, the smallest entity can also be used as the unit for data annotation.
[0128] The recording of snapshots is also carried out according to the granularity of entities. For a smallest entity, it is necessary to record the data snapshots of each smallest time unit. Whenever a sub-entity undergoes addition, deletion, or modification, the snapshot needs to be updated:
[0129] Addition: Add entity data and append the operation time point;
[0130] Deletion: Save a snapshot before deletion to the time line of the current entity;
[0131] Modification: Save a snapshot before modification to the time line of the current entity.
[0132] Each entity snapshot is assigned a unique ID. For a large entity composed of multiple small entities, the data snapshot at a certain point in time is the combination of the data snapshots of all its sub-entities at that time point. Since the sub-entity data may be deleted or added, at each time point, a combination of snapshot IDs corresponding to the sub-entities needs to be saved.
[0133] Specifically, when generating the snapshot, it can be achieved through the following method.
[0134] Suppose the target entity data includes a first sub-entity, the first sub-entity corresponds to a first identification code, and the target entity data is associated with the first sub-entity through the first identification code. Then, determining the target entity data snapshot corresponding to the updated target entity data based on the target entity data and the target difference data may include: determining that the first sub-entity in the target entity data is updated to a second sub-entity according to the target difference data; generating a second sub-entity snapshot according to the second sub-entity, and the second sub-entity snapshot corresponds to a second identification code; removing the association relationship between the target entity data and the first identification code, and associating the target entity data with the second sub-entity snapshot through the second identification code to generate the target entity data snapshot.
[0135] In step S43, the target entity data snapshot of the updated target entity data is used as the first target update record.
[0136] In step S44, if the Nth update record traced upward is the difference value type data, the target difference data is used as the first target update record.
[0137] Through the above method, on the one hand, the storage of all update records is realized, which is convenient for the recovery of entity data; on the other hand, recording the update records in the way of recording the difference values can greatly save the storage space; in addition, inserting snapshot type data in the difference values can quickly recover the time series data according to the adjacent snapshots during data recovery, without calculating the data to be recovered according to all the difference value information of the entity data, which greatly saves the computing resources.
[0138] Figure 8 Yes Figure 3 It is the flowchart of step S6 in an exemplary embodiment.
[0139] In some embodiments, since the data update period of the target database is relatively long and the user only focuses on the changes in the target database over a long time, a system time with a relatively coarse time granularity can be set for the target database.
[0140] For example, assume that the target database stores the weight changes of a target object. Then, the user may only be concerned with the weight information of the object in terms of monthly changes. In this case, the system time granularity of the target database can be set to months.
[0141] It can be understood that if the user is only concerned with the monthly changes of the target database, then when updating and storing the target database, it can also be updated and stored monthly.
[0142] Embodiments of the present disclosure provide a storage method for updating target entity data according to the system time of a target database.
[0143] First, assume that all update records in the present disclosure correspond to a system time, and the first update record address includes the latest update record corresponding to the data update system time.
[0144] Reference Figure 8 , the above step S6 may include the following steps.
[0145] In step S61, obtain the real time when the updated target entity data is generated.
[0146] Currently, the time granularity of real time can be minutes, seconds, etc., and can be infinitely subdivided. It is currently unknown whether time has a minimum granularity, but in the system where our target database is located, time requires a granularity, otherwise the historical data snapshot will tend to be infinite. Therefore, there must be a mapping relationship between system time and real time. The value of the minimum granularity size (unit time granularity size) of a system time needs to be determined according to the business situation of the system. For a system with a small business volume and a long data change interval, the unit time granularity can be set longer, and vice versa.
[0147] In step S62, determine the system time when the updated target entity data is generated according to the real time when the updated target entity data is generated, where the time granularity of the system time is M times the time granularity of the real time, and M is an integer greater than or equal to 1.
[0148] Generally speaking, the time granularity of the system time in the update record repository may be different from the time granularity of the real time, and can be M times the time granularity of the real time. The present disclosure does not limit this.
[0149] Update the time precision of the update record repository according to the time granularity. For example, if the system time granularity is 1 second, the data in the record repository can be traced back to the state at XX:XX:XX on XX / XX / XXXX. If the time granularity is 10 seconds, the data can only be traced back to the state at XX:XX:X0 on XX / XX / XXXX and cannot be more precise to the second.
[0150] After setting the time granularity for the update record repository, each update record needs to be marked with the corresponding system time point. Taking a time granularity of 10 seconds as an example, if the modification time of a piece of data is XX:XX:21 on XX / XX / XXXX, then the corresponding system time point is XX:XX:20 on XX / XX / XXXX. Similarly, if the modification time of a piece of data is XX:XX:3X on XX / XX / XXXX, then the corresponding system time point is XX:XX:30 on XX / XX / XXXX.
[0151] As Figure 9 shown, if the time granularity of the system time of the target database is greater than the actual time, then when modifying the target entity data, one system time can correspond to multiple modifications.
[0152] In step S63, if it is determined that the system time for generating the updated target entity data is different from the data update system time corresponding to the latest update record, then store the first target update record and the first update record address in the second target update record address of the update record repository.
[0153] It can be understood that if the system time for generating the updated target entity data is different from the data update system time corresponding to the latest update record, it is determined that this update and the previous update do not correspond to the same system time, and then a new address can be opened to store the first target update record.
[0154] In step S64, if it is determined that the system time for generating the updated target entity data is the same as the data update system time corresponding to the latest update record, then update the latest update record corresponding to the target entity data in the first update record address with the first target update record.
[0155] It can be understood that if the system time for generating the updated target entity data is the same as the data update system time corresponding to the latest update record, it is determined that this update and the previous update correspond to the same system time, and then only the update record in the first update record address needs to be updated with the first target update record.
[0156] Through the above method, it can be ensured that each system time point corresponds to only one update record, and this update record is the latest update record of the target entity data within this system time. Through the above method, the storage memory of the target database is greatly saved, and in addition, the computing resources during data recovery are also greatly saved.
[0157] Figure 10 is a flowchart of a data processing method shown according to an exemplary embodiment. When executing Figure 3 the embodiments shown can pre-execute the technical solutions shown in this embodiment.
[0158] Refer to Figure 10 , the above data processing method may include the following steps.
[0159] In step S01, obtain a target addition instruction, and the target addition instruction includes the target entity data.
[0160] In step S02, store the target entity data in the entity data repository according to the target addition instruction.
[0161] In step S03, store the target entity data as a snapshot at the first update record address in the update record repository.
[0162] In step S04, associate and store the first update record address with the target entity data in the entity data repository to complete the addition operation of the target entity data.
[0163] Through the technical solution provided by this embodiment, target entity data can be newly added to the target database.
[0164] Figure 11 is a data recovery method shown according to an exemplary embodiment.
[0165] Refer to Figure 11 , the above data recovery method may include the following steps.
[0166] In step S001, obtain a data recovery instruction of the target entity data at a target system time point.
[0167] In step S002, determine the first update record address corresponding to the target entity data in the entity data repository.
[0168] In step S003, trace back the second target update record corresponding to the target entity data at the target system time point according to the first update record address.
[0169] In step S004, if the second target update record corresponding to the target entity data at the target system time point is entity snapshot data, then the second target update record is the data corresponding to the target entity data at the target system time point.
[0170] In step S005, if the second target update record corresponding to the target system time point is difference value data, continue to trace upward until the snapshot data of the target entity data that is closest to the second target update record in terms of time.
[0171] In step S006, determine the data corresponding to the target entity data at the target system time point based on all the update records between the second target update record and the snapshot data of the target entity data that is closest to the second target update record in terms of time.
[0172] In some embodiments, when the second target update record corresponding to the target system time point is difference value data, restore the snapshot corresponding to the target system time point from the second target update record to the snapshot data of the target entity data that is closest to the second target update record in terms of time, and use it as the data corresponding to the target system time point.
[0173] Through the above method, it is possible to restore the data of the target entity data at the target system time point, occupy less storage memory, and improve the data recovery efficiency.
[0174] Figure 12 It is a data processing method shown according to an exemplary embodiment. Refer to Figure 12 , the above data processing method may include the following steps: in response to a data update instruction, update the data of the corresponding target entity in the current library; according to the first update record address corresponding to the target entity recorded in the entity data repository, find the corresponding update record in the update record repository, and determine whether it is necessary to calculate a snapshot; if it is necessary to calculate a snapshot, calculate the snapshot based on the update record in the update record repository and the data update instruction, and then append the snapshot and the first update record address value to the disk where the update record repository is located in sequence; if it is not necessary to calculate a snapshot, directly append the difference value between the target entity before and after the update and the first update record address to the disk in sequence; obtain the storage address of the difference value between the target entity before and after the update, and update this address to the target entity information in the entity data repository.
[0175] The technical solution provided in this embodiment, on the one hand, records the update record data of the target entity data by updating the record repository to facilitate the recovery of the target entity data; on the other hand, the record address of the update record data is associated and stored with the target entity data to facilitate the timely finding of the latest update record of the target entity data in the update record repository; finally, by associating and storing the previous update record address (i.e., the first update record address) of the target entity data with the current update record data (i.e., the first target update record), a chained storage structure can be formed for the update records of the target entity data to facilitate tracing back all the update records of the target entity data. In short, through the technical solution provided in the embodiments of the present disclosure, the target entity data can be restored to any point in time.
[0176] Figure 13 is a block diagram of a data processing device shown according to an exemplary embodiment. Referring to Figure 13 , the data processing device 1300 provided in the embodiments of the present disclosure may include: a target data update instruction acquisition module 1301, a target entity data acquisition module 1302, an entity data update module 1303, and a first target update record determination module 1304.
[0177] Among them, the target data update instruction acquisition module 1301 may be configured to acquire a target data update instruction for the target entity data; the target entity data acquisition module 1302 may be configured to acquire the target entity data and the corresponding first update record address of the target entity data from the entity data repository according to the target data update instruction, where the first update record address is the storage address of the latest update record corresponding to the target entity data in the update record repository; the entity data update module 1303 may be configured to update the target entity data in the entity data repository according to the target data update instruction to generate updated target entity data in the entity data repository; the first target update record determination module 1304 may be configured to determine the target difference data between the updated target entity data and the target entity data, and determine the first target update record of the updated target entity data according to the target difference data; the first target update record storage module 1305 may be configured to store the first target update record and the first update record address in the second target update record address of the update record repository; the second target update record address association module 1306 may be configured to associate and store the second target update record address with the updated target entity data in the entity data repository to complete the update of the target database.
[0178] In some embodiments, the first target update record determination module 1304 may include: an update record tracing sub-module, a target entity data snapshot determination sub-module, and a first target update record determination first module.
[0179] Among them, the update record tracing sub-module may be configured to trace back N update records of the target entity data in the update record repository according to the first update record address, where the N update records are difference value type data or entity snapshot type data, and N is an integer greater than or equal to 1; the first target entity data snapshot determination sub-module may be configured to, if the Nth update record traced back is the entity snapshot type data, determine the target entity data snapshot corresponding to the updated target entity data according to the N update records and the target difference data; the first target update record determination first module may be configured to use the target entity data snapshot of the updated target entity data as the first target update record.
[0180] In some embodiments, the target entity data snapshot determination sub-module may include: a target entity data recovery unit and a target entity data snapshot determination unit.
[0181] Among them, the target entity data recovery unit may be configured to determine the target entity data according to the N update records; the target entity data snapshot determination unit may be configured to determine the target entity data snapshot corresponding to the updated target entity data according to the target entity data and the target difference data.
[0182] In some embodiments, the target entity data includes a first sub-entity, the first sub-entity corresponds to a first identification code, and the target entity data is associated with the first sub-entity through the first identification code; among them, the target entity data snapshot determination unit may include: a first sub-entity update sub-unit, a second sub-entity snapshot determination unit, and an identification code re-association unit.
[0183] Among them, the first sub-entity update sub-unit may be configured to determine that the first sub-entity in the target entity data is updated to a second sub-entity according to the target difference data; the second sub-entity snapshot determination unit may be configured to generate a second sub-entity snapshot according to the second sub-entity, and the second sub-entity snapshot corresponds to a second identification code; the identification code re-association unit may be configured to remove the association relationship between the target entity data and the first identification code, and associate the target entity data with the second sub-entity snapshot through the second identification code to generate the target entity data snapshot.
[0184] In some embodiments, the first target update record determination module 1304 may further include: a second sub-module for determining a snapshot of the target entity data.
[0185] Wherein, the second sub-module for determining a snapshot of the target entity data may be configured to use the target difference data as the first target update record if the Nth update record traced upward is the difference value type data.
[0186] In some embodiments, the data processing device 1300 may further include: a target addition instruction determination module, an addition storage module, a first update record address generation module, and a first update record address association storage module.
[0187] Wherein, the target addition instruction determination module may be configured to obtain a target addition instruction, and the target addition instruction includes the target entity data; the addition storage module may be configured to add and store the target entity data in the entity data repository according to the target addition instruction; the first update record address generation module may be configured to store the target entity data as a snapshot in the first update record address of the update record repository; the first update record address association storage module may be configured to associate and store the first update record address with the target entity data in the entity data repository to complete the addition operation of the target entity data.
[0188] In some embodiments, the first update record address includes the data update system time corresponding to the latest update record; wherein, the first target update record storage module 1305 may include: a real-time determination sub-module, a system time determination sub-module, and a first storage sub-module.
[0189] Wherein, the real-time determination sub-module may be configured to obtain the real time for generating the updated target entity data; the system time determination sub-module may be configured to determine the system time for generating the updated target entity data according to the real time for generating the updated target entity data, where the time granularity of the system time is M times that of the real time, and M is an integer greater than or equal to 1; the first storage sub-module may be configured to determine that the system time for generating the updated target entity data is different from the data update system time corresponding to the latest update record, and then store the first target update record and the first update record address in the second target update record address of the update record repository.
[0190] In some embodiments, the storage address of the previous update record of the target entity data is stored in the first update record address; wherein the first target update record storage module 1305 may include: a second storage sub-module.
[0191] Wherein, the second storage sub-module may be configured to determine that the system time for generating the updated target entity data is the same as the data update system time corresponding to the latest update record, and then update the latest update record corresponding to the target entity data in the first update record address with the first target update record.
[0192] In some embodiments, the data processing device 1300 may further include: a data recovery instruction determination module, a first update record address determination module, a second target update record tracing module, and a snapshot type data determination module.
[0193] Wherein, the data recovery instruction determination module may be configured to obtain a data recovery instruction for the target entity data at a target system time point; the first update record address determination module may be configured to determine a first update record address corresponding to the target entity data in the entity data repository; the second target update record tracing module may be configured to trace upward according to the first update record address to obtain a second target update record corresponding to the target entity data at the target system time point; the snapshot type data determination module may be configured to determine that if the second target update record corresponding to the target entity data at the target system time point is entity snapshot type data, then the second target update record is the data corresponding to the target entity data at the target system time point.
[0194] In some embodiments, the data processing device 1300 may further include: a difference value type data determination module and a data recovery module.
[0195] Wherein, the difference value type data determination module may be configured to continue tracing upward until the snapshot type data of the target entity data that is closest in time to the second target update record if the second target update record corresponding to the target system time point is difference value type data; the data recovery module may be configured to determine the data corresponding to the target entity data at the target system time point according to all update records between the second target update record and the snapshot type data of the target entity data that is closest in time to the second target update record.
[0196] Since the functions of the device 1300 have been described in detail in their corresponding method embodiments, the present disclosure will not be elaborated herein.
[0197] Based on the descriptions of the above embodiments, those skilled in the art can easily understand that the exemplary embodiments described herein can be implemented by software or by a combination of software and necessary hardware. Therefore, the technical solutions of the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including several instructions for causing a computing device (such as a personal computer, a server, a mobile terminal, or a smart device, etc.) to execute the method according to the embodiments of the present disclosure, such as Figure 3 one or more of the steps shown in
[0198] In addition, the above drawings are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, rather than for limiting purposes. It is easy to understand that the processes shown in the above drawings do not indicate or limit the time sequence of these processes. Additionally, it is also easy to understand that these processes can be executed synchronously or asynchronously in, for example, multiple modules.
[0199] After considering the specification and practicing the disclosure herein, those skilled in the art will readily conceive of other embodiments of the present disclosure. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common general knowledge or conventional technical means in the technical field not claimed in the present disclosure. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present disclosure are pointed out by the claims.
[0200] It should be understood that the present disclosure is not limited to the detailed structures, drawing methods, or implementation methods shown herein. On the contrary, the present disclosure intends to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims
1. A data processing method, characterized in that, The target database includes an entity data repository and an update record repository. The entity data repository is used to store entity data and the update record address corresponding to the entity data, and the entity data includes target entity data. Among them, the method includes: Obtain a target data update instruction for the target entity data; According to the target data update instruction, obtain the target entity data and the first update record address corresponding to the target entity data from the entity data repository. The first update record address is the storage address of the latest update record corresponding to the target entity data in the update record repository; Update the target entity data in the entity data repository according to the target data update instruction to generate updated target entity data in the entity data repository; Determine the target difference data between the updated target entity data and the target entity data, and determine the first target update record of the updated target entity data according to the target difference data; Store the first target update record and the first update record address in the second target update record address of the update record repository; Associate and store the second target update record address with the updated target entity data in the entity data repository to complete the update of the target database.
2. The method according to claim 1, wherein Determining the first target update record of the updated target entity data according to the target difference data includes: Trace back N update records of the target entity data in the update record repository according to the first update record address. The N update records are difference value type data or entity snapshot type data, and N is an integer greater than or equal to 1; If the Nth update record traced back is the entity snapshot type data, determine the target entity data snapshot corresponding to the updated target entity data according to the N update records and the target difference data; Use the target entity data snapshot of the updated target entity data as the first target update record.
3. The method according to claim 2, wherein Determining the target entity data snapshot corresponding to the updated target entity data according to the N update records and the target difference data includes: Determine the target entity data according to the N update records; Determine the target entity data snapshot corresponding to the updated target entity data according to the target entity data and the target difference data.
4. The method according to claim 3, characterized in that, The target entity data includes a first sub-entity, the first sub-entity corresponds to a first identification code, and the target entity data is associated with the first sub-entity through the first identification code. Among them, determining the target entity data snapshot corresponding to the updated target entity data according to the target entity data and the target difference data includes: Determine that the first sub-entity in the target entity data is updated to a second sub-entity according to the target difference data; Generate a second sub-entity snapshot according to the second sub-entity, and the second sub-entity snapshot corresponds to a second identification code; Remove the association between the target entity data and the first identification code, and associate the target entity data with the second sub-entity snapshot through the second identification code to generate a snapshot of the target entity data.
5. The method according to claim 2, characterized in that, Determining a first target update record of the updated target entity data according to the target difference data further includes: If the Nth update record traced upward is the difference value type data, then use the target difference data as the first target update record.
6. The method according to claim 1, wherein Before obtaining a target data update instruction for the target entity data, it includes: Obtain a target addition instruction, where the target addition instruction includes the target entity data; Add and store the target entity data in the entity data repository according to the target addition instruction; Store the target entity data as a snapshot in the first update record address of the update record repository; Associate and store the first update record address with the target entity data in the entity data repository to complete the addition operation of the target entity data.
7. The method according to claim 1, wherein The first update record address includes the data update system time corresponding to the latest update record; where storing the first target update record and the first update record address in the second target update record address of the update record repository includes: Obtain the actual time when the updated target entity data is generated; Determine the system time when the updated target entity data is generated according to the actual time when the updated target entity data is generated, where the time granularity of the system time is M times the time granularity of the actual time, and M is an integer greater than or equal to 1; If it is determined that the system time when the updated target entity data is generated is different from the data update system time corresponding to the latest update record, then store the first target update record and the first update record address in the second target update record address of the update record repository.
8. The method according to claim 7, wherein The storage address of the previous update record of the target entity data is stored in the first update record address; where the method further includes: If it is determined that the system time when the updated target entity data is generated is the same as the data update system time corresponding to the latest update record, then update the latest update record corresponding to the target entity data in the first update record address through the first target update record.
9. The method according to claim 1, wherein It further includes: Obtain a data recovery instruction for the target entity data at a target system time point; Determine the first update record address corresponding to the target entity data in the entity data repository; Trace upward the second target update record corresponding to the target entity data at the target system time point according to the first update record address; If the second target update record corresponding to the target entity data at the target system time point is entity snapshot type data, then the second target update record is the data corresponding to the target entity data at the target system time point.
10. The method according to claim 9, wherein It further includes: If the second target update record corresponding to the target system time point is differential value type data, continue to trace upward until the snapshot type data of the target entity data that is closest in time to the second target update record is reached; Determine the data corresponding to the target entity data at the target system time point according to all the update records between the second target update record and the snapshot type data of the target entity data that is closest in time to the second target update record.
11. A data processing device, characterized in that, The target database includes an entity data repository and an update record repository. The entity data repository is used to store entity data and the update record address corresponding to the entity data. The entity data includes target entity data. Among them, the device includes: A target data update instruction acquisition module configured to acquire a target data update instruction for the target entity data; A target entity data acquisition module configured to, according to the target data update instruction, acquire the target entity data and the first update record address corresponding to the target entity data from the entity data repository. The first update record address is the storage address of the latest update record corresponding to the target entity data in the update record repository; An entity data update module configured to update the target entity data in the entity data repository according to the target data update instruction to generate updated target entity data in the entity data repository; A first target update record determination module configured to determine the target difference data between the updated target entity data and the target entity data, and determine the first target update record of the updated target entity data according to the target difference data; A first target update record storage module configured to store the first target update record and the first update record address in the second target update record address in the update record repository; A second target update record address association module configured to associate and store the second target update record address with the updated target entity data in the entity data repository to complete the update of the target database.
12. An electronic device, characterized in that, Includes: A memory; And A processor coupled to the memory. The processor is configured to execute the data processing method according to any one of claims 1-10 based on instructions stored in the memory.
13. A computer-readable storage medium having a program stored thereon, and when the program is executed by a processor, the data processing method according to any one of claims 1-10 is implemented.
Citation Information
Patent Citations
Method and device for managing database logs
CN104516959A
Data recovery method and device, storage medium and processor
CN111078719A