Data synchronization method and device based on gray isolation, equipment and medium
By employing a data synchronization strategy that reads and verifies data with consistent grayscale values at each level of multi-level memory, the problem of synchronizing grayscale data across multiple levels of memory is solved, achieving effective synchronization and isolation of grayscale data across multiple levels of memory.
Patent Information
- Application Number
- CN202411430910.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2044-10-14
AI Technical Summary
Existing technologies cannot effectively synchronize different versions of data with grayscale across multiple storage levels, resulting in significant application limitations.
By receiving data requests, the system reads the requested fields from multiple levels of memory in ascending order of memory level, using a preset grayscale strategy. If the expected grayscale parameters are matched, the system determines the returned data, verifies and synchronizes the data that matches the grayscale of the target program, and executes a bubbling strategy to synchronize the data to all memories smaller than the target memory.
It achieves effective synchronization of grayscale data across multiple levels of memory, avoids inconsistent data writing by the target program, and ensures that different grayscale versions of data are saved simultaneously in multiple levels of memory.
Smart Images

Figure CN119316437B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of Internet, in particular to the technical field of data processing, and particularly relates to a data synchronization method and device based on gray isolation, equipment and medium. BACKGROUND
[0002] At present, distributed and multi-instance program architecture has become mainstream. By assigning different grays to programs, different functional versions of the same program can exist in the same environment at the same time. Through gray requests to corresponding instances, functions such as functional isolation, parallel development, and gray online can be realized.
[0003] However, the multi-level data storage and synchronization scheme in the related art usually only involves the same version data without gray, and the logic of the data itself is relatively simple, so it cannot be applied to a distributed environment, has great application limitations, and cannot handle the synchronization of different version data with gray among multiple levels of storage. Therefore, how to realize the synchronization of data with gray among multiple levels of storage is a problem that needs to be solved at present. SUMMARY
[0004] Therefore, the embodiments of the present application provide a data synchronization method and device based on gray isolation, equipment, medium and product, which can realize the synchronization of data among multiple levels of storage in the case that the data has gray.
[0005] In a first aspect, the embodiments of the present application provide a data synchronization method based on gray isolation, which comprises: receiving a data request for updating a function, wherein the data request is used to obtain at least one request data, and the data request carries a request field corresponding to the request data; for each request data, in order of memory level from low to high, using a preset gray strategy to read the request field from the multiple levels of storage starting from the first level of storage, and taking the field value obtained by reading the request field from each level of storage as return data; in the case that the first return data matching an expected gray parameter in the preset gray strategy is read from the Pth level of storage, determining that the first return data is the request data, sending the first return data to the client, and stopping reading the request field to the P+1th level of storage, wherein the expected gray parameter is a request gray parameter carried in the data request or a program gray parameter of a target program, and the target program is the program receiving the data request; checking whether there is second return data consistent with the gray of the target program in the P return data read from the Pth level of storage; only in the case that there is second return data, executing a bubble strategy on the multiple levels of storage, wherein the storage where the second return data is located is the target storage, and the bubble strategy is used to synchronize the second return data to all storage with a memory level smaller than the target storage.
[0006] In some possible implementation manners of the first aspect, the reading the request field from the multi-level memory in a preset gray strategy from the first-level memory according to a memory level order from low to high, and obtaining a return data corresponding to the request field from each memory level that has been read, comprises: for the current memory level, reading the request field from the current memory level based on an expected gray parameter in the preset gray strategy; if the first return data is read from the current memory level, determining that the request data reading is successful, and stopping reading the request field to the next memory level; if the first return data is not read from the current memory level, determining that the request data reading fails, and continuing to read the request field from the current memory level based on an alternative gray parameter in the preset gray strategy, obtaining the return data corresponding to the request field, and continuing to read the request field to the next memory level based on the expected gray parameter until a preset ending condition is met and the reading is stopped; wherein the preset ending condition comprises that the request data reading is successful, or the multi-level memory traversal is completed.
[0007] In some possible implementation manners of the first aspect, each field value in the multi-level memory is associated with a data gray parameter, the reading the request field from the current memory level based on the expected gray parameter in the preset gray strategy comprises: only in the case that the field value of the request field in the current memory level is associated with the data gray parameter consistent with the expected gray parameter, the field value of the request field is read, the return data corresponding to the request field is obtained, and the return data is determined as the first return data matched with the expected gray parameter; the continuing to read the request field from the current memory level based on the alternative gray parameter in the preset gray strategy comprises: only in the case that the field value of the request field in the current memory level is associated with the data gray parameter consistent with the alternative gray parameter, the field value of the request field is read, and the return data corresponding to the request field is obtained.
[0008] In some possible implementation manners of the first aspect, the preset gray strategy is a local gray priority strategy, the expected gray parameter is a program gray parameter of a target program, and the alternative gray parameter comprises a request gray parameter and a preset initial gray. The local gray priority strategy comprises: in the case that the reading the request data in the current memory level based on the program gray parameter fails, continuing to read the request field in the current memory level based on the request gray parameter carried in the data request; in the case that the reading the request field in the current memory level based on the request gray parameter fails, continuing to read the request field in the current memory level based on the preset initial gray.
[0009] In some possible implementation manners of the first aspect, the preset gray strategy is a request gray priority strategy, the expected gray parameter is a request gray parameter carried in the data request, the alternative gray parameter includes a program gray parameter and a preset initial gray, and the request gray priority strategy includes: in a case where reading the request data from the current level memory based on the request gray parameter fails, continuing to read the request field from the current level memory based on the program gray parameter of the target program; and in a case where reading the request field from the current level memory based on the program gray parameter fails, continuing to read the request field from the current level memory based on the preset initial gray.
[0010] In some possible implementation manners of the first aspect, the data request is sent by the client, and after the field values obtained by reading the request field from each level memory are taken as return data, the method further includes: in a case where the last level memory of the multi-level memory is read, if the request data is not read from the last level memory based on the expected gray parameter, determining that the request data reading in the multi-level memory fails; obtaining a plurality of pieces of return data obtained from the multi-level memory, where the plurality of pieces of return data are read based on the alternative gray parameter in the preset gray strategy; and sending the return data obtained from the first level memory to the client.
[0011] In some possible implementation manners of the first aspect, before receiving the data request for the update function, the method further includes: in a case where the update function is tested, obtaining change data associated with the update function; filtering N programs dependent on the update function from each program, and determining that a program for maintaining the change data in the N programs is a first program, and a program other than the first program in the N programs is a second program, where the target program is the first program or the second program; configuring the program gray parameter of the first program, the data gray parameter of the change data, and the request gray parameter of the data request of the update function as a target gray; and storing the change data and the data gray parameter of the change data in the multi-level memory in association; where the multi-level memory is further used to store original data associated with the update function, the original data and the data gray parameter of the original data are stored in association, the data gray parameter of the original data and the program gray parameter of the second program are used to indicate a preset initial gray, and each piece of original data or each piece of change data is composed of a field and a field value.
[0012] In a second aspect, an embodiment of the present application provides a data synchronization device based on gray isolation, which comprises: a receiving module configured to receive a data request for updating a function, wherein the data request is used to obtain at least one piece of requested data, and the data request carries a request field corresponding to the requested data; a reading module configured to, for each piece of requested data, read the request field from a plurality of levels of memory in a level-by-level manner from a first level of memory to a highest level of memory according to a preset gray strategy, and take a field value obtained by reading the request field from each level of memory as return data; the reading module is configured to, in a case where a first return data matching an expected gray parameter in the preset gray strategy is read from a Pth level of memory, determine that the first return data is the requested data, send the first return data to a client, and stop reading the request field to a (P+1)th level of memory, wherein the expected gray parameter is a request gray parameter carried in the data request or a program gray parameter of a target program, and the target program is a program that receives the data request; a checking module configured to check whether there is second return data consistent with the gray of the target program in P pieces of return data read from the Pth level of memory; and a bubbling module configured to execute a bubbling strategy on the plurality of levels of memory only in a case where the second return data exists, wherein a memory where the second return data is located is a target memory, and the bubbling strategy is used to synchronize the second return data to all memories with a memory level smaller than the target memory.
[0013] In some implementable manners of the second aspect, the reading module comprises: a first reading unit configured to, for a current level of memory, read the request field from the current level of memory based on an expected gray parameter in the preset gray strategy first; a judging unit configured to, if the first return data is read from the current level of memory, determine that the requested data reading is successful, and stop reading the request field to a next level of memory; and a second reading unit configured to, if the first return data is not read from the current level of memory, determine that the requested data reading fails, continue to read the request field from the current level of memory based on an alternative gray parameter in the preset gray strategy, obtain return data corresponding to the request field, and continue to read the request field to a next level of memory based on the expected gray parameter until a preset ending condition is met and the reading is stopped; wherein the preset ending condition comprises that the requested data reading is successful, or the plurality of levels of memory are traversed completely.
[0014] In some implementations of the second aspect, each field value in the multi-level memory is associated with a data gray parameter, and the first reading unit is specifically configured to: read the field value of the requested field only when the data gray parameter associated with the field value of the requested field in the current level memory is consistent with the expected gray parameter, obtain the return data corresponding to the requested field, and determine that the return data is the first return data matching the expected gray parameter; and the second reading unit is specifically configured to: read the field value of the requested field only when the data gray parameter associated with the field value of the requested field in the current level memory is consistent with the alternative gray parameter, and obtain the return data corresponding to the requested field.
[0015] In some implementations of the second aspect, the preset gray strategy is a local gray priority strategy, the expected gray parameter is a program gray parameter of the target program, and the alternative gray parameter includes a request gray parameter and a preset initial gray. The local gray priority strategy includes: in a case where reading the requested data in the current level memory based on the program gray parameter fails, continuing to read the requested field in the current level memory based on the request gray parameter carried in the data request; and in a case where reading the requested field in the current level memory based on the request gray parameter fails, continuing to read the requested field in the current level memory based on the preset initial gray.
[0016] In some implementations of the second aspect, the preset gray strategy is a request gray priority strategy, the expected gray parameter is a request gray parameter carried in the data request, and the alternative gray parameter includes a program gray parameter and a preset initial gray. The request gray priority strategy includes: in a case where reading the requested data in the current level memory based on the request gray parameter fails, continuing to read the requested field in the current level memory based on the program gray parameter of the target program; and in a case where reading the requested field in the current level memory based on the program gray parameter fails, continuing to read the requested field in the current level memory based on the preset initial gray.
[0017] In some implementations of the second aspect, the data request is sent by a client, and the method further includes: determining, after the field value obtained by reading the requested field from each level memory is used as return data, that the reading of the requested data in the multi-level memory fails if the requested data is not read from the last level memory based on the expected gray parameter; obtaining a plurality of pieces of return data obtained from the multi-level memory, wherein the plurality of pieces of return data are obtained based on the alternative gray parameter in the preset gray strategy; and sending, to the client, the return data obtained from the first level memory.
[0018] In some possible implementation manners of the second aspect, the method further includes: a obtaining module, configured to, before receiving the data request for the update function, obtain the change data associated with the update function in a case where the update function is tested; a determining module, configured to determine N programs dependent on the update function from the programs, and determine a program for maintaining the change data in the N programs as the first program, and a program other than the first program in the N programs as the second program, wherein the target program is the first program or the second program; a gray configuration module, configured to configure the program gray parameter of the first program, the data gray parameter of the change data, and the request gray parameter of the data request for the update function as the target gray; a data storage module, configured to store the change data and the data gray parameter of the change data in the multi-level storage in association; wherein the multi-level storage is further configured to store original data associated with the update function, and the original data and the data gray parameter of the original data are stored in association, and the data gray parameter of the original data and the program gray parameter of the second program are used to indicate a preset initial gray, and each piece of original data or each piece of change data is composed of a field and a field value.
[0019] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory storing computer program instructions; the processor implements the steps of the data synchronization method based on gray isolation according to the first aspect when executing the computer program instructions.
[0020] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores computer program instructions, and the computer program instructions are executed by a processor to implement the steps of the data synchronization method based on gray isolation according to the first aspect.
[0021] In a fifth aspect, an embodiment of the present application provides a computer program product stored in a nonvolatile storage medium, and the computer program product is executed by a processor to implement the steps of the data synchronization method based on gray isolation according to the first aspect.
[0022] In a sixth aspect, an embodiment of the present application provides a chip, and the chip includes a processor and a communication interface, the communication interface is coupled with the processor, and the processor is configured to run a program or an instruction to implement the steps of the data synchronization method based on gray isolation according to the first aspect.
[0023] The present application provides a data synchronization method, device, equipment, medium and product based on grayscale isolation. In the scenario of testing the update function, a data request for the update function is received, and the data request carries a request field. The data request is used to indicate the acquisition of the request data corresponding to the request field. For each request data indicated by the data request, the request field is read from the multi-level memory step by step starting from the first-level memory using the preset grayscale strategy in the order of the memory level from low to high, and a return data corresponding to the request field is obtained from each level of memory that has been read. In the case where the first return data that matches the expected grayscale parameters in the preset grayscale strategy is read from the P-th level memory, it indicates that the first return data is the required request data, so it can be sent directly to the client, and the reading of the request field from the P+1-th level memory is stopped, completing the reading step for the request data. Based on this, after the reading is completed, it is checked whether there is a second return data that is consistent with the grayscale of the target program in the P return data read from the P-level memory. If so, a bubble strategy can be executed on the multi-level memory to synchronize the second return data to all memories with a memory level smaller than the target memory. The memory where the second return data is located is the target memory. In this way, in the scenario where the data has grayscale, different grayscale versions of data can be stored in the multi-level memory at the same time, but the target program can only write data consistent with its grayscale in the multi-level memory, avoiding the target program from writing data inconsistent with its own grayscale into the multi-level memory, realizing the regular bubbling of grayscale data within the multi-level memory, and then realizing the effective synchronization of grayscale data between the multi-level memories. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings in the embodiments of the present application.
[0025] Figure 1 This is a flowchart of a data synchronization method based on grayscale isolation provided by an embodiment of the present application;
[0026] Figure 2 1 is a flowchart of a data synchronization method based on grayscale isolation provided by another embodiment of the present application;
[0027] Figure 3 1 is a structural diagram of a data synchronization device based on grayscale isolation provided in an embodiment of the present application;
[0028] Figure 4 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] The principles and spirits of the present application will be described below with reference to a number of exemplary embodiments. It should be understood that the purpose of providing these embodiments is to make the principles and spirits of the present application clearer and more thorough, and to enable those skilled in the art to better understand and implement the principles and spirits of the present application. The exemplary embodiments provided herein are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments herein, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0030] In this document, terms such as first, second, third, etc. are used to distinguish one entity (or operation) from another entity (or operation), and do not imply or suggest any order or association between the entities (or operations).
[0031] The data synchronization method based on gray isolation provided by the embodiments of the present application will be described in detail below with reference to specific examples and application scenarios.
[0032] Figure 1 is a flowchart of the data synchronization method based on gray isolation provided by an embodiment of the present application. The execution subject of the data synchronization method based on gray isolation can be an application program. An application program can be divided into different parts, i.e. each program, so the application program can be composed of each program. Each program is a distributed application program, which is a group of computer programs scattered on multiple computing nodes. Each node is an independent physical device or software process, but all work to achieve the function of the application program.
[0033] The data synchronization method based on gray isolation of the present application will be described below with the execution subject of the data synchronization method based on gray isolation being an application program as an example. It should be noted that the above execution subject and application scenario do not constitute a limitation on the present application.
[0034] As shown in Figure 1 The data synchronization method based on gray isolation provided by the embodiments of the present application can include steps 110-150.
[0035] Step 110, receiving a data request for updating a function, the data request being used to obtain at least one request data, the data request carrying a request field corresponding to the request data;
[0036] Step 120, for each request data, in the order from low to high of the memory level, using a preset gray strategy to read the request field from the first level memory and from the multi-level memory step by step, and taking the field value obtained by reading the request field from each memory as the return data;
[0037] Step 130, in the case that the first return data matching the expected gray parameter in the preset gray strategy is read from the Pth level memory, the first return data is determined as the requested data, the first return data is sent to the client, and reading the request field to the (P+1) th level memory is stopped, wherein the expected gray parameter is the requested gray parameter carried in the data request or the program gray parameter of the target program, and the target program is the program receiving the data request;
[0038] Step 140, checking whether the second return data consistent with the gray of the target program exists in the P return data read from the Pth level memory;
[0039] Step 150, only in the case that the second return data exists, the bubble strategy is executed on the multi-level memory, the memory where the second return data is located is the target memory, and the bubble strategy is used to synchronize the second return data to all memories with a memory level less than the target memory.
[0040] The data synchronization method based on gray isolation provided by the embodiments of the present application, in the scene of testing the update function, receives the data request for the update function, the data request carries the request field, and the data request is used to indicate to obtain the requested data corresponding to the request field. For each piece of requested data indicated to be obtained by the data request, the request field is read from the multi-level memory starting from the first level memory in the order of low to high memory level according to the preset gray strategy, and one piece of return data corresponding to the request field is obtained from each level of memory read. In the case that the first return data matching the expected gray parameter in the preset gray strategy is read from the Pth level memory, it is indicated that the first return data is the required requested data, so it can be directly sent to the client, and reading the request field to the (P+1) th level memory is stopped, and the reading step for the requested data is completed. Based on this, after reading is completed, it is checked whether the second return data consistent with the gray of the target program exists in the P return data read from the Pth level memory, if it exists, the bubble strategy can be executed on the multi-level memory, the second return data is synchronized to all memories with a memory level less than the target memory, and the memory where the second return data is located is the target memory. In this way, in the scene of data with gray, different gray version data can be saved in the multi-level memory at the same time, but the target program can only write data consistent with its gray in the multi-level memory, avoiding the target program from writing data inconsistent with its gray in the multi-level memory, realizing regular bubble of gray data in the multi-level memory, and further realizing effective synchronization of gray data among the multi-level memories.
[0041] The specific implementation of the above steps will be described in detail in combination with specific embodiments.
[0042] The step 110 involves receiving a data request for updating a function.
[0043] In step 110, the program receiving the data request can be a target program, and the data request is for testing whether the update function can be implemented normally. The update function is an application function updated when the version of the application program is upgraded. Before the update function is officially put into operation, the tester needs to test the update function to ensure the normal operation of the update function. Therefore, the data request can be a function test request.
[0044] The data relied on by the update function when running can include not only changed data but also original data. Therefore, the requested data returned by the request can be changed data or original data. The data corresponding to the update data and the changed data has different data grayscales. The changed data is data that needs to be changed when the application function is updated, such as data items that are added, deleted, or modified. Therefore, after the update function is developed, the storage needs to maintain the changed data in addition to maintaining the original data of the stable (old) version of the application.
[0045] For example, the application program is a job application program, and the developer develops an update function of the job application program. The update function is used to optimize and update the style of the resume filling interface of the job application program. For example, the list width before the update is 100, and the input box cursor color is black. After the update, the list width is 120, and the input box cursor color is red. Therefore, “list width is 100” and “input box cursor color is black” are original data, and “list width is 120” and “input box cursor color is red” are changed data.
[0046] The request data is the target field value of the request field. Based on this, in order to obtain at least one piece of request data, the data request carries a request field corresponding to the request data, so as to read based on the request field in the multi-level storage to obtain the target field value, thereby obtaining the request data.
[0047] In the multi-level storage, the field value of each field is a piece of data, and each piece of data is associated with a data grayscale parameter. Therefore, each piece of data in the multi-level storage has a corresponding grayscale. For the same field, at least one field value can be corresponded in the multi-level storage. Different field values are associated with different data grayscale parameters, and different field values (different data) are configured as different grayscales to be distinguished.
[0048] For example, for the above-mentioned “list width” field, the field value “100” can be set as the nocolor grayscale, and the field value “120” can be set as the blue grayscale.
[0049] The multi-level memory is used to store original data and changed data maintained by each program, and the original data and the changed data are stored in association with corresponding data gray scale parameters. The data gray scale parameters of the original data and the changed data are used to indicate different gray scales. Therefore, by configuring the data gray scale parameters of the original data and the changed data as different parameters, different gray scale data can be simultaneously stored in the multi-level memory, without the need to set independent (physical or logical) memory for each gray scale data, thereby realizing gray scale isolation of the stored data in the same multi-level memory.
[0050] The multi-level memory includes a plurality of memories of different levels. Each memory can store data of at least one gray scale. The plurality of memories correspond to different data life cycles, and therefore the data stored in each memory is dynamically updated. For example, the data life cycle of the first-level memory is 1 hour, the data life cycle of the second-level memory is 1 day, and the data life cycle of the third-level memory is permanent persistent storage.
[0051] The data life cycles corresponding to the memories of different levels are different, and therefore the data or the data gray scales stored in the memories of different levels are also different at the same time. For example, at the same time, the data stored in the first-level memory is "list width is 100" and "input box cursor color is black", which is original data, and the data stored in the second-level memory is "list width is 120" and "input box cursor color is red", which is changed data, and therefore the gray scales are different.
[0052] In step 120, for each request data, the request field is read from the multi-level memory in order of memory level from low to high, starting from the first-level memory, using a preset gray scale strategy, and the field value of the request field read from each memory is taken as the return data.
[0053] In step 120, the preset gray scale strategy is a read rule for multi-gray scale version data, which is common between the memories of different levels. For each request field, the request field is read from the multi-level memory in order of memory level from low to high, starting from the first-level memory, using the preset gray scale strategy, and the field value of the request field read from each memory is taken as the return data, so that a return data corresponding to the request field can be obtained from each read memory.
[0054] Referring to the above example, for the field of "list width", the field value "100" can be set as nocolor gray scale, and the field value "120" can be set as blue gray scale. If the first level memory stores "list width-100" and the second level memory stores "list width-120", when the request field is "list width", "list width-100" can be obtained from the first level memory as the return data, and "list width-120" can be obtained from the second level memory as the return data.
[0055] In the embodiments of the present application, the target program can read the request field from the first level memory in the multi-level memory in order from low to high according to the memory level after receiving the data request.
[0056] In step 130, when the first return data matching the expected gray scale parameter in the preset gray scale strategy is read from the Pth level memory, it is determined that the first return data is the request data, the first return data is sent to the client, and reading the request field to the (P+1)th level memory is stopped.
[0057] In step 130, the expected gray scale parameter is used to represent or indicate a gray scale, and the expected gray scale parameter can be a request gray scale parameter carried in the data request or a program gray scale parameter of the target program. Whether the expected gray scale parameter is the request gray scale parameter or the program gray scale parameter is determined by the preset gray scale strategy. The target program is the program receiving the data request, and P is a positive integer. The first return data is the return data matching the expected gray scale parameter, which means that the first return data is consistent with the gray scale corresponding to the expected gray scale parameter.
[0058] Referring to the above example, if the return data "list width-100" obtained from the first level memory matches the expected gray scale parameter, it means that "list width-100" is the request data, and "100" is the target field value, so "list width-100" can be directly returned to the client, and there is no need to continue to obtain return data from the second level memory.
[0059] In some embodiments of the present application, the above 120 can specifically include the following steps:
[0060] For each level of memory, the request field is read from the current level of memory based on the expected gray scale parameter in the preset gray scale strategy;
[0061] If the first return data is read from the current level of memory, it is determined that the request data reading is successful, and reading the request field to the next level of memory is stopped;
[0062] Otherwise, it is necessary to continue reading the request field from the next level of memory based on the expected grayscale parameters until the preset end condition is met and the reading is stopped; wherein the preset end condition includes: the request data is read successfully, or the multi-level memory traversal is completed.
[0063] In some embodiments of the present application, Figure 2 This is a flow chart of a data synchronization method based on grayscale isolation provided by another embodiment of the present application. The above step 120 may include Figure 2 Steps 210 to 230 are shown.
[0064] Step 210 , for the current level memory, first read the requested field from the current level memory based on the expected grayscale parameters in the preset grayscale strategy;
[0065] Step 220: If the first return data is read from the current level memory, it is determined that the requested data is read successfully, and the reading of the request field from the next level memory is stopped;
[0066] Step 230: If the first return data is not read from the current level memory, it is determined that the requested data reading has failed, and the request field is continued to be read from the current level memory based on the alternative grayscale parameters in the preset grayscale strategy, and the return data corresponding to the request field is obtained, and the request field is continued to be read from the next level memory based on the expected grayscale parameters until the preset end condition is met and the reading is stopped.
[0067] Specifically, when reading a requested field from the current memory based on the expected grayscale parameter, the field value can be read only when the field value of the requested field in the current memory is consistent with the grayscale of the expected grayscale parameter, otherwise the field value cannot be read. Similarly, when reading a requested field from the current memory based on the alternative grayscale parameter, the field value can be read only when the field value of the requested field in the current memory is consistent with the grayscale of the alternative grayscale parameter, otherwise the field value cannot be read. In the same preset grayscale strategy, the grayscale indicated by the expected grayscale parameter is different from that indicated by the alternative grayscale parameter.
[0068] Based on this, if the field value of the requested field can be read from the current level memory based on the expected grayscale parameters, the data grayscale parameters associated with the field value must be consistent with the expected grayscale parameters, and the field value is the target field value. In this way, the first return data matching the expected grayscale parameters can be obtained.
[0069] The preset end condition may include: the requested data is read successfully, or the multi-level memory traversal is completed.
[0070] Exemplarily, it is expected that the gray scale parameter is used to indicate the blue gray scale, the alternative gray scale parameter is used to indicate the no color gray scale, the request field is "list width", "list width is 100" can correspond to the no color gray scale, "list width is 120" can correspond to the blue gray scale, and the multi-level memory includes 4 levels. Therefore, the request field can be read from the first level memory based on the blue gray scale.
[0071] If the first level memory contains the field value "list width is 120", the "list width is 120" can be directly read based on the blue gray scale, and there is no need to continue to read the second level memory;
[0072] If the first level memory contains the field value "list width is 100", the field value of the blue gray scale cannot be read based on the blue gray scale. Therefore, the "list width is 100" can be obtained based on the alternative gray scale parameter no color gray scale, and the field value of the blue gray scale can be continued to be read based on the blue gray scale from the second level memory until the field value "list width is 120" of the blue gray scale is stopped, or the field value of the blue gray scale is stopped based on the blue gray scale from the fourth level memory.
[0073] In the embodiment of the present application, when the request field is not read in the current level memory based on the expected gray scale parameter, it indicates that the first return data matched with the expected gray scale parameter is not contained in the current level memory, that is, the request data indicated by the data request is not contained. Based on this, the present application needs to continue to read the next level memory based on the expected gray scale parameter, and the request data is tried to be obtained from each level memory from top to bottom, until the request data is read or the multi-level memory is completed. In this way, the multi-level memory supports to store distributed and multi-gray scale version data, and the preset gray scale strategy is independently executed between each level memory without affecting each other. By using the preset gray scale strategy, the return data corresponding to the request field can be effectively obtained in each level memory, and the data request failure caused by the failure to obtain the return data is avoided.
[0074] In the above embodiment, when the expected gray scale parameter is the request gray scale parameter carried in the data request, the alternative gray scale parameter includes the program gray scale parameter of the target program; and when the expected gray scale parameter is the program gray scale parameter of the target program, the alternative gray scale parameter includes the request gray scale parameter carried in the data request.
[0075] It should be noted that the above steps 220 and 230 are two judgment branches, and the execution order thereof is not limited in the present application.
[0076] In some embodiments of the present application, each field value in the multi-level memory is associated with a data grayscale parameter. The reading of the request field from the current-level memory based on the expected grayscale parameter in the preset grayscale policy in step 210 may specifically include: only when the data grayscale parameter associated with the field value of the request field in the current-level memory is consistent with the expected grayscale parameter, reading the field value of the request field, obtaining return data corresponding to the request field, and determining that the return data is first return data that matches the expected grayscale parameter;
[0077] In the above step 230, the requested field is continued to be read from the current level memory based on the alternative grayscale parameters in the preset grayscale strategy, which may specifically include: only when the data grayscale parameters associated with the field value of the requested field in the current level memory are consistent with the alternative grayscale parameters, the field value of the requested field is read to obtain the return data corresponding to the requested field.
[0078] Specifically, the data grayscale parameter is used to indicate the grayscale corresponding to the field value. Each field value in the multi-level memory is stored in association with a key. The key of each field value is generated based on the data grayscale parameter of each data. The field value and the key can be stored in the form of a key-value pair. In this way, a mapping relationship between each data and the data grayscale can be established in the memory, and all data in the memory can be grayscale divided so that different grayscale data can be stored in the same memory at the same time. There is no need to set up an independent (physical, logical) memory for each grayscale data, so as to achieve data grayscale isolation in the same memory. In addition, the data grayscale parameter can directly reuse the program grayscale parameter of the first program, and directly add the data grayscale parameter as a parameter to the existing key. Developers do not need to perform any additional configuration or encoding work for the grayscale data, and can achieve data grayscale isolation simply and efficiently.
[0079] As an example, if the request field is "list width", the data grayscale parameter of "list width is 100" may indicate nocolor grayscale, and the data grayscale parameter of "list width is 120" may indicate blue grayscale.
[0080] In the embodiment of the present application, each field value in the multi-level memory can correspond to a data grayscale parameter. Only when the grayscale parameter used when reading the field value is consistent with the data grayscale parameter of the field value can the field value be successfully read. In this way, the orderly reading of data with grayscale between multi-level storage can be achieved.
[0081] In the embodiment of the present application, based on different preset grayscale strategies, the corresponding expected grayscale parameters and the alternative grayscale parameters are also different.
[0082] Optionally, in some embodiments of the present application, the preset gray strategy is a local gray first strategy, the expected gray parameter is a program gray parameter of the target program, and the alternative gray parameter includes a request gray parameter and a preset initial gray. The local gray first strategy can specifically include:
[0083] In a case where reading the request data from the current level memory based on the program gray parameter fails, reading the request field from the current level memory based on the request gray parameter carried in the data request is continued;
[0084] In a case where reading the request field from the current level memory based on the request gray parameter fails, reading the request field from the current level memory based on the preset initial gray is continued.
[0085] Among the programs, N programs that are dependent on the update function can be screened out. A program for maintaining change data associated with the update function in the N programs is a first program, and a program other than the first program in the N programs is a second program. The target program is the first program or the second program. The program gray parameter of the first program, the data gray parameter of the change data, and the request gray parameter of the data request of the update function are all configured as a target gray. The data gray parameter of the original data and the program gray parameter of the second program are configured as a preset initial gray. Therefore, the gray indicated by the request gray parameter is different from the preset initial gray.
[0086] In the embodiments of the present application, under the local gray first strategy, the program gray parameter of the target program is preferentially used to read the request data. If the reading fails, the request gray parameter can be used to continue reading the request data. If the reading fails, the preset initial gray is finally used to continue reading the request field from the current level memory. In this way, the three reading operations use three different parameters to read the request field, so as to ensure that the return data corresponding to the request field can be obtained from each level memory.
[0087] Optionally, in some embodiments of the present application, the preset gray strategy is a local gray first strategy, the expected gray parameter is a program gray parameter of the target program, and the alternative gray parameter includes a request gray parameter and a preset initial gray. The local gray first strategy can specifically include:
[0088] In a case where reading the request data from the current level memory based on the program gray parameter fails, reading the request field from the current level memory based on the target program gray parameter is continued;
[0089] In a case where reading the request field from the current level memory based on the program gray parameter fails, reading the request field from the current level memory based on the preset initial gray is continued.
[0090] In the embodiment of the present application, under the local gray scale priority strategy, the request data is read by using the request gray scale parameter first, if the reading fails, the request data is read by using the program gray scale parameter, if the reading fails, the request field in the current level memory is read by using the preset initial gray scale. In this way, the request field is read by using three different parameters in three reading operations, so as to ensure that the return data corresponding to the request field can be obtained from each level memory.
[0091] Step 140 is related to, checking whether the second return data consistent with the gray scale of the target program exists in the P pieces of return data read from the P-level memory.
[0092] In step 140, the second return data is the return data whose data gray scale is consistent with the program gray scale of the target program, and the consistency of the data gray scale parameter corresponding to each piece of return data and the program gray scale parameter of the target program can be checked, and in the case of consistency, the return data is determined as the second return data.
[0093] Step 150 is related to, only in the case that the second return data exists, the bubble strategy is executed on the multi-level memory.
[0094] In step 150, after the target program receives the data request, it exists as a local program for reading the request data, and the local program can only write data consistent with its own gray scale in the multi-level memory. Therefore, if the second return data consistent with the gray scale of the target program exists, the target program can synchronize the second return data to all memories whose memory level is smaller than the target memory by executing the bubble strategy, specifically, writing the second return data into these memories.
[0095] For example, if the second return data is obtained from the x-level memory, the second return data can be updated to the 1st, 2nd, …, x-1st memory; if there is no data consistent with the current program gray scale, no bubble is performed.
[0096] In some embodiments of the present application, the data request is sent by the client, in order to ensure that the client can receive the return data, after the field value obtained by reading the request field from each level memory is taken as the return data in the above step 120, the method can further include the following steps:
[0097] In the case of reading the last level memory of the multi-level memory, if the request data is not read from the last level memory based on the expected gray scale parameter, it is determined that the request data reading in the multi-level memory fails;
[0098] Obtain multiple pieces of return data obtained from the multi-level memory, wherein the multiple pieces of return data are read based on the alternative gray scale parameter in the preset gray scale strategy;
[0099] sending the return data obtained from the first level of the multi-level memory to the client.
[0100] For example, if the expected gray parameter is blue gray, the multi-level memory includes four levels, and the request field is "list width", if the field value of the blue gray is not obtained from each level of the memory, the return data of the nocolor gray obtained from the first level of the memory can be directly returned to the client.
[0101] In the embodiments of the present application, the different levels of the multi-level memory correspond to different life cycles, and the top level of the memory has a shorter life cycle, and thus has higher real-time data. Based on this, if the return data matching the expected gray parameter is not obtained from the multi-level memory, the return data obtained from the first level of the memory can be directly returned to the client, to ensure the real-time of the return data, and also to ensure that the client can receive the return data, and avoid the occurrence of request failure.
[0102] In some embodiments of the present application, before the step 110 of receiving the data request for the update function, the method can further include the following steps:
[0103] In the case of testing the update function, obtaining the change data associated with the update function;
[0104] Filtering N programs dependent on the update function from each program, and determining that a program for maintaining the change data in the N programs is a first program, and a program other than the first program in the N programs is a second program, wherein the target program is the first program or the second program;
[0105] The program gray parameter of the first program, the data gray parameter of the change data, and the request gray parameter of the data request of the update function are all configured as the target gray;
[0106] The change data and the data gray parameter thereof are stored in the multi-level memory in association;
[0107] The multi-level memory is also used for storing original data associated with the update function, and the original data and the data gray parameter thereof are stored in association, and the data gray parameter of the original data and the program gray parameter of the second program are used for indicating a preset initial gray, and each piece of original data or each piece of change data is composed of a field and a field value.
[0108] Specifically, the N programs are distributed application programs that need to be called when the update function runs, and not all programs in the N programs need to maintain the change data, and these programs that do not need to maintain the change data can be the second program.
[0109] For example, the second program can be an interface for receiving data requests sent by the front end and returning to the front end after the first program obtains the requested data; for another example, the second program is a program for maintaining original data, and the running of the update function needs to rely on part of the original data in addition to the changed data, so the original data also needs to be read through the second program when the update function is implemented.
[0110] For example, the update function is used to optimize and update the style of the resume filling interface of the job application program, so the interface style parameters need to be returned to the front end, which include parameter b and parameter c. Among them, program A is used to receive parameter acquisition requests from the front end and return interface style parameters to the front end, program B is used to maintain parameter b, and program C is used to maintain parameter c. Parameter b is changed data, and parameter c is original data. Then program A and C are the second program, and program B is the first program.
[0111] The program gray parameter is a parameter for indicating program gray, the data gray parameter is a parameter for indicating data gray, and the request gray parameter is a parameter for indicating request gray. Among them, the data gray parameter of the changed data and the request gray parameter of the data request of the update function can directly reuse the program gray parameter of the first program, that is, the program gray parameter, the data gray parameter and the request gray parameter are the same, which ensures that the grays of the first program, the changed data and all data requests of the update function are consistent.
[0112] Specifically, each program corresponds to a configuration file, and the program gray parameter can be set in the configuration file; the changed data is stored in the form of key-value pairs in the memory, and the data gray parameter can be set in the key; the request gray parameter can be set in the request header of the data request.
[0113] For example, “spring.cloud.nacos.discovery.metadata.color:nocolor” is the original program gray parameter of the first program, which indicates that the program gray is nocolor. By changing it to “spring.cloud.nacos.discovery.metadata.color:blue”, the first program is configured to be blue gray, and correspondingly, all data requests of the changed data and the update function are also configured to be blue gray.
[0114] The multi-level memory is used for storing original data and change data maintained by respective programs, and the original data and the change data are stored in association with data gray scale parameters thereof. Therefore, by configuring the data gray scale parameters of the original data and the change data as different parameters, different gray scale data can be simultaneously stored in the multi-level memory, and it is not necessary to set independent (physical or logical) memory for each type of gray scale data, so that gray scale isolation of different data in the multi-level memory is realized.
[0115] Corresponding to the method embodiment of the present application, the present application further provides a data synchronization device based on gray scale isolation.
[0116] Figure 3 is a structural schematic diagram of a data synchronization device based on gray scale isolation provided by an embodiment of the present application. As shown in the figure, the data synchronization device based on gray scale isolation 300 can include a receiving module 310, a reading module 320, a checking module 330, and a bubbling module 340. Figure 3
[0117] The receiving module 310 is configured to receive a data request for updating a function, wherein the data request is used for obtaining at least one piece of requested data, and the data request carries a request field corresponding to the requested data. The reading module 320 is configured to, for each piece of requested data, read the request field from the multi-level memory in a sequence from a first level to a last level of the memory, by using a preset gray scale strategy, and take a field value obtained by reading the request field from each level of the memory as return data. The reading module 320 is configured to, in a case where a first return data matching an expected gray scale parameter in the preset gray scale strategy is read from a Pth level of the memory, determine that the first return data is the requested data, send the first return data to a client, and stop reading the request field from a (P+1) th level of the memory, wherein the expected gray scale parameter is a request gray scale parameter carried in the data request or a program gray scale parameter of a target program, and the target program is a program that receives the data request. The checking module 330 is configured to check whether there is a second return data consistent with the gray scale of the target program in P pieces of return data read from the Pth level of the memory. The bubbling module 340 is configured to execute a bubbling strategy on the multi-level memory only in a case where the second return data exists, wherein a memory where the second return data is located is a target memory, and the bubbling strategy is used for synchronizing the second return data to all memories having a memory level smaller than the target memory.
[0118] The data synchronization device based on gray isolation provided by the embodiments of the present application can receive a data request for an update function in a scenario of testing the update function, the data request carrying a request field, the data request being used to indicate to obtain request data corresponding to the request field. For each piece of request data indicated to be obtained by the data request, the request field is read from a first-level memory to a multi-level memory in a preset gray strategy in a sequence from low to high of memory levels. A return data corresponding to the request field is obtained from each memory level that has been read. In a case where a first return data matching an expected gray parameter in the preset gray strategy is read from a Pth memory level, the first return data is the required request data, and thus can be directly sent to a client and reading of the request field from a P+1th memory level is stopped, thereby completing reading of the request data. Based on this, after reading is completed, whether there is a second return data consistent with a gray of a target program in P return data read from the Pth memory level is checked. If there is, a bubble strategy is executed on the multi-level memory to synchronize the second return data to all memories with a memory level smaller than a target memory, the memory where the second return data is located being the target memory. In this way, in a scenario where data has a gray, different gray versions of data can be simultaneously saved in the multi-level memory, but the target program can only write data consistent with the gray of the target program in the multi-level memory, avoiding the target program from writing data inconsistent with the gray of the target program in the multi-level memory, realizing regular bubbling of gray data in the multi-level memory, and further realizing effective synchronization of the gray data between the multi-level memories.
[0119] In some embodiments of the present application, the reading module 320 includes: a first reading unit, configured to read, for a current-level memory, a request field from the current-level memory based on an expected gray parameter in a preset gray strategy; a judging unit, configured to, if a first return data is read from the current-level memory, determine that reading of the request data is successful, and stop reading of the request field from a next-level memory; and a second reading unit, configured to, if the first return data is not read from the current-level memory, determine that reading of the request data fails, continue to read the request field from the current-level memory based on an alternative gray parameter in the preset gray strategy to obtain return data corresponding to the request field, and continue to read the request field from the next-level memory based on the expected gray parameter until a preset ending condition is met to stop reading; wherein the preset ending condition includes that reading of the request data is successful, or that the multi-level memory is traversed completely.
[0120] In some embodiments of the present application, each field value in the multi-level memory is associated with a data grayscale parameter, and the first reading unit is specifically configured to: only in the case that the data grayscale parameter associated with the field value of the requested field in the current level memory is consistent with the expected grayscale parameter, read the field value of the requested field, obtain the return data corresponding to the requested field, and determine that the return data is the first return data matching the expected grayscale parameter; and the second reading unit is specifically configured to: only in the case that the data grayscale parameter associated with the field value of the requested field in the current level memory is consistent with the alternative grayscale parameter, read the field value of the requested field, and obtain the return data corresponding to the requested field.
[0121] In some embodiments of the present application, the preset grayscale strategy is a local grayscale priority strategy, the expected grayscale parameter is a program grayscale parameter of the target program, and the alternative grayscale parameter includes a request grayscale parameter and a preset initial grayscale. The local grayscale priority strategy includes: in the case that reading the requested data in the current level memory based on the program grayscale parameter fails, continuing to read the requested field in the current level memory based on the request grayscale parameter carried in the data request; and in the case that reading the requested field in the current level memory based on the request grayscale parameter fails, continuing to read the requested field in the current level memory based on the preset initial grayscale.
[0122] In some embodiments of the present application, the preset grayscale strategy is a request grayscale priority strategy, the expected grayscale parameter is a request grayscale parameter carried in the data request, and the alternative grayscale parameter includes a program grayscale parameter and a preset initial grayscale. The request grayscale priority strategy includes: in the case that reading the requested data in the current level memory based on the request grayscale parameter fails, continuing to read the requested field in the current level memory based on the program grayscale parameter of the target program; and in the case that reading the requested field in the current level memory based on the program grayscale parameter fails, continuing to read the requested field in the current level memory based on the preset initial grayscale.
[0123] In some embodiments of the present application, the data request is sent by the client, and the method further includes: after taking the field value obtained by reading the requested field from each level memory as return data, in the case that the last level memory of the multi-level memory is read, if the requested data is not read from the last level memory based on the expected grayscale parameter, determining that the reading of the requested data in the multi-level memory fails; obtaining a plurality of return data obtained from the multi-level memory, wherein the plurality of return data are read based on the alternative grayscale parameter in the preset grayscale strategy; and sending, to the client, the return data obtained from the first level memory.
[0124] In some embodiments of the present application, the method further comprises: a obtaining module, configured to, before receiving the data request for updating the function, obtain the change data associated with the function to be updated in the case that the function to be updated is tested; a determining module, configured to select N programs from the programs, the N programs being dependent on the function to be updated, and determine a first program as a program for maintaining the change data in the N programs, and a second program as a program other than the first program in the N programs, wherein the target program is the first program or the second program; a gray configuration module, configured to configure the program gray parameter of the first program, the data gray parameter of the change data, and the request gray parameter of the data request for updating the function as the target gray; a data storage module, configured to store the change data and the data gray parameter of the change data in the multi-level storage in association; wherein the multi-level storage is further configured to store original data associated with the function to be updated, and the original data and the data gray parameter of the original data are stored in association, and the data gray parameter of the original data and the program gray parameter of the second program are used to indicate a preset initial gray, and each piece of original data or each piece of change data is composed of a field and a field value.
[0125] The data synchronization device based on gray isolation provided by the embodiments of the present application can realize the processes of the service platform in the method embodiments and achieve the same technical effects. To avoid repetition, no further description is given here. Figures 1-2 The processes of the service platform in the method embodiments and achieve the same technical effects. To avoid repetition, no further description is given here.
[0126] Figure 4 is a hardware structure schematic diagram of an electronic device provided by an embodiment of the present application.
[0127] As shown in Figure 4 , the electronic device 400 includes a memory 401, a processor 402, and a computer program stored in the memory 401 and executable on the processor 402.
[0128] In one example, the processor 402 described above can include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or can be configured as one or more integrated circuits that implement one or more embodiments of the present application.
[0129] The memory 401 can include a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical, or other physical / tangible memory storage device. Therefore, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software comprising computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the card opening method in the embodiments according to the first aspect of the application.
[0130] The processor 402 runs a computer program corresponding to the executable program code stored in the memory 401 by reading the executable program code, for implementing the card opening method in the embodiments of the first aspect described above.
[0131] In some examples, the electronic device 400 can further include a communication interface 403 and a bus 410. As shown, the memory 401, the processor 402, and the communication interface 403 are connected through the bus 410 and complete communication among each other. Figure 4
[0132] The communication interface 403 is mainly used to realize the communication among the modules, devices, units, and / or equipment in the embodiments of the application. The input device and / or the output device can also be accessed through the communication interface 403.
[0133] Bus 410 includes a hardware, software, or both, that couples electronic devices 400 to each other. By way of example, and not limitation, bus 410 can include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand (IB) interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-E) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or some other suitable bus or interconnect, or a combination of two or more of these. Bus 410 can include one or more buses according to appropriate standards, where appropriate. Although this application describes and illustrates a particular bus, this application contemplates any suitable bus or interconnect.
[0134] The electronic device provided by the embodiments of the present application can realize Figures 1-2 The method embodiments of the present application can realize the various processes realized by the electronic device, and can realize the same technical effects. To avoid repetition, the same will not be described here.
[0135] In combination with the data synchronization method based on gray isolation in the above embodiments, the embodiments of the present application can provide a computer storage medium to realize. The computer storage medium has computer program instructions stored thereon; the computer program instructions are executed by a processor to realize the steps of any one of the data synchronization methods based on gray isolation in the above embodiments.
[0136] In combination with the data synchronization method based on gray isolation in the above embodiments, the embodiments of the present application can provide a computer program product to realize. The (computer) program product is stored in a non-volatile storage medium, and the program product is executed by at least one processor to realize the steps of any one of the data synchronization methods based on gray isolation in the above embodiments.
[0137] The chip according to the embodiments of the present application can also be referred to as a system chip, a system on chip, a chip system, or a system on chip system.
[0138] It should be understood that the chip mentioned in the embodiments of the present application can also be referred to as a system chip, a system on chip, a chip system, or a system on chip system.
[0139] It should be understood that the present application is not limited to the specific configurations and processes described above and shown in the drawings. For the sake of brevity, detailed descriptions of well-known methods are omitted. In the above embodiments, several specific steps are described and shown as examples. However, the method processes of the present application are not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order of the steps, after understanding the spirit of the present application.
[0140] The functional blocks shown in the structural block diagrams described above can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a functional card, etc. When implemented in software, the elements of the present application are program or code segments used to perform the required tasks. The program or code segments can be stored in a machine-readable medium or transmitted through a data signal carried in a carrier wave over a transmission medium or communication link. The "machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segments can be downloaded via a computer network such as the Internet, an intranet, etc.
[0141] It should also be noted that the exemplary embodiments mentioned in the present application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiments, or in an order different from the embodiments, or several steps can be performed simultaneously.
[0142] The computer program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other processing device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other processing device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0143] The above solely describes specific implementations of the present application. For the purpose of description and brevity, the specific working process of the system, module and unit described above can refer to the corresponding process in the foregoing method embodiments, which will not be described herein. It should be understood that the protection scope of the present application is not limited to this. Any person skilled in the art can easily think of various equivalent modifications or replacements within the technical range disclosed in the present application, and these modifications or replacements shall be included in the protection scope of the present application.
Claims
1. A data synchronization method based on grayscale isolation, characterized in that: include: Receiving a data request for an update function, wherein the data request is used to obtain at least one piece of request data, and the data request carries a request field corresponding to the request data; For each request data, in ascending order of memory levels, the request fields are read from the multi-level memory level by level using a preset grayscale strategy, starting from the first-level memory, and the field values obtained from reading the request fields from each level of memory are used as return data; In a case where first return data matching the expected grayscale parameters in the preset grayscale policy is read from the P-th level memory, determining that the first return data is request data, sending the first return data to the client, and stopping reading the request field from the P+1-th level memory, wherein the expected grayscale parameters are the request grayscale parameters carried in the data request or the program grayscale parameters of the target program, and the target program is the program that receives the data request; Verify whether there is second return data consistent with the grayscale of the target program among the P pieces of return data read from the P-level memory; The bubble strategy is executed on the multi-level memory only when the second return data exists, wherein the memory where the second return data is located is the target memory, and the bubble strategy is used to synchronize the second return data to all memories with a memory level smaller than the target memory.
2. The method according to claim 1, characterized in that The method includes: reading the requested field from the multi-level memory in descending order of the memory level, starting from the first-level memory, and using the field value obtained by reading the requested field from each level of memory as the return data; For a current level memory, firstly read a request field from the current level memory based on the expected grayscale parameters in the preset grayscale strategy; If the first return data is read from the current level memory, it is determined that the request data is read successfully, and the reading of the request field from the next level memory is stopped; If the first return data is not read from the current-level memory, it is determined that the requested data reading fails, and the request field is continued to be read from the current-level memory based on the alternative grayscale parameter in the preset grayscale strategy, and the return data corresponding to the request field is obtained, and the request field is continued to be read from the next-level memory based on the expected grayscale parameter until the preset end condition is met and the reading is stopped; The preset end condition includes: the requested data is read successfully, or the multi-level memory traversal is completed.
3. The method according to claim 2, characterized in that Each field value in the multi-level memory is associated with a data grayscale parameter, and a request field is read from the current level memory based on the expected grayscale parameter in the preset grayscale strategy, including: Only when the data grayscale parameter associated with the field value of the request field in the current-level memory is consistent with the expected grayscale parameter, reading the field value of the request field, obtaining return data corresponding to the request field, and determining that the return data is first return data that matches the expected grayscale parameter; Continuing to read the requested field from the current level memory based on the candidate grayscale parameters in the preset grayscale strategy includes: Only when the data grayscale parameter associated with the field value of the requested field in the current level memory is consistent with the candidate grayscale parameter, the field value of the requested field is read and the return data corresponding to the requested field is obtained.
4. The method according to claim 2, characterized in that The preset grayscale strategy is a local grayscale priority strategy, the expected grayscale parameters are program grayscale parameters of the target program, the candidate grayscale parameters include requested grayscale parameters and preset initial grayscale, and the local grayscale priority strategy includes: In the case that reading the requested data in the current level memory based on the program grayscale parameter fails, continuing to read the requested field in the current level memory based on the request grayscale parameter carried in the data request; In the case that reading the requested field in the current level memory based on the requested grayscale parameter fails, the requested field in the current level memory continues to be read based on the preset initial grayscale.
5. The method according to claim 2, characterized in that The preset grayscale strategy is a request grayscale priority strategy, the expected grayscale parameters are request grayscale parameters carried in the data request, the candidate grayscale parameters include program grayscale parameters and preset initial grayscale, and the request grayscale priority strategy includes: In the case that reading the requested data in the current level memory based on the requested grayscale parameter fails, continuing to read the requested field in the current level memory based on the program grayscale parameter of the target program; In the case that reading the requested field in the current level memory based on the program grayscale parameter fails, the requested field in the current level memory continues to be read based on the preset initial grayscale.
6. The method according to claim 1, characterized in that The data request is sent by the client, and after the field value of the requested field is read from each level of memory as the return data, the method further includes: In the case of reading the last level memory of the multi-level memory, if the requested data is not read from the last level memory based on the expected grayscale parameter, determining that the reading of the requested data in the multi-level memory fails; Acquire multiple pieces of returned data from the multi-level memory, wherein the multiple pieces of returned data are all read based on the candidate grayscale parameters in the preset grayscale strategy; Send the return data obtained from the first-level storage to the client.
7. The method according to claim 1, characterized in that Before receiving the data request for the update function, the method further includes: When testing an update function, obtaining change data associated with the update function; Filtering N programs on which the update function depends from various programs, and determining that a program for maintaining the change data among the N programs is a first program, and that programs among the N programs other than the first program are second programs, wherein the target program is the first program or the second program; configuring the program grayscale parameter of the first program, the data grayscale parameter of the change data, and the request grayscale parameter of the data request of the update function as target grayscale; storing the changed data and its data grayscale parameters in association with each other in the multi-level memory; In which, the multi-level memory is also used to store the original data associated with the update function, the original data and its data grayscale parameters are stored in association, the data grayscale parameters of the original data and the program grayscale parameters of the second program are used to indicate the preset initial grayscale, and each piece of original data or each piece of changed data consists of fields and their field values.
8. A data synchronization device based on grayscale isolation, characterized in that: include: A receiving module, configured to receive a data request for an update function, wherein the data request is used to obtain at least one piece of request data, and the data request carries a request field corresponding to the request data; A reading module is configured to read the requested fields from the multi-level memory layer by layer starting from the first-level memory according to the order of memory levels from low to high for each request data, using a preset grayscale strategy, and use the field values obtained by reading the requested fields from each level of memory as return data; The reading module is configured to, when first return data matching the expected grayscale parameters in the preset grayscale policy is read from the P-th level memory, determine that the first return data is request data, send the first return data to the client, and stop reading the request field from the P+1-th level memory, wherein the expected grayscale parameters are the request grayscale parameters carried in the data request or the program grayscale parameters of the target program, and the target program is the program that receives the data request; A verification module, configured to verify whether there is second return data consistent with the grayscale of the target program among the P pieces of return data read from the P-level memory; A bubble module is used to execute a bubble strategy on the multi-level memory only when the second return data exists, wherein the memory where the second return data is located is the target memory, and the bubble strategy is used to synchronize the second return data to all memories whose memory level is smaller than the target memory.
9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; and when the electronic device executes the computer program instructions, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Gray scale upgrading method and device, electronic equipment and readable storage medium
CN113282326A
Processing method and device for application program in online development platform and storage medium
CN116149638A