Cross-channel session data sharing method and device, equipment, storage medium and program product

By receiving and merging data update messages from worker nodes, using vector clocks to process conflicting and non-conflict content, the accuracy problem caused by lock competition in cross-channel session data sharing is solved, and data consistency and efficient sharing are achieved.

CN120492183APending Publication Date: 2025-08-15GUANGDONG ELECTRIC POWER COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510480984.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-17
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

In the process of cross-channel session data sharing, the prior art has problems such as degradation of concurrency performance caused by lock competition and low accuracy of data sharing.

Method used

By receiving data update messages from each worker node, using the vector clock to determine conflicting and non-conflicting content, and performing merging processing, generating target update content, and finally sending the updated data to each worker node.

Benefits of technology

Improve the accuracy of cross-channel data sharing, enhance the consistency of data received by each worker node, and avoid delays caused by lock competition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120492183A_ABST
    Figure CN120492183A_ABST
Patent Text Reader

Abstract

The invention discloses a cross-channel session data sharing method and device, equipment, a storage medium and a program product, and the method comprises the steps: receiving a data updating message from each working node, and enabling the data updating message to comprise the updating information of each working node for target data, the update information comprises update content of the working node for the target data and a vector clock of the working node for updating the target data; based on the plurality of vector clocks, determining first target update contents corresponding to conflict contents in the plurality of update contents, and merging non-conflict contents in the plurality of update contents to obtain second target update contents; based on the first target update content and the second target update content, updating the target data to obtain updated target data; and sending the updated target data to each working node. By adopting the method, the accuracy of cross-channel data sharing can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method, apparatus, device, storage medium, and program product for sharing cross-channel session data. Background Art

[0002] Typically, cross-channel session data (such as user electricity bills, work order status, and troubleshooting progress) requires real-time synchronization across multiple channels, including mobile applications (APPs), personal computers (PCs), and third-party systems (such as mini-programs). Currently, cross-channel session data caching is primarily achieved through centralized storage models, such as Redis clusters (consisting of multiple worker nodes, divided into master and slave nodes: the master node is responsible for read and write requests and cluster information maintenance; slave nodes only replicate the master node's data and status information). However, cross-channel session data updates rely on distributed locks. Coarse lock granularity can lead to reduced concurrency performance. For example, in high-concurrency write scenarios, lock contention may occur, resulting in delays in cross-channel session data sharing and, in turn, lower data sharing accuracy.

[0003] Therefore, how to improve the accuracy of cross-channel data sharing has become an urgent problem to be solved. Summary of the Invention

[0004] Embodiments of the present application provide a cross-channel session data sharing method, apparatus, device, storage medium, and program product, which can improve the accuracy of cross-channel data sharing.

[0005] In a first aspect, an embodiment of the present application provides a cross-channel session data sharing method, which is applied to a management work node in a distributed cluster; the method includes:

[0006] Receive a data update message from each working node, where the data update message includes update information of each working node for target data, the update information includes update content of the working node for the target data and a vector clock used by the working node to update the target data;

[0007] Determining, based on multiple vector clocks, first target update content corresponding to conflicting content among the multiple update contents, and merging non-conflicting content among the multiple update contents to obtain second target update content; conflicting content is update content for the same field in the target data; non-conflicting content is update content for different fields in the target data;

[0008] updating the target data based on the first target update content and the second target update content to obtain updated target data;

[0009] Send the updated target data to each worker node.

[0010] In one embodiment, each vector clock includes a timestamp of each working node updating target data; based on multiple vector clocks, determining a first target update content corresponding to conflicting content among multiple update contents includes: selecting a maximum timestamp from the timestamps respectively included in the multiple vector clocks, and using the working node corresponding to the vector clock to which the maximum timestamp belongs as the target working node; and for conflicting content among the multiple update contents, using the update content of the target data by the target working node as the first target update content corresponding to the conflicting content.

[0011] In one embodiment, each update content includes a first field content and a second field content; the first field content is encrypted data, and the second field content is unencrypted content; the method further includes: decrypting the first field content in each update content to obtain decrypted first field content; for each update content, based on the decrypted first field content and second field content, determining the decrypted data packet corresponding to the update content; storing each decrypted data packet in a distributed document storage database, and sending multiple decrypted data packets to each working node.

[0012] In one embodiment, the method further includes: determining the predicted load corresponding to each working node; based on the predicted load corresponding to each working node, using a preset weight determination function to determine the weight corresponding to each working node; and based on the weight corresponding to each working node, performing load balancing on multiple working nodes.

[0013] In one embodiment, determining the predicted load of each working node includes: obtaining historical operation information of each working node; calling a pre-trained load prediction model to obtain the predicted load corresponding to each working node based on the historical operation information of each working node.

[0014] In one embodiment, the predicted load corresponding to each working node includes a predicted value of central processing unit (CPU) utilization, a predicted value of memory occupancy, and a predicted value of network delay.

[0015] In a second aspect, the present application provides a cross-channel session data sharing device, which is applied to a management work node in a distributed cluster; the device includes:

[0016] A receiving module is configured to receive a data update message from each working node, wherein the data update message includes update information of each working node for target data, the update information includes the updated content of the working node for the target data and the vector clock of the working node for updating the target data;

[0017] a determination and merging module configured to determine, based on multiple vector clocks, first target update content corresponding to conflicting content among the multiple update contents, and to merge non-conflicting content among the multiple update contents to obtain second target update content; conflicting content is update content for the same field in the target data; non-conflicting content is update content for different fields in the target data;

[0018] An updating module, configured to update the target data based on the first target update content and the second target update content to obtain updated target data;

[0019] The sending module is used to send the updated target data to each working node.

[0020] In a third aspect, the present application provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are performed:

[0021] Receive a data update message from each working node, where the data update message includes update information of each working node for target data, the update information includes update content of the working node for the target data and a vector clock used by the working node to update the target data;

[0022] Determining, based on multiple vector clocks, first target update content corresponding to conflicting content among the multiple update contents, and merging non-conflicting content among the multiple update contents to obtain second target update content; conflicting content is update content for the same field in the target data; non-conflicting content is update content for different fields in the target data;

[0023] updating the target data based on the first target update content and the second target update content to obtain updated target data;

[0024] Send the updated target data to each worker node.

[0025] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:

[0026] Receive a data update message from each working node, where the data update message includes update information of each working node for target data, the update information includes update content of the working node for the target data and a vector clock used by the working node to update the target data;

[0027] Determining, based on multiple vector clocks, first target update content corresponding to conflicting content among the multiple update contents, and merging non-conflicting content among the multiple update contents to obtain second target update content; conflicting content is update content for the same field in the target data; non-conflicting content is update content for different fields in the target data;

[0028] updating the target data based on the first target update content and the second target update content to obtain updated target data;

[0029] Send the updated target data to each worker node.

[0030] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the following steps:

[0031] Receive a data update message from each working node, where the data update message includes update information of each working node for target data, the update information includes update content of the working node for the target data and a vector clock used by the working node to update the target data;

[0032] Determining, based on multiple vector clocks, first target update content corresponding to conflicting content among the multiple update contents, and merging non-conflicting content among the multiple update contents to obtain second target update content; conflicting content is update content for the same field in the target data; non-conflicting content is update content for different fields in the target data;

[0033] updating the target data based on the first target update content and the second target update content to obtain updated target data;

[0034] Send the updated target data to each worker node.

[0035] The above-mentioned cross-channel session data sharing method, device, equipment, storage medium and program product, the management node can receive data update messages from each working node, the data update messages include update information of each working node for the target data, the update information includes the update content of the working node for the target data and the vector clock of the working node updating the target data; based on multiple vector clocks, determine the first target update content corresponding to the conflicting content in the multiple update contents, and merge the non-conflicting content in the multiple update contents to obtain the second target update content; the conflicting content is the update content for the same field in the target data; the non-conflicting content is the update content for different fields in the target data; based on the first target update content and the second target update content, update the target data to obtain updated target data; and send the updated target data to each working node. By adopting this method, when a management node receives data update messages from multiple working nodes, it can update the vector clock of the target data of the working node included in the data update message, merge the conflicting content and non-conflicting content in the multiple update contents, and obtain the target update content (including the first target update content and the second target update content). Then, the target data is updated based on the target update content to obtain the updated target data. Finally, the updated target data is sent to each working node. In this way, each working node receives the updated target data, so that the data received by each working node can be consistent, which improves the accuracy of cross-channel data sharing. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.

[0037] Figure 1 This is a schematic diagram of an application scenario of a cross-channel session data sharing method provided by an embodiment of the present application;

[0038] Figure 2 This is a flow chart of a cross-channel session data sharing method provided by an embodiment of the present application;

[0039] Figure 3 This is a flowchart of another cross-channel session data sharing method provided by an embodiment of the present application;

[0040] Figure 4 This is a schematic structural diagram of a cross-channel session data sharing device provided by an embodiment of the present application;

[0041] Figure 5 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0043] The following introduces the application scenarios of the cross-channel session data sharing method provided in the embodiments of the present application.

[0044] See Figure 1 , Figure 1 This is a schematic diagram of an application scenario of a cross-channel session data sharing method provided by an embodiment of the present application. Figure 1 As shown, the distributed cluster includes a management node 101 and multiple working nodes ( Figure 1 102 and 103 are used as examples in the figure. Data is transmitted between the management node 101 and the working nodes 102 and 103 via a network.

[0045] The management node 101 can receive data update messages from the working node 102 and the working node 103 respectively, where the data update messages include the update information of the working node for the target data, and the update information includes the update content of the working node for the target data and the vector clock of the working node for updating the target data; based on multiple vector clocks, the first target update content corresponding to the conflicting content in the multiple update contents is determined, and the non-conflicting content in the multiple update contents is merged to obtain the second target update content; the conflicting content is the update content for the same field in the target data; the non-conflicting content is the update content for different fields in the target data; based on the first target update content and the second target update content, the target data is updated to obtain the updated target data; and the updated target data is sent to the working node 102 and the working node 103. By adopting this method, when a management node receives data update messages from multiple working nodes, it can update the vector clock of the target data of the working node included in the data update message, merge the conflicting content and non-conflicting content in the multiple update contents, and obtain the target update content (including the first target update content and the second target update content). Then, the target data is updated based on the target update content to obtain the updated target data. Finally, the updated target data is sent to each working node. In this way, each working node receives the updated target data, so that the data received by each working node can be consistent, which improves the accuracy of cross-channel data sharing.

[0046] Optionally, management node 101, worker node 102, and worker node 103 may all be terminal devices or servers. The terminal devices mentioned herein may include, but are not limited to, smartphones, tablet computers, laptop computers, desktop computers, smart watches, smart TVs, and smart car terminals. The servers mentioned herein may be independent physical servers, or they may be server clusters or distributed systems composed of multiple physical servers.

[0047] The following describes a cross-channel session data sharing method provided in an embodiment of the present application.

[0048] See Figure 2 , Figure 2 This is a flow chart of a cross-channel session data sharing method provided by an embodiment of the present application. Figure 1 The management node 101 in the Figure 2 As shown, the cross-channel session data sharing method may include but is not limited to the following steps:

[0049] S201. Receive a data update message from each working node. The data update message includes update information of each working node for target data. The update information includes update content of the working node for the target data and a vector clock for updating the target data by the working node.

[0050] Optionally, each working node may update the target data's vector clock in the form of a key-value pair of [node identifier: logical timestamp], where the logical timestamp may also be referred to as simply a timestamp.

[0051] For example, assuming that the target data is a user work order, work node 1 is the APP side, and work node 2 is the PC side, after the APP side updates the user work order, the vector clock can be updated to [APP: 2]; after the PC side updates the user work order, the vector clock can be updated to [PC: 3].

[0052] Optionally, the update content for the target data may be the update content for some or all fields in the target data.

[0053] For example, assuming that the target data is a user work order, the update content for the target data may be the update content for the "Status" and "Remarks" fields in the user work order, or the update content for all fields in the user work order.

[0054] S202: Determine first target update content corresponding to conflicting content among multiple update contents based on multiple vector clocks, and merge non-conflicting content among the multiple update contents to obtain second target update content.

[0055] The conflicting content refers to the update content for the same field in the target data; the non-conflicting content refers to the update content for different fields in the target data.

[0056] In an optional embodiment, the management node determines the first target update content corresponding to the conflicting content among the multiple update contents based on multiple vector clocks. The management node may call a timestamp comparison and field difference analysis algorithm to determine the first target update content corresponding to the conflicting content among the multiple update contents based on the logical timestamp in each vector clock.

[0057] The following examples illustrate conflicting and non-conflicting content. For example, assuming the target data is a user work order, work node 1 is the app, and work node 2 is the PC. If both the app and the PC update the "Status" and "Remarks" fields in the user work order, the updated content corresponding to the "Status" and "Remarks" fields will be the conflicting content among the multiple updated contents; if the app updates the "Status" field in the user work order and the PC updates the "Remarks" field in the user work order, the updated content corresponding to the "Status" and "Remarks" fields will be the non-conflicting content among the multiple updated contents.

[0058] Continuing with the above example, the management node merges the non-conflicting content in multiple update contents to obtain the second target update content. For example, the "Status" field in the user work order updated on the APP side and the "Remarks" field in the user work order updated on the PC side are directly merged to obtain the second target update content.

[0059] S203: Update the target data based on the first target update content and the second target update content to obtain updated target data.

[0060] In an optional embodiment, the management node updates the target data based on the first target update content and the second target update content to obtain updated target data. The management node may merge the first target update content and the second target update content to obtain merged target update content; and update the target data based on the merged target update content to obtain updated target data.

[0061] S204: Send the updated target data to each working node.

[0062] In an embodiment of the present application, the management node can receive a data update message from each working node, the data update message including the update information of each working node for the target data, the update information including the update content of the working node for the target data and the vector clock of the working node for updating the target data; based on multiple vector clocks, determine the first target update content corresponding to the conflicting content in the multiple update contents, and merge the non-conflicting content in the multiple update contents to obtain the second target update content; the conflicting content is the update content for the same field in the target data; the non-conflicting content is the update content for different fields in the target data; based on the first target update content and the second target update content, update the target data to obtain the updated target data; and send the updated target data to each working node. By adopting this method, when a management node receives data update messages from multiple working nodes, it can update the vector clock of the target data of the working node included in the data update message, merge the conflicting content and non-conflicting content in the multiple update contents, and obtain the target update content (including the first target update content and the second target update content). Then, the target data is updated based on the target update content to obtain the updated target data. Finally, the updated target data is sent to each working node. In this way, each working node receives the updated target data, so that the data received by each working node can be consistent, which improves the accuracy of cross-channel data sharing.

[0063] In an optional embodiment, Figure 1 In the cross-channel session data sharing method shown, each vector clock includes a timestamp of when each work node updates the target data; the management node determines, based on multiple vector clocks, the first target update content corresponding to the conflicting content among the multiple update contents, which may include: selecting the maximum timestamp from the timestamps respectively included in the multiple vector clocks, and using the work node corresponding to the vector clock to which the maximum timestamp belongs as the target work node; for the conflicting content among the multiple update contents, using the update content of the target data by the target work node as the first target update content corresponding to the conflicting content.

[0064] For example, suppose the target data is a user work order, work node 1 is the app, and work node 2 is the PC. Assuming both the app and the PC update the "Status" and "Remarks" fields in the user work order, after the app updates the user work order, the vector clock may be updated to [APP:2]; after the PC updates the user work order, the vector clock may be updated to [PC:3]. In this case, the management node may determine that the maximum timestamp of timestamps 2 and 3 included in [APP:2] and [PC:3], respectively, is 3. In this case, the management node will use the work node corresponding to the vector clock [PC:3] with the maximum timestamp 3, i.e., the PC, as the target work node. Subsequently, for the updates corresponding to the "Status" and "Remarks" fields in multiple updates (i.e., conflicting updates), the management node will use the PC's updates to the "Status" and "Remarks" fields as the first target update corresponding to the conflicting updates.

[0065] For another example, suppose the target data is the payment amount, work node 1 is the app, and work node 2 is the webpage. Assuming the user pays the same electricity bill through both the app and the webpage, after payment on the app, the vector clock may be updated to [APP:7]; after payment on the webpage, the vector clock may be updated to [WEB:5]. In this case, the management node can determine that the maximum timestamp of timestamps 7 and 5 included in [APP:7] and [WEB:5] is 7. At this time, the management node uses the work node corresponding to the vector clock [APP:7] with the maximum timestamp 7, that is, the app, as the target work node. The management node can then call a reversal transaction to refund the electricity bill paid by the user through the webpage and push a refund notification to the app and the webpage.

[0066] With this implementation, when determining the first target update for conflicting content, the management node prioritizes the work node based on the maximum timestamp among the timestamps corresponding to each worker node. The work node corresponding to the vector clock with the maximum timestamp is then selected as the target work node. The target work node's updates for the target data are then retained. This intelligent merging of data version differences between different channels avoids lock contention caused by strong consistency.

[0067] In an optional embodiment, Figure 1In the cross-channel session data sharing method shown, each update content includes a first field content and a second field content; the first field content is encrypted data, and the second field content is unencrypted content; the management node can also decrypt the first field content in each update content to obtain decrypted first field content; for each update content, based on the decrypted first field content and second field content, determine the decrypted data packet corresponding to the update content; store each decrypted data packet in a distributed document storage database, and send multiple decrypted data packets to each working node.

[0068] In an optional implementation, each working node may use the SM4 segmented encryption algorithm to decrypt the updated content of the target data in segments to obtain the first field content and the second field content.

[0069] The first field content may be, for example, sensitive information, such as a user identity. The first field content may be encrypted using SM4-CTR mode (a counter mode (CTR) encryption implementation based on the Chinese national cryptographic algorithm SM4, which converts a block cipher into a stream cipher operating mode). The key may be negotiated using a national cryptographic Secure Sockets Layer (SSL) protocol, such as the Transport Layer Cryptography Protocol (TLCP).

[0070] The second field content is, for example, a product review, etc., and the second field content can be transmitted in plain text.

[0071] In some embodiments, each update content can be a binary differential packet. This binary differential packet can be obtained by processing the updated content for the target data using field-level differential encoding in Protocol Buffers (Protobuf), a tool for efficiently storing and reading structured data. For example, each worker node can use Protobuf's FieldMask feature (primarily used to selectively manipulate specific fields in a message) to serialize only the changed fields. For example, when a user modifies an address, the transmitted data is reduced from a full JSON (a lightweight data exchange format) (1KB) to a binary differential packet (300B).

[0072] With this implementation, since the multiple update contents received by the management node are segmented encrypted update contents, the reliability and accuracy of the multiple update contents received can be improved.

[0073] In an optional embodiment, Figure 1In the cross-channel session data sharing method shown, the management node can also determine the predicted load corresponding to each working node; based on the predicted load corresponding to each working node, a preset weight determination function is used to determine the weight corresponding to each working node; and based on the weight corresponding to each working node, load balancing is performed on multiple working nodes.

[0074] In some embodiments, the management node determines the predicted load of each working node, which may include: obtaining historical operating information of each working node; calling a pre-trained load prediction model to obtain the predicted load corresponding to each working node based on the historical operating information of each working node.

[0075] Among them, the pre-trained load prediction model can be built based on a bidirectional long short-term memory (LSTM) network.

[0076] Optionally, before obtaining the historical operating information of each working node, the management node may also collect the operating information of each working node in real time or periodically and store each collected operating information in a database. The management node may obtain the historical operating information of each working node from the database. Optionally, when the management node periodically collects the operating information of each working node, the period may be 500ms. Optionally, the operating information may include, but is not limited to, CPU utilization, memory usage, and network latency, etc., which are not limited here. Memory usage may be obtained by the management node through Java Virtual Machine (JVM) heap monitoring; network latency may be obtained by the management node through Transmission Control Protocol (TCP) round trip time (RTT) measurement.

[0077] The historical operation information of each working node is, for example, the operation information of the working node within 10 minutes before the current moment.

[0078] Optionally, the predicted load corresponding to each working node may include but is not limited to a predicted value of central processing unit (CPU) utilization, a predicted value of memory occupancy, and a predicted value of network delay.

[0079] In some embodiments, the management node determines the weight corresponding to each working node based on the predicted load corresponding to each working node using a preset weight determination function. The weight corresponding to each working node can be determined based on the predicted load corresponding to each working node using the following formula (1).

[0080] (1)

[0081] In formula (1), W i It represents the weight corresponding to the i-th working node; f cpu It represents the predicted value of CPU utilization corresponding to the i-th working node; f 内存 It represents the predicted value of memory usage corresponding to the i-th working node; f 网络 It represents the predicted value of network delay corresponding to the i-th working node. α, β, and γ are all constants. They can be obtained through training with historical data.

[0082] In some embodiments, after determining the weight corresponding to each working node, the management node may also write the weight corresponding to each working node into the Consul (a tool for implementing service discovery and configuration of distributed systems) configuration center.

[0083] In some embodiments, the management node performs load balancing on multiple working nodes based on the weight corresponding to each working node. For example, if it is determined that the weight corresponding to any working node is greater than a preset weight threshold, 70% of the traffic will be directed to any working node.

[0084] For example, assume that the CPU utilization of the working node corresponding to a payment service (denoted as working node A) reaches the 95% threshold. In this case, the management node can reduce the weight corresponding to working node A from 0.7 to 0.1 within 200ms and transfer the backlog of pending requests to other idle working nodes.

[0085] Using this implementation, the management node can determine the predicted load corresponding to each working node, and dynamically adjust the traffic allocated to each working node based on the predicted load corresponding to each working node, thereby achieving load balancing among multiple working nodes.

[0086] See Figure 3 , Figure 3 This is a flow chart of another cross-channel session data sharing method provided by an embodiment of the present application. Figure 2 Compared to the cross-channel session data sharing approach shown, Figure 3 The method shown also describes how the management node determines the first target update content corresponding to the conflicting content in the multiple update contents based on multiple vector clocks. Figure 3 As shown, the cross-channel session data sharing method may include but is not limited to the following steps:

[0087] S301. Receive a data update message from each working node. The data update message includes update information of each working node for the target data. The update information includes the update content of the working node for the target data and the vector clock of the working node updating the target data. Each vector clock includes the timestamp of each working node updating the target data.

[0088] In an optional implementation, the relevant description of step S301 can be found in the description of the aforementioned step S201, and will not be repeated here.

[0089] S302: Select a maximum timestamp from the timestamps included in the multiple vector clocks, and use the working node corresponding to the vector clock to which the maximum timestamp belongs as the target working node.

[0090] S303 : For conflicting contents among the multiple update contents, use the update content of the target working node for the target data as the first target update content corresponding to the conflicting contents.

[0091] The conflicting content refers to the updated content for the same field in the target data.

[0092] The following is an illustration of steps S302 and S303.

[0093] For example, assuming the target data is a user work order, work node 1 is the app, and work node 2 is the PC. Assuming both the app and the PC update the "Status" and "Remarks" fields in the user work order, after the app updates the user work order, the vector clock may be updated to [APP:2]; after the PC updates the user work order, the vector clock may be updated to [PC:3]. In this case, the management node may determine that the maximum timestamp among the timestamps 2 and 3 included in [APP:2] and [PC:3], respectively, is 3. In this case, the management node may select the work node corresponding to the vector clock [PC:3] with the maximum timestamp 3, i.e., the PC, as the target work node. Subsequently, for the updates corresponding to the "Status" and "Remarks" fields in multiple updates (i.e., conflicting content), the management node may select the PC's updates for the "Status" and "Remarks" fields as the first target update corresponding to the conflicting content.

[0094] In steps S302 and S303, when determining the first target update corresponding to the conflicting content, the management node prioritizes the work node based on the maximum timestamp among the timestamps corresponding to each work node. The work node corresponding to the vector clock with the maximum timestamp is then selected as the target work node. The target work node's update for the target data is then retained. This intelligent merging of data version differences between different channels avoids lock contention caused by strong consistency.

[0095] S304: Merge non-conflicting contents in the multiple update contents to obtain second target update content.

[0096] The non-conflicting content is the updated content for different fields in the target data.

[0097] S305 : Update the target data based on the first target update content and the second target update content to obtain updated target data.

[0098] S306: Send the updated target data to each working node.

[0099] In an embodiment of the present application, when a management node receives data update messages from multiple working nodes, it can update the vector clock of the target data of the working node included in the data update message, merge the conflicting content and non-conflicting content in the multiple update contents, and obtain the target update content (including the first target update content and the second target update content). Then, it updates the target data based on the target update content to obtain the updated target data. Finally, it sends the updated target data to each working node. In this way, each working node receives the updated target data, so that the data received by each working node can be consistent, thereby improving the accuracy of cross-channel data sharing.

[0100] In an optional embodiment, Figure 2 and Figure 3 In the cross-channel session data sharing method shown, the management node can also write update information to Cassandra (an open source distributed NoSQL database system) to achieve data redundant storage through a multi-replication mechanism. This ensures that even if some worker nodes fail, users can still read the latest data through other normally operating worker nodes. In addition, a vector clock is used to track version information of concurrent operations on multiple worker nodes to ensure final data consistency.

[0101] In this implementation, any worker node (denoted as worker node B) can pull data from multiple replicas of Cassandra, each of which may carry a different version of the vector clock. Worker node B can then automatically merge conflicting and non-conflicting content from the multiple updates and, based on business rules, return the merged result.

[0102] For example, suppose user A has an account balance of 300 yuan. User A pays an electricity bill of 200 yuan through the app, while user A's family pays 100 yuan through the PC. Both 200 yuan and 100 yuan are deducted from user A's account balance. After the app operation, the vector clock is [APP:5], with a balance of 100 yuan. After the PC operation, the vector clock is [PC:3], with a balance of 200 yuan. In this case, the management node detects that the timestamps 5 and 3 in [APP:5] are the largest of the timestamps 5. Based on the deduction rules, the management node first deducts the 200 yuan paid through the app from the account balance, followed by the 100 yuan paid through the PC. At this point, user A's account balance is 300 - 200 - 100 = 0.

[0103] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.

[0104] Based on the same inventive concept, embodiments of the present application also provide a cross-channel session data sharing device for implementing the cross-channel session data sharing method described above. The solution provided by this device is similar to the solution described in the method described above. Therefore, the specific limitations of one or more embodiments of the cross-channel session data sharing device provided below can be found in the above-mentioned limitations of the cross-channel session data sharing method and will not be further elaborated here.

[0105] See Figure 4 , Figure 4 This is a schematic diagram of the structure of a cross-channel session data sharing device provided by an embodiment of the present application. Figure 4 As shown, the cross-channel session data sharing device may include but is not limited to:

[0106] Receiving module 401, configured to receive a data update message from each working node, the data update message including update information of each working node for target data, the update information including the updated content of the working node for the target data and the vector clock used by the working node to update the target data;

[0107] The determination and merging module 402 is configured to determine, based on multiple vector clocks, first target update content corresponding to conflicting content among the multiple update contents, and merge non-conflicting content among the multiple update contents to obtain second target update content; conflicting content is update content for the same field in the target data; non-conflicting content is update content for different fields in the target data;

[0108] An updating module 403 is configured to update the target data based on the first target update content and the second target update content to obtain updated target data;

[0109] The sending module 404 is configured to send the updated target data to each working node.

[0110] In one embodiment, each vector clock includes a timestamp of when each working node updates target data. When determining the first target update content corresponding to conflicting content among multiple update contents based on multiple vector clocks, the determination and merging module 402 is specifically configured to: select a maximum timestamp from the timestamps respectively included in the multiple vector clocks, and use the working node corresponding to the vector clock to which the maximum timestamp belongs as the target working node; and, for conflicting content among the multiple update contents, use the update content of the target data by the target working node as the first target update content corresponding to the conflicting content.

[0111] In one embodiment, the apparatus further includes a processing module and a storage module. Each update content includes a first field content and a second field content; the first field content is encrypted data, and the second field content is unencrypted content. The processing module is configured to decrypt the first field content in each update content to obtain decrypted first field content. The determination and merging module 402 is further configured to determine, for each update content, a decrypted data packet corresponding to the update content based on the decrypted first field content and the decrypted second field content. The storage module is configured to store each decrypted data packet in a distributed document storage database. The sending module 404 is further configured to send multiple decrypted data packets to each working node.

[0112] In one embodiment, the determination and merging module 402 is also used to determine the predicted load corresponding to each working node; based on the predicted load corresponding to each working node, a preset weight determination function is used to determine the weight corresponding to each working node; the processing module is also used to perform load balancing processing on multiple working nodes based on the weight corresponding to each working node.

[0113] In one embodiment, when the determination and merging module 402 is used to determine the predicted load of each working node, it is specifically used to: obtain the historical operation information of each working node; call a pre-trained load prediction model, and obtain the predicted load corresponding to each working node based on the historical operation information of each working node.

[0114] In one embodiment, the predicted load corresponding to each working node includes a predicted value of central processing unit (CPU) utilization, a predicted value of memory occupancy, and a predicted value of network delay.

[0115] Each module in the cross-channel conversation data sharing device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a terminal device in hardware form, or stored in a memory in the terminal device in software form, so that the processor can call and execute the corresponding operations of each module.

[0116] In an exemplary embodiment, the present application provides a computer device, which may be a terminal device, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals via wired or wireless means. The wireless means can be implemented via Wi-Fi, mobile cellular networks, near-field communication (NFC), or other technologies. When executed by the processor, the computer program implements a method for sharing cross-channel session data. The display unit of the computer device is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse.

[0117] Those skilled in the art will understand that Figure 5The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0118] In an exemplary embodiment, the present application provides a computer device including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps in the above-mentioned cross-channel session data sharing method are implemented.

[0119] In an exemplary embodiment, the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps in the above-mentioned cross-channel session data sharing method are implemented.

[0120] In an exemplary embodiment, the present application provides a computer program product, including a computer program, which implements the steps in the above-mentioned cross-channel session data sharing method when executed by a processor.

[0121] It should be noted that the data involved in this application (including but not limited to data update messages, target data, update information, vector clocks, first target update content, second target update content, updated target data, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0122] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), quantum computing-based data processing logic devices, artificial intelligence (AI) processors, and the like.

[0123] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0124] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A cross-channel session data sharing method, characterized in that: Applicable to management working nodes in a distributed cluster; the method includes: Receiving a data update message from each working node, wherein the data update message includes update information of each working node for target data, the update information including update content of the target data by the working node and a vector clock used by the working node to update the target data; determining, based on the plurality of vector clocks, first target update content corresponding to conflicting content among the plurality of update contents, and merging non-conflicting content among the plurality of update contents to obtain second target update content; the conflicting content is update content for the same field in the target data; and the non-conflicting content is update content for different fields in the target data; updating the target data based on the first target update content and the second target update content to obtain updated target data; The updated target data is sent to each of the working nodes.

2. The method according to claim 1, characterized in that Each of the vector clocks includes a timestamp of each working node updating the target data; The determining, based on the plurality of vector clocks, first target update content corresponding to conflicting content among the plurality of update contents includes: Selecting a maximum timestamp from the timestamps respectively included in the plurality of vector clocks, and using a working node corresponding to the vector clock to which the maximum timestamp belongs as a target working node; For conflicting contents among the multiple update contents, the update content of the target working node for the target data is used as the first target update content corresponding to the conflicting contents.

3. The method according to claim 1, characterized in that Each of the update contents includes a first field content and a second field content; the first field content is encrypted data, and the second field content is unencrypted content; the method further includes: Decrypting the first field content in each of the update contents to obtain decrypted first field content; For each of the update contents, determining a decrypted data packet corresponding to the update content based on the decrypted first field content and the second field content; Each of the decrypted data packets is stored in a distributed document storage database, and multiple of the decrypted data packets are sent to each of the working nodes.

4. The method according to claim 1, wherein The method further comprises: Determining the predicted load corresponding to each of the working nodes; Based on the predicted load corresponding to each of the working nodes, a preset weight determination function is used to determine the weight corresponding to each of the working nodes; Based on the weight corresponding to each working node, load balancing processing is performed on the multiple working nodes.

5. The method according to claim 4, characterized in that Determining the predicted load of each working node includes: Obtaining historical operation information of each of the working nodes; A pre-trained load prediction model is called to obtain the predicted load corresponding to each working node based on the historical operation information of each working node.

6. The method according to claim 4 or 5, characterized in that The predicted load corresponding to each working node includes a predicted value of central processing unit (CPU) utilization, a predicted value of memory occupancy, and a predicted value of network delay.

7. A cross-channel session data sharing device, characterized in that: Applicable to management working nodes in a distributed cluster; the device includes: a receiving module, configured to receive a data update message from each working node, wherein the data update message includes update information of each working node for target data, the update information including the update content of the target data by the working node and the vector clock used by the working node to update the target data; a determination and merging module, configured to determine, based on the plurality of vector clocks, first target update content corresponding to conflicting content among the plurality of update contents, and merge non-conflicting content among the plurality of update contents to obtain second target update content; the conflicting content is update content for the same field in the target data; and the non-conflicting content is update content for different fields in the target data; an updating module, configured to update the target data based on the first target update content and the second target update content to obtain updated target data; A sending module is used to send the updated target data to each of the working nodes.

8. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method according to any one of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.