Data synchronization method and device based on gray scale isolation, equipment and medium
By adopting a data synchronization method based on grayscale isolation in a multi-level storage environment, the problem of synchronizing grayscale data between multiple storages is solved, and effective synchronization and consistent writing of grayscale data is achieved.
Patent Information
- Application Number
- CN202411430910.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2044-10-14
AI Technical Summary
The prior art is difficult to synchronize different versions of data with grayscale in a multi-level storage environment, and cannot adapt to the needs of a distributed environment.
Using a data synchronization method based on grayscale isolation, by receiving data requests, using preset grayscale policies to read the request fields step by step in the order of memory level from low to high, determine the matching return data, and be consistent with the target program. Perform a bubble policy when data is used to synchronize the data into all memory whose memory level is smaller than the target memory.
Grayscale data synchronization between multi-level storage is realized, ensuring that the target program only writes data consistent with its own grayscale, avoids inconsistent writing of data, and improves the effectiveness and consistency of data synchronization.
Smart Images

Figure CN119316437A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, in particular to the field of data processing technology, and in particular to a data synchronization method, device, equipment and medium based on grayscale isolation. Background Art
[0002] Currently, distributed, multi-instance program architecture has become the mainstream. By assigning different grayscales to programs, different functional versions of the same program can exist in the same environment at the same time. Through grayscale requests to the corresponding instances, functions such as functional isolation, parallel development, and grayscale launch can be achieved.
[0003] However, the data multi-level storage and synchronization solutions in related technologies usually only involve the same version of data without grayscale. The logic of the data itself is relatively simple, so it cannot be applied to distributed environments. There are large application limitations and it is impossible to handle the synchronization of different versions of data with grayscale between multi-level storage. Therefore, how to achieve the synchronization of data with grayscale between multi-level storage is a problem that needs to be solved urgently. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a data synchronization method, device, equipment, medium and product based on grayscale isolation, which can realize data synchronization between multi-level storage in scenarios where data has grayscale.
[0005] In a first aspect, an embodiment of the present application provides a data synchronization method based on grayscale isolation, the method comprising: receiving a data request for an update 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 from low to high memory levels, using a preset grayscale strategy to read the request field from a multi-level memory step by step starting from a first-level memory, and using the field value obtained by reading the request field from each level of memory as return data; in the case where first return data matching the expected grayscale parameter in the preset grayscale strategy is read from the P-th level memory, determining the first return data; According to the requested data, the first return data is sent to the client, and the request field is stopped from being read from the P+1th level memory, wherein the expected grayscale parameter is the requested grayscale parameter carried in the data request or the program grayscale parameter of the target program, and the target program is the program that receives the data request; it is checked whether there is second return data consistent with the grayscale of the target program in the P return data read from the P level memory; a bubbling strategy is executed on the multi-level memories only when the second return data exists, wherein the memory where the second return data is located is the 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.
[0006] In some implementable embodiments of the first aspect, in order from low to high memory levels, a preset grayscale strategy is used to read request fields from multi-level memories step by step starting from the first-level memory, and a return data corresponding to the request field is obtained from each level of memory that has been read, including: for the current level of memory, first read the request field from the current level of memory based on the expected grayscale parameters in the preset grayscale strategy; if the first return data is read from the current level of memory, it is determined that the request data is read successfully, and stop reading the request field from the next level of memory; if the first return data is not read from the current level of memory, it is determined that the request data is read unsuccessfully, and continue to read the request field from the current level of memory based on the alternative grayscale parameters in the preset grayscale strategy, obtain the return data corresponding to the request field, and continue to read 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 stops; wherein the preset end condition includes: the request data is read successfully, or the multi-level memory traversal is completed.
[0007] In some implementations of the first aspect, each field value in the multi-level memory is associated with a data grayscale parameter, and the request field is read from the current level memory based on the expected grayscale parameter in the preset grayscale policy, 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, 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 to be the first return data matching the expected grayscale parameter; based on the alternative grayscale parameter in the preset grayscale policy, the request field is continued to be read from the current level memory, 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 alternative grayscale parameter, the field value of the request field is read, and the return data corresponding to the request field is obtained.
[0008] In some implementable methods of the first aspect, the preset grayscale strategy is a local grayscale priority strategy, the expected grayscale parameters are program grayscale parameters of the target program, the alternative grayscale parameters include request grayscale parameters and preset initial grayscale, and the local grayscale priority strategy includes: in the event of a failure to read the requested data in the current level memory based on the program grayscale parameters, continuing to read the requested field in the current level memory based on the request grayscale parameters carried in the data request; in the event of a failure to read the requested field in the current level memory based on the request grayscale parameters, continuing to read the requested field in the current level memory based on the preset initial grayscale.
[0009] In some implementable methods of the first aspect, the preset grayscale strategy is a request grayscale priority strategy, the expected grayscale parameters are the request grayscale parameters carried in the data request, the alternative grayscale parameters include program grayscale parameters and a preset initial grayscale, and the request grayscale priority strategy includes: in the event of a failure to read the requested data in the current level memory based on the request grayscale parameters, continuing to read the requested field in the current level memory based on the program grayscale parameters of the target program; in the event of a failure to read the requested field in the current level memory based on the program grayscale parameters, continuing to read the requested field in the current level memory based on the preset initial grayscale.
[0010] In some implementations of the first aspect, the data request is sent by the client, and after the field value obtained by reading the requested field from each level of memory is used as the return data, the method also includes: when reading the last level of the multi-level memory, if the requested data is not read from the last level of the memory based on the expected grayscale parameter, it is determined that the reading of the requested data in the multi-level memory fails; obtaining multiple return data obtained from the multi-level memory, wherein the multiple return data are all read based on the alternative grayscale parameters in the preset grayscale strategy; and sending the return data obtained from the first level of the memory to the client.
[0011] In some implementations of the first aspect, before receiving a data request for an update function, it also includes: when testing the update function, obtaining change data associated with the update function; screening N programs on which the update function depends from each program, and determining that the program used to maintain the change data among the N programs is the first program, and the programs other than the first program among the N programs are the second program, wherein the target program is the first program or the second program; configuring the program grayscale parameters of the first program, the data grayscale parameters of the change data, and the request grayscale parameters of the data request of the update function as target grayscale; storing the change data and its data grayscale parameters in a multi-level memory in association with each other; wherein the multi-level memory is also used to store 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 a preset initial grayscale, and each piece of original data or each piece of change data consists of fields and their field values.
[0012] In a second aspect, an embodiment of the present application provides a data synchronization device based on grayscale isolation, the device comprising: a receiving module, for receiving a data request for an update 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; a reading module, for reading the request field from a multi-level memory step by step from the first-level memory in the order of the memory level from low to high using a preset grayscale strategy for each request data, and using the field value obtained by reading the request field from each level of memory as return data; a reading module, for determining the Pth level memory when the first return data matching the expected grayscale parameters in the preset grayscale strategy is read from the Pth level memory. A return data is request data, the first return data is sent to the client, and the reading of the request field to the P+1th level memory is stopped, wherein the expected grayscale parameter is the request grayscale parameter carried in the data request or the program grayscale parameter of the target program, and the target program is the program that receives the data request; a verification module is used to verify whether there is second return data consistent with the grayscale of the target program in the P 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.
[0013] In some implementations of the second aspect, the reading module includes: a first reading unit, used to read a request field from the current level memory based on the expected grayscale parameters in a preset grayscale strategy for the current level memory; a judgment unit, used to determine that the request data is read successfully if the first return data is read from the current level memory, and stop reading the request field from the next level memory; a second reading unit, used to determine that the request data read fails if the first return data is not read from the current level memory, and continue to read the request field from the current level memory based on the alternative grayscale parameters in the preset grayscale strategy, obtain the return data corresponding to the request field, and continue to read the request field from the next level memory based on the expected grayscale parameters until the preset end condition is met and the reading stops; wherein the preset end condition includes: the request data is read successfully, or the multi-level memory traversal is completed.
[0014] In some implementations of the second aspect, each field value in the multi-level memory is associated with a data grayscale parameter, and the first reading unit is specifically used to: read the field value of the requested field only when 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, obtain the return data corresponding to the requested field, and determine that the return data is the first return data that matches the expected grayscale parameter; the second reading unit is specifically used to read the field value of the requested field only when 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, and obtain the return data corresponding to the requested field.
[0015] In some implementable methods of the second aspect, the preset grayscale strategy is a local grayscale priority strategy, the expected grayscale parameters are program grayscale parameters of the target program, the alternative grayscale parameters include request grayscale parameters and preset initial grayscale, and the local grayscale priority strategy includes: in the event of a failure to read the requested data in the current level memory based on the program grayscale parameters, continuing to read the requested field in the current level memory based on the request grayscale parameters carried in the data request; in the event of a failure to read the requested field in the current level memory based on the request grayscale parameters, continuing to read the requested field in the current level memory based on the preset initial grayscale.
[0016] In some implementable methods of the second aspect, the preset grayscale strategy is a request grayscale priority strategy, the expected grayscale parameters are the request grayscale parameters carried in the data request, the alternative grayscale parameters include program grayscale parameters and a preset initial grayscale, and the request grayscale priority strategy includes: in the event of a failure to read the requested data in the current level memory based on the request grayscale parameters, continuing to read the requested field in the current level memory based on the program grayscale parameters of the target program; in the event of a failure to read the requested field in the current level memory based on the program grayscale parameters, continuing to read the requested field in the current level memory based on the preset initial grayscale.
[0017] In some implementation methods of the second aspect, the data request is sent by the client and also includes: a determination module, which is used to determine that the reading of the requested data in the multi-level memory fails after reading the field value obtained from the requested field in each level of memory as the return data, if the requested data is not read from the last level of memory based on the expected grayscale parameter when the last level of memory of the multi-level memory is read; an acquisition module, which is used to acquire multiple return data obtained from the multi-level memory, wherein the multiple return data are all read based on the alternative grayscale parameters in the preset grayscale strategy; and a sending module, which is used to send the return data obtained from the first level of memory to the client.
[0018] In some implementations of the second aspect, it also includes: an acquisition module, which is used to acquire the change data associated with the update function before receiving a data request for the update function and testing the update function; a determination module, which is used to screen N programs that the update function depends on from various programs, and determine that the program used to maintain the change data among the N programs is the first program, and the programs other than the first program among the N programs are the second program, wherein the target program is the first program or the second program; a grayscale configuration module, which is used to configure the program grayscale parameters of the first program, the data grayscale parameters of the change data, and the request grayscale parameters of the data request of the update function as target grayscale; a data storage module, which is used to store the change data and its data grayscale parameters in a multi-level memory in association with each other; wherein 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 a preset initial grayscale, and each piece of original data or each piece of change data consists of fields and their field values.
[0019] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the steps of the data synchronization method based on grayscale isolation as in the first aspect are implemented.
[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, the steps of the data synchronization method based on grayscale isolation as in the first aspect are implemented.
[0021] In a fifth aspect, an embodiment of the present application provides a computer program product, which is stored in a non-volatile storage medium, and when the computer program product is executed by a processor, implements the steps of the data synchronization method based on grayscale isolation as in the first aspect.
[0022] In a sixth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the steps of the data synchronization method based on grayscale isolation as in 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, and 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 from the first-level memory using a 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 matching 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 request field is stopped from being read from the P+1-th level memory, completing the reading step for the request data. Based on this, after the reading is completed, check whether there is a second return data consistent with the grayscale of the target program in the P return data read from the P-level memory. If so, the bubbling 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, and the memory where the second return data is located is the target memory. In this way, in the scenario where the data has grayscale, data of different grayscale versions 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 in the multi-level memory, and then realizing the effective synchronization of grayscale data between multi-level memories. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following briefly introduces the drawings in the embodiments of the present application.
[0025] Figure 1 It is a flowchart of a data synchronization method based on grayscale isolation provided in an embodiment of the present application;
[0026] Figure 2 is a flowchart of a data synchronization method based on grayscale isolation provided by another embodiment of the present application;
[0027] Figure 3 It is a structural schematic diagram of a data synchronization device based on grayscale isolation provided in an embodiment of the present application;
[0028] Figure 4 It 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 spirit of the present application will be described below with reference to several exemplary embodiments. It should be understood that the purpose of providing these embodiments is to make the principles and spirit of the present application clearer and more thorough, so that those skilled in the art can better understand and implement the principles and spirit of the present application. The exemplary embodiments provided herein are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments herein, all other embodiments obtained by ordinary technicians of the art without creative work are within the scope of protection of this application.
[0030] In this document, terms such as first, second, third, etc. are only used to distinguish one entity (or operation) from another entity (or operation), but not to require or imply any order or relationship between these entities (or operations).
[0031] The data synchronization method based on grayscale isolation provided by the embodiment of the present application is described in detail below through specific embodiments and application scenarios in conjunction with the accompanying drawings.
[0032] Figure 1 It is a flow chart of a data synchronization method based on grayscale isolation provided in one embodiment of the present application. The executor of the data synchronization method based on grayscale isolation can be an application. By splitting an application into different parts, individual programs can be obtained. Therefore, the application can be composed of individual programs. Each program is a distributed application, which is a group of computer programs distributed on multiple computing nodes. Each node is an independent physical device or software process, but all work to realize the functions of the application.
[0033] The following takes the execution subject of the data synchronization method based on grayscale isolation as an application as an example to illustrate the data synchronization method based on grayscale isolation of the present application. It should be noted that the above execution subject and application scenario do not constitute a limitation on the present application.
[0034] like Figure 1 As shown, the data synchronization method based on grayscale isolation provided in the embodiment of the present application may include steps 110 to 150.
[0035] Step 110, receiving a data request for an update function, 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;
[0036] Step 120, for each request data, in the order of memory levels from low to high, using a preset grayscale strategy, read the request field from the multi-level memory level by level starting from the first level memory, and use the field value obtained by reading the request field from each level of memory as the return data;
[0037] Step 130, when first return data matching the expected grayscale parameter in the preset grayscale strategy 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 parameter is the request grayscale parameter carried in the data request or the program grayscale parameter of the target program, and the target program is the program that receives the data request;
[0038] Step 140, checking 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;
[0039] Step 150, executing a bubble strategy on the multi-level memory only when there is second return data, 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.
[0040] The data synchronization method based on grayscale isolation provided by the embodiment of the present application receives a data request for the update function in the scenario of testing the update function, and the data request carries a request field, and the data request is used to indicate 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 from the first-level memory in the order of the memory level from low to high using the preset grayscale strategy, 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 matching the expected grayscale parameter in the preset grayscale strategy is read from the P-level memory, it indicates that the first return data is the required request data, so it can be sent directly to the client, and stop reading the request field from the P+1-level memory, and complete 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 consistent with the grayscale of the target program in the P return data read from the P-level memory. If it exists, the 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, and the memory where the second return data is located is the target memory. In this way, in the scenario where the data is grayscale, different grayscale versions of the data can be stored in the multi-level memory at the same time, but the target program can only write data that is consistent with its grayscale in the multi-level memory, thereby preventing the target program from writing data that is inconsistent with its own grayscale into the multi-level memory, thereby achieving regular bubbling of grayscale data within the multi-level memory, and further achieving effective synchronization of grayscale data between multi-level memories.
[0041] The specific implementation of the above steps will be described in detail below in conjunction with specific embodiments.
[0042] Referring to step 110 , a data request for an update function is received.
[0043] In step 110, the program that receives the data request among various programs may be the target program. The data request is used to test whether the update function can be implemented normally. The update function is the application function that is updated when the application version is upgraded. Before the update function is officially launched, the tester needs to test the update function to ensure the normal operation of the update function. Therefore, the data request may be a function test request.
[0044] The data that the update function relies on during runtime may include original data in addition to changed data, so the request data returned by the request can be changed data or original data. The data grayscales corresponding to the update data and the changed data are different. The changed data is the data that needs to be changed when the application function is updated, such as the data items that are added, deleted, or modified. Therefore, after developing the update function, the storage device 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 is a job search application, and the developer has developed an update function for the job search application, which is used to optimize and update the style of the resume filling interface of the job search application. For example, the list width before the update is 100 and the input box cursor color is black, and the list width after the update is 120 and the input box cursor color is red. Then "list width is 100" and "input box cursor color is black" are the original data, and "list width is 120" and "input box cursor color is red" are the 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 request data, the data request carries the request field. The request field corresponds to the request data, so that the target field value is obtained by reading in the multi-level memory based on the request field, thereby obtaining the request data.
[0047] In the multi-level memory, the field value of each field is a piece of data, and each piece of data is associated with a data grayscale parameter, so each piece of data in the multi-level memory has a corresponding grayscale. For the same field, at least one field value can be corresponding in the multi-level memory. By associating different field values with different data grayscale parameters, different field values (different data) are configured with different grayscales to distinguish them.
[0048] For example, for the above-mentioned "list width" field, the field value "100" can be set to nocolor grayscale, and the field value "120" can be set to blue grayscale.
[0049] The multi-level memory is used to store the original data and the changed data maintained by each program. The original data and the changed data are stored in association with their corresponding data grayscale parameters. The data grayscale parameters of the original data and the changed data are used to indicate different grayscales. Therefore, by configuring the data grayscale parameters of the original data and the changed data as different parameters, different grayscale data can be stored in the multi-level memory at the same time, without setting up an independent (physical, logical) memory for each grayscale data, so as to achieve grayscale isolation of the data stored in the same multi-level memory.
[0050] The multi-level memory contains multiple memories of different levels. Each level of memory can store at least one grayscale data. Multiple memories correspond to different data life cycles, so 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 a persistent storage that never expires.
[0051] The data lifecycles corresponding to different levels of memory are different, so at the same time, the data or data grayscale stored in different levels of memory will also be different. 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 the 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 the changed data, so the grayscales of the two are different.
[0052] Involving step 120, for each request data, in the order of memory level from low to high, using a preset grayscale strategy, the request field is read from the multi-level memory level by level starting from the first-level memory, and the field value obtained by reading the request field from each level of memory is used as the return data.
[0053] In step 120, the preset grayscale strategy is a reading rule for multi-grayscale version data, which is common among all levels of memory. For each request field, the preset grayscale strategy is used to read the request field from the multi-level memory step by step starting from the first level memory, and the field value of the request field read from each level of memory is used as the return data, so that a return data corresponding to the request field can be obtained from each level of memory that has been read.
[0054] Referring to the above example, for the field "list width", the field value "100" can be set to nocolor grayscale, and the field value "120" can be set to blue grayscale. If "list width - 100" is stored in the first-level memory and "list width - 120" is stored in the second-level memory, then 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] Furthermore, in an embodiment of the present application, after receiving a data request, the target program may read the request field from the multi-level memory step by step starting from the first-level memory using a preset grayscale strategy in the order of memory levels from low to high.
[0056] Involving step 130, when the first return data matching the expected grayscale parameters in the preset grayscale strategy is read from the P-th level memory, the first return data is determined to be request data, the first return data is sent to the client, and the reading of the request field from the P+1-th level memory is stopped.
[0057] In step 130, the expected grayscale parameter is used to characterize or indicate a grayscale. The expected grayscale parameter can be a request grayscale parameter carried in the data request or a program grayscale parameter of the target program. Whether the expected grayscale parameter is a request grayscale parameter or a program grayscale parameter is determined by a preset grayscale policy. The target program is the program that receives the data request, and P is a positive integer. The first return data is the return data that matches the expected grayscale parameter. Matching the expected grayscale parameter indicates that the first return data is consistent with the grayscale corresponding to the expected grayscale parameter.
[0058] Continuing with the above example, if the return data "list width - 100" obtained from the first-level storage matches the expected grayscale parameter, it means that "list width - 100" is the requested data and "100" is the target field value. Therefore, "list width - 100" can be directly returned to the client without continuing to obtain the return data from the second-level storage.
[0059] In some embodiments of the present application, the above 120 may specifically include the following steps:
[0060] For each level of memory, first read the request field from the current level of memory based on the expected grayscale parameters in the preset grayscale strategy;
[0061] 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;
[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 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 request 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 request data is read successfully, and the reading of the request field to 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, 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 request field from the current memory based on an expected grayscale parameter, the field value can be read only when the field value of the request 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 request field from the current memory based on an alternative grayscale parameter, the field value can be read only when the field value of the request 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, then 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, the expected grayscale parameter is used to indicate blue grayscale, the alternative grayscale parameter is used to indicate nocolor grayscale, the request field is "list width", "list width of 100" can correspond to nocolor grayscale, and "list width of 120" can correspond to blue grayscale. The multi-level memory includes 4 levels, and the request field can be read starting from the first-level memory based on the blue grayscale.
[0071] If the first-level memory contains the field value "list width is 120", then based on the blue grayscale, "list width is 120" can be directly read without continuing to read from the second-level memory;
[0072] If the first-level memory contains the field value "list width is 100", the blue grayscale field value cannot be read based on the blue grayscale. Therefore, the reading can continue based on the alternative grayscale parameter nocolor grayscale to obtain "list width is 100", and the blue grayscale field value can be read from the second-level memory based on the blue grayscale until the blue grayscale field value "list width is 120" is read, or the blue grayscale field value is not read from the 4-level memory based on the blue grayscale.
[0073] In an embodiment of the present application, when the request field is not read in the current level memory based on the expected grayscale parameters, it indicates that the current level memory does not contain the first return data matching the expected grayscale parameters, that is, it does not contain the request data indicated by the data request. Based on this, the present application needs to continue reading from the next level memory based on the expected grayscale parameters, and try to obtain the request data from each level memory from top to bottom until the request data is read or the multi-level memory traversal is completed. In this way, the multi-level memory supports the storage of distributed, multi-grayscale version data, and the preset grayscale strategy is executed independently between the various levels of memory without affecting each other. By using the preset grayscale strategy, the return data corresponding to the request field can be effectively obtained in each level of memory, avoiding the failure of the data request due to the inability to obtain the return data.
[0074] In the above embodiment, when the expected grayscale parameter is the requested grayscale parameter carried in the data request, the alternative grayscale parameter includes the program grayscale parameter of the target program; when the expected grayscale parameter is the program grayscale parameter of the target program, the alternative grayscale parameter includes the requested grayscale parameter carried in the data request.
[0075] It should be noted that the above steps 220 and 230 are two judgment branches, and this application does not specifically limit their execution order.
[0076] In some embodiments of the present application, each field value in the multi-level memory is associated with a data grayscale parameter. In the above step 210, reading the request field from the current level memory based on the expected grayscale parameter in the preset grayscale policy 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 the return data corresponding to the request field, and determining that the return data is the first return data matching 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 divided into grayscales, 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 to the existing key. Developers do not need to perform any additional configuration or encoding work for the grayscale data, and can simply and efficiently achieve data grayscale isolation.
[0079] As an example, 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 may correspond to a data grayscale parameter, and the field value can be successfully read only when the grayscale parameter used when reading the field value is consistent with the data grayscale parameter of the field value. In this way, the orderly reading of data with grayscale between multi-level storage can be achieved.
[0081] In the embodiments 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 grayscale strategy is a local grayscale priority strategy, the expected grayscale parameter is a program grayscale parameter of the target program, the candidate grayscale parameter includes a requested grayscale parameter and a preset initial grayscale, and the local grayscale priority strategy may specifically include:
[0083] In the case of failure to read the requested data in the current level memory based on the program grayscale parameter, continue to read the requested field in the current level memory based on the requested grayscale parameter carried in the data request;
[0084] 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.
[0085] Among them, N programs that the update function depends on can be screened out from various programs, the program used to maintain the change data associated with the update function among the N programs is the first program, the programs other than the first program among the N programs are the second program, and the target program is the first program or the second program. The program grayscale parameters of the first program, the data grayscale parameters of the change data, and the request grayscale parameters of the data request of the update function are all configured as target grayscales, and the data grayscale parameters of the original data and the program grayscale parameters of the second program are configured as preset initial grayscales, so the grayscale indicated by the request grayscale parameters is different from the preset initial grayscale.
[0086] In the embodiment of the present application, under the local grayscale priority strategy, the program grayscale parameters of the local target program are used to read the request data first. If the reading fails, the request grayscale parameters can be used to continue to read the request data. If the reading fails, the preset initial grayscale is used to continue to read the request field in the current level memory. In this way, three read operations use three different parameters to read the request field, and try to ensure that the return data corresponding to the request field can be obtained from each level of memory.
[0087] Optionally, in some other 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, the alternative grayscale parameter includes a program grayscale parameter and a preset initial grayscale, and the request grayscale priority strategy may specifically include:
[0088] In the case of failure to read the requested data in the current level memory based on the requested grayscale parameter, continuing to read the requested field in the current level memory based on the program grayscale parameter of the target program;
[0089] 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.
[0090] In the embodiment of the present application, under the local grayscale priority strategy, the request grayscale parameters are used to read the request data first. If the reading fails, the program grayscale parameters can be used to continue to read the request data. If the reading fails, the preset initial grayscale is used to continue to read the request field in the current level memory. In this way, three read operations use three different parameters to read the request field, and try to ensure that the return data corresponding to the request field can be obtained from each level of memory.
[0091] In step 140 , it is checked 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.
[0092] In step 140, the second return data is return data whose data grayscale is consistent with the program grayscale of the target program. The data grayscale parameters corresponding to each return data and the program grayscale parameters of the target program can be checked for consistency. When the two are consistent, the return data is determined to be the second return data.
[0093] Referring to step 150 , the bubble strategy is executed on the multi-level memory only when the second return data exists.
[0094] In step 150, after receiving the data request, the target program exists as a local program for reading the requested data. The local program can only write data consistent with its own grayscale in the multi-level memory. Therefore, if there is second return data consistent with the grayscale of the target program, the target program can synchronize the second return data to all memories with a memory level smaller than the target memory by executing the bubble strategy, specifically writing the second return data to these memories.
[0095] Exemplarily, if the second return data is obtained from the x-th level memory, the second return data can be updated to the 1st level, 2nd level, ..., x-1th level memory; if there is no data consistent with the grayscale of the current program, no bubbling occurs.
[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 returned data, after the field value obtained by reading the request field from each level of memory as the returned data in the above step 120, the method may further include the following steps:
[0097] 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, it is determined that the reading of the requested data in the multi-level memory fails;
[0098] Acquire multiple pieces of returned data obtained 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;
[0099] Send the return data obtained from the first-level storage to the client.
[0100] Exemplarily, the expected grayscale parameter is blue grayscale, and the multi-level memory includes 4 levels. For the request field "list width", if the field value of blue grayscale is not obtained from each level of memory, the return data of nocolor grayscale obtained from the first level memory can be directly returned to the client.
[0101] In the embodiment of the present application, different levels of memory in the multi-level memory have different corresponding life cycles, and the life cycle of the top-level memory is shorter, so the data real-time performance is higher. Based on this, if the return data matching the expected grayscale parameters is not obtained from the multi-level memory, the return data obtained from the first-level memory can be directly returned to the client, ensuring the real-time performance of the return data, and also ensuring that the client can receive the return data, avoiding the occurrence of request failure.
[0102] In some embodiments of the present application, before receiving the data request for the update function in step 110, the method may further include the following steps:
[0103] When testing the update function, obtain the change data associated with the update function;
[0104] Screening N programs that the update function depends on from each program, and determining that a program for maintaining the change data among the N programs is a first program, and programs other than the first program among the N programs are second programs, wherein the target program is the first program or the second program;
[0105] configuring the program grayscale parameter of the first program, the data grayscale parameter of the changed data, and the request grayscale parameter of the data request of the update function as the target grayscale;
[0106] The changed data and its data grayscale parameters are stored in a multi-level memory in association with each other;
[0107] Among them, 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. Each piece of original data or each piece of changed data consists of fields and their field values.
[0108] Specifically, the N programs are distributed application programs that need to be called when the update function is running. Not all of the N programs need to maintain change data, and those programs that do not need to maintain change data may be second programs.
[0109] For example, the second program may be an open interface, which is only used to receive data requests sent by the front end, and after the first program obtains the requested data, the second program returns it to the front end; for another example, the second program is a program for maintaining the original data. In addition to relying on the changed data, the operation of the update function also needs to rely on a part of the original data. Therefore, when the update function is implemented, it is also necessary to read the original data through the second program.
[0110] For example, the update function is used to optimize and update the style of the resume filling interface of the job application, so it is necessary to return the interface style parameters to the front end, and the interface style parameters include parameters b and c. Among them, program A is used to receive the parameter acquisition request from the front end and return the 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 the changed data, and parameter c is the original data. Then programs A and C are the second program, and program B is the first program.
[0111] The program grayscale parameter is a parameter for indicating the grayscale of the program, the data grayscale parameter is a parameter for indicating the grayscale of the data, and the request grayscale parameter is a parameter for indicating the grayscale of the request. Among them, the data grayscale parameter of the change data and the request grayscale parameter of the data request of the update function can directly reuse the program grayscale parameter of the first program, that is, the program grayscale parameter, the data grayscale parameter and the request grayscale parameter are the same, ensuring that the grayscale of the first program, the change data and all the data requests of the update function are consistent.
[0112] Specifically, each program corresponds to a configuration file, and the program grayscale parameters can be set in the configuration file; the change data is stored in the memory in the form of key-value pairs, and the data grayscale parameters can be set in the key; the request grayscale parameters can be set in the request header of the data request.
[0113] Exemplarily, "spring.cloud.nacos.discovery.metadata.color:nocolor" is the original program grayscale parameter of the first program, which indicates that the program grayscale is nocolor. By changing it to "spring.cloud.nacos.discovery.metadata.color:blue", the first program is configured to blue grayscale. Accordingly, all data requests for change data and update functions are also configured to blue grayscale.
[0114] The multi-level memory is used to store the original data and the changed data maintained by each program. Both the original data and the changed data are stored in association with their data grayscale parameters. Therefore, by configuring the data grayscale parameters of the original data and the changed data as different parameters, different grayscale data can be stored in the multi-level memory at the same time, without setting up an independent (physical, logical) memory for each grayscale data, so as to achieve grayscale isolation of different data in the multi-level memory.
[0115] Corresponding to the method embodiment of the present application, the present application also provides a data synchronization device based on grayscale isolation.
[0116] Figure 3 Schematic diagram of a data synchronization device based on grayscale isolation provided by an embodiment of the present application. Figure 3 As shown, the data synchronization device 300 based on grayscale isolation may include: a receiving module 310 , a reading module 320 , a checking module 330 , and a bubbling module 340 .
[0117] Among them, the receiving module 310 is used to receive a data request for an update 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; the reading module 320 is used to, for each request data, read the request field from the multi-level memory step by step starting from the first-level memory in the order of the memory level from low to high using a preset grayscale strategy, and use the field value obtained by reading the request field from each level of memory as the return data; the reading module 320 is used to determine that the first return data is the request data when the first return data matching the expected grayscale parameter in the preset grayscale strategy is read from the P-th level memory, and send the request data to the client. Send the first return data, and stop reading the request field to the P+1th level memory, wherein the expected grayscale parameter is the request grayscale parameter carried in the data request or the program grayscale parameter of the target program, and the target program is the program that receives the data request; a verification module 330 is used to verify whether there is second return data consistent with the grayscale of the target program in the P return data read from the P level memory; a bubble module 340 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.
[0118] The data synchronization device based on grayscale isolation provided by the embodiment of the present application receives a data request for the update function in the scenario of testing the update function, and the data request carries a request field, and the data request is used to indicate 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 from the first-level memory according to the order of the memory level from low to high, using the preset grayscale strategy, 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 matching the expected grayscale parameter in the preset grayscale strategy is read from the P-level memory, it indicates that the first return data is the required request data, so it can be sent directly to the client, and stop reading the request field from the P+1-level memory, and complete 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 consistent with the grayscale of the target program in the P return data read from the P-level memory. If it exists, the 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, and the memory where the second return data is located is the target memory. In this way, in the scenario where the data is grayscale, different grayscale versions of the data can be stored in the multi-level memory at the same time, but the target program can only write data that is consistent with its grayscale in the multi-level memory, thereby preventing the target program from writing data that is inconsistent with its own grayscale into the multi-level memory, thereby achieving regular bubbling of grayscale data within the multi-level memory, and further achieving effective synchronization of grayscale data between multi-level memories.
[0119] In some embodiments of the present application, the reading module 320 includes: a first reading unit, which is used to read the request field from the current level memory based on the expected grayscale parameters in the preset grayscale policy for the current level memory; a judgment unit, which is used to determine that the request data is read successfully if the first return data is read from the current level memory, and stop reading the request field from the next level memory; a second reading unit, which is used to determine that the request data read fails if the first return data is not read from the current level memory, and continue to read the request field from the current level memory based on the alternative grayscale parameters in the preset grayscale policy, obtain the return data corresponding to the request field, and continue to read the request field from the next level memory based on the expected grayscale parameters until the preset end condition is met and the reading stops; wherein the preset end condition includes: the request data is read successfully, or the multi-level memory traversal is completed.
[0120] In some embodiments of the present application, each field value in a multi-level memory is associated with a data grayscale parameter, and the first reading unit is specifically used to: read the field value of the requested field only when 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, obtain the return data corresponding to the requested field, and determine that the return data is the first return data that matches the expected grayscale parameter; the second reading unit is specifically used to read the field value of the requested field only when 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, 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 parameters are the program grayscale parameters of the target program, the alternative grayscale parameters include requested grayscale parameters and preset initial grayscale, and the local grayscale priority strategy includes: in the event of a failure to read the requested data in the current level memory based on the program grayscale parameters, continue to read the requested field in the current level memory based on the requested grayscale parameters carried in the data request; in the event of a failure to read the requested field in the current level memory based on the requested grayscale parameters, continue 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 parameters are the request grayscale parameters carried in the data request, the alternative grayscale parameters include program grayscale parameters and preset initial grayscale, and the request grayscale priority strategy includes: in the event of a failure to read the requested data in the current level memory based on the request grayscale parameters, continuing to read the requested field in the current level memory based on the program grayscale parameters of the target program; in the event of a failure to read the requested field in the current level memory based on the program grayscale parameters, 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 also includes: a determination module, which is used to determine that the reading of the requested data in the multi-level memory fails after reading the field value obtained from the requested field in each level of memory as the return data, if the requested data is not read from the last level of memory based on the expected grayscale parameter when the last level of memory of the multi-level memory is read; an acquisition module, which is used to acquire multiple return data obtained from the multi-level memory, wherein the multiple return data are all read based on the alternative grayscale parameters in the preset grayscale strategy; and a sending module, which is used to send the return data obtained from the first level of memory to the client.
[0124] In some embodiments of the present application, it also includes: an acquisition module, which is used to acquire the change data associated with the update function before receiving a data request for the update function while testing the update function; a determination module, which is used to screen N programs that the update function depends on from various programs, and determine that the program used to maintain the change data among the N programs is the first program, and the programs other than the first program among the N programs are the second program, wherein the target program is the first program or the second program; a grayscale configuration module, which is used to configure the program grayscale parameters of the first program, the data grayscale parameters of the change data, and the request grayscale parameters of the data request of the update function as target grayscale; a data storage module, which is used to store the change data and its data grayscale parameters in a multi-level memory in association with each other; wherein 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 a preset initial grayscale, and each piece of original data or each piece of change data consists of fields and their field values.
[0125] The data synchronization device based on grayscale isolation provided in the embodiment of the present application can achieve Figure 1-2 The various processes implemented by the service platform in the method embodiment can achieve the same technical effect. To avoid repetition, they will not be described here.
[0126] Figure 4 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.
[0127] like Figure 4 As shown, 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 an example, the processor 402 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0129] The memory 401 may include a read-only memory (ROM), a random access memory (RAM), a 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., a memory device) encoded with software including computer executable instructions, and when the software is executed (e.g., by one or more processors), it can be operated to perform the operations described with reference to the card opening method in the embodiment according to the first aspect of the present application.
[0130] The processor 402 runs a computer program corresponding to the executable program code by reading the executable program code stored in the memory 401, so as to implement the card activation method in the embodiment of the first aspect.
[0131] In some examples, the electronic device 400 may further include a communication interface 403 and a bus 410. Figure 4 As shown, the memory 401, the processor 402, and the communication interface 403 are connected via a bus 410 and communicate with each other.
[0132] The communication interface 403 is mainly used to realize the communication between the modules, devices, units and / or equipment in the embodiment of the present application. The input device and / or output device can also be accessed through the communication interface 403.
[0133] The bus 410 includes hardware, software, or both, coupling the components of the electronic device 400 to each other. By way of example and not limitation, the bus 410 may 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 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 Bus (VLB) bus, or other suitable buses or a combination of two or more of these. Where appropriate, the bus 410 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.
[0134] The electronic device provided in the embodiment of the present application can realize Figure 1-2 The various processes implemented by the electronic device in the method embodiment can achieve the same technical effect, and to avoid repetition, they will not be described here.
[0135] In combination with the grayscale isolation-based data synchronization method in the above embodiment, the present application embodiment can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, the steps of any one of the grayscale isolation-based data synchronization methods in the above embodiment are implemented.
[0136] In combination with the data synchronization method based on grayscale isolation in the above embodiment, the embodiment of the present application can provide a computer program product for implementation. The (computer) program product is stored in a non-volatile storage medium, and when the program product is executed by at least one processor, the steps of any one of the data synchronization methods based on grayscale isolation in the above embodiment are implemented.
[0137] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned data synchronization method embodiment based on grayscale isolation, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0138] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0139] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is 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 between the steps after understanding the spirit of the present application.
[0140] The functional blocks shown in the above-described block diagram 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 (Application Specific Integrated Circuit, ASIC), appropriate firmware, plug-in, function card, etc. When implemented in software, the elements of the present application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier. "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 segment 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 this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0142] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0143] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this 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 the order of memory levels from low to high, the request fields are read from the multi-level memory level by level starting from the first-level memory using a preset grayscale strategy, and the field value obtained by reading the request field from each level of memory is used as the return data; In the case where first return data matching the expected grayscale parameter in the preset grayscale strategy 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 parameter is the request grayscale parameter carried in the data request or the program grayscale parameter of the target program, and the target program is the program that receives the data request; Checking 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 whose memory level is smaller than the target memory.
2. The method according to claim 1, characterized in that The method includes: reading the request field from the multi-level memory in order from the first level memory by using a preset grayscale strategy, and using the field value obtained by reading the request field from each level memory as the return data, including: For the current level memory, firstly read the request field from the current level memory based on the expected grayscale parameter 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 request 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, 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, 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 to be the first return data matching the expected grayscale parameter; Continuing to read the request field from the current level memory based on the candidate grayscale parameter in the preset grayscale strategy includes: Only when the data grayscale parameter associated with the field value of the request field in the current level memory is consistent with the candidate grayscale parameter, the field value of the request field is read to obtain the return data corresponding to the request field.
4. The method according to claim 2, characterized in that: The preset grayscale strategy is a local grayscale priority strategy, the expected grayscale parameter is a program grayscale parameter of the target program, the candidate grayscale parameter includes a requested grayscale parameter and a preset initial grayscale, and the local grayscale priority strategy includes: In the case of failure to read the requested data in the current level memory based on the program grayscale parameter, 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 parameter is a request grayscale parameter carried in the data request, the candidate grayscale parameter includes a program grayscale parameter and a preset initial grayscale, and the request grayscale priority strategy includes: In the case of failure to read the requested data in the current level memory based on the requested grayscale parameter, 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 obtained by reading the requested field from each level of memory is used as the return data, it also 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 requested data reading in the multi-level memory fails; Acquire multiple pieces of returned data obtained 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 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, and 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 used to read the request fields from the multi-level memory level by level 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 using the field value obtained by reading the request field from each level of memory as the return data; The reading module is used for, when first return data matching the expected grayscale parameter in the preset grayscale strategy 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 parameter is the request grayscale parameter carried in the data request or the program grayscale parameter of the target program, and the target program is the program that receives the data request; A verification module, used for verifying 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; 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, and when the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
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
Request processing method and system, computer equipment, storage medium and program product
CN116679976A
Gradation shared data generator and gradation shared data restoration device
JP1999134488A