WO2021227860A1 - 一种数据同步的方法、装置、终端以及存储介质 - Google Patents

一种数据同步的方法、装置、终端以及存储介质 Download PDF

Info

Publication number
WO2021227860A1
WO2021227860A1 PCT/CN2021/089960 CN2021089960W WO2021227860A1 WO 2021227860 A1 WO2021227860 A1 WO 2021227860A1 CN 2021089960 W CN2021089960 W CN 2021089960W WO 2021227860 A1 WO2021227860 A1 WO 2021227860A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
record
linked list
data linked
records
Prior art date
Application number
PCT/CN2021/089960
Other languages
English (en)
French (fr)
Inventor
黄邦邦
刘玉辉
高华江
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021227860A1 publication Critical patent/WO2021227860A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/215Improving data quality; Data cleansing, e.g. de-duplication, removing invalid entries or correcting typographical errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2358Change logging, detection, and notification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Definitions

  • This application belongs to the field of Internet technology, and in particular relates to a method, device, terminal, and storage medium for data synchronization.
  • a distributed storage method can be used. Users edit data on multiple different terminal devices, and through methods such as timing or quantitative synchronization to ensure the unity of the data, it also solves the problem.
  • the operation of the same data requires editing operation on a device.
  • the existing data synchronization technology generates corresponding operation records every time data is edited.
  • a large number of operation records are stored in multiple distributed nodes at the same time, which takes up a lot of Storage resources reduce the storage efficiency of distributed nodes.
  • the embodiments of the application provide a data synchronization method, device, terminal, and storage medium, which can solve the data synchronization technology.
  • a large number of operation records are stored in multiple distributed nodes at the same time, which takes up a lot of storage resources and has low storage efficiency. problem.
  • an embodiment of the present application provides a data synchronization method, including:
  • the data link includes: a plurality of operation records sorted in sequence based on the operation time;
  • the determining an invalid operation record according to the synchronization identifier of each operation record in the data linked list includes:
  • each of the data linked lists contains the operation record whose synchronization identifier is synchronized, based on the operation time, identifying the last synchronized operation record as a reserved record;
  • the identifying the last synchronized operation record as a reserved record based on the operation time includes:
  • the distributed nodes If any one of the distributed nodes is offline, select any one of the first data linked lists from all the first data linked lists to generate a reserved linked list; the first data linked list means that the distributed node to which it belongs is online The data linked list;
  • the second data linked list is the distributed node to which it belongs The data linked list in an offline state.
  • the identifying the other synchronized operation records except the reserved record as invalid operation records includes:
  • the method further includes:
  • the determining an invalid operation record according to the synchronization identifier of each operation record in the data linked list includes:
  • the deleting the invalidation operation record and updating each of the data linked lists includes:
  • the upper associated byte of the reserved record is adjusted from pointing to the invalid operation record to point to the root node preset for the target data; the reserved record is the last synchronized operation record in the data chain.
  • an embodiment of the present application provides a data synchronization device, including:
  • the data link list obtaining unit is used to obtain the data link table corresponding to the target data at each distributed node; the data link includes: a plurality of operation records sorted in sequence based on the operation time;
  • the invalidation operation record determining unit is configured to determine the invalidation operation record according to the synchronization identifier of each of the operation records in the data link list;
  • the data link list update unit is used to delete the invalidation operation record and update each of the data link lists.
  • the embodiments of the present application provide a terminal device, a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the A computer program is a method for realizing the data synchronization described in any one of the above-mentioned first aspects.
  • an embodiment of the present application provides a computer-readable storage medium that stores a computer program, and is characterized in that, when the computer program is executed by a processor, any of the above-mentioned aspects of the first aspect is implemented.
  • the embodiments of the present application provide a computer program product, which when the computer program product runs on a terminal device, causes the terminal device to perform the data synchronization method described in any one of the above-mentioned first aspects.
  • a chip system includes a memory and a processor, and the processor executes a computer program stored in the memory to implement the data synchronization method according to any one of the first aspects.
  • a chip system includes a processor, the processor is coupled with a memory, and the processor executes a computer program stored in the memory to implement the data as described in any one of the first aspect The method of synchronization.
  • the chip system may be a single chip or a chip module composed of multiple chips.
  • the embodiment of the present application can obtain the data linked list of each distributed node about the target data, so as to determine the invalid operation record through the synchronization identifier corresponding to each operation record in the data link list, delete the invalid operation record from the data link list, and Update the data link list, so that the operation data corresponding to the invalid operation record can be deleted, the storage of the invalid data can be reduced, the storage pressure of the distributed node can be increased, and the storage efficiency can be improved.
  • FIG. 1 is a block diagram of a part of the structure of a mobile phone provided by an embodiment of the present application
  • FIG. 2 is a block diagram of the software structure of a mobile phone according to an embodiment of the present application.
  • Fig. 3 is a structural block diagram of a data synchronization system provided by an embodiment of the present application.
  • FIG. 4 is a structural block diagram of a data synchronization system provided by another embodiment of the present application.
  • FIG. 5 is an implementation flowchart of a data synchronization method provided by the first embodiment of the present application.
  • FIG. 6 is a schematic diagram of the structure of a data linked list provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of synchronization of operation records provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of synchronization of operation records provided by another embodiment of the present application.
  • FIG. 9 is a schematic diagram of synchronization of a data linked list when deleting an unsynchronized operation record according to an embodiment of the present application.
  • FIG. 10 is a specific implementation flowchart of a data synchronization method S502 provided by the second embodiment of the present application.
  • FIG. 11 is a specific implementation flowchart of a data synchronization method S1001 provided by the third embodiment of the present application.
  • FIG. 12 is a schematic diagram of synchronized operation records in multiple data linked lists provided by an embodiment of the present application.
  • FIG. 13 is a specific implementation flowchart of a data synchronization method S1002 provided by the fourth embodiment of the present application.
  • FIG. 16 is a specific implementation flowchart of S503 of a data synchronization method provided by the seventh embodiment of the present application.
  • FIG. 17 is a structural block diagram of a data synchronization device provided by an embodiment of the present application.
  • FIG. 18 is a schematic diagram of a terminal device provided by another embodiment of the present application.
  • the term “if” can be construed as “when” or “once” or “in response to determination” or “in response to detecting “.
  • the phrase “if determined” or “if detected [described condition or event]” can be interpreted as meaning “once determined” or “in response to determination” or “once detected [described condition or event]” depending on the context ]” or “in response to detection of [condition or event described]”.
  • the data synchronization method provided by the embodiments of this application can be applied to mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR)/virtual reality (VR) devices, notebook computers, and ultra-mobile personal Computers (ultra-mobile personal computers, UMPC), netbooks, personal digital assistants (personal digital assistants, PDAs) and other terminal devices can also be applied to databases, servers, and service response systems based on terminal artificial intelligence. There are no restrictions on the specific types of terminal equipment.
  • the terminal device may be a station (STAION, ST) in a WLAN, a cellular phone, a cordless phone, a Session Initiation Protocol (SIP) phone, a wireless local loop (Wireless Local Loop, WLL) station, Personal Digital Assistant (PDA) devices, handheld devices with wireless communication capabilities, computing devices or other processing devices connected to wireless modems, computers, laptops, handheld communication devices, handheld computing devices, and /Or other devices used to communicate on the wireless system and next-generation communication systems, for example, mobile terminals in 5G networks or mobile terminals in the future evolved Public Land Mobile Network (PLMN) network, etc.
  • STAION, ST station
  • WLAN Wireless Local Loop
  • PDA Personal Digital Assistant
  • the mobile terminal since the mobile terminal is specifically used to manage the data linked list of each distributed node, and respond to the synchronization operation of each distributed node, in this case, the mobile terminal may specifically be a mobile that has been online for a long time. terminal.
  • the mobile terminal is an uninterrupted and networked mobile terminal.
  • Fig. 1 shows a block diagram of a part of the structure of a mobile phone provided in an embodiment of the present application.
  • the mobile phone includes: a radio frequency (RF) circuit 110, a memory 120, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, a near field communication module 170, a processor 180, and a power supply 190.
  • RF radio frequency
  • FIG. 1 does not constitute a limitation on the mobile phone, and may include more or fewer components than those shown in the figure, or a combination of some components, or different component arrangements.
  • the RF circuit 110 can be used for receiving and sending signals during the process of sending and receiving information or talking. In particular, after receiving the downlink information of the base station, it is processed by the processor 180; in addition, the designed uplink data is sent to the base station.
  • the RF circuit includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, and the like.
  • the RF circuit 110 can also communicate with the network and other devices through wireless communication.
  • the above-mentioned wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division) Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE)), Email, Short Messaging Service (SMS), etc., through RF circuits 110 receives the data linked list uploaded by the distributed nodes, and responds to the synchronization request of each distributed node.
  • GSM Global System of Mobile Communication
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • Email Short Messaging Service
  • SMS Short Messaging Service
  • the memory 120 can be used to store software programs and modules.
  • the processor 180 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 120, such as storing the received data linked list uploaded by distributed nodes.
  • the memory 120 may mainly include a program storage area and a data storage area.
  • the program storage area may store an operating system, an application program required by at least one function (such as a sound playback function, an image playback function, etc.), etc.; Data (such as audio data, phone book, etc.) created by the use of mobile phones, etc., and the storage data area can also store data fed back by other terminals (such as biometric data fed back by wearable devices).
  • the memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
  • the input unit 130 may be used to receive inputted numeric or character information, and generate key signal input related to user settings and function control of the mobile phone 100.
  • the input unit 130 may include a touch panel 131 and other input devices 132.
  • the touch panel 131 also known as a touch screen, can collect user touch operations on or near it (for example, the user uses any suitable objects or accessories such as fingers, stylus, etc.) on the touch panel 131 or near the touch panel 131. Operation), and drive the corresponding connection device according to the preset program.
  • the terminal device itself can also be used as a distributed node, that is, data can be edited. In this case, the user can input the editing content through the input unit 130 , And edit the target data, and then generate the corresponding operation record.
  • the display unit 140 can be used to display information input by the user or information provided to the user and various menus of the mobile phone, such as outputting an operation interface for editing target data, and receiving user query instructions for target data to display target data, etc. .
  • the display unit 140 may include a display panel 141.
  • the display panel 141 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc.
  • the touch panel 131 can cover the display panel 141. When the touch panel 131 detects a touch operation on or near it, it transmits it to the processor 180 to determine the type of the touch event, and then the processor 180 responds to the touch event. The type provides corresponding visual output on the display panel 141.
  • the touch panel 131 and the display panel 141 are used as two independent components to realize the input and input functions of the mobile phone, but in some embodiments, the touch panel 131 and the display panel 141 can be integrated. Realize the input and output functions of the mobile phone.
  • the mobile phone 100 may also include at least one sensor 150, such as a light sensor, a motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor.
  • the ambient light sensor can adjust the brightness of the display panel 141 according to the brightness of the ambient light.
  • the proximity sensor can close the display panel 141 and/or when the mobile phone is moved to the ear. Or backlight.
  • the accelerometer sensor can detect the magnitude of acceleration in various directions (usually three-axis), and can detect the magnitude and direction of gravity when it is stationary.
  • the audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the mobile phone.
  • the audio circuit 160 can transmit the electrical signal converted from the received audio data to the speaker 161, which is converted into a sound signal for output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal, and the audio circuit 160 After being received, it is converted into audio data, and then processed by the audio data output processor 180, and then sent to, for example, another mobile phone via the RF circuit 110, or the audio data is output to the memory 120 for further processing.
  • the terminal device can access the Internet through the near field communication module 170, thereby receiving the data link list fed back by each distributed node.
  • the router establishes a communication connection and accesses the Internet through the wireless router.
  • FIG. 1 shows the near field communication module 170, it can be understood that it is not a necessary component of the mobile phone 100, and can be omitted as needed without changing the essence of the application.
  • the processor 180 is the control center of the mobile phone. It uses various interfaces and lines to connect various parts of the entire mobile phone. Various functions and processing data of the mobile phone can be used to monitor the mobile phone as a whole.
  • the processor 180 may include one or more processing units; preferably, the processor 180 may integrate an application processor and a modem processor, where the application processor mainly processes the operating system, user interface, application programs, etc. , The modem processor mainly deals with wireless communication. It can be understood that the foregoing modem processor may not be integrated into the processor 180.
  • the mobile phone 100 also includes a power source 190 (such as a battery) for supplying power to various components.
  • a power source 190 such as a battery
  • the power source can be logically connected to the processor 180 through a power management system, so that functions such as charging, discharging, and power consumption management can be managed through the power management system.
  • the software system of the mobile phone 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
  • the embodiment of the present application takes an Android system with a layered architecture as an example to illustrate the software structure of the mobile phone 100 by way of example.
  • FIG. 2 is a block diagram of the software structure of the mobile phone 100 according to an embodiment of the present application.
  • the Android system is divided into four layers, which are application layer, application framework layer (framework, FWK), system layer, and hardware abstraction layer.
  • the layers communicate through software interfaces.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Communication between layers through software interface.
  • the Android system is divided into four layers, from top to bottom, the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
  • the application layer can include a series of application packages.
  • the application package can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
  • the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
  • the application framework layer includes some predefined functions.
  • the application framework layer can include a window manager, a content provider, a view system, a phone manager, a resource manager, and a notification manager.
  • the window manager is used to manage window programs.
  • the window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, take a screenshot, etc.
  • the content provider is used to store and retrieve data and make these data accessible to applications.
  • the data may include videos, images, audios, phone calls made and received, browsing history and bookmarks, phone book, etc.
  • the view system includes visual controls, such as controls that display text, controls that display pictures, and so on.
  • the view system can be used to build applications.
  • the display interface can be composed of one or more views.
  • a display interface that includes a short message notification icon may include a view that displays text and a view that displays pictures.
  • the phone manager is used to provide the communication function of the electronic device 100. For example, the management of the call status (including connecting, hanging up, etc.).
  • the resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and so on.
  • the notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages, and it can automatically disappear after a short stay without user interaction.
  • the notification manager is used to notify download completion, message reminders, and so on.
  • the notification manager can also be a notification that appears in the status bar at the top of the system in the form of a chart or a scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, text messages are prompted in the status bar, prompt sounds, electronic devices vibrate, and indicator lights flash.
  • Android Runtime includes core libraries and virtual machines. Android runtime is responsible for the scheduling and management of the Android system.
  • the core library consists of two parts: one part is the function functions that the java language needs to call, and the other part is the core library of Android.
  • the application layer and application framework layer run in a virtual machine.
  • the virtual machine executes the java files of the application layer and the application framework layer as binary files.
  • the virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
  • the system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), three-dimensional graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), etc.
  • the surface manager is used to manage the display subsystem and provides a combination of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files.
  • the media library can support multiple audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing.
  • the 2D graphics engine is a drawing engine for 2D drawing.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
  • the above-mentioned kernel layer further includes a PCIE driver.
  • Fig. 3 shows a structural block diagram of a data synchronization system provided by an embodiment of the present application.
  • the data synchronization system includes a server 310 and multiple distributed nodes 320. Wherein, a communication link is established between the server 310 and the distributed node 320.
  • the data synchronization device may specifically be the aforementioned server 310.
  • the server 310 may be used to manage the data linked list of each data in the database uploaded on different distributed storage nodes.
  • the server 310 can configure a corresponding data number for each data in the database.
  • the data can be a text document, picture, video, audio, and other different forms of data, or a certain data in any data package, such as a text document
  • the parameter value of a certain data item, or the display content of a certain area in a certain network page, etc. does not limit the data here.
  • the server 310 may establish an association relationship between the data and the data linked list according to the data number. For example, the header of the data linked list is added with the above-mentioned data number.
  • the server 310 may associate and store all data linked lists related to the same data (that is, the same data number). Then identify the invalid operation record according to each data link list to update each data link list.
  • the server 310 can also perform a synchronization operation of operation records according to the data linked list of each distributed node, as the main body of distributed transaction management.
  • the distributed node 320 can be any type of device, including but not limited to mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR)/virtual reality (VR) devices, laptops, and super Mobile personal computers (ultra-mobile personal computers, UMPC), netbooks, personal digital assistants (personal digital assistants, PDAs) and other terminal devices.
  • Multiple distributed nodes 320 can perform editing operations on the same data. When performing the above-mentioned editing operations, the distributed nodes 320 can be online or offline. After the user edits the data through the input module on the distributed node 320, an operation record of the target data will be generated and added to the data linked list corresponding to the target data.
  • the distributed node 320 may upload the data linked list to the server 310, and may also perform data synchronization on each operation record in the local data linked list when the preset synchronization conditions are met. In addition to storing each operation record, each distributed node also stores operation data corresponding to the operation record. The distributed node 320 can delete the operation data corresponding to the invalid operation record, thereby reducing the resource occupation of the memory by the invalid data.
  • Fig. 4 shows a structural block diagram of a data synchronization system provided by another embodiment of the present application.
  • the data synchronization system includes a first distributed node 410 and a second distributed node 420.
  • the first distributed node 410 and the second distributed node 420 may communicate through a wired and/or wireless network.
  • first distributed node 410 and second distributed node 420 are any type of equipment, including but not limited to mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR)/virtual reality ( Virtual reality, VR) equipment, notebook computers, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (personal digital assistants, PDAs) and other terminal equipment, of course, can also be servers or databases and other equipment .
  • AR augmented reality
  • VR virtual reality
  • UMPC ultra-mobile personal computers
  • PDAs personal digital assistants
  • other terminal equipment of course, can also be servers or databases and other equipment.
  • the aforementioned first distributed node 410 may work with other second distributed nodes 420 to perform editing operations on the same data. After performing the above editing operations, you can create an operation record about the target data, thereby generating a corresponding data link list.
  • the first distributed node 410 may perform data synchronization on each operation record in the local data linked list according to the locally generated data linked list and the data linked list uploaded by the second distributed node 420.
  • the first distributed node 410 may also store operation data corresponding to the operation record. That is, the first distributed node includes the functions of each second distributed node 420, that is, the editing function of the same data, and the storage of operation records and operation data corresponding to the operation records.
  • the first distributed node 410 can also be used to manage the data linked list of the entire distributed system, and synchronize the operation records in the data linked list.
  • the above-mentioned first distributed node 410 is specifically a device that is online for a long time, and the long-time online requires the first distributed node 410 to be in a networked state and in an uninterrupted power state.
  • the data synchronization system may configure the first distributed node 410 with a standby device 411 in response to an abnormal state.
  • the first distributed node 410 can periodically synchronize the data linked list stored locally and the data linked list fed back by each second distributed node 420 to the backup device 411.
  • the backup device 411 is in The standby state can reduce resource consumption. If it is detected that the first distributed node 410 is in an abnormal warning state, for example, the power is lower than the preset minimum power threshold, or the packet loss rate is greater than the preset normal packet loss threshold, or the hardware resource occupancy rate is greater than the preset occupancy threshold At this time, it is recognized that the first distributed node 410 may be offline.
  • the backup device 411 will be activated, and the data of the first distributed node 410 will be synchronized to the backup device 411 in real time, and a connection with each second distributed node will be established. 420 communication link. If it is detected that the first distributed node 410 is offline (for example, in the case of a power failure or unable to connect to the network), the communication link established by the above-mentioned backup device 411 and each second distributed node 420 will receive each second distributed node 410. The data linked list uploaded by the distributed node and the synchronization operation of the response operation record.
  • the operation of managing the data linked list can be rotated at each distributed node. That is, the distributed node can serve as the first distributed node 410 for managing the data linked list or the second distributed node 420 for reporting the data linked list at different times.
  • the data synchronization system can determine the priority of each distributed node according to the operating parameters of each distributed node, and select the distributed node with the highest priority as the first distributed node 410, and other distributed nodes As the second distributed node 420.
  • the above operating parameters include: available storage resources, computing speed, network bandwidth, etc., and based on the above computing parameters and the preset priority weights of each computing parameter, the priority corresponding to each distributed node is calculated.
  • the function of managing the data link list can be transferred to other distributions.
  • each distributed node will be obtained, and the priority of each distributed node will be re-determined, so that among all the second distributed nodes, the second distributed node with the highest priority is selected as the new first Distributed node (that is, the node that manages the data linked list), the original first distributed node sends the stored data linked list of each distributed node to the new first distributed node, thereby realizing the transfer of management tasks, and thus the data
  • the synchronization system does not need to be equipped with a separate management device, which increases the cost of the data synchronization system.
  • the operation of managing the data linked list can be rotated at each distributed node. That is, the distributed node can serve as the first distributed node 410 for managing the data linked list or the second distributed node 420 for reporting the data linked list at different times.
  • the data synchronization system can configure a corresponding management period for each distributed node. If any distributed node is in its corresponding management period, it will act as the aforementioned first distributed node 410 to manage the data linked list of the entire system; if any other distributed node is not in its corresponding management period, it will act as The above-mentioned second distributed node 420 uploads the data link list.
  • the stored and local data linked list can be sent to the distributed node corresponding to the next management period, so that the distributed node corresponding to the next management period can continue to bear the data
  • the management operation of the linked list realizes that the operation is rotated based on the time period. There is no need to keep a certain device online for a long time. It only needs to be online during the corresponding management cycle, and the distributed nodes of the brother can undertake the management operation of the data linked list. , Thereby improving the robustness of the data synchronization system.
  • the execution subject of the process is a device installed with a data synchronization program.
  • the device of the data synchronization program can specifically be a terminal device, the terminal device can be a server, dedicated to managing data linked lists, or smart phones, tablets, laptops, etc., which can be used as distributed nodes at the same time
  • the terminal device is used to represent the device that manages the data synchronization program of the data linked list.
  • FIG. 5 shows an implementation flowchart of the data synchronization method provided by the first embodiment of the present application, and the details are as follows:
  • a data link list corresponding to target data at each distributed node is obtained; the data link includes: a plurality of operation records sequentially sorted based on operation time.
  • the data synchronization system contains multiple distributed nodes.
  • the distributed nodes can be installed in the same location, for example, in the same computer room; if multiple distributed nodes are in the same location, each distributed node A communication connection can be established with a terminal device through a serial port or a communication port, and a data linked list can be sent to the terminal device through the communication connection.
  • the above multiple distributed nodes may be in different locations, for example, each distributed node is located in a different computer room, or any multiple distributed nodes are located in the same computer room, and other distributed nodes are located in different computer rooms; in this case, each The distributed node can establish a communication connection with the terminal device through wired or wireless communication, and send a data link list to the terminal device.
  • each distributed node can operate on the same target data.
  • the operations include: adding target data, deleting target data, replacing target data, or changing the data content of target data, etc., and according to the target
  • the data type is different, and a variety of operation methods related to the data type can be used.
  • the above operation can be: filter the audio data through a preset filter algorithm to obtain the filtered audio Data;
  • the target number is image data, the above operation can be: face recognition on the image data and extract the face image; therefore, different data types use different operation methods, and the operation content is not limited here.
  • the user can edit the target data on the distributed nodes. After each editing operation is performed, a corresponding operation record will be generated, and the data about the target data will be generated according to the operation time corresponding to each operation record.
  • Linked list Since the user is operating on the target data on a distributed node, the distributed node is not necessarily online, and it does not synchronize the edited data to each distributed node in real time. Based on this, each distributed node stores There are data linked lists for local operations, and when the preset upload timing is met, the data linked list is uploaded to the terminal device, and when the preset synchronization timing is reached, the operation records in the data linked list are synchronized to keep in The consistency of the data content of the target data on each distributed terminal.
  • the terminal device can synchronize all the synchronized operation records in the offline state to the data linked list of the offline distributed node.
  • the upload timing of the above-mentioned distributed node uploading the data linked list can be specifically: the distributed node can establish a communication connection with the terminal device through a built-in client program, and the distributed node can establish communication with the terminal device.
  • the distributed node In the connected state, it is recognized that the distributed node is online.
  • the distributed node In the online state, the distributed node will update the data linked list after detecting the generation of an operation record on the target data, and upload the updated data linked list to the terminal device. That is, the above upload timing is: the node is online and the data link list triggers the update process.
  • the above method of uploading the data linked list can be incremental upload or full upload, where the incremental upload specifically means that the distributed node can send the newly added operation records in the data linked list this time to the terminal device, and the terminal device can send The received operation record is added to the corresponding data link list; the full upload is specifically to send the complete data link list about the target data to the terminal device, the terminal device can delete the stored data link list about the distributed node, and save the distribution The linked list of data uploaded by the type node this time.
  • the timing for synchronizing the data linked list may be: if the terminal device detects that each distributed node is online, it executes the synchronization operation of the data linked list; preferably, if the terminal device detects When each distributed node is online, the current operating parameters of each distributed node are obtained. If the above operating parameters are greater than the preset synchronization threshold (that is, each distributed node currently has a certain amount of available resources to respond to the synchronization operation), then execute Synchronous operation of the data link.
  • the timing for synchronizing the data linked list may be: if the terminal device detects that the number of target data to be synchronized in each data linked list is greater than the preset number threshold, then The synchronization operation of the data linked list can be performed. For example, the number of operation records to be synchronized in each data linked list is greater than 2, at this time, the terminal device can perform synchronization operations on the data linked lists of each distributed node at the same time.
  • FIG. 6 shows a schematic structural diagram of a data linked list provided by an embodiment of the present application.
  • the data linked list contains multiple operation records, and each operation record contains the following three contents: the unique identifier corresponding to the operation record, and the upper association of the operation record corresponding to the previous operation Byte, and the data index of the operation data corresponding to this operation. Based on the above three contents, each operation record can be connected in turn according to the operation time corresponding to each operation record, thereby generating a corresponding data link list.
  • Operation record 1 in Figure 6 the operation record corresponding to the last operation is operation record 2, so the corresponding value in the upper associated byte is the unique identifier of operation record 2; and because operation record 1 is the last generated
  • the operation record of the operation record so there is no upper associated byte of the operation record pointing to the operation record 1, that is, the operation record 1 is the end of the data chain; and the data index in the operation record 1 can be a storage path for determining
  • the storage address for storing the data of the current operation for example, the current operation is an editing operation, the storage address can store the edited value of the target data.
  • the header of the data linked list can point to the preset root node, and the root node can be empty, that is, when the user edits the target data for the first time, the target data is not assigned a value.
  • the root node can be empty, that is, when the user edits the target data for the first time, the target data is not assigned a value.
  • an operation will be generated Record, because the operation record does not have other operation records earlier than its operation time, the corresponding upper correlation byte can point to an empty or preset root node.
  • the root node is specifically an empty node, that is, Empty.
  • the method for the terminal device to perform the above data synchronization may be: the terminal device can determine whether the operation record is included in each data linked list according to the unique identifier corresponding to each operation record, and if the operation record is included, the The synchronization flag of the operation record is set as synchronized; if the operation record is not included in any data link list or the synchronization recognition operation is not performed, the operation record is identified as unsynchronized. The terminal device can synchronize each operation record whose synchronization is identified as unsynchronized into each data linked list.
  • the method for the terminal device to perform the above-mentioned data synchronization may be: judging whether the operation record to be synchronized is included in the data linked list of other distributed nodes, if it does, there is no need to synchronize; otherwise, if the operation record is included If the operation record is not included in the data linked list, then according to the operation time of the operation record and the operation time of each existing operation record, determine the serial number of the operation record added this time, and insert it into the corresponding serial number of the data linked list based on the above serial number Position, and adjust the operation time to be later than the serial number of each existing operation record of the operation record.
  • FIG. 7 shows a schematic diagram of synchronization of operation records provided by an embodiment of the present application.
  • the data linked list contains multiple operation records, which are operation records 1 to 5, and the operation time corresponding to each operation record is: April 1, April 2, April 3, April 5th and April 6th.
  • the operation time corresponding to the operation record to be synchronized is April 4, and its operation time is between operation record 3 and operation record 4.
  • the upper associated record of operation record A to be synchronized is operation Record 3, so the upper associated byte of operation record A is configured as "operation record 3" (that is, the unique identifier corresponding to operation record 3); and the upper associated byte of operation record 4 is adjusted to "operation record A" , Thereby generating a new data link list.
  • the method for the terminal device to perform the above-mentioned data synchronization may be: judging whether the operation record to be synchronized is included in the data linked list of other distributed nodes, if it does, there is no need to synchronize; otherwise, if the operation record is included The operation record is not included in the data linked list, and then the data linked list is updated after being added to the existing operation record corresponding to the upper associated byte in the data chain according to the upper associated byte contained in the operation record. If the data chain already contains the corresponding lower associated record with the existing operation record, a new data chain branch will be created.
  • FIG. 8 shows a schematic diagram of synchronization of operation records provided by another embodiment of the present application.
  • the upper associated byte in the operation record A to be synchronized is "operation record 3"
  • the lower associated operation record of operation record 3 stored in the data linked list of other distributed nodes is operation record 4, and the operation The operation data of record 4 and operation record A are inconsistent, so the above two operation records cannot be merged. Therefore, a data link branch will be created, that is, the synchronized data link list is obtained from operation record 1 ⁇ 2 ⁇ 3 ⁇ A.
  • an invalid operation record is determined according to the synchronization identifier of each operation record in the data link list.
  • each operation record in the data link list corresponds to a synchronization identifier, that is, whether the operation record has performed a synchronization operation on each distributed node. If the operation record has been synchronized to each data linked list, that is, deleting the operation record will not affect the structure of the data linked list, so it can be identified as an invalid operation record; on the contrary, if the operation record is not synchronized to each data linked list In this case, deleting the operation record may affect the structure of the data linked list, so it cannot be deleted.
  • FIG. 9 shows a schematic diagram of synchronization of a data linked list when an unsynchronized operation record is deleted according to an embodiment of the present application.
  • the data linked list in the first distributed node contains 5 operation records, which are operation records 1 to 5, respectively, while the data linked list in the second distributed node contains 2 operation records, which are operation records. Records 1 and 2, where operation records 1 and 2 are synchronized operation records (that is, they exist in the first distributed node and the second distributed node at the same time). If at this time, the operation records 1 to 3 in the data linked list in the first distributed node are deleted, and records 4 and 5 are retained. Since the upper associated node associated in operation record 4 is an empty node, when synchronizing with the data linked list of the second distributed node, it is consistent with the upper associated node corresponding to the original operation record 1, and the two operation data are different.
  • the second distributed node will keep the above two operation records at the same time, thereby generating a branch chain, which affects the structure of the data link list. Based on the above reasons, the terminal device does not delete unsynchronized operation records, so the invalid operation record can be determined from the data linked list according to the synchronization identification of each operation record.
  • the way of triggering S502 can be manually initiated, that is, the user initiates a data aging instruction to the terminal device, and the terminal device can delete the invalid operation record according to the data linked list uploaded by each distributed node; or Based on the preset trigger condition, the above-mentioned operation of S502 is performed.
  • the way to trigger S502 may be: after receiving the synchronization request for the operation record sent by the distributed node, the terminal device may synchronize the operation record in the data linked list corresponding to each distributed node , And adjust the synchronization identifier corresponding to each operation record after synchronization.
  • the terminal device may synchronize the operation record in the data linked list corresponding to each distributed node , And adjust the synchronization identifier corresponding to each operation record after synchronization.
  • the synchronized data link list can be aged in a unified manner, that is, the invalid operation record is identified and deleted, and the operation of S502 will be executed at this time.
  • the way to trigger S502 may be: the terminal device can obtain the storage occupancy rate of each distributed node, and if the storage occupancy rate of any distributed node is greater than the preset occupancy threshold, execute S502 operate. That is, the terminal device will identify the invalid operation record contained in the data linked list corresponding to each distributed node, and delete the operation data corresponding to each invalid operation record from the distributed node, so as to release the storage resources of invalid data and reduce the distribution.
  • the storage occupancy rate of the model node may be: the terminal device can obtain the storage occupancy rate of each distributed node, and if the storage occupancy rate of any distributed node is greater than the preset occupancy threshold, execute S502 operate. That is, the terminal device will identify the invalid operation record contained in the data linked list corresponding to each distributed node, and delete the operation data corresponding to each invalid operation record from the distributed node, so as to release the storage resources of invalid data and reduce the distribution.
  • the storage occupancy rate of the model node may be: the terminal device can obtain the storage occupancy rate of each distributed node
  • the way to trigger S502 can be: the terminal device can obtain the number of operation records contained in the data linked list of each distributed node, if the number of operation records in any of the data linked lists is greater than For the preset number threshold, the operation of S502 is executed.
  • the terminal device can delete the invalidation operation record from the data link list, and update the data link list.
  • the updated data link list does not include the above deleted invalidation operation. record.
  • the terminal device can feed back the data linked list of deleted invalid records to each distributed node, and each distributed node can determine the invalid operation record according to the received data linked list and the locally stored data linked list, Then the data index of the corresponding operation data in each invalid operation record is determined, the corresponding operation data is obtained and the data deletion operation is performed to release the storage resources.
  • the data synchronization method can obtain the data linked list of each distributed node about the target data, so as to determine the invalid operation record through the synchronization identifier corresponding to each operation record in the data linked list. Delete the invalid operation records from the data link list, and update the data link list, so that the operation data corresponding to the invalid operation records can be deleted, the storage of invalid data can be reduced, the storage pressure of distributed nodes can be increased, and the storage can be improved efficient.
  • FIG. 10 shows a specific implementation flowchart of a data synchronization method S502 provided by the second embodiment of the present application.
  • S502 in a data synchronization method provided in this embodiment includes: S1001 to S1002, which are detailed as follows:
  • the terminal device can obtain the synchronization identifier of the operation record contained in each data link list, and divide the data link list into two segments based on the synchronization identifier, including the synchronized data link segment and the data link segment to be synchronized.
  • the synchronization identifier of each operation record in the synchronized data link segment is synchronized, and the synchronization identifier of each operation record in the data link segment to be synchronized is to be synchronized.
  • the terminal device can detect whether each data linked list contains a synchronized operation record, and if so, execute the operation of S1001. Because when there is no synchronized operation record in the data linked list, it means that there is no reserved record that can be deleted in the data linked list. In a possible implementation, the terminal device can first The data linked list of the operation record is synchronized with the data linked list stored by any other distributed node, and the operation of S1001 is re-executed after synchronization.
  • the terminal device determines the last synchronized operation record based on the operation time of each synchronized operation record (that is, the operation record whose synchronization is identified as synchronized), and recognizes it as a reserved record.
  • the last synchronized operation record is specifically the operation record with the smallest time difference between the operation time and the time at which the invalidation operation record is currently triggered.
  • operation records 1 to 3 are all synchronized operation records, and the corresponding operation times are April 1, April 2, and April 3 respectively. Since the last synchronized operation record of the operation time is an operation Record 3, that is, operation record 3 is a reserved record.
  • the terminal device can identify other synchronized operation records except the reserved records as invalid records in each data link, so that the operation records that need to be deleted from the data link list can be determined.
  • the last synchronized operation record is identified as a reserved record, so as to ensure that the same operation record is stored in each data linked list, because when the synchronization operation is performed, it is necessary to determine whether the upper associated nodes of the operation record are consistent. , And perform the chaining operation based on the associated node. If each data linked list does not contain the same operation record, it is easy to produce branch links when performing the chaining operation, which affects the structure of the data linked list.
  • FIG. 11 shows a specific implementation flowchart of a data synchronization method S1001 provided by the third embodiment of the present application.
  • S1001 in a data synchronization method provided in this embodiment includes: S1101 to S1104, which are detailed as follows:
  • the identifying the last synchronized operation record as a reserved record based on the operation time includes:
  • the terminal device when the distributed node is in an online state, a communication connection can be established with the terminal device, and the communication connection is in an active state. Therefore, the terminal device can determine the number of online distributed nodes according to the number of currently active communication connections, and determine the online distributed nodes according to the communication peer corresponding to each communication connection.
  • the terminal device may store a list of all nodes included in the data synchronization system. If it is detected that any distributed node in the node list is offline, the operation of S1102 is executed; if it is detected that each node in the node list is offline If the distributed nodes are all in an online state, an operation of identifying the last synchronized operation record as a reserved record based on the operation time can be performed.
  • any one of the distributed nodes is offline, select any one of the first data linked lists from all the first data linked lists to generate a reserved linked list; the first data linked list is the distributed node to which it belongs The data linked list where the node is online.
  • the terminal device can divide the data linked list into two types according to the online status of the distributed node to which it belongs. Wherein, if the distributed node to which the data linked list belongs is online, the data linked list is identified as the first data linked list; if the distributed node to which the data linked list belongs is offline, the data linked list is identified as the second data linked list.
  • the terminal device can arbitrarily select the first data linked list corresponding to an online distributed node as the reserved linked list, so that after the distributed node that is currently offline goes online, it can compare the second data based on the reserved linked list.
  • the linked list performs data synchronization operations.
  • the last synchronized operation record is identified from the first data linked list as the first reserved record of the first data linked list.
  • the terminal device may select the last synchronized operation record from all the first data linked lists as the first reserved record of each first data linked list according to the operation time corresponding to each operation record. Since the operation records in the first data linked list and the offline second data linked list may have different numbers of synchronized operation records, the last synchronized operation records may be different in different data linked lists. In order to ensure that each data linked list has one and only one identical operation record, the last synchronized operation record is identified from the first data linked list, and the operation record is identified as the first reserved record of the first data linked list. Among them, the distributed node is online, and the last synchronized operation record must be an operation record with the same content for all distributed nodes. Because the synchronization operation is a synchronization operation performed for all online distributed nodes, it can avoid the situation where subsequent nodes cannot determine the same associated node during synchronization.
  • the last synchronized operation record is identified from the second data linked list as the second reserved record of the second data linked list; the second data linked list is the one to which it belongs The data linked list in which the distributed node is in an offline state.
  • the data linked list stored in the terminal device does not record the data linked list actually generated locally by this type of distributed node, which is the data linked list obtained by historical upload. Therefore, the last synchronized operation record in the second data linked list is identified as the second reserved record corresponding to the second data linked list. For example, a distributed node goes online on April 1 and synchronizes the data linked list, and the last synchronized operation record is the operation record on April 1. At this time, the terminal device stores the data linked list on the distributed node on April 1. On April 2 and April 3, the data synchronization system performed the synchronization operation of the operation record, but because the distributed node was not online, the synchronized operation record could not be updated to the data linked list.
  • the terminal device needs to delete the invalid operation record.
  • the data linked list uploaded by the distributed node to the terminal device is the operation record as of April 1st, and the operation on April 1st will be changed.
  • the record is identified as the second reserved record.
  • FIG. 12 shows a schematic diagram of synchronized operation records in multiple data linked lists provided by an embodiment of the present application.
  • the distributed node 1-3 is in an online state
  • the distributed node 4 is in an offline state.
  • the data linked list of distributed node 1 contains operation records 1 to 8.
  • operation records 1-6 are synchronized operation records, among which, operation records 7 and 8 are operation records to be synchronized; and distributed node 2
  • the data linked list contains operation records 1 to 7, of which operation records 1-7 are all synchronized operation records;
  • the data linked list of distributed node 3 contains operation records 1-9, of which, operation records 1-7 Operation records are synchronized operation records, operation records 8 and 9 are unsynchronized operation records;
  • the data linked list of distributed node 4 contains operation records 1-5, operation records 1-3 are synchronized operation records, and operation record 4 And 5 are the data obtained by the user editing on the distributed node 4 in the offline state.
  • the first data linked list is the data linked list of distributed nodes 1-3, wherein the last synchronized operation records are operation record 6 of distributed node 1, and operation record 7 of distributed nodes 2 and 3. Therefore, the above three operation records can be regarded as the first reserved record in the corresponding data list.
  • the distributed node 4 is offline
  • the corresponding second data linked list is the data linked list of distributed node 4
  • the last synchronized operation record in the second data linked list is operation record 3, that is, the second reserved record is operation Record 3.
  • the corresponding reserved nodes are determined for different data linked lists according to different online states, so that invalid operation records in the data linked list can be deleted while ensuring that the subsequent synchronization of the data linked list will not affect The structure of the data link list.
  • FIG. 13 shows a specific implementation flowchart of a data synchronization method S1002 provided by the fourth embodiment of the present application.
  • S1002 in a data synchronization method provided in this embodiment includes: S1301 to S1302, which are detailed as follows:
  • the recognizing the synchronized operation records other than the reserved records as invalid operation records includes:
  • the terminal device retains a linked list to perform synchronization operations when performing synchronization operations when the currently offline distributed node is back online. Therefore, it is necessary to ensure that at least one identical operation record is retained in the reserved linked list and the second data linked list, and other synchronized operation records whose operation time is earlier than the second reserved record are identified as invalid operation records, that is, the editing operation of the invalid operation record It happened before the edit operation to keep the record.
  • the above-mentioned operation of determining the second reserved record is independent.
  • the synchronized operation record is identified as an invalid operation record. Since each second data linked list is based on the reserved linked list for data synchronization operations, so as long as the reserved linked list is guaranteed to be complete, different second data linked lists can be synchronized based on the reserved linked list, and the synchronization operations between each other are independent of.
  • the terminal device can perform the identification operation of the invalid operation record on the associated first data linked list according to the corresponding first reserved record in each first data linked list, that is, remove the first reserved record from the first data linked list Other synchronized operation records are identified as invalid operation records.
  • the reserved linked list is specifically stored in the terminal device. Therefore, when the invalid data identification is performed on the data linked list of the distributed node corresponding to the reserved linked list, the first reserved record corresponding to the reserved linked list will still be determined, that is, in the subsequent During the operation, it will identify the invalid operation record in the reserved linked list based on the first reserved record, but the invalid operation record is used to delete the operation data of the distributed node corresponding to the reserved record, and will not affect the storage in the terminal device The reserved list.
  • the accuracy of identifying invalid operation records can be improved, thereby releasing storage resources occupied by invalid data to a greater extent.
  • FIG. 14 shows a specific implementation flowchart of a data synchronization method provided by the fifth embodiment of the present application.
  • the operation record is identified as an invalid operation record, it also includes: S1401 ⁇ S1404, which are detailed as follows:
  • the method further includes:
  • the terminal device can retain the linked list for the second data of the distributed node
  • the linked list performs synchronization operations.
  • the synchronization process is specifically: the second distributed node can update the second data link list, that is, upload the operation record initiated in the offline state to the terminal device to obtain the updated second data link list, and the terminal device passes Keep the synchronized operation records in the linked list and synchronize to the above updated second data linked list.
  • the synchronized second data linked list has been obtained.
  • the terminal device After the terminal device performs the synchronization operation, it can identify whether the second data linked list contains waiting data. Synchronized operation records, if they exist, send synchronization instructions to all other distributed nodes that are currently online, and synchronize operation records that need to be synchronized to other distributed nodes for storage.
  • the synchronization tags of each operation record in the second data linked list are configured to be synchronized.
  • each distributed node can receive a feedback synchronization completion instruction. If all online distributed nodes feedback the synchronization completion instruction, it will Generate synchronization completion information to indicate all operation records in the second data link list to complete the synchronization operation.
  • the terminal device can recognize the synchronization tags of each operation record of the second data link list as being synchronized.
  • the last synchronized operation record is identified as a reserved record of the second data linked list.
  • the terminal device after the terminal device performs the synchronization operation on the second data linked list, it can perform the failure record identification operation on the distributed node corresponding to the second data linked list. Similarly, in order to ensure that the subsequent update of the data linked list can ensure The operation record can identify the corresponding upper associated node, and a last synchronized reserved record needs to be determined. Therefore, the last synchronized operation record in the second data linked list is recognized as a reserved record.
  • the terminal device can identify all synchronized operation records except the reserved record as invalid operation records, thereby ensuring that there is only one operation record in the second data linked list and the operation records of other data linked lists are In the same way, the resources occupied by invalid data are released to the greatest extent.
  • the updated second data link list may be fed back to the distributed node to which it belongs, so that the corresponding distributed node releases the corresponding occupied resources.
  • the data synchronization operation can be performed on the distributed node that is offline and re-online by keeping records, so as to ensure that the data linked list of the target data is consistent with other distributed nodes.
  • the data link list is consistent, and after the data link list is updated, the identification operation of the invalid operation record is performed on the distributed node, which can release the resource occupation of the distributed node that is back online after being offline, and avoid the distributed node from missing the resource release opportunity. Backlog of resources.
  • FIG. 15 shows a specific implementation flowchart of a data synchronization method S502 provided by the sixth embodiment of the present application.
  • a data synchronization method S502 provided in this embodiment includes: S1501 to S1504, which are detailed as follows:
  • the determining the invalid operation record according to the synchronization identifier of each of the operation records in the data linked list includes:
  • each data linked list contains at least one identical operation record. Based on this, the terminal device needs to synchronize the operation records in the data link list to ensure the consistency of the data link list of each distributed node.
  • the synchronization tag of each of the operation records is configured to be synchronized.
  • each distributed node after each distributed node completes synchronization of the local data linked list, it can feed back a synchronization completion message to the terminal device. If the synchronization completion information of each data linked list is detected, the synchronization label of each operation record can be configured It is synchronized, which means that each operation record has been kept consistent with the operation records of other distributed nodes.
  • the last synchronized operation record is identified as the reserved record of each of the data linked lists.
  • the terminal device can identify the last synchronized operation record according to the operation time of each operation record, and recognize the last synchronized operation record in each data linked list as a reserved record.
  • retention records it can be ensured that each data linked list after aging data contains at least one identical operation record, so that the consistency of the data linked list structure can be ensured during subsequent synchronization, and branching can be avoided.
  • the terminal device can identify all synchronized operation records except the reserved record as invalid operation records, thereby ensuring that there is only one operation record in the data linked list and other data linked lists.
  • the operation records are the same, and the resources occupied by invalid data are released to the greatest extent.
  • the updated data link list can be fed back to the distributed node to which it belongs, so that the corresponding distributed node releases the corresponding occupied resources.
  • FIG. 16 shows a specific implementation flowchart of S503 of a data synchronization method provided by the seventh embodiment of the present application. Referring to FIG. 16, with respect to any one of the embodiments described in FIG. 5, FIG. 10, FIG. 11, FIG. 13, FIG. 14, and FIG. The description is as follows:
  • deleting the invalidation operation record and updating each of the data linked lists includes:
  • a data release instruction of the invalidation operation record is sent to the distributed node associated with the data link list, so that the distributed node deletes the operation data corresponding to the invalidation operation record in a local database.
  • the terminal device may send the data release instruction corresponding to each invalidation operation record to the distributed node to which it belongs, and the data release instruction carries the unique identifier of the operation record.
  • the distributed node may determine the operation record from the data linked list according to the unique identifier, determine the storage location of the operation data based on the data index contained in the operation record, and delete the operation data from the local database.
  • the upper associated byte of the reserved record is adjusted from pointing to the invalidation operation record to point to the preset root node of the target data; the reserved record is the last synchronized operation record in the data chain.
  • the terminal device can adjust the upper correlation byte of the reserved record.
  • FIG. 17 shows a structural block diagram of a data synchronization device provided in an embodiment of the present application. For ease of description, only the parts related to the embodiment of the present application are shown.
  • the data synchronization device includes:
  • the data link list obtaining unit 171 is configured to obtain the data link table corresponding to the target data at each distributed node; the data link includes: a plurality of operation records sequentially sorted based on the operation time;
  • the invalidation operation record determining unit 172 is configured to determine the invalidation operation record according to the synchronization identifier of each of the operation records in the data linked list;
  • the data link list update unit 173 is used to delete the invalidation operation record and update each of the data link lists.
  • the failure operation record determining unit 172 includes:
  • the first reserved record identifying unit is configured to, if each of the data linked lists contains the operation record whose synchronization identifier is synchronized, based on the operation time, identify the last synchronized operation record as a reserved record ;
  • the first invalidation operation record determining unit is configured to identify the other synchronized operation records except the reserved record as invalidation operation records.
  • the first reserved record identifying unit includes:
  • An online status determining unit configured to obtain the online status of each of the distributed nodes
  • the reserved linked list determining unit is configured to select any one of the first data linked lists from all the first data linked lists to generate a reserved linked list if any one of the distributed nodes is in an offline state; the first data linked list is the one to which it belongs The data linked list of the distributed node in an online state;
  • a first reserved record determining unit configured to identify the last synchronized operation record from the first data linked list as the first reserved record of the first data linked list based on the operation time;
  • the second reserved record determining unit is configured to identify the last synchronized operation record from the second data linked list as the second reserved record of the second data linked list based on the operation time; the second data
  • the linked list is the data linked list to which the distributed node to which it belongs is in an offline state.
  • the first failure operation record determining unit includes:
  • a first invalidation operation record identification unit configured to identify the operation records that have been synchronized other than the second reserved record in the second data linked list as invalidation operation records
  • the second invalidation operation record identification unit is configured to identify the other synchronized operation records other than the first reserved record in the first data link list as invalidation operation records.
  • the data synchronization device further includes:
  • a node online detection unit configured to, if it is detected that the distributed node corresponding to the second data linked list is online, perform data synchronization on each operation record in the second data linked list based on the reserved linked list;
  • the first operation record synchronization unit is configured to, if synchronization completion information about the second data linked list is detected, configure the synchronization tags of each operation record in the second data linked list to be synchronized;
  • a second reserved record identifying unit configured to identify the last synchronized operation record as a reserved record of the second data linked list based on the operation time
  • the second invalidation operation record identification unit is configured to identify the other synchronized operation records in the second data linked list except the reserved records as invalidation operation records.
  • the failure operation record determining unit 172 includes:
  • a data synchronization execution unit configured to perform data synchronization on each operation record in all the data linked lists if the operation record whose synchronization identifier is synchronized is not included in any of the data linked lists;
  • the second operation record synchronization unit is configured to configure the synchronization tag of each operation record to be synchronized if the synchronization completion information on each of the data linked lists is detected;
  • the third reserved record identifying unit is configured to identify the last synchronized operation record as the reserved record of each data linked list based on the operation time;
  • the third invalidation operation record identification unit is configured to identify the other synchronized operation records in the data linked list except for the reserved record as invalid operation records.
  • the data link list update unit 173 includes:
  • a data deletion unit configured to send a data release instruction of the invalidation operation record to the distributed node associated with the data linked list, so that the distributed node deletes the operation data corresponding to the invalidation operation record in the local database ;
  • the upper correlation byte adjustment unit is configured to adjust the upper correlation byte of the reserved record from pointing to the invalid operation record to pointing to the root node preset for the target data; the reserved record is the last synchronized byte in the data chain Operation record.
  • the data synchronization device provided by the embodiment of the present application can also obtain the data linked list of each distributed node about the target data, so as to determine the invalid operation record through the synchronization identifier corresponding to each operation record in the data link list.
  • the operation record is deleted from the data link list and the data link list is updated, so that the operation data corresponding to the invalid operation record can be deleted, the storage of the invalid data can be reduced, the storage pressure of the distributed node can be increased, and the storage efficiency can be improved.
  • FIG. 18 is a schematic structural diagram of a terminal device provided by an embodiment of this application.
  • the terminal device 18 of this embodiment includes: at least one processor 180 (only one is shown in FIG. 18), a processor, a memory 181, and a memory 181 that is stored in the memory 181 and can be processed in the at least one processor.
  • the terminal device 18 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the terminal device may include, but is not limited to, a processor 180 and a memory 181.
  • FIG. 18 is only an example of the terminal device 18, and does not constitute a limitation on the terminal device 18. It may include more or less components than shown in the figure, or a combination of certain components, or different components. , For example, can also include input and output devices, network access devices, and so on.
  • the so-called processor 180 may be a central processing unit (Central Processing Unit, CPU), and the processor 180 may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), and application specific integrated circuits (Application Specific Integrated Circuits). , ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the memory 181 may be an internal storage unit of the terminal device 18 in some embodiments, such as a hard disk or a memory of the terminal device 18. In other embodiments, the memory 181 may also be an external storage device of the terminal device 18, such as a plug-in hard disk equipped on the terminal device 18, a smart memory card (Smart Media Card, SMC), and a secure digital (Secure Digital). Digital, SD) card, flash card, etc. Further, the memory 181 may also include both an internal storage unit of the terminal device 18 and an external storage device. The memory 181 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory 181 can also be used to temporarily store data that has been output or will be output.
  • a boot loader BootLoader
  • An embodiment of the present application also provides a network device, which includes: at least one processor, a memory, and a computer program stored in the memory and running on the at least one processor, and the processor executes The computer program implements the steps in any of the foregoing method embodiments.
  • the embodiments of the present application also provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in each of the foregoing method embodiments can be realized.
  • the embodiments of the present application provide a computer program product.
  • the steps in the foregoing method embodiments can be realized when the mobile terminal is executed.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the computer program can be stored in a computer-readable storage medium. When executed by the processor, the steps of the foregoing method embodiments can be implemented.
  • the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate forms.
  • the computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the photographing device/terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), and random access memory (RAM, Random Access Memory), electric carrier signal, telecommunications signal and software distribution medium.
  • ROM read-only memory
  • RAM random access memory
  • electric carrier signal telecommunications signal and software distribution medium.
  • U disk mobile hard disk, floppy disk or CD-ROM, etc.
  • computer-readable media cannot be electrical carrier signals and telecommunication signals.
  • the disclosed apparatus/network equipment and method may be implemented in other ways.
  • the device/network device embodiments described above are only illustrative.
  • the division of the modules or units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units.
  • components can be combined or integrated into another system, or some features can be omitted or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

一种数据同步的方法、装置、终端以及存储介质,该方法包括:获取目标数据在各个分布式节点对应的数据链表;所述数据链包括:基于操作时间依次排序的多个操作记录(S501);根据所述数据链表中各个所述操作记录的同步标识,确定失效操作记录(S502);删除所述失效操作记录并更新各个所述数据链表(S503)。该方法能够删除数据链表中已失效的操作记录对应的操作数据,减少了对失效数据的存储,能够提高分布式节点的存储压力,提高了存储效率。

Description

一种数据同步的方法、装置、终端以及存储介质
本申请要求于2020年05月12日提交国家知识产权局、申请号为202010398492.X、申请名称为“一种数据同步的方法、装置、终端以及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请属于互联网技术领域,尤其涉及一种数据同步的方法、装置、终端以及存储介质。
背景技术
为了提高数据操作的便捷性,可以采用分布式存储的方式,用户在多个不同的终端设备上对数据进行编辑,并通过定时或定量同步等方式,保证了数据的统一性的同时,也解决了对相同数据的操作需要在一个设备上进行编辑操作。现有的数据同步技术,对每次对数据进行编辑时会产生对应的操作记录,然而随着对数据编辑操作的次数不断增加,大量的操作记录同时存储于多个分布式节点,占用了大量存储资源,降低了分布式节点的存储效率。
发明内容
本申请实施例提供了一种数据同步的方法、装置、终端以及存储介质,可以解决数据同步技术,大量的操作记录同时存储于多个分布式节点,占用了大量存储资源,存储效率较低的问题。
第一方面,本申请实施例提供了一种数据同步的方法,包括:
获取目标数据在各个分布式节点对应的数据链表;所述数据链包括:基于操作时间依次排序的多个操作记录;
根据所述数据链表中各个所述操作记录的同步标识,确定失效操作记录;
删除所述失效操作记录并更新各个所述数据链表。
在第一方面的一种可能的实现方式中,所述根据所述数据链表中各个所述操作记录的同步标识,确定失效操作记录,包括:
若各个所述数据链表内均包含所述同步标识为已同步的所述操作记录,则基于所述操作时间,将最后同步的所述操作记录识别为保留记录;
将除所述保留记录外的其他已同步的所述操作记录识别为失效操作记录。
在第一方面的一种可能的实现方式中,所述基于所述操作时间,将最后同步的所述操作记录识别为保留记录,包括:
获取各个所述分布式节点的在线状态;
若任一所述分布式节点处于离线状态,则从所有第一数据链表中选取任一所述第一数据链表生成保留链表;所述第一数据链表为所属的所述分布式节点处于在线状态的所述数据链表;
基于所述操作时间,从所述第一数据链表中将最后同步的所述操作记录识别为所述第一数据链表的第一保留记录;
基于所述操作时间,从所述第二数据链表中将最后同步的所述操作记录识别为所述第二数据链表的第二保留记录;所述第二数据链表为所属的所述分布式节点处于离线状态的所述数据链表。
在第一方面的一种可能的实现方式中,所述将除所述保留记录外的其他已同步的所述操作记录识别为失效操作记录,包括:
将所述第二数据链表中除所述第二保留记录的其他已同步的所述操作记录识别为失效操作记录;
将所述第一数据链表中所述第一保留记录外的其他已同步的所述操作记录识别为失效操作记录。
在第一方面的一种可能的实现方式中,在所述将所述第二数据链表中除所述第二保留记录的其他已同步的所述操作记录识别为失效操作记录之后,还包括:
若检测到所述第二数据链表对应的分布式节点处于在线状态,则基于所述保留链表对所述第二数据链表内的各个操作记录进行数据同步;
若检测到关于所述第二数据链表的同步完成信息,则将所述第二数据链表内各个操作记录的所述同步标签配置为已同步;
基于所述操作时间,将最后同步的所述操作记录识别为所述第二数据链表的保留记录;
将所述第二数据链表内除所述保留记录外的其他已同步的所述操作记录识别为失效操作记录。
在第一方面的一种可能的实现方式中,所述根据所述数据链表中各个所述操作记录的同步标识,确定失效操作记录,包括:
若任一所述数据链表内不包含所述同步标识为已同步的所述操作记录,则对所有所述数据链表内的各个操作记录进行数据同步;
若检测到关于各个所述数据链表的同步完成信息,则将各个所述操作记录的所述同步标签配置为已同步;
基于所述操作时间,将最后同步的所述操作记录识别为各个所述数据链表的保留记录;
将所述数据链表内除所述保留记录外的其他已同步的所述操作记录识别为失效操作记录。
在第一方面的一种可能的实现方式中,所述删除所述失效操作记录并更新各个所述数据链表,包括:
向与所述数据链表关联的所述分布式节点发送所述失效操作记录的数据释放指令,以使所述分布式节点在本地数据库删除所述失效操作记录对应的操作数据;
将保留记录的上关联字节由指向所述失效操作记录调整为指向所述目标数据预设的根节点;所述保留记录为所述数据链中最后同步的操作记录。
第二方面,本申请实施例提供了一种数据同步的装置,包括:
数据链表获取单元,用于获取目标数据在各个分布式节点对应的数据链表;所述数据链包括:基于操作时间依次排序的多个操作记录;
失效操作记录确定单元,用于根据所述数据链表中各个所述操作记录的同步标识, 确定失效操作记录;
数据链表更新单元,用于删除所述失效操作记录并更新各个所述数据链表。
第三方面,本申请实施例提供了一种终端设备,存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现上述第一方面中任一项所述数据同步的方法。
第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现上述第一方面中任一项所述数据同步的方法。
第五方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在终端设备上运行时,使得终端设备执行上述第一方面中任一项所述数据同步的方法。
第六方面,一种芯片系统,所述芯片系统包括存储器和处理器,所述处理器执行所述存储器中存储的计算机程序,以实现如第一方面中任一项所述数据同步的方法。
第七方面,一种芯片系统,所述芯片系统包括处理器,所述处理器与存储器耦合,所述处理器执行存储器中存储的计算机程序,以实现如第一方面中任一项所述数据同步的方法。
所述芯片系统可以为单个芯片,或者多个芯片组成的芯片模组。
可以理解的是,上述第二方面至第七方面的有益效果可以参见上述第一方面中的相关描述,在此不再赘述。
本申请实施例与现有技术相比存在的有益效果是:
本申请实施例可以获取各个分布式节点关于目标数据的数据链表,从而通过数据链表内各个操作记录对应的同步标识,确定已失效的操作记录,将已失效的操作记录从数据链表中删除,并更新数据链表,从而能够删除已失效的操作记录对应的操作数据,减少了对失效数据的存储,能够提高分布式节点的存储压力,提高了存储效率。
附图说明
图1是本申请实施例提供的手机的部分结构的框图;
图2是本申请实施例的手机的软件结构框图;
图3是本申请一实施例提供的数据同步的系统的结构框图;
图4是本申请另一实施例提供的数据同步的系统的结构框图;
图5是本申请第一实施例提供的一种数据同步的方法的实现流程图;
图6是本申请一实施例提供的数据链表的结构示意图;
图7是本申请一实施例提供的操作记录的同步示意图;
图8是本申请另一实施例提供的操作记录的同步示意图;
图9是本申请一实施例提供的删除未同步的操作记录时的数据链表的同步示意图;
图10是本申请第二实施例提供的一种数据同步的方法S502的具体实现流程图;
图11是本申请第三实施例提供的一种数据同步的方法S1001的具体实现流程图;
图12是本申请一实施例提供的多个数据链表中已同步的操作记录的示意图;
图13是本申请第四实施例提供的一种数据同步的方法S1002的具体实现流程图;
图14是本申请第五实施例提供的一种数据同步的方法的具体实现流程图;
图15是本申请第六实施例提供的一种数据同步的方法S502的具体实现流程图;
图16是本申请第七实施例提供的一种数据同步的方法的S503具体实现流程图;
图17是本申请一实施例提供的一种数据同步的设备的结构框图;
图18是本申请另一实施例提供的一种终端设备的示意图。
具体实施方式
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。
应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。
还应当理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。
如在本申请说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定”或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。
另外,在本申请说明书和所附权利要求书的描述中,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。
在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。
本申请实施例提供的数据同步的方法可以应用于手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等终端设备上,还可以应用于数据库、服务器以及基于终端人工智能的服务响应系统,本申请实施例对终端设备的具体类型不作任何限制。
例如,所述终端设备可以是WLAN中的站点(STAION,ST),可以是蜂窝电话、无绳电话、会话启动协议(Session InitiationProtocol,SIP)电话、无线本地环路(Wireless Local Loop,WLL)站、个人数字处理(Personal Digital Assistant,PDA)设备、具有无线通信功能的手持设备、计算设备或连接到无线调制解调器的其它处理设备、电脑、膝上型计算机、手持式通信设备、手持式计算设备、和/或用于在无线系统上进行通信的其它设备以及下一代通信系统,例如,5G网络中的移动终端或者未来演进的公共陆地移动网络(Public Land Mobile Network,PLMN)网络中的移动终端等。需要说明的是, 由于该移动终端具体是用于管理各个分布式节点的数据链表,响应各个分布式节点的同步操作,在该情况下,该移动终端具体可以为一长时间处于在线状态的移动终端。优选地,该移动终端为不断电且联网的移动终端。
以所述终端设备为手机为例。图1示出的是与本申请实施例提供的手机的部分结构的框图。参考图1,手机包括:射频(Radio Frequency,RF)电路110、存储器120、输入单元130、显示单元140、传感器150、音频电路160、近场通信模块170、处理器180、以及电源190等部件。本领域技术人员可以理解,图1中示出的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
下面结合图1对手机的各个构成部件进行具体的介绍:
RF电路110可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,给处理器180处理;另外,将设计上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路110还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global System of Mobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE))、电子邮件、短消息服务(Short Messaging Service,SMS)等,通过RF电路110接收分布式节点上传的数据链表,以及响应各个分布式节点的同步请求。
存储器120可用于存储软件程序以及模块,处理器180通过运行存储在存储器120的软件程序以及模块,从而执行手机的各种功能应用以及数据处理,例如将接收到的分布式节点上传的数据链表存储于存储器120内。存储器120可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据手机的使用所创建的数据(比如音频数据、电话本等)等,存储数据区还可以存储其他终端反馈的数据(比如可穿戴设备反馈的生物特征数据)。此外,存储器120可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。
输入单元130可用于接收输入的数字或字符信息,以及产生与手机100的用户设置以及功能控制有关的键信号输入。具体地,输入单元130可包括触控面板131以及其他输入设备132。触控面板131,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板131上或在触控面板131附近的操作),并根据预先设定的程式驱动相应的连接装置。需要说明的是,该终端设备除了管理各个分布式节点的数据链表外,本身也可以作为一分布式节点,即可以对数据进行编辑操作,在该情况下,用户可以通过输入单元130输入编辑内容,并对目标数据进行编辑操作,继而生成对应的操作记录。
显示单元140可用于显示由用户输入的信息或提供给用户的信息以及手机的各种 菜单,例如输出用于编辑目标数据的操作界面,以及接收用户对于目标数据的查询指令,以显示目标数据等。显示单元140可包括显示面板141,可选的,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板141。进一步的,触控面板131可覆盖显示面板141,当触控面板131检测到在其上或附近的触摸操作后,传送给处理器180以确定触摸事件的类型,随后处理器180根据触摸事件的类型在显示面板141上提供相应的视觉输出。虽然在图1中,触控面板131与显示面板141是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板131与显示面板141集成而实现手机的输入和输出功能。
手机100还可包括至少一种传感器150,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板141的亮度,接近传感器可在手机移动到耳边时,关闭显示面板141和/或背光。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于手机还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。
音频电路160、扬声器161,传声器162可提供用户与手机之间的音频接口。音频电路160可将接收到的音频数据转换后的电信号,传输到扬声器161,由扬声器161转换为声音信号输出;另一方面,传声器162将收集的声音信号转换为电信号,由音频电路160接收后转换为音频数据,再将音频数据输出处理器180处理后,经RF电路110以发送给比如另一手机,或者将音频数据输出至存储器120以便进一步处理。
终端设备可以通过近场通信模块170可以接入互联网,从而接收各个分布式节点反馈的数据链表,例如该近场通信模块170集成有WIFI通信模块,通过WIFI通信模块与当前所处场景下的无线路由器建立通信连接,并通过无线路由器接入互联网。虽然图1示出了近场通信模块170,但是可以理解的是,其并不属于手机100的必须构成,完全可以根据需要在不改变申请的本质的范围内而省略。
处理器180是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器120内的软件程序和/或模块,以及调用存储在存储器120内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。可选的,处理器180可包括一个或多个处理单元;优选的,处理器180可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器180中。
手机100还包括给各个部件供电的电源190(比如电池),优选的,电源可以通过电源管理系统与处理器180逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。
手机100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明手机100的软 件结构。
图2是本申请实施例的手机100的软件结构框图。将Android系统分为四层,分别为应用程序层、应用程序框架层(framework,FWK)、系统层以及硬件抽象层,层与层之间通过软件接口通信。
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。
应用程序层可以包括一系列应用程序包。
如图2所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。
如图2所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。
Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。
2D图形引擎是2D绘图的绘图引擎。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。在一些实施例中,上述内核层还包含PCIE驱动。
图3示出了本申请一实施例提供的数据同步的系统的结构框图。参见图3所示,该数据同步的系统包括服务器310以及多个分布式节点320。其中,服务器310与分布式节点320之间建立有通信链路。
其中,本申请提供的数据同步的装置具体可以为上述的服务器310。服务器310可以用于管理数据库内各个数据在不同的分布式存储节点上传的数据链表。服务器310可以为数据库内的各个数据配置对应的数据编号,该数据可以为一个文本文档、图片、视频、音频等不同形式的数据,或是任一数据包内的某个数据,例如文本文档中某个数据项的参数值,又或者某个网络页面内的某一区域的显示内容等,在此不对数据进行限定。服务器310可以根据数据编号,建立数据与数据链表之间的关联关系,例如该数据链表的表头添加上述的数据编号。服务器310可以将关于同一数据(即数据编号相同)的所有数据链表进行关联存储。继而根据各个数据链表识别失效操作记录,以更新各个数据链表。当然,服务器310还可以根据各个分布式节点的数据链表,执行操作记录的同步操作,作为分布式事务的管理主体。
分布式节点320可以为任意类型的设备,包括但不限于手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等终端设备。多个分布式节点320可以对同一数据进行编辑操作,在执行上述编辑操作时,该分布式节点320可以处于在线状态,也可以处于离线状态。用户通过分布式节点320上的输入模块对数据进行编辑后,会生成对目标数据的操作记录,并添加到该目标数据对应的数据链表上。分布式节点320可以将数据链表上传给服务器310,也可以在满足预设的同步条件时,对本地的数据链表内的各个操作记录进行数据同步。各个分布式节点除了存储各个操作记录外,还存储有该操作记录对应的操作数据。分布式节点320可以删除失效操作记录对应的操作数据,从而减少无效数据对于存储器的资源占用。
图4示出了本申请另一实施例提供的数据同步的系统的结构框图。参见图4所示,该数据同步的系统包括第一分布式节点410以及第二分布式节点420。其中,第一分布式节点410与第二分布式节点420之间可以通过有线和/或无线网络进行通信。
其中,上述第一分布式节点410以及第二分布式节点420为任意类型的设备,包括但不限于手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile  personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等终端设备,当然,还可以为服务器或数据库等设备。
上述第一分布式节点410可以与其他第二分布式节点420一起,对同一数据进行编辑操作。在执行上述编辑操作后,可以创建关于目标数据的操作记录,从而生成对应的数据链表。第一分布式节点410可以根据本地生成的数据链表以及第二分布式节点420上传的数据链表,对本地的数据链表内的各个操作记录进行数据同步。该第一分布式节点410还可以存储有该操作记录对应的操作数据。即第一分布式节点包含有各个第二分布式节点420的功能,即对同一数据的编辑功能,以及存储操作记录与操作记录对应的操作数据等。除上述功能之外,第一分布式节点410还可以用于管理整个分布式系统的数据链表,对数据链表内的操作记录进行同步。优选地,上述第一分布式节点410具体为一长时间在线的设备,该长时间在线即要求第一分布式节点410处于联网状态以及处于不断电状态。
在一种可能的实现方式中,数据同步的系统可以为第一分布式节点410配置应对异常状态下的备用设备411。第一分布式节点410可以将本地存储的数据链表以及各个第二分布式节点420反馈的数据链表定期同步至备用设备411,在第一分布式节点410处于正常运行的状态下,备用设备411处于待机状态,从而能够减少资源的消耗。若检测到第一分布式节点410处于异常预警状态,例如电量低于预设的最低电量阈值,或者丢包率大于预设的正常丢包阈值,又或者硬件资源占用率大于预设的占用阈值,此时则识别第一分布式节点410可能会掉线,此时,会激活备用设备411,并实时同步第一分布式节点410的数据至备用设备411,并建立与各个第二分布式节点420的通信链路。若检测到第一分布式节点410处于离线状态(例如发生断电或无法连接网络的情况下),则通过上述备用设备411与各个第二分布式节点420建立的通信链路,接收各个第二分布式节点上传的数据链表,以及响应操作记录的同步操作。
在一种可能的实现方式中,管理数据链表的操作可以在各个分布式节点进行轮换。即分布式节点在不同的时刻可以作为管理数据链表的第一分布式节点410,或者上报数据链表的第二分布式节点420。在该情况下,数据同步的系统可以根据各个分布式节点的运行参数,确定各个分布式节点的优先级,选取优先级最高的分布式节点作为第一分布式节点410,其他的分布式节点则作为第二分布式节点420。其中,上述运行参数包括有:可用的存储资源、运算速度、网络带宽等,并基于上述运算参数以及各个运算参数预设的优先权重,计算得到各个分布式节点对应的优先级。在运行的过程中,若检测到第一分布式节点410的运行参数低于预设的正常运行范围,则识别该第一分布式节点410处于过载状态,可以管理数据链表的功能转移到其他分布式节点,因此,会获取各个分布式节点的运行参数,并重新确定各个分布式节点的优先级,从而所有第二分布式节点中,选取优先级最高的第二分布式节点作为新的第一分布式节点(即管理数据链表的节点),原本的第一分布式节点将存储有的各个分布式节点的数据链表发送给新的第一分布式节点,从而实现了管理任务的转移,从而数据同步系统无需配置单独的管理设备,提高了数据同步的系统的造价。
在一种可能的实现方式中,管理数据链表的操作可以在各个分布式节点进行轮换。即分布式节点在不同的时刻可以作为管理数据链表的第一分布式节点410,或者上报 数据链表的第二分布式节点420。在该情况下,数据同步的系统可以为各个分布式节点配置对应的管理周期。若任一分布式节点处于其所对应的管理周期内,则作为上述的第一分布式节点410,管理整个系统的数据链表;其他分布式节点在不处于其所对应的管理周期内,则作为上述的第二分布式节点420,上传数据链表。在到达该分布式节点所对应的管理周期的周期结束时刻,可以将存储与本地的数据链表发送给下一个管理周期对应的分布式节点,以通过下一管理周期对应的分布式节点继续承担数据链表的管理操作,实现操作基于时间周期进行轮转,无需保持某一设备长期处于在线状态,只需在对应的管理周期时处于在线状态即可,而且哥哥分布式节点均可承担数据链表的管理操作,从而提高了数据同步系统的鲁棒性。
在本申请实施例中,流程的执行主体为安装有数据同步的程序的设备。作为示例而非限定,数据同步的程序的设备具体可以为终端设备,该终端设备可以为服务器,专门用于管理数据链表,还可以为智能手机、平板电脑、笔记本电脑等可同时作为分布式节点的设备,在后续的实施例中,以终端设备表示上述管理数据链表的数据同步的程序的设备。图5示出了本申请第一实施例提供的数据同步的方法的实现流程图,详述如下:
在S501中,获取目标数据在各个分布式节点对应的数据链表;所述数据链包括:基于操作时间依次排序的多个操作记录。
在本实施例中,数据同步的系统内包含有多个分布式节点,该分布式节点可以安装于同一位置,例如处于同一机房内;若多个分布式节点处于同一位置,则各个分布式节点可以通过串口或通信端口的方式,与终端设备建立通信连接,并通过该通信连接向终端设备发送数据链表。上述多个分布式节点可以处于不同的位置,例如处于各个分布式节点处于不同的机房,或者任意多个分布式节点处于同一机房,其他分布式节点处于不同的机房;在该情况下,则各个分布式节点可以通过有线或无线通信方式,与终端设备建立通信连接,并向终端设备发送数据链表。
在本实施例中,各个分布式节点均可以对同一目标数据进行操作,该操作包括:增加目标数据、删除目标数据、替换目标数据或变更目标数据的数据内容等各种操作形式,并且根据目标数据的数据类型不同,可以采用多种与数据类型相关的操作方式,例如若目标数据为音频数据,则上述操作可以为:对音频数据通过预设的滤波算法进行滤波处理,得到滤波后的音频数据;若目标数为图像数据,则上述操作可以为:对图像数据进行人脸识别,并提取人脸图像;因此,不同的数据类型所采用的操作方式不同,在此不对操作内容进行限定。
在本实施例中,用户可以在分布式节点上对目标数据进行编辑操作,在每次执行编辑操作后,会生成对应的操作记录,根据各个操作记录对应的操作时间,生成关于目标数据的数据链表。由于用户在分布式节点对目标数据进行操作时,该分布式节点并非一定处于在线状态,且处于在线状态也并非实时将编辑后的数据同步至各个分布式节点,基于此,各个分布式节点存储有关于本地操作的数据链表,并在满足预设的上传时机时,将数据链表上传至终端设备,并在到达预设的同步时机时,对数据链表内的操作记录进行同步操作,以保持处于各个分布式终端上关于目标数据的数据内容的一致性。需要说明的是,若在执行同步操作时,任一分布式节点处于离线状态,即 本次同步操作并未更新到处于离线的分布式节点的数据链表内,此时,也会识别该操作记录为已同步的操作记录,待该离线的分布式节点上线后,终端设备可以将离线状态下所有同步的操作记录,同步至该离线的分布式节点的数据链表内。
在一种可能的实现方式中,上述分布式节点上传数据链表的上传时机具体可以为:分布式节点可以通过内置的客户端程序与终端设备建立通信连接,在分布式节点与终端设备建立有通信连接的状态下,则识别该分布式节点处于在线状态。在在线状态下,分布式节点在检测到生成一个关于目标数据的操作记录后,会更新数据链表,并将更新后的数据链表上传给终端设备。即上述的上传时机为:节点在线且数据链表触发了更新流程。其中,上述上传数据链表的方式可以为增量上传也可以是全量上传,其中,增量上传具体为分布式节点可以将本次数据链表中新增的操作记录发送给终端设备,终端设备可以将接收到的操作记录添加到对应的数据链表内;全量上传具体为将关于目标数据的完整的数据链表发送给终端设备,终端设备可以删除已存储的关于该分布式节点的数据链表,并保存分布式节点本次上传的数据链表。
在一种可能的实现方式中,上述对数据链表进行同步的时机可以为:终端设备若检测到各个分布式节点均处于在线状态,则执行数据链表的同步操作;优选地,终端设备若检测到各个分布式节点处于在线状态,则获取各个分布式节点当前的运行参数,若上述运行参数均大于预设的同步阈值(即各个分布式节点当前均存在一定的可用资源响应同步操作),则执行数据链的同步操作。
在一种可能的实现方式中,上述对数据链表进行同步的时机可以为:终端设备若检测到目标数据在各个数据链表中待同步的操作记录的个数大于预设的个数阈值时,则可以执行数据链表的同步操作。例如各个数据链表中待同步的操作记录的个数大于2,此时终端设备可以同时对各个分布式节点的数据链表执行同步操作。
示例性地,图6示出了本申请一实施例提供的数据链表的结构示意图。参见图6所示,该数据链表内包含有多个操作记录,每个操作记录包含以下三个内容,分别为:该操作记录对应的唯一标示符、上一次操作所对应的操作记录的上关联字节,以及本次操作对应的操作数据的数据索引。基于上述三个内容,可以根据各个操作记录对应的操作时间,依次连接各个操作记录,从而生成对应的数据链表。如图6中的操作记录1,其上一次操作所对应的操作记录为操作记录2,因此在上关联字节内对应的值为操作记录2的唯一标示符;而由于操作记录1为最后生成的操作记录,因此没有任何操作记录的上关联字节是指向操作记录1,即操作记录1是该数据链的链尾;而该操作记录1中的数据索引可以为一存储路径,用于确定存储本次操作数据的存储地址,例如本次操作是编辑操作,则该存储地址可以存储有对目标数据编辑后的值。需要说明的是,该数据链表的表头可以指向预设的根节点,该根节点可以为空,即用户首次对目标数据进行编辑时,该目标数据并未赋值,此时,会生成一个操作记录,由于该操作记录并不存在比其操作时间更早的其他操作记录,因此,对应的上关联字节可以指向空或预设的根节点。在图6中,该根节点具体为空节点,即Empty。
在本实施例中,终端设备执行上述数据同步的方式可以为:终端设备可以根据各个操作记录对应的唯一标识符,判断各个数据链表内是否包含该操作记录,若均包含该操作记录,则将该操作记录的同步标识设置为已同步;若该操作记录并非包含在任 一数据链表内或未执行同步识别操作,则识别该操作记录为未同步。终端设备可以将各个同步标识为未同步的操作记录同步至各个数据链表内。
在一种可能的实现方式中,终端设备执行上述数据同步的方式可以为:判断该待同步的操作记录是否包含在其他分布式节点的数据链表内,若包含,则无需同步;反之,若该操作记录不包含在数据链表内,则根据该操作记录的操作时间,以及各个已有操作记录的操作时间,确定本次添加的操作记录的序号,并基于上述序号插入到数据链表对应的序号的位置,并调整操作时间晚于该操作记录的各个已有操作记录的序号。若该操作记录包含有上关联字节,则可以调整该序号对应的原有的已有操作记录的上关联字节修改为本次插入的操作记录对应的唯一标示符。示例性地,图7示出了本申请一实施例提供的操作记录的同步示意图。参见图7所示,该数据链表包含多个操作记录,分别为操作记录1~5,各个操作记录对应的操作时间分别为:4月1日、4月2日、4月3日、4月5日以及4月6日。待同步的操作记录(即操作记录A)对应的操作时间为4月4日,其操作时间在操作记录3和操作记录4之间,因此,该待同步的操作记录A的上关联记录为操作记录3,因此将该操作记录A的上关联字节配置为“操作记录3”(即操作记录3对应的唯一标示符);而将操作记录4的上关联字节调整为“操作记录A”,从而生成新的数据链表。
在一种可能的实现方式中,终端设备执行上述数据同步的方式可以为:判断该待同步的操作记录是否包含在其他分布式节点的数据链表内,若包含,则无需同步;反之,若该操作记录不包含在数据链表内,则根据该操作记录内包含的上关联字节,添加到该数据链中与该上关联字节对应的已有操作记录后,更新所述数据链表。若该数据链中与已有操作记录已包含对应的下关联记录,则会创建一个新的数据链分支。示例性地,图8示出了本申请另一实施例提供的操作记录的同步示意图。参见图8所示,待同步的操作记录A中的上关联字节为“操作记录3”,存储于其他分布式节点的数据链表中操作记录3的下关联操作记录为操作记录4,且操作记录4和操作记录A的操作数据不一致,因此无法合并上述两个操作记录,因此,会创建一个数据链分支,即由操作记录1→2→3→A,得到同步后的数据链表。
在S502中,根据所述数据链表中各个所述操作记录的同步标识,确定失效操作记录。
在本实施例中,由于数据链表内各个操作记录对应有同步标识,即该操作记录是否已在各个分布式节点上执行了同步操作。若该操作记录已经同步到各个数据链表内,即删除该操作记录并不会对数据链表的结构产生影响,因此可以将其识别为失效操作记录;反之,若该操作记录未同步到各个数据链表内,即删除该操作记录可能会影响该数据链表的结构,因此不能将其删除。示例性地,图9示出了本申请一实施例提供的删除未同步的操作记录时的数据链表的同步示意图。参见图9所示,第一分布式节点内的数据链表包含有5个操作记录,分别为操作记录1至5,而第二分布式节点内的数据链表包含有2个操作记录,分别为操作记录1和2,其中操作记录1和2是已同步的操作记录(即同时存在于第一分布式节点以及第二分布式节点)。若此时,删除掉了第一分布式节点内数据链表中的操作记录1至3,保留记录4和5。由于操作记录4内关联的上关联节点为空节点,与第二分布式节点的数据链表进行同步时,则与 原有的操作记录1对应的上关联节点一致,且两个操作数据不同,第二分布式节点会同时保留上述两个操作记录,从而产生了支链,影响了数据链表的结构。基于上述原因,终端设备并不会删除未同步的操作记录,因此可以根据各个操作记录的同步标识,从数据链表中确定出失效操作记录。
在本实施例中,触发S502的方式可以由人为手动启动,即用户向终端设备发起一个数据老化指令,则终端设备可以根据各个分布式节点上传的数据链表,对失效操作记录进行删除;也可以基于预设的触发条件,执行上述S502的操作。
在一种可能的实现方式中,触发S502的方式可以为:终端设备在接收到分布式节点发送的操作记录的同步请求后,可以对各个分布式节点对应的数据链表内的操作记录进行同步操作,并在同步后调整各个操作记录对应的同步标识。此时,由于已经完成了数据链表的同步流程,因此可以对同步后的数据链表进行统一老化,即识别失效操作记录并进行删除,此时会执行S502的操作。
在一种可能的实现方式中,触发S502的方式可以为:终端设备可以获取各个分布式节点的存储占用率,若任一分布式节点的存储占用率大于预设的占用阈值,则执行S502的操作。即终端设备会识别各个分布式节点对应的数据链表内包含的失效操作记录,并将各个失效操作记录对应的操作数据从分布式节点中进行删除,从而可以释放无效数据的存储资源,以降低分布式节点的存储占用率。
在一种可能的实现方式中,触发S502的方式可以为:终端设备可以获取各个分布式节点的数据链表包含的操作记录的个数,若任一所述数据链表内的操作记录的个数大于预设的个数阈值,则执行S502的操作。
在S503中,删除所述失效操作记录并更新各个所述数据链表。
在本实施例中,终端设备在确定了各个失效操作记录后,可以将失效的操作记录从数据链表中进行删除,并对数据链表进行更新,更新后的数据链表不包含上述已删除的失效操作记录。
在一种可能的实现方式中,终端设备可以将删除了失效记录的数据链表反馈给各个分布式节点,各个分布式节点可以根据接收到的数据链表以及本地存储的数据链表,确定失效操作记录,继而确定各个失效操作记录中对应操作数据的数据索引,获取得到对应的操作数据并进行数据删除操作,以释放存储资源。
以上可以看出,本申请实施例提供的一种数据同步的方法可以获取各个分布式节点关于目标数据的数据链表,从而通过数据链表内各个操作记录对应的同步标识,确定已失效的操作记录,将已失效的操作记录从数据链表中删除,并更新数据链表,从而能够删除已失效的操作记录对应的操作数据,减少了对失效数据的存储,能够提高分布式节点的存储压力,提高了存储效率。
图10示出了本申请第二实施例提供的一种数据同步的方法S502的具体实现流程图。参见图10,相对于图5所述实施例,本实施例提供的一种数据同步的方法中S502包括:S1001~S1002,具体详述如下:
在S1001中,若各个所述数据链表内均包含所述同步标识为已同步的所述操作记录,则基于所述操作时间,将最后同步的所述操作记录识别为保留记录。
在本实施例中,终端设备可以获取各个数据链表内包含的操作记录的同步标识, 并基于同步标识将数据链表划分为两段,包括已同步的数据链段以及待同步的数据链段,已同步的数据链段内的各个操作记录的同步标识均为已同步,而待同步的数据链段内的各个操作记录的同步标识为待同步。
在本实施例中,终端设备可以检测各个数据链表中是否均包含有已同步的操作记录,若是,则执行S1001的操作。由于当存在数据链表内不包含已同步的操作记录时,则表示该数据链表内并不存在可以删除的保留记录,在一种可能的实现方式中,终端设备可以将先对该不包含已同步的操作记录的数据链表,与任一其他分布式节点存储的数据链表进行同步操作,并在同步后重新执行S1001的操作。
在本实施例中,终端设备根据各个已同步的操作记录(即同步标识为已同步的操作记录)的操作时间,确定出最后完成同步的操作记录,并将其识别为保留记录。其中,该最后同步的操作记录具体为操作时间与当前触发确定失效操作记录的时刻之间的时间差最小的操作记录。例如,操作记录1到3均为已同步的操作记录,且对应的操作时间分别为4月1日、4月2日以及4月3日,由于操作时间最后的一个已同步的操作记录为操作记录3,即操作记录3为保留记录。
在S1002中,将除所述保留记录外的其他已同步的所述操作记录识别为失效操作记录。
在本实施例中,终端设备可以各个数据链中将除保留记录外的其他已同步的操作记录识别为失效记录,从而可以确定出需要从数据链表中删除的操作记录。
在本申请实施例中,通过将最后同步的操作记录识别为保留记录,从而保证在各个数据链表中存储有相同的操作记录,由于在执行同步操作时,需要确定操作记录的上关联节点是否一致,并基于上关联节点来执行上链操作,若各个数据链表中不包含相同的操作记录,则执行上链操作时容易产生支链,影响数据链表的结构。因此,若在数据链表中保留有至少一个相同的操作记录(即已同步的保留记录),在后续对未同步的操作记录进行同步时,能够避免出现支链,影响数据表的结构,也能够最大限度释放失效的操作记录,提高了分布式节点的存储效率。
图11示出了本申请第三实施例提供的一种数据同步的方法S1001的具体实现流程图。参见图11,相对于图10所述实施例,本实施例提供的一种数据同步的方法中S1001包括:S1101~S1104,具体详述如下:
进一步地,所述基于所述操作时间,将最后同步的所述操作记录识别为保留记录,包括:
在S1101中,获取各个所述分布式节点的在线状态。
在本实施例中,分布式节点在处于在线状态下,可以与终端设备建立有通信连接,且该通信连接处于激活状态。因此,终端设备可以根据当前处于激活状态的通信连接的个数,确定在线的分布式节点的个数,以及根据各个通信连接对应的通信对端,确定处于在线状态的分布式节点。
在本实施例中,终端设备可以存储有数据同步系统内包含的所有节点列表,若检测到该节点列表内存在任一分布式节点处于离线状态,则执行S1102的操作;若检测到节点列表内各个分布式节点均处于在线状态,则可以执行基于所述操作时间,将最后同步的所述操作记录识别为保留记录的操作。
在S1102中,若任一所述分布式节点处于离线状态,则从所有第一数据链表中选取任一所述第一数据链表生成保留链表;所述第一数据链表为所属的所述分布式节点处于在线状态的所述数据链表。
在本实施例中,终端设备可以将数据链表根据所属的分布式节点的在线状态划分为两个类型。其中,若数据链表所属的分布式节点处于在线状态,则该数据链表识别为第一数据链表;若数据链表所属的分布式节点处于离线状态,则该数据链表识别为第二数据链表。
在本实施例中,终端设备可以从任意选取一个在线的分布式节点对应的第一数据链表,作为保留链表,以便后续当前处于离线状态的分布式节点上线后,可以基于保留链表对第二数据链表进行数据同步操作。
在S1103中,基于所述操作时间,从所述第一数据链表中将最后同步的所述操作记录识别为所述第一数据链表的第一保留记录。
在本实施例中,终端设备可以根据各个操作记录对应的操作时间,从所有第一数据链表中选取出最后同步的操作记录作为各个第一数据链表的第一保留记录。由于第一数据链表内的操作记录与处于离线的第二数据链表中,已同步的操作记录的个数可能不同,因此,最后同步的操作记录在不同的数据链表中会存在差异。为了保证各个数据链表保证有且只有一个相同的操作记录,从第一数据链表中识别得到最后同步的操作记录,并将该操作记录识别为该第一数据链表的第一保留记录。其中,分布式节点处于在线状态,且最后同步的操作记录,必然对于所有分布式节点而言,是内容相同的操作记录。因为同步操作,是对于所有在线的分布式节点而言所执行的同步操作,因此可以避免出现后续节点在同步时,无法确定相同的上关联节点的情况。
在S1104中,基于所述操作时间,从所述第二数据链表中将最后同步的所述操作记录识别为所述第二数据链表的第二保留记录;所述第二数据链表为所属的所述分布式节点处于离线状态的所述数据链表。
在本实施例中,由于部分分布式节点处于离线状态,因此,终端设备存储有的数据链表,并没有记录有该类型的分布式节点实际本地生成的数据链表,是历史上传得到的数据链表,因此将该第二数据链表中最后同步的操作记录,识别为该第二数据链表对应的第二保留记录。例如,某一分布式节点在4月1日上线,并对数据链表进行同步,最后同步的操作记录为4月1日的操作记录。此时,终端设备存储有4月1日关于该分布式节点的数据链表。而在4月2日以及4月3日,数据同步的系统执行了操作记录的同步操作,但由于该分布式节点并没有上线,因此无法将同步的操作记录更新至该数据链表内。在4月4日时,终端设备需要对失效的操作记录进行删除,此时该分布式节点上传到终端设备的数据链表为截止至4月1日的操作记录,会将4月1日的操作记录识别为第二保留记录。
示例性地,图12示出了本申请一实施例提供的多个数据链表中已同步的操作记录的示意图。其中,分布式节点1-3处于在线状态,分布式节点4处于离线状态。分布式节点1的数据链表内包含有操作记录1至8,其中,操作记录1-6为已同步的操作记录,其中,操作记录7和8为待同步的操作记录;而分布式节点2的数据链表内包含有操作记录1至7,其中,操作记录1-7为均为已同步的操作记录;分布式节点3的数 据链表内包含有操作记录1-9,其中,操作记录1-7为已同步的操作记录,操作记录8和9为未同步的操作记录;分布式节点4的数据链表内包含有操作记录1-5,操作记录1-3为已同步的操作记录,操作记录4和5为处于离线状态下,用户在分布式节点4上编辑得到的数据。在此,第一数据链表即为分布式节点1-3的数据链表,其中,最后同步的操作记录分别分布式节点1的操作记录6,分布式节点2和3中的操作记录7。因此,可以将上述3个操作记录作为对应数据列表内的第一保留记录。对应地,分布式节点4处于离线状态,则对应的第二数据链表为分布式节点4的数据链表,且第二数据链表中最后同步的操记录为操作记录3,即第二保留记录为操作记录3。
在本申请实施例中,根据不同的在线状态为不同的数据链表确定对应的保留节点,从而能够在删除数据链表中无效的操作记录的同时,能够保证后续对数据链表进行同步时,不会影响数据链表的结构。
图13示出了本申请第四实施例提供的一种数据同步的方法S1002的具体实现流程图。参见图13,相对于图12所述实施例,本实施例提供的一种数据同步的方法中S1002包括:S1301~S1302,具体详述如下:
进一步地,所述将除所述保留记录外的其他已同步的所述操作记录识别为失效操作记录,包括:
在S1301中,将所述第二数据链表中除所述第二保留记录的其他已同步的所述操作记录识别为失效操作记录。
在本实施例中,终端设备由于保留链表用于在当前离线的分布式节点重新上线时,进行同步操作时进行同步操作。因此,需要确保保留链表与第二数据链表中至少保留一个相同的操作记录,会将操作时间早于第二保留记录的其他已同步的操作记录识别为失效操作记录,即失效操作记录的编辑操作是在保留记录的编辑操作之前发生的。
在一种可能的实现方式中,若存在多个离线的分布式节点,则上述确定第二保留记录的操作是独立的,同样地,将该第二数据链表中除第二保留记录外的其他已同步的操作记录识别为失效操作记录。由于各个第二数据链表均是基于保留链表进行数据同步操作,因此,只要保证保留链表是完整的,则不同的第二数据链表均可以基于保留链表进行同步操作,相互之间的同步操作是独立的。
在S1302中,将所述第一数据链表中所述第一保留记录外的其他已同步的所述操作记录识别为失效操作记录。
在本实施例中,终端设备可以根据各个第一数据链表中对应的第一保留记录,对关联的第一数据链表进行失效操作记录的识别操作,即将该第一数据链表中除第一保留记录外的其他已同步的操作记录识别为失效操作记录。
需要说明的是,保留链表具体是存储于终端设备,因此在对该保留链表对应的分布式节点的数据链表进行失效数据识别时,依然会确定该保留链表对应的第一保留记录,即在后续的操作时,会基于第一保留记录,识别保留链表内的失效操作记录,但该失效操作记录是用于删除保留记录对应的分布式节点的操作数据上,而并不会影响存储于终端设备的保留链表内。
在本申请实施例中,通过对分布式节点的在线状态不同,采用对应的失效操作记录的识别手段,可以提高失效操作记录的识别准确性,从而更大限度的释放无效数据 占用的存储资源。
图14示出了本申请第五实施例提供的一种数据同步的方法的具体实现流程图。参见图14,相对于图13所述实施例,本实施例提供的一种数据同步的方法中在所述将所述第二数据链表中除所述第二保留记录的其他已同步的所述操作记录识别为失效操作记录之后,还包括:S1401~S1404,具体详述如下:
进一步地,在所述将所述第二数据链表中除所述第二保留记录的其他已同步的所述操作记录识别为失效操作记录之后,还包括:
在S1401中,若检测到所述第二数据链表对应的分布式节点处于在线状态,则基于所述保留链表对所述第二数据链表内的各个操作记录进行数据同步。
在本实施例中,若处于离线的分布式节点重新上线,即上述测到所述第二数据链表对应的分布式节点处于在线状态,终端设备可以通过保留链表对该分布式节点的第二数据链表进行同步操作。其中,同步的过程具体为:第二分布式节点可以对第二数据链表进行更新,即将在离线状态下发起的操作记录上传给终端设备,以得到更新后的第二数据链表,终端设备则通过保留链表内已同步的操作记录,同步至上述更新后的第二数据链表内,已得到同步后的第二数据链表,终端设备在执行同步操作后,可以识别该第二数据链表内是否包含待同步的操作记录,若存在则向当前在线的所有其他分布式节点发送同步指令,将需要同步的操作记录同步至其他分布式节点内,以予以存储。
在S1402中,若检测到关于所述第二数据链表的同步完成信息,则将所述第二数据链表内各个操作记录的所述同步标签配置为已同步。
在本实施例中,在对第二数据链表内的所有操作记录执行同步操作后,可以接收到各个分布式节点反馈同步完成指令,若所有在线的分布式节点均反馈上述同步完成指令,则会生成同步完成信息,以指示该第二数据链表中的所有操作记录以完成同步操作。终端设备可以将该第二数据链表的各个操作记录的同步标签识别为已同步。
在S1403中,基于所述操作时间,将最后同步的所述操作记录识别为所述第二数据链表的保留记录。
在本实施例中,终端设备在对第二数据链表进行同步操作后,可以对第二数据链表对应的分布式节点进行失效记录的识别操作,同样地,为了确保后续更新数据链表时,能够保证操作记录能够识别得到对应的上关联节点,需要确定一个最后同步的保留记录,因此,会将第二数据链表中最后同步的操作记录识别为保留记录。
在S1404中,将所述第二数据链表内除所述保留记录外的其他已同步的所述操作记录识别为失效操作记录。
在本实施例中,终端设备可以将除保留记录外的其他所有已同步的操作记录识别为失效操作记录,从而能够保证第二数据链表中有且只有一个操作记录与其他数据链表的操作记录是相同的,最大程度上释放无效数据的占用资源。在确定第二数据链表内的失效操作记录后,可以将更新后的第二数据链表反馈给所属的分布式节点,以使对应的分布式节点释放对应的占用资源。
在本申请实施例中,在检测到处于离线的分布式节点重新上线时,可以通过保留记录对该离线后重新上线的分布式节点进行数据同步操作,以保证目标数据的数据链 表与其他分布式数据链表一致,并且在更新了数据链表后,对分布式节点进行失效操作记录的识别操作,从而能够释放离线后重新上线的分布式节点的资源占用,避免分布式节点因错过资源释放时机而导致资源积压。
图15示出了本申请第六实施例提供的一种数据同步的方法S502的具体实现流程图。参见图15,相对于图5所述实施例,本实施例提供的一种数据同步的方法S502包括:S1501~S1504,具体详述如下:
进一步地,所述根据所述数据链表中各个所述操作记录的同步标识,确定失效操作记录,包括:
在S1501中,若任一所述数据链表内不包含所述同步标识为已同步的所述操作记录,则对所有所述数据链表内的各个操作记录进行数据同步。
在本实施例中,终端设备若检测到各个分布式节点处于在线状态,且存在一个数据链表内不包含有已同步的操作记录,即无法保证各个数据链表中包含有至少一个相同的操作记录,基于此,终端设备需要对数据链表中的操作记录进行数据同步,以保证各个分布式节点的数据链表一致性。
在S1502中,若检测到关于各个所述数据链表的同步完成信息,则将各个所述操作记录的所述同步标签配置为已同步。
在本实施例中,各个分布式节点对本地的数据链表完成同步后,可以向终端设备反馈一个同步完成信息,若检测到各个数据链表的同步完成信息后,可以将各个操作记录的同步标签配置为已同步,即表示各个操作记录已经与其他分布式节点的操作记录保持一致。
在S1503中,基于所述操作时间,将最后同步的所述操作记录识别为各个所述数据链表的保留记录。
在本实施例中,终端设备可以根据各个操作记录的操作时间,识别得到最后同步的操作记录,并将各个数据链表中最后同步的操作记录识别为保留记录。通过配置保留记录,能够保证老化数据后的各个数据链表中至少包含一个相同的操作记录,从而能够在后续同步时,保证数据链表结构的一致性,避免出现支链。
在S1504中,将所述数据链表内除所述保留记录外的其他已同步的所述操作记录识别为失效操作记录。
在本实施例中,在本实施例中,终端设备可以将除保留记录外的其他所有已同步的操作记录识别为失效操作记录,从而能够保证数据链表中有且只有一个操作记录与其他数据链表的操作记录是相同的,最大程度上释放无效数据的占用资源。在确定数据链表内的失效操作记录后,可以将更新后的数据链表反馈给所属的分布式节点,以使对应的分布式节点释放对应的占用资源。
在本申请实施例中,在各个数据链表中不存在已同步的操作记录时,可以先进行全量同步后,在进行失效操作记录的识别,保证了数据链表结构的一致性,避免出现支链。
图16示出了本申请第七实施例提供的一种数据同步的方法的S503具体实现流程图。参见图16,相对于图5、图10、图11、图13、图14以及图15任一所述实施例,本实施例提供的一种数据同步的方法S503包括:S1601~S1602,具体详述如下:
进一步地,所述删除所述失效操作记录并更新各个所述数据链表,包括:
在S1601中,向与所述数据链表关联的所述分布式节点发送所述失效操作记录的数据释放指令,以使所述分布式节点在本地数据库删除所述失效操作记录对应的操作数据。
在本实施例中,终端设备在确定了失效操作记录后,可以将各个失效操作记录对应的数据释放指令发送给所属的分布式节点,该数据释放指令携带有该操作记录的唯一标识符。分布式节点可以根据该唯一标识符,从数据链表中确定出操作记录,并基于该操作记录内包含有的数据索引,确定操作数据的存储位置,并将该操作数据从本地数据库进行删除。
在S1602中,将保留记录的上关联字节由指向所述失效操作记录调整为指向所述目标数据预设的根节点;所述保留记录为所述数据链中最后同步的操作记录。
在本实施例中,由于各个保留记录的上关联字节指向已失效的操作记录,此时,为了保证数据链的完整性,需要调整保留记录内的上关联字节的内容,避免数据链表断链。基于此,终端设备可以调整保留记录的上关联字节。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
对应于上文实施例所述的数据同步的方法,图17示出了本申请实施例提供的数据同步的装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。
参照图17,该数据同步的装置包括:
数据链表获取单元171,用于获取目标数据在各个分布式节点对应的数据链表;所述数据链包括:基于操作时间依次排序的多个操作记录;
失效操作记录确定单元172,用于根据所述数据链表中各个所述操作记录的同步标识,确定失效操作记录;
数据链表更新单元173,用于删除所述失效操作记录并更新各个所述数据链表。
可选地,所述失效操作记录确定单元172包括:
第一保留记录识别单元,用于若各个所述数据链表内均包含所述同步标识为已同步的所述操作记录,则基于所述操作时间,将最后同步的所述操作记录识别为保留记录;
第一失效操作记录确定单元,用于将除所述保留记录外的其他已同步的所述操作记录识别为失效操作记录。
可选地,所述第一保留记录识别单元包括:
在线状态确定单元,用于获取各个所述分布式节点的在线状态;
保留链表确定单元,用于若任一所述分布式节点处于离线状态,则从所有第一数据链表中选取任一所述第一数据链表生成保留链表;所述第一数据链表为所属的所述分布式节点处于在线状态的所述数据链表;
第一保留记录确定单元,用于基于所述操作时间,从所述第一数据链表中将最后同步的所述操作记录识别为所述第一数据链表的第一保留记录;
第二保留记录确定单元,用于基于所述操作时间,从所述第二数据链表中将最后 同步的所述操作记录识别为所述第二数据链表的第二保留记录;所述第二数据链表为所属的所述分布式节点处于离线状态的所述数据链表。
可选地,所述第一失效操作记录确定单元包括:
第一失效操作记录识别单元,用于将所述第二数据链表中除所述第二保留记录的其他已同步的所述操作记录识别为失效操作记录;
第二失效操作记录识别单元,用于将所述第一数据链表中所述第一保留记录外的其他已同步的所述操作记录识别为失效操作记录。
可选地,所述数据同步的装置还包括:
节点上线检测单元,用于若检测到所述第二数据链表对应的分布式节点处于在线状态,则基于所述保留链表对所述第二数据链表内的各个操作记录进行数据同步;
第一操作记录同步单元,用于若检测到关于所述第二数据链表的同步完成信息,则将所述第二数据链表内各个操作记录的所述同步标签配置为已同步;
第二保留记录识别单元,用于基于所述操作时间,将最后同步的所述操作记录识别为所述第二数据链表的保留记录;
第二失效操作记录识别单元,用于将所述第二数据链表内除所述保留记录外的其他已同步的所述操作记录识别为失效操作记录。
可选地,所述失效操作记录确定单元172包括:
数据同步执行单元,用于若任一所述数据链表内不包含所述同步标识为已同步的所述操作记录,则对所有所述数据链表内的各个操作记录进行数据同步;
第二操作记录同步单元,用于若检测到关于各个所述数据链表的同步完成信息,则将各个所述操作记录的所述同步标签配置为已同步;
第三保留记录识别单元,用于基于所述操作时间,将最后同步的所述操作记录识别为各个所述数据链表的保留记录;
第三失效操作记录识别单元,用于将所述数据链表内除所述保留记录外的其他已同步的所述操作记录识别为失效操作记录。
可选地,所述数据链表更新单元173包括:
数据删除单元,用于向与所述数据链表关联的所述分布式节点发送所述失效操作记录的数据释放指令,以使所述分布式节点在本地数据库删除所述失效操作记录对应的操作数据;
上关联字节调整单元,用于将保留记录的上关联字节由指向所述失效操作记录调整为指向所述目标数据预设的根节点;所述保留记录为所述数据链中最后同步的操作记录。
因此,本申请实施例提供的数据同步的装置同样可以获取各个分布式节点关于目标数据的数据链表,从而通过数据链表内各个操作记录对应的同步标识,确定已失效的操作记录,将已失效的操作记录从数据链表中删除,并更新数据链表,从而能够删除已失效的操作记录对应的操作数据,减少了对失效数据的存储,能够提高分布式节点的存储压力,提高了存储效率。
图18为本申请一实施例提供的终端设备的结构示意图。如图18所示,该实施例的终端设备18包括:至少一个处理器180(图18中仅示出一个)处理器、存储器181 以及存储在所述存储器181中并可在所述至少一个处理器180上运行的计算机程序182,所述处理器180执行所述计算机程序182时实现上述任意各个数据同步的方法实施例中的步骤。
所述终端设备18可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。该终端设备可包括,但不仅限于,处理器180、存储器181。本领域技术人员可以理解,图18仅仅是终端设备18的举例,并不构成对终端设备18的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如还可以包括输入输出设备、网络接入设备等。
所称处理器180可以是中央处理单元(Central Processing Unit,CPU),该处理器180还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
所述存储器181在一些实施例中可以是所述终端设备18的内部存储单元,例如终端设备18的硬盘或内存。所述存储器181在另一些实施例中也可以是终端设备18的外部存储设备,例如所述终端设备18上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器181还可以既包括所述终端设备18的内部存储单元也包括外部存储设备。所述存储器181用于存储操作系统、应用程序、引导装载程序(BootLoader)、数据以及其他程序等,例如所述计算机程序的程序代码等。所述存储器181还可以用于暂时地存储已经输出或者将要输出的数据。
需要说明的是,上述装置/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
本申请实施例还提供了一种网络设备,该网络设备包括:至少一个处理器、存储器以及存储在所述存储器中并可在所述至少一个处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述任意各个方法实施例中的步骤。
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现可实现上述各个方法实施例中的 步骤。
本申请实施例提供了一种计算机程序产品,当计算机程序产品在移动终端上运行时,使得移动终端执行时实现可实现上述各个方法实施例中的步骤。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到拍照装置/终端设备的任何实体或装置、记录介质、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的实施例中,应该理解到,所揭露的装置/网络设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/网络设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。

Claims (10)

  1. 一种数据同步的方法,其特征在于,包括:
    获取目标数据在各个分布式节点对应的数据链表;所述数据链包括:基于操作时间依次排序的多个操作记录;
    根据所述数据链表中各个所述操作记录的同步标识,确定失效操作记录;
    删除所述失效操作记录并更新各个所述数据链表。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述数据链表中各个所述操作记录的同步标识,确定失效操作记录,包括:
    若各个所述数据链表内均包含所述同步标识为已同步的所述操作记录,则基于所述操作时间,将最后同步的所述操作记录识别为保留记录;
    将除所述保留记录外的其他已同步的所述操作记录识别为失效操作记录。
  3. 根据权利要求2所述的方法,其特征在于,所述基于所述操作时间,将最后同步的所述操作记录识别为保留记录,包括:
    获取各个所述分布式节点的在线状态;
    若任一所述分布式节点处于离线状态,则从所有第一数据链表中选取任一所述第一数据链表生成保留链表;所述第一数据链表为所属的所述分布式节点处于在线状态的所述数据链表;
    基于所述操作时间,从所述第一数据链表中将最后同步的所述操作记录识别为所述第一数据链表的第一保留记录;
    基于所述操作时间,从所述第二数据链表中将最后同步的所述操作记录识别为所述第二数据链表的第二保留记录;所述第二数据链表为所属的所述分布式节点处于离线状态的所述数据链表。
  4. 根据权利要求3所述的方法,其特征在于,所述将除所述保留记录外的其他已同步的所述操作记录识别为失效操作记录,包括:
    将所述第二数据链表中除所述第二保留记录的其他已同步的所述操作记录识别为失效操作记录;
    将所述第一数据链表中所述第一保留记录外的其他已同步的所述操作记录识别为失效操作记录。
  5. 根据权利要求4所述的方法,在所述将所述第二数据链表中除所述第二保留记录的其他已同步的所述操作记录识别为失效操作记录之后,还包括:
    若检测到所述第二数据链表对应的分布式节点处于在线状态,则基于所述保留链表对所述第二数据链表内的各个操作记录进行数据同步;
    若检测到关于所述第二数据链表的同步完成信息,则将所述第二数据链表内各个操作记录的所述同步标签配置为已同步;
    基于所述操作时间,将最后同步的所述操作记录识别为所述第二数据链表的保留记录;
    将所述第二数据链表内除所述保留记录外的其他已同步的所述操作记录识别为失效操作记录。
  6. 根据权利要求1所述的方法,其特征在于,所述根据所述数据链表中各个所述操作记录的同步标识,确定失效操作记录,包括:
    若任一所述数据链表内不包含所述同步标识为已同步的所述操作记录,则对所有所述数据链表内的各个操作记录进行数据同步;
    若检测到关于各个所述数据链表的同步完成信息,则将各个所述操作记录的所述 同步标签配置为已同步;
    基于所述操作时间,将最后同步的所述操作记录识别为各个所述数据链表的保留记录;
    将所述数据链表内除所述保留记录外的其他已同步的所述操作记录识别为失效操作记录。
  7. 根据权利要求1-6任一所述的方法,其特征在于,所述删除所述失效操作记录并更新各个所述数据链表,包括:
    向与所述数据链表关联的所述分布式节点发送所述失效操作记录的数据释放指令,以使所述分布式节点在本地数据库删除所述失效操作记录对应的操作数据;
    将保留记录的上关联字节由指向所述失效操作记录调整为指向所述目标数据预设的根节点;所述保留记录为所述数据链中最后同步的操作记录。
  8. 一种数据同步的装置,其特征在于,包括:
    数据链表获取单元,用于获取目标数据在各个分布式节点对应的数据链表;所述数据链包括:基于操作时间依次排序的多个操作记录;
    失效操作记录确定单元,用于根据所述数据链表中各个所述操作记录的同步标识,确定失效操作记录;
    数据链表更新单元,用于删除所述失效操作记录并更新各个所述数据链表。
  9. 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至7任一项所述的方法。
  10. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述的方法。
PCT/CN2021/089960 2020-05-12 2021-04-26 一种数据同步的方法、装置、终端以及存储介质 WO2021227860A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010398492.X 2020-05-12
CN202010398492.XA CN113656490B (zh) 2020-05-12 2020-05-12 一种数据同步的方法、装置、终端以及存储介质

Publications (1)

Publication Number Publication Date
WO2021227860A1 true WO2021227860A1 (zh) 2021-11-18

Family

ID=78488881

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/089960 WO2021227860A1 (zh) 2020-05-12 2021-04-26 一种数据同步的方法、装置、终端以及存储介质

Country Status (2)

Country Link
CN (1) CN113656490B (zh)
WO (1) WO2021227860A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114640574A (zh) * 2022-02-28 2022-06-17 天翼安全科技有限公司 一种主备设备的切换方法及装置

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114710394A (zh) * 2022-03-30 2022-07-05 亚信科技(中国)有限公司 告警同步方法、装置、电子设备及可读存储介质
CN114780325B (zh) * 2022-06-21 2022-09-30 新华三信息技术有限公司 一种PCIe设备检测方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102291453A (zh) * 2011-08-09 2011-12-21 中兴通讯股份有限公司 一种数据同步的方法及装置
US20120259889A1 (en) * 2008-03-20 2012-10-11 Darpan Dinker Scalable Database Management Software on a Cluster of Nodes Using a Shared-Distributed Flash Memory
US20160110408A1 (en) * 2013-12-02 2016-04-21 Amazon Technologies, Inc. Optimized log storage for asynchronous log updates
CN105574217A (zh) * 2016-03-16 2016-05-11 中国联合网络通信集团有限公司 分布式关系型数据库的数据同步方法和装置
CN106411901A (zh) * 2016-10-08 2017-02-15 北京三未信安科技发展有限公司 一种数字身份标识管理方法及系统

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101505248B (zh) * 2009-02-25 2012-04-04 成都市华为赛门铁克科技有限公司 一种监控锁定机制的方法及装置
CN102447742A (zh) * 2011-11-24 2012-05-09 中兴通讯股份有限公司 一种动态数据主备同步的方法、系统及一种元数据服务器
CN103886091B (zh) * 2014-04-01 2017-08-01 无锡科技职业学院 一种基于记录标记的数据库同步方法
CN109150356A (zh) * 2018-08-15 2019-01-04 合肥云序科技有限公司 一种网络通信的同步方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120259889A1 (en) * 2008-03-20 2012-10-11 Darpan Dinker Scalable Database Management Software on a Cluster of Nodes Using a Shared-Distributed Flash Memory
CN102291453A (zh) * 2011-08-09 2011-12-21 中兴通讯股份有限公司 一种数据同步的方法及装置
US20160110408A1 (en) * 2013-12-02 2016-04-21 Amazon Technologies, Inc. Optimized log storage for asynchronous log updates
CN105574217A (zh) * 2016-03-16 2016-05-11 中国联合网络通信集团有限公司 分布式关系型数据库的数据同步方法和装置
CN106411901A (zh) * 2016-10-08 2017-02-15 北京三未信安科技发展有限公司 一种数字身份标识管理方法及系统

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114640574A (zh) * 2022-02-28 2022-06-17 天翼安全科技有限公司 一种主备设备的切换方法及装置
CN114640574B (zh) * 2022-02-28 2023-11-28 天翼安全科技有限公司 一种主备设备的切换方法及装置

Also Published As

Publication number Publication date
CN113656490A (zh) 2021-11-16
CN113656490B (zh) 2024-01-30

Similar Documents

Publication Publication Date Title
WO2021227860A1 (zh) 一种数据同步的方法、装置、终端以及存储介质
US11853820B2 (en) Cross-process communication method, apparatus, and device
AU2020203219B2 (en) Sharing unmanaged content using a content management system
CN106104514B (zh) 加速访问对象存储库中的对象的方法、系统及介质
CN109154931A (zh) 显示内容的方法和适用于该方法的电子设备
US20140297586A1 (en) Device and method for cloud file management
JP7201827B2 (ja) 画像分類方法及び電子デバイス
CN110532058B (zh) 容器集群服务的管理方法、装置、设备及可读存储介质
CN111857531A (zh) 移动终端及其文件显示方法
CN113495744A (zh) 一种版本升级方法及相关装置
US20230216732A1 (en) Network Configuration Method and Device
WO2022001633A1 (zh) 设备控制方法和设备
CN114531413B (zh) 电子设备及其邮件同步方法和可读介质
CN116055634B (zh) 消息管理方法、终端设备及其介质
CN117131240B (zh) 服务推荐方法、电子设备及计算机可读存储介质
WO2023070462A1 (zh) 一种文件去重方法、装置和设备
CN116719556B (zh) 系统升级的方法和电子设备
WO2021114919A1 (zh) 内容获取方法、系统、用户终端及内容服务器
WO2024140002A1 (zh) 一种存储空间的管理方法、装置、电子设备及存储介质
WO2024046010A1 (zh) 一种界面显示方法、设备及系统
US10157047B2 (en) Methods and systems for communicating application prototype information
CN114281822A (zh) 数据处理方法、装置、电子设备及存储介质
CN115706737A (zh) 一种推送消息同步的方法、电子设备及系统
CN116719649A (zh) 会话通知的提示方法、电子设备及可读存储介质
CN117708072A (zh) 文件复制方法、终端设备及芯片系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21804729

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21804729

Country of ref document: EP

Kind code of ref document: A1