A method and system for distributing data

Through the method of obtaining and updating the distribution data version from the external cache of the first terminal, the timeliness and reliability problems when the server distributes data to multiple clients are solved, and efficient and reliable data distribution is achieved.

CN114143375BActive Publication Date: 2025-02-11ADVANCED NOVA TECH (SINGAPORE) PTE LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010814256.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-13
Publication Date
2025-02-11
Estimated Expiration
2040-08-13

AI Technical Summary

Technical Problem

When distributing data to multiple clients on the server side, it is difficult to ensure the timeliness and reliability of the data, especially when facing multiple clients, resource consumption is too large and the effectiveness of the distributed data is difficult to monitor.

Method used

The first terminal obtains the distribution data version from the external cache and determines whether the version exists. If it does not exist, the distribution data and the effective version of the data will be obtained from the external cache, and the pointer of the effective data version will be updated to ensure the timeliness and reliability of the data. .

Benefits of technology

It improves the efficiency and reliability of data distribution, reduces the resource consumption of the second terminal, and verifies the effectiveness of the data through external cache, ensuring the timeliness and reliability of the distributed data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114143375B_ABST
    Figure CN114143375B_ABST
Patent Text Reader

Abstract

The embodiments of this specification provide a method and system for distributing data. The method includes: a first terminal obtains a distribution data version from an external cache, and determines whether the first terminal has the distribution data version; if not, the first terminal obtains the distribution data corresponding to the distribution data version from the external cache and saves it, and the first terminal obtains the corresponding data effective version from the external cache; determines whether the pointer of the data effective version is the distribution data version, and if so, rewrites the pointer of the effective data version of the first terminal to the distribution data version.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and system for distributing data. Background Art

[0002] With the development of computer technology, data distribution has been applied in various fields. For example, the new version of the server application is distributed to each terminal, the new equipment trial service is distributed to each terminal, and the configuration changes of the international payment domain are distributed to each terminal. With the development of information technology, the requirements for data distribution are getting higher and higher. When the server distributes data to multiple clients, it is necessary to ensure the timeliness of the data distributed to each client. When distributing data to multiple clients, it is also necessary to ensure that each client receives the distributed data to ensure the reliability of the distributed data.

[0003] Therefore, there is an urgent need for a method and system for distributing data. Summary of the invention

[0004] In one aspect, the present specification provides a method for distributing data. The method includes: a first terminal obtains a distribution data version from an external cache, and determines whether the first terminal has the distribution data version; if not, the first terminal obtains the distribution data corresponding to the distribution data version from the external cache and saves it, and the first terminal obtains the corresponding data effective version from the external cache; determines whether the pointer of the data effective version is the distribution data version, and if so, rewrites the pointer of the effective data version of the first terminal to the distribution data version.

[0005] Another aspect of the present specification provides a system for distributing data. The system includes a first terminal, and the first terminal includes: a data acquisition module: used to obtain a distribution data version from an external cache, and determine whether the first terminal has the distribution data version; if not, obtain the distribution data corresponding to the distribution data version from the external cache and save it, and obtain the corresponding data effective version from the external cache; a data effective module: used to determine whether the pointer of the data effective version is the distribution data version, and if so, rewrite the pointer of the effective data version of the first terminal to the distribution data version.

[0006] Another aspect of the present specification provides a device for distributing data, including a processor, wherein the processor is configured to execute a method for distributing data.

[0007] Another aspect of the present specification provides a computer-readable storage medium, wherein the storage medium stores computer instructions. When a computer reads the computer instructions in the storage medium, the computer executes the method for distributing data. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] This specification will be further described in the form of exemplary embodiments, which will be described in detail by the accompanying drawings. These embodiments are not restrictive, and in these embodiments, the same number represents the same structure, wherein:

[0009] Figure 1 is a schematic diagram of an application scenario of a system for distributing data according to some embodiments of this specification;

[0010] Figure 2 is a module diagram of an exemplary data distribution system according to some embodiments of the present specification;

[0011] Figure 3 is an exemplary flow chart of a method for distributing data according to some embodiments of this specification;

[0012] Figure 4 is an exemplary flow chart of another method for distributing data according to some embodiments of this specification;

[0013] Figure 5 is an exemplary flow chart of a method for verifying distribution data according to some embodiments of this specification;

[0014] Figure 6 This is an exemplary data change diagram of a method for distributing data according to some embodiments of the present specification. DETAILED DESCRIPTION

[0015] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the following is a brief introduction to the drawings required for the description of the embodiments. Obviously, the drawings described below are only some examples or embodiments of this specification. For ordinary technicians in this field, this specification can also be applied to other similar scenarios based on these drawings without creative work. Unless it is obvious from the language environment or otherwise explained, the same reference numerals in the figures represent the same structure or operation.

[0016] It should be understood that the "system", "device", "unit" and / or "module" used in this specification is a method for distinguishing different components, elements, parts, parts or assemblies at different levels. However, if other words can achieve the same purpose, the words can be replaced by other expressions.

[0017] As shown in this specification and claims, unless the context clearly indicates an exception, the words "a", "an", "an" and / or "the" do not refer to the singular and may also include the plural. Generally speaking, the terms "comprise" and "include" only indicate the inclusion of the steps and elements that have been clearly identified, and these steps and elements do not constitute an exclusive list. The method or device may also include other steps or elements.

[0018] Flowcharts are used in this specification to illustrate the operations performed by the system according to the embodiments of this specification. It should be understood that the preceding or following operations are not necessarily performed precisely in order. Instead, the steps may be processed in reverse order or simultaneously. At the same time, other operations may also be added to these processes, or one or more operations may be removed from these processes.

[0019] Figure 1 It is a schematic diagram of an application scenario of an exemplary data distribution system shown in some embodiments of this specification.

[0020] like Figure 1 As shown, the application scenario 100 may include a first terminal 110 , a second terminal 120 , a storage device 130 , and a network 140 .

[0021] The application scenario 100 can be applied to a variety of data distribution application scenarios. For example, the second terminal 120 can distribute the new version of the server application to each first terminal 110, the second terminal 120 can distribute the new equipment trial service to each first terminal 110, and the second terminal 120 can distribute the configuration changes of the international payment domain to each first terminal 110. In the method of directly distributing data from the second terminal 120 to the first terminal 110, the second terminal 120 is required to distribute the data to each first terminal 110 one by one. However, due to the excessive number of first terminals 110 to receive the distributed data, the timeliness of the distributed data is low, and multiple first terminals 110 need to be connected. The second terminal 120 must manage complex relationships and consume too much resources. After the second terminal 120 distributes the data to each first terminal 110 one by one, it is impossible to know whether the first terminal 110 receives the distributed data and whether the distributed data is effective, and the distributed data is unreliable. To this end, the present invention proposes to implement data distribution through the first terminal 110, the second terminal 120 and the external cache. The first terminal 110 can asynchronously obtain data from the cache according to its own situation, which can reduce the resource consumption of the second terminal 120 in distributing data and greatly improve the efficiency of data distribution. The effective data can be verified through the data version saved in the external cache, making the distributed data reliable.

[0022] In a typical application scenario, a user can access the second terminal 120; the second terminal 120 can send the effectiveness policy formulated by the user (i.e., the effective version of the data of each first terminal 110) and the distribution data to the storage device 130; the first terminal 110 can pull the distribution data from the storage device 130, and update or maintain the effective data version according to the effectiveness policy, i.e., the effective version of the data corresponding to each terminal recorded in the external cache, and report the effective data version to the external storage 130; the second terminal 120 and the first terminal 110 can obtain the effective data version reported by the first terminal 110 from the storage device 130, and compare it with the effective version of the data recorded in the storage device 130, to check whether the distribution data is effective as required, and to determine whether the process of distributing data is completed.

[0023] The first terminal 110 and the second terminal 120 may be various devices with information receiving and / or sending functions, such as computers, mobile phones, text scanning devices, display devices, printers, etc. The first terminal 110 and the first terminal 120 may be electronic devices used by users, and may include various mobile devices, smart devices, wearable devices, etc., for example, mobile phones, smart bracelets, vehicle-mounted computers, etc. In some embodiments, the first terminal 110 and the second terminal 120 may be devices of the same type or devices of different types.

[0024] In some embodiments, the storage device 130 may be used to store data and / or instructions. The storage device 130 may include one or more storage components, each of which may be an independent device or part of another device. In some embodiments, the storage device 130 may include a random access memory (RAM), a read-only memory (ROM), a mass storage device, a removable memory, a volatile read-write memory, or the like, or any combination thereof. Exemplarily, the mass storage device may include a magnetic disk, an optical disk, a solid-state disk, or the like. In some embodiments, the storage device 130 may be implemented on a cloud platform. By way of example only, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an internal cloud, a multi-layer cloud, or the like, or any combination thereof. Data refers to a digital representation of information and may include various types, such as binary data, text data, image data, video data, or the like. Instructions refer to programs that can control a device or a device to perform a specific function.

[0025] The network 140 connects the components of the system so that the components can communicate with each other. The network between the components in the system may include a wired network and / or a wireless network. For example, the network 140 may include a cable network, a wired network, a fiber optic network, a telecommunications network, an internal network, the Internet, a local area network (LAN), a wide area network (WAN), a wireless local area network (WLAN), a metropolitan area network (MAN), a public switched telephone network (PSTN), a Bluetooth network, a ZigBee network (ZigBee), a near field communication (NFC), a bus within a device, a line within a device, a cable connection, etc. or any combination thereof. The network connection between each two components may be in one of the above-mentioned ways, or in multiple ways.

[0026] Figure 2 is a module diagram of an exemplary data distribution system according to some embodiments of the present specification.

[0027] like Figure 2 As shown, in some embodiments, the system 200 for distributing data may include a first data acquisition module 201, a data validation module 202, a validation selection module 203, a validation determination module 204, a reporting module 205, a validation data acquisition module 206, a validation judgment module 207, a verification module 208, a second pointer rewriting module 209, a data judgment module 210, and a related data acquisition module 211. These modules may also be implemented as an application or a set of instructions read and executed by a processing engine. In addition, a module may be any combination of a hardware circuit and an application / instruction. For example, when a processing engine or a processor executes an application / a set of instructions, a module may be part of a processor.

[0028] The first data acquisition module 201 can be used to obtain the distribution data version from the external cache and determine whether the first terminal has the distribution data version; if not, obtain the distribution data corresponding to the distribution data version from the external cache and save it, and obtain the corresponding data effective version from the external cache; in some embodiments, the first data acquisition module 201 also includes a first pointer rewriting module 2011, which is used to rewrite the pointer of the current local data version to the distribution data version after the first terminal obtains the distribution data from the external cache. In some embodiments, the external cache can adopt a distributed cache.

[0029] The data validation module 202 may be configured to determine whether the pointer of the data validation version is the distributed data version. If so, the pointer of the validation data version of the first terminal is rewritten to the distributed data version.

[0030] The effective selection module 203 may be used to select an effective terminal, where the effective terminal is the first terminal among the first terminals for which the distributed data is effective.

[0031] The effectiveness determination module 204 can be used to set the pointer of the data effectiveness version of the effective terminal to the distributed data version, and set the pointer of the data effectiveness version of other first terminals except the effective terminal to the effective data version of the corresponding first terminal.

[0032] The reporting module 205 may be used to send the effective data version to the external cache for storage.

[0033] The effective data acquisition module 206 can be used to acquire the effective data version sent by the first terminal and the corresponding effective data version of the first terminal in the external cache. In some embodiments, the first terminal acquires the distribution data version from the external cache, and the first terminal acquires the corresponding effective data version of the first terminal from the external cache.

[0034] The validity judgment module 207 can be used to judge whether the validity data version sent by the first terminal is consistent with the corresponding data validity version of the first terminal. If not, the first terminal re-executes the method for distributing data.

[0035] The verification module 208 may be used to verify the distribution data.

[0036] The second pointer rewriting module 209 can be used to rewrite the pointer of the effective data version of the first terminal after completing data distribution to the first pointer if the verification fails. The first pointer is the effective data version of the first terminal corresponding to the previous data distribution completion.

[0037] The data determination module 210 can be used to determine whether there is relevant data corresponding to the first terminal in the external cache; the relevant data corresponding to the first terminal at least includes the distribution data version, the distribution data and the data effective version of the first terminal.

[0038] The relevant data acquisition module 211 can be used to acquire the relevant data corresponding to the first terminal and save it to the external cache if the judgment result of the data judgment module 210 is no.

[0039] It should be understood that the system and its modules shown can be implemented in various ways. For example, in some embodiments, the system and its modules can be implemented by hardware, software, or a combination of software and hardware. Among them, the hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or a dedicated design hardware. Those skilled in the art will understand that the above-mentioned methods and systems can be implemented using computer executable instructions and / or included in a processor control code, such as a carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. Such code is provided on the carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. The system and its modules of the present application can not only be implemented by hardware circuits such as ultra-large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., but can also be implemented by software such as executed by various types of processors, and can also be implemented by a combination of the above-mentioned hardware circuits and software (e.g., firmware).

[0040] It should be noted that the above description of the system 200 and its modules for distributing data is only for convenience of description and cannot limit this specification to the scope of the embodiments. It can be understood that for those skilled in the art, after understanding the principle of the system, it is possible to arbitrarily combine the various modules without deviating from this principle, or to form a subsystem connected with other modules. For example, the first data acquisition module 201, the data validation module 202, the validation selection module 203, the validation determination module 204, the reporting module 205, the validation data acquisition module 206, the validation judgment module 207, the verification module 208, the second pointer rewriting module 209, the data judgment module 210, and the related data acquisition module 211 can share a storage module, and each module can also have its own storage module. Such variations are all within the scope of protection of this application.

[0041] Figure 3 FIG. 3 is an exemplary flow chart of a method for distributing data according to some embodiments of the present specification. In some embodiments, the method 300 for distributing data may be executed by a first terminal.

[0042] like Figure 3 As shown, the method 300 for distributing data may include:

[0043] Step 310, the first terminal obtains the distribution data version from the external cache and determines whether the first terminal has the distribution data version. If not, the first terminal obtains the distribution data corresponding to the distribution data version from the external cache and saves it, and the first terminal obtains the corresponding data effective version from the external cache.

[0044] Specifically, step 310 may be performed by the first data acquisition module 201 .

[0045] Terminal refers to various devices with information receiving and / or sending functions, such as computers, mobile phones, text scanning devices, display devices, printers, etc. Terminals can be used to push distributed data or receive distributed data.

[0046] Distributed data refers to various data that are distributed, which may include message data, configuration data, instruction data, etc.

[0047] In some embodiments, the terminal for receiving the distribution data may be referred to as a first terminal, or a client, and the terminal for pushing the distribution data may be referred to as a second terminal, or a server.

[0048] External cache refers to a separate external cache space, such as an external database cache, an external server cache, a distributed cache, etc. The external cache can be mounted on an external storage medium, such as an external server, an external memory, etc.

[0049] In some embodiments, the external cache may use a distributed cache, such as Redis, MemCache, SSDB, etc. The distributed cache, the first terminal, and the second terminal may be deployed in the same physical computer room, for example, the distributed cache, the first terminal, and the second terminal are all deployed in the same city, or in the same country.

[0050] The distribution data version refers to the data version of the distribution data. For example, if the distribution data is Y, its corresponding distribution data version is M.

[0051] In some embodiments, the distribution data may be determined by the user selecting data through the second terminal, or may be automatically determined by the second terminal according to pre-set settings.

[0052] In some embodiments, the distribution data version and the corresponding distribution data in the external cache are from the second terminal. That is, the second terminal used to push the distribution data can write the distribution data and the corresponding distribution data version into the external cache. For example, see Figure 6 In the exemplary data change 600, the user or according to the pre-settings selects and determines through the first terminal that the distribution data is Y, the distribution data version is M, and is written into the external cache, and the external cache records (distribution data version: M, data: Y).

[0053] In some embodiments, multiple second terminals may write at least one distribution data and a corresponding distribution data version into an external cache. For example, there are two second terminals A and B, and the second terminal A may write distribution data Z and a corresponding distribution data version O into an external cache, and the second terminal B may write distribution data Y and a corresponding distribution data version M into an external cache. For another example, the second terminal B may write distribution data Y and a corresponding distribution data version M, and distribution data Z and a corresponding distribution data version O into an external cache. It is understood that a plurality of different distribution data and corresponding distribution data versions may be recorded in an external cache, and the plurality of different distribution data may come from a plurality of second terminals.

[0054] In some embodiments, the first terminal may obtain the distribution data version from the external cache in a timed manner. For example, the first terminal may obtain the distribution data version from the external cache every 5 seconds. The first terminal may obtain the distribution data version by scanning the external cache, and the scanning may be a timed scanning.

[0055] The local storage of the first terminal records the version of the distribution data that the first terminal has received or obtained, which can be represented by the current local data version. The version of the distribution data that has been received or obtained and stored locally by the first terminal may include one or more data versions. For example, before this data distribution, the first terminal has received distribution data X, and the corresponding distribution data version is N, then the first terminal has stored the current local data X, and the corresponding current local data version is N. For another example, before this data distribution, the first terminal has received distribution data X and Y, and the corresponding distribution data versions are N and M, then the first terminal has stored the current local data X, Y, and the corresponding current local data versions include N, M.

[0056] After the first terminal obtains the distribution data version from the external cache, it can be compared with the current local data version to determine whether the distribution data version exists in the first terminal. If the current local data version is consistent with the distribution data version, the data distribution version exists in the local storage of the first terminal, that is, the corresponding distribution data is also stored; if the current data version is inconsistent with the distribution data version, the data distribution version does not exist in the local storage of the first terminal, that is, the corresponding distribution data is not stored.

[0057] When there is no data distribution version in the local storage of the first terminal, that is, no corresponding distribution data is saved, then in this data distribution, the first terminal needs to obtain and save the corresponding distribution data from the external cache. Through this embodiment, by comparing whether there is a distribution data version in the existing data version stored locally by the first terminal, it is possible to accurately determine whether the first terminal has the current distribution data saved locally. If so, there is no need to re-obtain the distribution data. If not, it is necessary to obtain the current distribution data. The efficiency of data distribution is improved and repeated acquisition of distribution data is avoided.

[0058] In some embodiments, after the first terminal obtains the distribution data from the external cache, the pointer of the current local data version may be rewritten to the distribution data version. This step may be performed by the first pointer rewriting module 2011. For example, see Figure 6 In exemplary data change 600, the current local data stored by the first terminal is X, and the corresponding current local data version is N. The distributed data is Y, and the corresponding data distribution version is M. After comparing the current data version N and the distributed data version M, it is found that the current data version N is inconsistent. The first terminal obtains the distributed data Y from the external cache, and can change the pointer N of the current local data version to M. Through this embodiment, the current local data version recorded by the first terminal can be updated according to whether the distributed data is obtained, and the current local data version is always consistent with the data version of the distributed data currently obtained by the first terminal.

[0059] The data effective version refers to the data version that needs to be effective for the first terminal, and the external cache stores at least one data effective version of the first terminal. For example, the external cache stores (first terminal 127.0.0.1, data effective version M), (first terminal 127.0.0.2, data effective version N).

[0060] The effective data version refers to the data version currently in effect stored locally in the first terminal. For example, if the data currently in effect stored locally in the first terminal is X and the corresponding data version is N, then the effective data version of the first terminal is N.

[0061] The data effective version of the first terminal is the distribution data version or the effective data version of the first terminal. When the data effective version of the first terminal is the distribution data version, it means that in this distribution data, the distribution data of the first terminal needs to be effective. When the data effective version of the first terminal is the effective data version, it means that in this distribution data, the distribution data of the first terminal does not need to be effective, and the effective data of the first terminal is the data corresponding to the effective data version. The data effective version corresponding to the first terminal can be determined by user selection or automatically determined according to pre-settings.

[0062] In some embodiments, the data effective version corresponding to the first terminal can be determined by the following method: selecting an effective terminal, which can be performed by the effective selection module 203, and the effective terminal is the first terminal in at least one first terminal for which the distributed data needs to be effective; setting the pointer of the data effective version of the effective terminal to the distributed data version of the distributed data, and setting the pointer of the data effective version of other first terminals except the effective terminal to the effective data version of the corresponding first terminal, which can be performed by the effective determination module 204. For example, see Figure 6 In the exemplary data change 600, there are two first terminals, with IP addresses of 127.0.0.1 and 127.0.0.2, respectively. 127.0.0.1 is selected as the effective terminal for the data distribution this time. The data distributed this time is Y, and the corresponding data distribution version is M, then (first terminal 127.0.0.1, data effective version M) is obtained. The effective data version of the first terminal 127.0.0.2 is N, then (first terminal 127.0.0.2, data effective version N) is obtained. Through this embodiment, when distributing data, the scope of data effectiveness can be selected. Not every first terminal will be effective after obtaining the distributed data. It is possible to control which first terminals' distributed data will be effective, making data distribution more controllable.

[0063] In some embodiments, the first terminal may obtain the corresponding data effective version from the external cache in a timed manner. For example, the first terminal may obtain the corresponding data effective version from the external cache every 5 seconds. The first terminal may obtain the corresponding data effective version by scanning the external cache, and the scanning may be a timed scanning.

[0064] Step 320, determining whether the pointer of the effective data version is the distributed data version, if so, rewriting the pointer of the effective data version of the first terminal to the distributed data version.

[0065] Specifically, step 320 may be performed by the data validation module 202 .

[0066] After the first terminal obtains the corresponding data effective version, it determines the data effective version. If the pointer of the data effective version corresponding to the first terminal is the effective data version of the first terminal, it means that in this data distribution, the distribution data of the first terminal does not need to be effective, and the first terminal keeps the current effective data unchanged. If the data effective version corresponding to the first terminal is the distribution data version, it means that in this data distribution, the distribution data of the first terminal needs to be effective, and the current effective data of the first terminal will change. The change is specifically that the pointer of the effective data version of the first terminal is rewritten to the distribution data version of the distributed data this time, so that the distributed data this time is effective on the first terminal.

[0067] See also Figure 6 In the exemplary data change 600, taking the aforementioned selection of 127.0.0.1 as the effective terminal for the distributed data this time as an example, the distributed data this time is Y, and the corresponding data distribution version is M. The external cache stores (first terminal 127.0.0.1, data effective version M), the effective data version of the first terminal is N, and the pointer of the effective data version corresponding to the first terminal is M, which is the distribution data version. In this data distribution, the distribution data of the first terminal 127.0.0.1 needs to be effective, and the pointer N of the effective data version of the first terminal is rewritten to M, so that the distribution data Y obtained by the first terminal 127.0.0.1 is effective.

[0068] Step 330: The first terminal sends the effective data version to the external cache.

[0069] Specifically, step 330 may be performed by the reporting module 205 .

[0070] The first terminal can send the effective data version to the external cache for storage, which means that the current effective data status of the first terminal is reported to the external cache. After the effective data version corresponding to the first terminal is judged, and the corresponding effective data version is updated or maintained according to the comparison result, whether the distribution data of the first terminal is effective is determined. At this time, the first terminal reports the effective data version to the external cache, and the external cache can update the data effectiveness status of the first terminal.

[0071] In some embodiments, the external cache can use the current version of data to record the effective data version sent by the first terminal. The first terminal reports the effective data version to the external cache, and then writes the pointer of the effective data version of the first terminal into the corresponding current version of data of the first terminal in the external cache. For example, see Figure 6 In the exemplary data change 600, the effective data version N of the first terminal 127.0.0.1 is compared with the corresponding effective data version M, and a new effective data version M is obtained according to the comparison result. The first terminal 127.0.0.1 reports the effective data version M to the external cache, and the current version of the data of the first terminal in the external cache is M. Through this embodiment, the effectiveness of the data of the corresponding first terminal can be known through the current version of the data of the first terminal recorded in the external cache.

[0072] Step 340, obtain the effective data version sent by the first terminal and the corresponding data effective version of the first terminal in the external cache; determine whether the effective data version sent by the first terminal and the corresponding data effective version of the first terminal are consistent; if not, the first terminal re-executes the method of distributing data.

[0073] Specifically, step 340 may be performed by the effectiveness data acquisition module 206 and the effectiveness determination module 207 .

[0074] In some embodiments, the effective data version sent by the first terminal in the external cache and the corresponding effective data version of the first terminal can also be obtained for comparison. If they are consistent, it means that the data distribution to the first terminal is successful. If they are inconsistent, it means that the data distribution to the first terminal fails (for example, the distribution data obtained by the first terminal needs to be effective, but its effectiveness is not successful, resulting in the inconsistency between the effective data version of the first terminal and the corresponding effective data version of the first terminal in the external cache). When there is inconsistency, the data distribution fails, and the first terminal can re-execute the method for distributing data, that is, it can re-execute steps 310-330.

[0075] Through this embodiment, the data distribution results of each first terminal can be clearly perceived by checking the current version of the data corresponding to the first terminal in the external cache. The data can be redistributed to the first terminal that failed to distribute data, ensuring the validity of the distributed data and greatly improving the reliability of data distribution.

[0076] Figure 4 FIG. 4 is an exemplary flow chart of another method for distributing data according to some embodiments of the present specification. In some embodiments, the method 400 for distributing data may be executed by a first terminal.

[0077] like Figure 4 As shown, the method 400 may include:

[0078] Step 410, the first terminal determines whether there is relevant data corresponding to the first terminal in the external cache; the relevant data corresponding to the first terminal at least includes the distribution data version, the distribution data and the data effective version of the first terminal; if not, obtain the corresponding relevant data corresponding to the first terminal and save it to the external cache.

[0079] Specifically, step 410 may be performed by the data determination module 210 and the related data acquisition module 211 .

[0080] When distributing data, the first terminal may first determine whether the relevant data corresponding to the first terminal is stored in the external cache. If the relevant data corresponding to the first terminal does not exist in the external cache, it can be considered that the first terminal has not been registered in the external cache, and the first terminal has not received the distribution data through the external cache. Then, the relevant data corresponding to the corresponding first terminal can be obtained and saved in the external cache.

[0081] In some embodiments, the relevant data corresponding to the first terminal can be obtained by calling the second terminal to query and obtain the relevant data corresponding to the first terminal, and the obtained relevant data corresponding to the first terminal is written into the external cache. The relevant data corresponding to the first terminal includes at least distribution data, distribution data version and data effective version of the first terminal. After the aforementioned relevant data is saved in the external cache, the first terminal can receive the distribution data through the external cache.

[0082] In some embodiments, the relevant data corresponding to the first terminal may also include the effective data version of the first terminal, the current local data version, and the current data version.

[0083] Step 420, the first terminal obtains the distribution data version from the external cache and determines whether the first terminal has the distribution data version. If not, the first terminal obtains the distribution data corresponding to the distribution data version from the external cache and saves it, and the first terminal obtains the corresponding data effective version from the external cache.

[0084] Specifically, step 420 may be performed by the first data acquisition module 201 .

[0085] The first terminal obtains the distribution data version from the external cache and determines whether the distribution data version exists in the first terminal; if not, the first terminal obtains the distribution data corresponding to the distribution data version from the external cache and saves it. For details about the first terminal obtaining the corresponding data effective version from the external cache, please refer to Figure 3 Step 310 and related descriptions thereof are not repeated here.

[0086] Step 430, determining whether the pointer of the effective data version is the distributed data version, if so, rewriting the pointer of the effective data version of the first terminal to the distributed data version.

[0087] Specifically, step 430 may be performed by the data validation module 202 .

[0088] Determine whether the pointer of the data effective version is the distributed data version. If so, rewrite the pointer of the effective data version of the first terminal to the distributed data version. For details, see Figure 3 Step 320 and related descriptions thereof are not repeated here.

[0089] Step 440: The first terminal sends the effective data version to the external cache.

[0090] Specifically, step 440 may be performed by the reporting module 205 .

[0091] The first terminal sends the effective data version to the external cache. For details, see Figure 3 Step 330 and related descriptions thereof are not repeated here.

[0092] Step 450, obtain the effective data version sent by the first terminal and the corresponding data effective version of the first terminal in the external cache; determine whether the effective data version sent by the first terminal and the corresponding data effective version of the first terminal are consistent; if not, the first terminal re-executes the method of distributing data.

[0093] Specifically, step 450 may be performed by the effectiveness data acquisition module 206 and the effectiveness determination module 207 .

[0094] In some embodiments, the effective data version sent by the first terminal and the corresponding effective data version of the first terminal in the external cache can also be obtained; it is determined whether the effective data version sent by the first terminal and the corresponding effective data version of the first terminal are consistent; if not, the first terminal re-executes the method for distributing data. The specific content of this step can be found in Figure 3 Step 340 and related descriptions thereof are not repeated here.

[0095] Figure 5 is an exemplary flow chart of a method for verifying distribution data according to some embodiments of the present specification.

[0096] like Figure 5 As shown, the method 500 may include:

[0097] Step 510, verifying the distribution data.

[0098] Specifically, step 510 may be performed by the verification module 208 .

[0099] As mentioned above, the distributed data refers to various data that are distributed, such as message data, configuration data, instruction data, etc. The distributed data can be verified to verify whether the data content of the distributed data is complete, whether the format of the distributed data is correct, whether the distributed data contains illegal information such as viruses, etc., to determine whether the distributed data is correct and complete data, and to verify whether the distributed data is correctly effective on the first terminal, for example, to verify whether the instruction data distributed to the first terminal is correctly executed, and to verify whether the configuration data distributed to the first terminal is successfully configured.

[0100] The method for verifying the distribution data may be any one or more of the following methods: data testing, unit testing, functional testing, stress testing, performance testing, load balancing testing, interface testing, acceptability testing, user testing, interface testing, regression testing, etc.

[0101] Step 520: If the verification fails, the pointer of the effective data version of the first terminal after the data distribution is completed is rewritten to the first pointer, and the first pointer is the effective data version of the first terminal corresponding to the previous data distribution completion.

[0102] Specifically, step 520 may be performed by the second pointer rewriting module 209 .

[0103] When the distribution data verification passes, the distribution data is correct, the data distribution is successful, and there is no problem. When the distribution data verification fails, the distribution data is considered invalid. If the distribution data is invalid, the data of the first terminal can be rolled back. Specifically, the pointer of the effective data version of the first terminal after the distribution of the data is completed is rewritten to the first pointer, and the first pointer is the effective data version of the first terminal corresponding to the previous distribution of the data.

[0104] In some embodiments, when the distributed data verification fails, the pointer of the current local data version of the first and second terminals after the data distribution is completed can also be rewritten as a second pointer, and the second pointer is the current local data version at the time of the previous data distribution.

[0105] It can be understood that after the aforementioned rewriting, the pointer of the effective data version of the first terminal and the current local data version are consistent with the state before this release, that is, they are rolled back to the state when the previous data distribution was completed. Through this embodiment, if there is a problem in the verification process of the distributed data, the pointer of the first client can be directly switched to achieve data rollback. This can further reduce time consumption, thereby improving the stability of data distribution.

[0106] The embodiment of the present specification also provides a device, including a processor, the processor is used to execute the above-mentioned method for distributing data. The method for distributing data may include: a first terminal obtains a distribution data version from an external cache, and determines whether the first terminal has the distribution data version; if not, the first terminal obtains the distribution data corresponding to the distribution data version from the external cache and saves it, and the first terminal obtains the corresponding data effective version from the external cache; determines whether the pointer of the data effective version is the distribution data version, and if so, rewrites the pointer of the effective data version of the first terminal to the distribution data version.

[0107] The embodiment of this specification also provides a computer-readable storage medium, the storage medium stores computer instructions, and when the computer reads the computer instructions in the storage medium, the computer executes the aforementioned method of distributing data. The method of distributing data may include: the first terminal obtains the distribution data version from the external cache, and determines whether the first terminal has the distribution data version; if not, the first terminal obtains the distribution data corresponding to the distribution data version from the external cache and saves it, and the first terminal obtains the corresponding data effective version from the external cache; determines whether the pointer of the data effective version is the distribution data version, and if so, rewrites the pointer of the effective data version of the first terminal to the distribution data version.

[0108] The beneficial effects that may be brought about by the embodiments of this specification include but are not limited to: (1) using the first terminal and the second terminal in combination with the external cache to distribute data, the first terminal asynchronously obtains the distribution data from the cache according to its own situation, reducing the resource consumption of the second terminal when distributing data, and greatly improving the efficiency of data distribution; (2) using dual versions for distribution data and effective data, the distribution data and effective data do not affect each other, realizing the rapid distribution of data and the effectiveness of data according to the range; (3) realizing fast data switching through pointers, making the entire data distribution and switching process more reliable, and data rollback can be realized by directly switching the pointer of the first terminal, further reducing time consumption and improving the stability of data distribution; (4) the first terminal can report the data effectiveness to the external cache, which can realize clear perception of the data distribution results of each first terminal, ensure the effectiveness of the distribution data, and improve the reliability of data distribution. It should be noted that different embodiments may produce different beneficial effects. In different embodiments, the beneficial effects that may be produced may be any one or a combination of the above, or any other beneficial effects that may be obtained.

[0109] The basic concepts have been described above. Obviously, for those skilled in the art, the above detailed disclosure is only for example and does not constitute a limitation of this specification. Although not explicitly stated here, those skilled in the art may make various modifications, improvements and corrections to this specification. Such modifications, improvements and corrections are suggested in this specification, so such modifications, improvements and corrections still belong to the spirit and scope of the exemplary embodiments of this specification.

[0110] At the same time, this specification uses specific words to describe the embodiments of this specification. For example, "one embodiment", "an embodiment", and / or "some embodiments" refer to a certain feature, structure or characteristic related to at least one embodiment of this specification. Therefore, it should be emphasized and noted that "one embodiment" or "an embodiment" or "an alternative embodiment" mentioned twice or more in different positions in this specification does not necessarily refer to the same embodiment. In addition, certain features, structures or characteristics in one or more embodiments of this specification can be appropriately combined.

[0111] In addition, it will be understood by those skilled in the art that various aspects of this specification may be illustrated and described by a number of patentable categories or situations, including any new and useful process, machine, product or combination of substances, or any new and useful improvements thereto. Accordingly, various aspects of this specification may be performed entirely by hardware, entirely by software (including firmware, resident software, microcode, etc.), or by a combination of hardware and software. The above hardware or software may be referred to as "data blocks", "modules", "engines", "units", "components" or "systems". In addition, various aspects of this specification may be represented as a computer product located in one or more computer-readable media, which includes computer-readable program code.

[0112] A computer storage medium may include a propagated data signal containing computer program code, for example, in baseband or as part of a carrier wave. The propagated signal may be in a variety of forms, including electromagnetic, optical, etc., or a suitable combination. A computer storage medium may be any computer-readable medium other than a computer-readable storage medium, which can be connected to an instruction execution system, device or apparatus to communicate, propagate or transmit the program for use. The program code on the computer storage medium may be transmitted via any suitable medium, including radio, cable, fiber optic cable, RF, or similar media, or any combination of the above media.

[0113] The computer program code required for the operation of each part of this specification can be written in any one or more programming languages, including object-oriented programming languages ​​such as Java, Scala, Smalltalk, Eiffel, JADE, Emerald, C++, C#, VB.NET, Python, etc., conventional procedural programming languages ​​such as C language, Visual Basic, Fortran2003, Perl, COBOL2002, PHP, ABAP, dynamic programming languages ​​such as Python, Ruby and Groovy, or other programming languages, etc. The program code can be run entirely on the user's computer, or run on the user's computer as an independent software package, or run partially on the user's computer and partially on a remote computer, or run entirely on a remote computer or processing device. In the latter case, the remote computer can be connected to the user's computer through any network form, such as a local area network (LAN) or a wide area network (WAN), or connected to an external computer (e.g., via the Internet), or in a cloud computing environment, or used as a service such as software as a service (SaaS).

[0114] In addition, unless explicitly stated in the claims, the order of the processing elements and sequences described in this specification, the use of alphanumeric characters, or the use of other names are not intended to limit the order of the processes and methods of this specification. Although the above disclosure discusses some invention embodiments that are currently considered useful through various examples, it should be understood that such details are only for illustrative purposes, and the attached claims are not limited to the disclosed embodiments. On the contrary, the claims are intended to cover all modifications and equivalent combinations that are consistent with the essence and scope of the embodiments of this specification. For example, although the system components described above can be implemented by hardware devices, they can also be implemented only by software solutions, such as installing the described system on an existing processing device or mobile device.

[0115] Similarly, it should be noted that in order to simplify the description disclosed in this specification and thus help understand one or more embodiments of the invention, in the above description of the embodiments of this specification, multiple features are sometimes combined into one embodiment, figure or description thereof. However, this disclosure method does not mean that the features required by the subject matter of this specification are more than the features mentioned in the claims. In fact, the features of the embodiments are less than all the features of the single embodiment disclosed above.

[0116] In some embodiments, numbers describing the number of components and attributes are used. It should be understood that such numbers used in the description of the embodiments are modified by the modifiers "about", "approximately" or "substantially" in some examples. Unless otherwise specified, "about", "approximately" or "substantially" indicate that the numbers are allowed to vary by ±20%. Accordingly, in some embodiments, the numerical parameters used in the specification and claims are approximate values, which may change according to the required features of individual embodiments. In some embodiments, the numerical parameters should take into account the specified significant digits and adopt the general method of retaining digits. Although the numerical domains and parameters used to confirm the breadth of their range in some embodiments of this specification are approximate values, in specific embodiments, the setting of such numerical values ​​is as accurate as possible within the feasible range.

[0117] Each patent, patent application, patent application publication, and other materials, such as articles, books, specifications, publications, documents, etc., cited in this specification are hereby incorporated by reference in their entirety. Except for application history documents that are inconsistent with or conflicting with the contents of this specification, documents that limit the broadest scope of the claims of this specification (currently or later attached to this specification) are also excluded. It should be noted that if the descriptions, definitions, and / or use of terms in the materials attached to this specification are inconsistent or conflicting with the contents described in this specification, the descriptions, definitions, and / or use of terms in this specification shall prevail.

[0118] Finally, it should be understood that the embodiments described in this specification are only used to illustrate the principles of the embodiments of this specification. Other variations may also fall within the scope of this specification. Therefore, as an example and not a limitation, alternative configurations of the embodiments of this specification may be considered consistent with the teachings of this specification. Accordingly, the embodiments of this specification are not limited to the embodiments explicitly introduced and described in this specification.

Claims

1. A method for distributing data, characterized in that: include: The first terminal obtains a distribution data version from an external cache, and determines whether the distribution data version exists in the first terminal; wherein the distribution data version in the external cache and the corresponding distribution data come from the second terminal; If not, the first terminal obtains the distribution data corresponding to the distribution data version from the external cache and saves it, and the first terminal obtains the corresponding data effective version from the external cache; Determine whether the pointer of the effective version of the data is the distribution data version. If so, the pointer of the effective data version of the first terminal is rewritten as the distribution data version. If not, the pointer of the effective version of the data is the effective data version, and the distribution data corresponding to the distribution data version is invalid.

2. The method according to claim 1, wherein the method for determining the valid data version of the first terminal comprises: Selecting an effective terminal, the effective terminal being the first terminal among the first terminals for which the distributed data is effective; The pointer of the data effective version of the effective terminal is set as the distributed data version, and the pointer of the data effective version of other first terminals except the effective terminal is set as the effective data version of the corresponding first terminal.

3. The method of claim 1, further comprising: The first terminal sends the effective data version to the external cache for storage; Acquire the effective data version sent by the first terminal and the corresponding effective data version of the first terminal in the external cache; Determine whether the effective data version sent by the first terminal is consistent with the data effective version of the corresponding first terminal; If not, the first terminal re-executes the method for distributing data.

4. The method according to claim 1, wherein the first terminal obtains the distribution data from the external cache and stores the data, comprising: The first terminal obtains and stores the distribution data from the external cache, and rewrites the pointer of the current local data version of the first terminal into the distribution data version.

5. The method of claim 1, further comprising: verifying the distribution data; If the verification fails, the pointer of the effective data version of the first terminal after the data distribution is completed is rewritten as the first pointer, and the first pointer is the effective data version of the first terminal corresponding to the previous data distribution completion. The method according to claim 1 , wherein the external cache is a distributed cache.

7. The method according to claim 1, wherein the first terminal obtains the distribution data version from the external cache in a periodic manner.

8. The method of claim 1, further comprising: The first terminal determines whether relevant data corresponding to the first terminal exists in the external cache; The relevant data corresponding to the first terminal at least includes the distribution data version, the distribution data and the data validity version of the first terminal; If not, then obtain the relevant data corresponding to the first terminal and save it to the external cache.

9. A system for distributing data, characterized in that: The system includes a first terminal, wherein the first terminal includes: The first data acquisition module is used to acquire a distribution data version from an external cache, and determine whether the distribution data version exists in the first terminal; if not, acquire the distribution data corresponding to the distribution data version from the external cache and save it, and acquire the corresponding data effective version from the external cache; wherein the distribution data version in the external cache and the corresponding distribution data come from the second terminal; Data effectiveness module: used to determine whether the pointer of the data effectiveness version is the distribution data version. If so, the pointer of the effectiveness data version of the first terminal is rewritten as the distribution data version. If not, the pointer of the data effectiveness version is the effectiveness data version, and the distribution data corresponding to the distribution data version is not effective.

10. The system of claim 9, further comprising: An effective selection module: used for selecting an effective terminal, wherein the effective terminal is the first terminal among the first terminals for which the distributed data is effective this time; Validity determination module: used to set the pointer of the data validity version of the valid terminal to the distributed data version, and set the pointer of the data validity version of other first terminals except the valid terminal to the valid data version of the corresponding first terminal.

11. The system according to claim 9, wherein the first terminal further comprises: Reporting module: used for sending the effective data version to the external cache for storage; An effective data acquisition module: used for acquiring the effective data version sent by the first terminal and the corresponding effective data version of the first terminal in the external cache; Validity judgment module: used to judge whether the validity data version sent by the first terminal is consistent with the corresponding data validity version of the first terminal. If not, the first terminal re-executes the method for distributing data.

12. The system as claimed in claim 9, wherein the distribution data acquisition module further comprises a first pointer rewriting module: configured to rewrite the pointer of the current local data version of the first terminal to the distribution data version after the first terminal acquires the distribution data from the external cache.

13. The system of claim 9, further comprising: Verification module: used to verify the distribution data; The second pointer rewriting module is used to rewrite the pointer of the effective data version of the first terminal after the data distribution is completed to the first pointer if the verification fails. The first pointer is the effective data version of the first terminal corresponding to the previous data distribution. The system according to claim 9 , wherein the external cache is a distributed cache.

15. The system according to claim 9, wherein the first terminal obtains the distribution data version from the external cache in a periodic manner.

16. The system according to claim 9, wherein the first terminal further comprises: Data judgment module: used to judge whether there is relevant data corresponding to the first terminal in the external cache; the relevant data corresponding to the first terminal at least includes the distribution data version, the distribution data and the data effective version of the first terminal; Related data acquisition module: used for acquiring the related data corresponding to the first terminal and saving it to the external cache if the judgment result of the data judgment module is no.

17. A device for distributing data, comprising a processor, wherein the processor is used to execute the method for distributing data according to any one of claims 1 to 8.

18. A computer-readable storage medium, wherein the storage medium stores computer instructions. When a computer reads the computer instructions in the storage medium, the computer executes the method for distributing data as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Data synchronization method and data synchronization device based on a plurality of end points

    CN108259562A

  • Method, device and system for realizing distributed cache

    CN110505310A