A tab page data synchronization method, device and electronic equipment

By detecting concurrent operation conflicts in browser tabs and applying appropriate conflict resolution strategies, the consistency problem in tab data synchronization is solved, achieving efficient data consistency management.

CN122152938APending Publication Date: 2026-06-05DUXIAOMAN TECH (BEIJING) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DUXIAOMAN TECH (BEIJING) CO LTD
Filing Date
2026-03-20
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing browser tab data synchronization methods can easily lead to data inconsistency when multiple tabs modify the same data simultaneously, especially when using a 'last write overwrites first write' strategy during concurrent modifications, which undermines data consistency.

Method used

By performing conflict detection on concurrent operations of active tabs in the browser, matching conflict resolution strategies, such as OT, CRDT, or LLW strategies, are selected, the initial state change operation is transformed, and the target state change operation is applied on the active tabs to ensure data consistency.

Benefits of technology

It effectively resolves concurrency conflicts between tabs, ensures data consistency across different tabs, and achieves efficient data synchronization through intelligent selection of conflict resolution strategies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122152938A_ABST
    Figure CN122152938A_ABST
Patent Text Reader

Abstract

The application provides a tab page data synchronization method and device and electronic equipment, and relates to the field of coordination computing and distributed coordination. In the application, concurrent operation conflict detection is performed on initial state change operations respectively initiated by a target object within a set time range for any two active tab pages in a browser to obtain a conflict detection result. If the conflict detection result indicates that the two initial state change operations have concurrent operation conflicts, a target conflict resolution strategy matching the two initial state change operations is selected from a plurality of candidate conflict resolution strategies. Operation conversion is performed on the two initial state change operations based on the target conflict resolution strategy to obtain a target state change operation. The target state change operation is applied to the any two active tab pages respectively, so that the any two active tab pages are synchronized with a tab page state corresponding to the target state change operation. In this way, complex concurrent operation conflicts can be effectively handled.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of coordinated computing and distributed coordination technology, and in particular to a method, apparatus and electronic device for synchronizing data on tabs. Background Technology

[0002] Currently, native cross-tab communication can be achieved between multiple tabs in a browser through data synchronization methods such as the broadcast channel application programming interface (Broadcast Channel API), Shared Worker, or Local Storage.

[0003] However, the data synchronization methods described above can only perform simple message broadcasting. When multiple tabs need to modify the same data simultaneously, a "last write overwrites first write" strategy is typically used. This can lead to different data states on different tabs, thus compromising data consistency. For example, if a user modifies data X on tab A and tab B, only the modified data on one tab (i.e., tab A or tab B) will ultimately be retained on both tabs A and B.

[0004] Therefore, how to effectively handle complex concurrent conflicts (such as concurrent modification conflicts) to ensure data consistency across different tabs is a problem that urgently needs to be solved. Summary of the Invention

[0005] This application provides a data synchronization method, apparatus, and electronic device for tab pages, which can effectively handle complex concurrent conflicts and thus ensure data consistency across different tab pages.

[0006] In a first aspect, embodiments of this application provide a data synchronization method for a tab page, the method comprising: In response to the initial state change operations initiated by the target object for any two active tabs in the browser within a set time range, concurrent operation conflict detection is performed on the two initial state change operations to obtain the conflict detection result. If the conflict detection result indicates that there is a concurrent operation conflict between the two initial state change operations, then the target conflict resolution strategy that matches the two initial state change operations is selected from the multiple preset candidate conflict resolution strategies. Based on the target conflict resolution strategy, the two initial state change operations are transformed to obtain the target state change operation; Apply the target state change operation to any two active tabs respectively, so that the tab states corresponding to the target state change operation are synchronized between the two active tabs.

[0007] In one optional embodiment, concurrent operation conflict detection is performed on two initial state change operations to obtain conflict detection results, including: The two initial state change operations are serialized to obtain the operation instruction sequences corresponding to the two initial state change operations respectively. If the sequence similarity between two operation instruction sequences is greater than the set sequence similarity threshold, then the conflict detection result indicates that there is a concurrent operation conflict between the two initial state change operations. If the sequence similarity is less than or equal to the sequence similarity threshold, then the conflict detection result indicates that there is no concurrent operation conflict between the two initial state change operations.

[0008] In one optional embodiment, selecting a target conflict resolution strategy that matches two initial state change operations from a plurality of preset candidate conflict resolution strategies includes: Obtain the data type of the tab content corresponding to the two initial state change operations, the conflict complexity between the two initial state change operations, and the browser's service performance requirements; Based on strategy selection rules built according to data type, conflict complexity, and service performance requirements, the target conflict resolution strategy is selected from multiple candidate conflict resolution strategies.

[0009] In one alternative embodiment, the multiple candidate conflict resolution strategies include: an operational transformation (OT) conflict resolution strategy, a conflict-free replicated data type (CRDT) conflict resolution strategy, and a last-writer-wins (LLW) conflict resolution strategy. Based on strategy selection rules built according to data type, conflict complexity, and service performance requirements, a target conflict resolution strategy is selected from multiple candidate conflict resolution strategies, including: If the conflict complexity exceeds the set conflict complexity threshold, or if the data type is text or list, then the OT conflict resolution strategy will be used as the target conflict resolution strategy. If the service performance requirements meet the preset high service performance requirements, or if the data type is a counter type or a set type, then the CRDT conflict resolution strategy will be used as the target conflict resolution strategy. If the data type is a simple value type, then the LLW conflict resolution strategy will be used as the target conflict resolution strategy.

[0010] In an optional embodiment, after performing an operation transformation on the two initial state change operations based on the target conflict resolution strategy to obtain the target state change operation, the method further includes: Determine the distributed transaction to which the target state change operation belongs, and generate the transaction identifier for the distributed transaction; Upon successfully acquiring the distributed lock set for each state change operation included in the distributed transaction, execute each state change operation and generate the operation log of the distributed transaction based on the transaction identifier; After each state change operation is completed, the distributed lock is released based on the transaction identifier, and the transaction commit message of the distributed transaction is broadcast to any two active tabs.

[0011] In one optional embodiment, after generating the transaction identifier for the distributed transaction, the method further includes: If the distributed lock is not successfully acquired, roll back at least one state change operation that has been executed in each state change operation based on the transaction identifier, release the sub-distributed lock corresponding to at least one state change operation, and broadcast the transaction rollback message of the distributed transaction to any two active tabs.

[0012] In one optional embodiment, generating an operation log for a distributed transaction based on a transaction identifier includes: For each state change operation, perform the following operations respectively: During the execution of the first state change operation, a timestamp index and a vector clock index are created for the first state change operation; wherein, the first state change operation is any one of the various state change operations; Based on the timestamp index, vector clock index, and the operation identifier and execution data of the first state change operation, the operation data of the first state change operation is generated; The operation data is treated as a sub-operation log, and the sub-operation log is stored in a preset storage space.

[0013] In an optional embodiment, the method further includes: Obtain the tab identifiers corresponding to each active tab in the browser; wherein each active tab includes: a first active tab and multiple second active tabs, and the first active tab is any one of the active tabs; Send a primary instance election request for the first active tab to multiple second active tabs; the primary instance election request must carry at least the tab identifier of the first active tab; Receive the primary instance election results returned by multiple second active tabs based on their tab identifiers and primary instance election requests; wherein, each primary instance election result indicates whether the corresponding second active tab has selected the first active tab as the primary instance tab; If the number of primary instance election results that indicate the first active tab as the primary instance tab exceeds a set threshold, then the first active tab will be selected as the primary instance tab.

[0014] Secondly, embodiments of this application also provide a data synchronization device for tab pages, the device comprising: The conflict detection module is used to respond to the initial state change operations initiated by the target object against any two active tabs in the browser within a set time range, and to perform concurrent operation conflict detection on the two initial state change operations to obtain the conflict detection results. The strategy filtering module is used to select a target conflict resolution strategy that matches the two initial state change operations from a set of multiple candidate conflict resolution strategies if the conflict detection results indicate that there is a concurrent operation conflict between the two initial state change operations. The operation conversion module is used to convert two initial state change operations based on the target conflict resolution strategy to obtain the target state change operation. The state synchronization module is used to apply the target state change operation to any two active tabs respectively, so that the two active tabs can synchronize the tab state corresponding to the target state change operation.

[0015] In an optional embodiment, when performing concurrent operation conflict detection on two initial state change operations and obtaining the conflict detection result, the conflict detection module is specifically used for: The two initial state change operations are serialized to obtain the operation instruction sequences corresponding to the two initial state change operations respectively. If the sequence similarity between two operation instruction sequences is greater than the set sequence similarity threshold, then the conflict detection result indicates that there is a concurrent operation conflict between the two initial state change operations. If the sequence similarity is less than or equal to the sequence similarity threshold, then the conflict detection result indicates that there is no concurrent operation conflict between the two initial state change operations.

[0016] In an optional embodiment, when selecting a target conflict resolution strategy that matches two initial state change operations from a plurality of preset candidate conflict resolution strategies, the strategy selection module is specifically used for: Obtain the data type of the tab content corresponding to the two initial state change operations, the conflict complexity between the two initial state change operations, and the browser's service performance requirements; Based on strategy selection rules built according to data type, conflict complexity, and service performance requirements, the target conflict resolution strategy is selected from multiple candidate conflict resolution strategies.

[0017] In one optional embodiment, the multiple candidate conflict resolution strategies include: OT conflict resolution strategy, CRDT conflict resolution strategy, and LLW conflict resolution strategy; When selecting a target conflict resolution strategy from multiple candidate conflict resolution strategies based on strategy selection rules built according to data type, conflict complexity, and service performance requirements, the strategy selection module is specifically used for: If the conflict complexity exceeds the set conflict complexity threshold, or if the data type is text or list, then the OT conflict resolution strategy will be used as the target conflict resolution strategy. If the service performance requirements meet the preset high service performance requirements, or if the data type is a counter type or a set type, then the CRDT conflict resolution strategy will be used as the target conflict resolution strategy. If the data type is a simple value type, then the LLW conflict resolution strategy will be used as the target conflict resolution strategy.

[0018] In an optional embodiment, after performing operation transformation on the two initial state change operations based on the target conflict resolution strategy to obtain the target state change operation, the state synchronization module is further configured to: Determine the distributed transaction to which the target state change operation belongs, and generate the transaction identifier for the distributed transaction; Upon successfully acquiring the distributed lock set for each state change operation included in the distributed transaction, execute each state change operation and generate the operation log of the distributed transaction based on the transaction identifier; After each state change operation is completed, the distributed lock is released based on the transaction identifier, and the transaction commit message of the distributed transaction is broadcast to any two active tabs.

[0019] In one optional embodiment, after generating the transaction identifier for the distributed transaction, the state synchronization module is further configured to: If the distributed lock is not successfully acquired, roll back at least one state change operation that has been executed in each state change operation based on the transaction identifier, release the sub-distributed lock corresponding to at least one state change operation, and broadcast the transaction rollback message of the distributed transaction to any two active tabs.

[0020] In an optional embodiment, when generating the operation log of a distributed transaction based on the transaction identifier, the state synchronization module is specifically used for: For each state change operation, perform the following operations respectively: During the execution of the first state change operation, a timestamp index and a vector clock index are created for the first state change operation; wherein, the first state change operation is any one of the various state change operations; Based on the timestamp index, vector clock index, and the operation identifier and execution data of the first state change operation, the operation data of the first state change operation is generated; The operation data is treated as a sub-operation log, and the sub-operation log is stored in a preset storage space.

[0021] In an optional embodiment, the state synchronization module is further configured to: Obtain the tab identifiers corresponding to each active tab in the browser; wherein each active tab includes: a first active tab and multiple second active tabs, and the first active tab is any one of the active tabs; Send a primary instance election request for the first active tab to multiple second active tabs; the primary instance election request must carry at least the tab identifier of the first active tab; Receive the primary instance election results returned by multiple second active tabs based on their tab identifiers and primary instance election requests; wherein, each primary instance election result indicates whether the corresponding second active tab has selected the first active tab as the primary instance tab; If the number of primary instance election results that indicate the first active tab as the primary instance tab exceeds a set threshold, then the first active tab will be selected as the primary instance tab.

[0022] Thirdly, embodiments of this application provide an electronic device, including: processor; Stored program memory, The program includes instructions that, when executed by the processor, cause the processor to perform the tab data synchronization method as described in the first aspect.

[0023] Fourthly, embodiments of this application provide a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the tab page data synchronization method as described in the first aspect.

[0024] Fifthly, this application provides a computer program product that, when invoked by a computer, causes the computer to execute the tab data synchronization method as described in the first aspect.

[0025] The beneficial effects of this application are as follows: In the tab data synchronization method provided in this application embodiment, when concurrent operation conflicts exist when the target object initiates initial state change operations for any two active tabs in the browser within a set time range, a target conflict resolution strategy matching the two initial state change operations can be selected from a set of multiple candidate conflict resolution strategies. Based on the target conflict resolution strategy, the two initial state change operations are transformed to obtain the target state change operation. This target state change operation is then applied to the two active tabs to synchronize their tab states. In this way, the target state change operation obtained by transforming the two initial state change operations using the target conflict resolution strategy effectively resolves concurrent conflicts arising when synchronizing tab states between any two active tabs, ensuring data consistency across different tabs.

[0026] Furthermore, other features and advantages of this application will be set forth in the following description and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description

[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described herein are used to provide a further understanding of this application, constitute a part of this application, and do not constitute an improper limitation of this application. In the accompanying drawings: Figure 1 This is a schematic diagram of an optional system architecture applicable to the embodiments of this application.

[0028] Figure 2 This is a schematic diagram illustrating the implementation process of a data synchronization method for tabs provided in an embodiment of this application.

[0029] Figure 3 This is a logical diagram illustrating a target conflict resolution strategy provided in an embodiment of this application.

[0030] Figure 4 This is a schematic diagram illustrating the composition of a tab page data synchronization engine provided in an embodiment of this application.

[0031] Figure 5 This is a logical diagram illustrating a conflict resolution process provided in an embodiment of this application.

[0032] Figure 6 This is a schematic diagram of a data synchronization device for a tab page provided in an embodiment of this application.

[0033] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0034] Embodiments of this application will now be described in more detail with reference to the accompanying drawings. While some embodiments of this application are shown in the drawings, it should be understood that this application can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this application. It should be understood that the drawings and embodiments of this application are for illustrative purposes only and are not intended to limit the scope of protection of this application.

[0035] It should be understood that the steps described in the method embodiments of this application may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this application is not limited in this respect.

[0036] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc., mentioned in this application are used only to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.

[0037] It should be noted that the terms "a" and "a plurality of" used in this application are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0038] The names of the messages or information exchanged between multiple devices in the embodiments of this application are for illustrative purposes only and are not intended to limit the scope of these messages or information.

[0039] The following explanations of some terms used in the embodiments of this application are provided to facilitate understanding by those skilled in the art.

[0040] (1) Transaction processing: Multiple related operations are executed as an atomic unit, either all succeed or all are rolled back.

[0041] (2) Vector clock: A logical clock mechanism used in a distributed system to determine the timing relationship of events.

[0042] (3) Primary instance coordinator: The primary tab instance responsible for coordinating operation logs and conflict resolution in a multi-tab environment.

[0043] (4) Two-Phase Commit Protocol (2PC): A distributed transaction processing protocol that ensures that all participants either commit all transactions or roll back all transactions.

[0044] (5) Distributed Lock: A synchronization mechanism for controlling access to shared resources in a distributed system.

[0045] (6) Status snapshot: A backup of the complete state of the system at a certain moment, used for rapid recovery and incremental synchronization.

[0046] (7) Indexed DB: A browser-side transactional database API that supports local storage of large amounts of structured data.

[0047] (8) Broadcast Channel API: A cross-tab communication interface provided by the browser, which allows message broadcasting between pages of the same origin.

[0048] (9) Shared Worker: A shared Web Worker in the browser that can be shared by multiple pages and is often used for cross-tab communication.

[0049] (10) Transaction rollback: When a transaction fails or is canceled, the executed operations are undone and the state is restored to that before the transaction started.

[0050] (11) Heartbeat detection: A mechanism to detect the liveness status of nodes in a distributed system by periodically sending heartbeat messages.

[0051] (12) Network partitioning: The phenomenon of communication interruption between nodes due to network failure in a distributed system.

[0052] (13) Split-brain: A consistency problem caused by multiple nodes in a distributed system simultaneously believing themselves to be the master node.

[0053] (14) Deadlock prevention: Techniques to avoid deadlock by designing reasonable resource acquisition order and timeout mechanism.

[0054] (15) Garbage collection: A mechanism that automatically collects unused operation logs and state snapshots to free up storage space.

[0055] (16) Incremental synchronization: a synchronization method that only transmits the changed data parts, rather than the complete state.

[0056] (17) Conflict detection: Algorithms and mechanisms for identifying whether there are conflicts between concurrent operations.

[0057] (18) State machine replication: A distributed algorithm that applies the same sequence of operations to maintain a consistent state across multiple nodes.

[0058] Based on the above explanations of terms and related terminology, the design concept of the embodiments of this application will be briefly introduced below: Currently, native cross-tab communication can be achieved between multiple tabs in a browser through data synchronization methods such as Broadcast Channel API, Shared Worker, Local Storage, or Window.post Message.

[0059] Among them, the Broadcast Channel API allows simple message broadcasting between tabs of the same origin, SharedWorker provides a shared background thread for cross-tab communication, Local Storage events achieve cross-tab synchronization by listening for changes in LocalStorage, and Window.postMessage supports message passing between cross-domain windows.

[0060] However, the data synchronization methods described above can only perform simple message broadcasting. When multiple tabs need to modify the same data simultaneously, a "last write overwrites first write" strategy is typically used. This can lead to different data states on different tabs, thus compromising data consistency. For example, if a user modifies data X on tab A and tab B, only the modified data on one tab (i.e., tab A or tab B) will ultimately be retained on both tabs A and B.

[0061] In view of this, in order to solve or improve the above-mentioned problems, embodiments of this application provide a tab data synchronization method, which specifically includes: responding to initial state change operations initiated by a target object for any two active tabs in a browser within a set time range, performing concurrent operation conflict detection on the two initial state change operations to obtain a conflict detection result; then, if the conflict detection result indicates that the two initial state change operations have concurrent operation conflicts, selecting a target conflict resolution strategy that matches the two initial state change operations from a preset plurality of candidate conflict resolution strategies; further, performing operation transformation on the two initial state change operations based on the target conflict resolution strategy to obtain a target state change operation; finally, applying the target state change operation to any two active tabs respectively, so that the two active tabs synchronize the tab state corresponding to the target state change operation. In this way, the target state change operation obtained by performing operation transformation on the two initial state change operations through the target conflict resolution strategy can effectively resolve the concurrent conflicts generated when synchronizing the tab state of any two active tabs, ensuring data consistency of different tabs.

[0062] In particular, the preferred embodiments of this application will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit this application. Furthermore, the embodiments of this application and the features in the embodiments can be combined with each other unless otherwise specified.

[0063] See Figure 1 The diagram illustrates an optional system architecture applicable to an embodiment of this application. This system architecture may include: terminal devices (101a, 101b) and server 102. The terminal devices (101a, 101b) and server 102 can interact via a communication network. The communication network may employ wireless communication or wired communication methods. For example, the terminal devices (101a, 101b) can access the network and communicate with server 102 via cellular mobile communication technology. The aforementioned cellular mobile communication technology may include, for example, 5th generation mobile networks (5G) technology or next-generation mobile communication technology. Optionally, the terminal devices (101a, 101b) can access the network and communicate with server 102 via short-range wireless communication. The aforementioned short-range wireless communication method may include, for example, wireless fidelity (Wi-Fi) technology.

[0064] This application embodiment does not impose any limitation on the number of communication devices involved in the above system architecture. For example, the above system architecture may include more terminal devices, or fewer terminal devices, or other network devices. Figure 1 As shown, only terminal devices (101a, 101b) and server 102 are described as examples. The following is a brief introduction to each of the above communication devices and their respective functions.

[0065] A terminal device (101a, 101b) is a device that can provide voice and / or data connectivity to a user, and may be a device that supports wired and / or wireless connections.

[0066] For example, terminal devices (101a, 101b) may include, but are not limited to: mobile phones, tablets, laptops, handheld computers, mobile internet devices (MID), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminal devices in industrial control, wireless terminal devices in autonomous driving, wireless terminal devices in smart grids, wireless terminal devices in transportation safety, wireless terminal devices in smart cities, or wireless terminal devices in smart homes, etc.

[0067] Furthermore, the terminal devices (101a, 101b) may have related clients installed. These clients can be software, such as applications (APPs), browsers, or short video software, or they can be web pages or mini-programs. It should be noted that the browser on the terminal devices (101a, 101b) in this embodiment may include multiple active tabs, and the target object can initiate tab state change operations on the active tabs in the browser.

[0068] Server 102 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.

[0069] It is worth mentioning that, in this embodiment of the application, server 102 can respond to the initial state change operations initiated by the target object for any two active tabs in the browser presented by the terminal device (101a, 101b) within a set time range, and perform concurrent operation conflict detection on the two initial state change operations to obtain a conflict detection result; then, if the aforementioned conflict detection result indicates that there is a concurrent operation conflict between the two initial state change operations, a target conflict resolution strategy matching the aforementioned two initial state change operations is selected from a plurality of preset candidate conflict resolution strategies; further, the two initial state change operations are transformed based on the target conflict resolution strategy to obtain a target state change operation; finally, the target state change operation is applied to the aforementioned two active tabs respectively, so that the aforementioned two active tabs synchronize the tab state corresponding to the target state change operation.

[0070] The following describes the tab data synchronization method provided by the exemplary embodiments of this application in conjunction with the above-described system architecture and with reference to the accompanying drawings. It should be noted that the above-described system architecture is only shown to facilitate understanding of the spirit and principles of this application, and the embodiments of this application are not limited in any way in this respect.

[0071] See Figure 2 The diagram illustrates the implementation flow of a tab page data synchronization method provided in this application embodiment. Taking a server as an example, the specific implementation flow of this method is as follows: S201: In response to the initial state change operations initiated by the target object for any two active tabs in the browser within a set time range, perform concurrent operation conflict detection on the two initial state change operations and obtain the conflict detection result.

[0072] The aforementioned time range is typically a short period, such as within a few seconds. In other words, the initial state change operations initiated by any two active tabs are also the initial state change operations of the target object within a short time range. It should be understood that each initial state change operation is used to change the tab content of the corresponding active tab.

[0073] Furthermore, the conflict detection results described above indicate whether there are concurrent operation conflicts between the two initial state change operations. If the conflict detection results indicate that the two initial state change operations have concurrent operation conflicts, then the two initial state change operations are used to modify or change the state of the same tab, and these two initial state change operations are also included in the concurrent operation set. Conversely, if the conflict detection results indicate that the two initial state change operations do not have concurrent operation conflicts, then the two initial state change operations are not change operations.

[0074] In one optional implementation, during step S201, the server can perform operation serialization processing on the two initial state change operations respectively to obtain operation instruction sequences corresponding to the two initial state change operations. For example, taking the initial state change operation A in the aforementioned two initial state change operations as an instruction that "the user changes data.users[0].name from "Zhang X" to "Li Y" on tab 1", the operation serializer converts it into standardized operation instructions, for example, {type: "UPDATE_FIELD", path: "data.users[0].name", value: "Li Y", vectorclock: "{"tab_A": 5}}. The aforementioned operation serialization processing ensures that the modification of tab content across tabs is possible. For example, when the user modifies data on tab 1, the operation needs to go through operation serialization, broadcasting, synchronization and other steps before it reaches tab 2.

[0075] Next, if the sequence similarity between the two operation instruction sequences is greater than the set sequence similarity threshold, then the conflict detection result indicates that there is a concurrent operation conflict between the two initial state change operations.

[0076] Taking the above-mentioned sequence similarity threshold of 95% as an example, if the sequence similarity between two operation instruction sequences is 98%, the server can determine that the sequence similarity between the two operation instruction sequences is greater than the set sequence similarity threshold, and thus can determine that there is a concurrent operation conflict between the two initial state change operations.

[0077] For example, when a user modifies data on tab 1 (changing "Zhang X" to "Li Y"), the operation needs to go through serialization, broadcasting, and synchronization steps before reaching tab 2. Before this synchronization is complete (usually a few milliseconds to tens of milliseconds), if the user switches to tab 2 and modifies the same data (e.g., while the status change operation on tab 1 is still being broadcast, the user switches to tab 2 and changes the same field to "Wang Z"), this will cause a concurrency conflict.

[0078] If the sequence similarity between two operation instruction sequences is less than or equal to the set sequence similarity threshold, then the conflict detection result indicates that there is no concurrent operation conflict between the two initial state change operations.

[0079] Taking the aforementioned sequence similarity threshold of 95% as an example, if the sequence similarity between two operation instruction sequences is 87%, the server can determine that the sequence similarity between the two operation instruction sequences is less than the set sequence similarity threshold, and thus can determine that there is no concurrent operation conflict between the two initial state change operations.

[0080] Optionally, the sequence similarity between two operation instruction sequences can be determined based on the maximum instruction similarity corresponding to each operation instruction in any of the two operation instruction sequences and the tab state adjustment weight. The maximum instruction similarity corresponding to each operation instruction refers to the maximum value among the instruction similarities between that operation instruction and multiple operation instructions included in the other operation instruction sequence, while the tab state adjustment weight characterizes the contribution of that operation instruction to the tab state change implemented by the initial state change operation.

[0081] S202: If the conflict detection result indicates that there is a concurrent operation conflict between the two initial state change operations, then select the target conflict resolution strategy that matches the two initial state change operations from the multiple preset candidate conflict resolution strategies.

[0082] The aforementioned preset multiple candidate conflict resolution strategies may include: OT conflict resolution strategy, CRDT conflict resolution strategy and LLW conflict resolution strategy, and this application embodiment does not specifically limit them.

[0083] The OT conflict resolution strategy is a distributed collaborative editing algorithm that resolves concurrent conflicts by transforming operation instructions, ensuring that the final state of different clients is consistent. The input to the OT conflict resolution strategy is typically a set of concurrent operations (represented as `concurrent_ops`, such as two initial state change operations) and the current state (`current_state`). The current state refers to the complete data state at a given moment, containing the current values ​​of all data fields. In the core operation transformation algorithm, the current state, as an input parameter, represents a snapshot of the state before the conflict occurs. This snapshot is used to verify the legality of the transformed operation (e.g., whether the path exists, whether the value is valid), and is dynamically updated after the operation is applied, serving as the basis for subsequent operation transformations. Assuming the current state is `{users: [{name: "Zhang San", age: 25}], count: 1}`, the algorithm verifies and applies the transformed operation based on this state. When the operation "changes users[0].name to "Li Si"" is applied, the current state is updated to `{users: [{name: "Li Si", age: 25}], count: 1}`, and then the next operation is processed based on the updated state. The output of an OT conflict resolution strategy is typically a sequence of transformed operations, represented as `transformed_ops`. Specifically, an OT conflict resolution strategy may include the following steps: Step 1: Operation sorting sorted_ops ← Sort by vector clock (concurrent_ops) / / Step 2: Step-by-step conversion transformed_ops ← Empty list FOR EACH op IN sorted_ops DO / / Step 3: Calculate the transformation operation transformed_op ← no operation FOR EACH applied_op IN transformed_ops DO transformed_op ← OT_TRANSFORM(op, applied_op) END FOR / / Step 4: Verify the conversion results IF Verify the validity of the operation (transformed_op, current_state) THEN transformed_ops.add(transformed_op) current_state ← Application operation (transformed_op, current_state) END IF END FOR RETURN transformed_ops END The operation instruction data structure is as follows: The operation instructions use a standardized JSON format: { "id": "unique_operation_id", "type": "UPDATE_FIELD | INSERT_ITEM | DELETE_ITEM | MOVE_ITEM", "path": "data.users[0].profile.name", "value": "new_value", "oldValue": "old_value", "timestamp": 1698765432123, "authorId": "tab_instance_id", "vectorClock": {"tab1": 5, "tab2": 3}, "transactionId": "optional_transaction_id" } CRDT (Content Response Time Determination) conflict resolution strategies can automatically resolve conflicts in distributed systems, guaranteeing eventual consistency without coordination. Specifically, CRDT conflict resolution strategies can include the following: Algorithm: G-Counter CRDT implementation (for counter types) Input: Increment value, node ID Output: Updated counter state (counter_state) BEGIN / / Each node maintains an independent counter counter_state[node_id] += increment / / The global value is the sum of the counters of all nodes. global_value ← SUM(counter_state.values()) / / Broadcast Incremental Operation broadcast_operation({ type: "INCREMENT", node_id: node_id, increment: increment, vectorClock: Current vector clock() }) RETURN counter_state END Supported CRDT types: 1. G-Counter: An incrementing counter that supports distributed counting. 2. PN-Counter: A counter that can increment and decrement, supporting distributed counter operations. 3. G-Set: A set that only grows and supports adding elements to a distributed set. 4. OR-Set: Observe and remove set, supports add and delete operations. 5. LWW-Register: Last Write Winner Register, used for simple value types. 6. RGA: Copy Graph Automaton, used for operations on ordered lists. In addition, the LWW conflict resolution strategy aims to prioritize the operation with the latest timestamp when multiple change operations conflict.

[0084] In one optional implementation, during step S202, the server can obtain the data types of the tab content corresponding to the two initial state change operations, the conflict complexity between the two initial state change operations, and the browser's service performance requirements. Based on strategy selection rules built around data types, conflict complexity, and service performance requirements, the server can then select a target conflict resolution strategy from multiple candidate conflict resolution strategies. In this way, the optimal conflict resolution strategy can be selected based on data types, conflict complexity, and service performance requirements, thereby more effectively handling complex concurrent conflicts and ensuring data consistency across different tabs, achieving an optimal balance between performance and consistency.

[0085] For example, the input to the comprehensive scheduling algorithm for the aforementioned conflict strategy is the set of conflict operations (conflict_ops) and the data type (data_type), and its output is the selected conflict resolution strategy (selected_strategy). Therefore, the specific process for selecting the target conflict resolution strategy described above is as follows: Comprehensive scheduling algorithm: Algorithm: Intelligent Policy Selection Algorithm Input: Set of conflicting operations (conflict_ops), data type (data_type) Output: Selected strategy BEGIN / / Step 1: Data Type Analysis IF data_type = "TEXT" OR data_type = "LIST" THEN selected_strategy ← "OT_ALGORITHM" ELSE IF data_type = "COUNTER" OR data_type = "SET" THEN selected_strategy ← "CRDT_STRATEGY" ELSE IF data_type = "SIMPLE_VALUE" THEN selected_strategy ← "LWW_STRATEGY" END IF / / Step 2: Conflict Complexity Assessment conflict_complexity ← Evaluates the complexity of conflict (conflict_ops) IF conflict_complexity>COMPLEX_THRESHOLD THEN selected_strategy ← "OT_ALGORITHM" / / Forces the use of OT for complex conflicts END IF / / Step 3: Service Performance Requirements Check operation_frequency ← Gets the operation frequency (conflict_ops) IF operation_frequency>HIGH_FREQ_THRESHOLD THEN IF data_type supports CRDT THEN selected_strategy ← "CRDT_STRATEGY" / / CRDT is preferred for high-frequency operations END IF END IF RETURN selected_strategy END In this way, the server can intelligently select the most suitable conflict resolution strategy based on data type, conflict complexity, and service performance requirements, achieving an optimal balance between performance and consistency.

[0086] Further, see Figure 3 As shown, if the conflict complexity exceeds the set conflict complexity threshold, or if the data type is text or list, the server can use the OT conflict resolution strategy as the target conflict resolution strategy; if the service performance requirement meets the preset high service performance requirement conditions (e.g., high operation frequency (10 times / second)), or if the data type is counter or set, the server can use the CRDT conflict resolution strategy as the target conflict resolution strategy; if the data type is simple value, the server can use the LLW conflict resolution strategy as the target conflict resolution strategy.

[0087] Among the three parallel conflict resolution strategies mentioned above, the OT conflict resolution strategy is suitable for scenarios that require precise conversion, such as text editing and list operations. It handles position and content conflicts of concurrent operations through transformation functions. The CRDT conflict resolution strategy is suitable for data types such as counters, sets, and mappings. It automatically resolves conflicts through mathematically commutative operations. The LWW conflict resolution strategy is suitable for simple value types and low-conflict scenarios. It selects the latest operation as the final result based on the timestamp.

[0088] Therefore, based on the above-mentioned conflict resolution strategy selection mechanism, the most suitable strategy can be automatically selected according to the data type of the operation target (i.e., the corresponding tab content). Complex conflicts use the OT conflict resolution strategy, simple conflicts use the LWW conflict resolution strategy, and high-frequency operation scenarios prioritize the CRDT conflict resolution strategy to reduce computational overhead.

[0089] S203: Based on the target conflict resolution strategy, perform operation transformation on the two initial state change operations to obtain the target state change operation.

[0090] In this way, by using the target conflict resolution strategy to transform the two initial state change operations, the problem of concurrent operation conflicts in the initial state change operations is effectively solved.

[0091] Furthermore, to address the limitations of existing data synchronization methods in effectively handling complex business transactions, such as lack of atomicity, an alternative implementation can be implemented whereby the server can transform the two initial state change operations based on a target conflict resolution strategy to obtain the target state change operation. Afterward, it can determine the distributed transaction to which the target state change operation belongs and generate a transaction identifier for the distributed transaction. Then, upon successfully acquiring the distributed locks set for each state change operation within the distributed transaction, it can execute each state change operation and generate an operation log for the distributed transaction based on the transaction identifier. Finally, after each state change operation is completed, it can release the distributed locks based on the transaction identifier and broadcast the transaction commit message of the distributed transaction to any two active tabs.

[0092] Optionally, after generating the transaction identifier of the distributed transaction, the server can also, if it fails to acquire the distributed lock, roll back at least one of the executed state change operations based on the transaction identifier and release the sub-distributed lock corresponding to at least one state change operation, and broadcast the transaction rollback message of the distributed transaction to any two active tabs.

[0093] It should be noted that acquiring the distributed lock is also the preparation phase of transaction processing. Therefore, the above-described distributed transaction processing mechanism implements browser-side transaction processing through a two-phase commit protocol and a distributed lock, ensuring the atomicity of complex business operations. The above-described distributed transaction processing mechanism can be specifically represented as follows: Algorithm: Distributed Transaction Commit Algorithm Input: Set of transaction operations (transaction_ops) Output: Transaction execution result (transaction_result) BEGIN transaction_id ← Generate a unique transaction ID() / / Phase 1: Preparation Phase prepare_success ← TRUE FOR EACH tab IN active_tabs DO lock_acquired ← Acquires the distributed lock (tab, transaction_ops) IF NOT lock_acquired THEN prepare_success ← FALSE BREAK END IF END FOR / / Phase 2: Commit or Rollback IF prepare_success THEN FOR EACH op IN transaction_ops DO Perform the operation (op) Record operation logs (op, transaction_id) END FOR Release all locks (transaction_id) Broadcast transaction commit (transaction_id) RETURN SUCCESS ELSE Rollback of the executed operation (transaction_id) Release all locks (transaction_id) Broadcast transaction rollback (transaction_id) RETURN FAILURE END IF END It should also be noted that the deadlock prevention mechanisms of distributed locks include: 1. Timeout mechanism: locks are automatically released after a timeout; 2. Priority sorting: locks are acquired in order of transaction ID to avoid circular waiting; 3. Resource graph detection: a resource dependency graph is maintained to detect deadlocks; 4. Preemptive rollback: transactions with lower priority are rolled back when a deadlock is detected.

[0094] Based on the above approach, by implementing a transaction coordination mechanism based on a two-phase commit protocol, distributed lock management and deadlock prevention algorithms, and providing automatic rollback and fault recovery capabilities, complete distributed transaction processing capabilities can be achieved in a browser environment. This supports ACID properties (i.e., Atomicity, Consistency, Isolation, or Durability) guarantees, thereby overcoming problems such as lack of atomicity (i.e., inability to guarantee the atomic execution of multiple related operations), partial failure handling (i.e., inability to correctly roll back executed operations when an operation in a transaction fails), data integrity risks (i.e., data inconsistency may occur in complex business logic (e.g., transfers, order processing)), and business logic complexity (i.e., developers need to handle transaction logic at the application level).

[0095] Furthermore, the server generates distributed transaction operation logs based on transaction identifiers, constructing a high-performance operation log storage system that supports breakpoint resumption and fault recovery. In one optional implementation, when generating distributed transaction operation logs based on transaction identifiers, the server can perform the following operations for any one of the state change operations, such as the first state change operation: During the execution of the first state change operation, a timestamp index and a vector clock index are created for the first state change operation; then, based on the timestamp index, the vector clock index, and the operation identifier and execution data of the first state change operation, operation data for the first state change operation is generated; finally, the operation data is used as a sub-operation log and stored in a preset storage space.

[0096] Taking IndexedDB as a preset storage space as an example, the log storage algorithm for building a high-performance operation log storage system using IndexedDB can be an operation log storage and indexing algorithm. The input to the operation log storage and indexing algorithm can be operation instructions (referred to as "operation," for example, a first state change operation), and its output is the storage state (storage_result). The operation log storage and indexing algorithm can be specifically represented as follows: BEGIN / / Generate log entries (e.g., operation data for the first state change operation, i.e., sub-operation log). log_entry ← { id: operation.id, timestamp: operation.timestamp, operation: serialize(operation), vector_clock: operation.vectorClock, applied: FALSE } / / Store in IndexedDB transaction ← indexedDB.transaction(["operations"], "readwrite") object_store ← transaction.objectStore("operations") request ← object_store.add(log_entry) / / Create an index Create a timestamp index (log_entry.timestamp) Create a vector clock index (log_entry.vector_clock) / / Garbage collection inspection IF Log entry count > MAX_LOG_SIZE THEN Perform garbage collection() END IF RETURN SUCCESS END The fault recovery mechanism of a high-performance operation log storage system built on Indexed DB includes: 1. State snapshot: Regularly create complete state snapshots to accelerate recovery; 2. Incremental recovery: Replay operation logs starting from the most recent snapshot; 3. Consistency check: Verify the consistency of the state of each tab after recovery; 4. Conflict resolution: Handle operation conflicts that occurred offline during the recovery process.

[0097] S204: Apply the target state change operation to any two active tabs respectively, so that the tabs corresponding to the target state change operation are synchronized.

[0098] Based on the above method, the transformed operation (i.e., the target state change operation) is applied to all tabs (i.e., any two active tabs) to ensure that the state of all tabs is consistent.

[0099] To ensure high availability of the cross-tab data synchronization method, an adaptive primary instance tab election can be implemented. In one optional implementation, the server can obtain the tab identifiers corresponding to each active tab in the browser; each active tab may include a first active tab and multiple second active tabs, where the first active tab is any one of the active tabs. Then, a primary instance election request for the first active tab is sent to each of the multiple second active tabs; the primary instance election request may at least carry the tab identifier of the first active tab. Further, the server receives the primary instance election results returned by each of the multiple second active tabs based on its tab identifier and the primary instance election request; each primary instance election result can indicate whether the corresponding second active tab has selected the first active tab as its primary instance tab. Finally, if the number of primary instance election results indicating that the first active tab is the primary instance tab exceeds a set threshold, the first active tab is selected as the primary instance tab. The aforementioned set threshold can be half the number of active tabs in the browser plus one. In other words, if more than half of the multiple second-active tabs use the first-active tab as the primary instance tab, then the server can use the first-active tab as the primary instance tab.

[0100] For example, the above-mentioned main instance tab election algorithm can be specifically represented as follows: Algorithm: Tab Master Instance Election Algorithm Input: List of currently active tabs (active_tabs) Output: Master instance ID (master_id) BEGIN / / Election using the least-ID strategy master_id ← MIN(active_tabs.map(tab =>tab.id)) / / Initiate election voting votes ← {} FOR EACH tab IN active_tabs DO vote ← Send election request (tab, master_id) votes[tab.id] ← vote END FOR / / Count the vote results If the number of "yes" votes in `votes` is greater than or equal to `active_tabs.length / 2 + 1`, then... Broadcast master instance confirmation (master_id) IF Current tab ID = master_id THEN Start the primary instance service() END IF RETURN master_id ELSE / / The election failed, a new election is needed. RETURN (active_tabs) END IF END Based on the aforementioned tab master instance election algorithm, the master instance coordinator corresponding to the determined master instance tab can undertake master instance responsibilities such as global state management, conflict arbitration, resource coordination, and fault handling. Global state management refers to maintaining the authoritative version of the global state; conflict arbitration refers to resolving complex conflicts as the final arbitrator; resource coordination refers to managing distributed locks and transaction coordination; and fault handling refers to handling abnormal tab closures and network partitions. For example, the master instance tab can implement heartbeat detection and automatic failover, as well as provide network partition tolerance and split-brain prevention mechanisms.

[0101] Based on the tab data synchronization method steps described in steps S201-S204 above, refer to... Figure 4 The diagram shown illustrates the structural composition of a tab data synchronization engine provided in this embodiment of the application. The data synchronization engine mainly includes: an application access layer (API interface layer or top layer), an operation abstraction layer (instruction processing layer), a synchronization engine core layer (conflict resolution layer), a persistent storage layer (data management layer), and a communication coordination layer (cross-tab communication layer).

[0102] The application access layer can include: a state manager, a transaction manager, and a subscription manager. The state manager provides a declarative state management API; the transaction manager supports the definition and execution of complex transaction operations, i.e., it provides a transaction management API; and the subscription manager manages the listening and notification of state changes, providing a subscription notification API.

[0103] The operation abstraction layer may include: an operation instruction generator, an operation instruction serialization processor, an operation validity validator, and an operation route dispatcher. The operation instruction serialization processor converts state changes into serializable operation instructions, the operation validity validator verifies the legality and completeness of operation instructions, and the operation route dispatcher routes operations to the appropriate processor based on the operation type.

[0104] The core layer of the synchronization engine can include: a conflict resolution strategy adapter, a vector clock manager, a causal relationship analyzer, a conflict detector, and a consistency coordinator. The vector clock manager is used to determine event timing relationships and causal consistency, and it needs to work in conjunction with the conflict resolution strategy adapter. The conflict resolution strategy adapter is used to match the most suitable conflict resolution strategy from OT conflict resolution strategies, CRDT conflict resolution strategies, and LLW conflict resolution strategies.

[0105] The persistent storage layer may include: an operation log store, a state snapshot manager, a transaction log recorder, a data compression optimizer, and a garbage collection scheduler. The operation log store persists operation logs based on Indexed DB, the state snapshot manager periodically generates and manages state snapshots, and the garbage collection scheduler cleans up expired operation logs and snapshots.

[0106] The communication coordination layer can include: Broadcast Channel, Shared Worker, Message Queue Manager, Network Partition Detector, and Heartbeat Monitor. The communication coordination layer can support the election of a primary instance coordinator (or primary instance tab) in multiple tabs, ensure the reliable propagation of operational commands, and detect and handle abnormal tab closures.

[0107] based on Figure 4 The data synchronization engine for the tabs shown can enable the server to achieve the following: Figure 5 The conflict resolution process is shown below: 1. Operation capture phase: When a user performs an initial state change operation (e.g., CRUD operations) on a tab, the captured initial state change operation is standardized, an operation ID is generated, the operation type is recorded, and a snapshot of the current state is obtained.

[0108] 2. Timing Management Phase: Vector clock allocation, incrementing local clock, generating global timestamps, and establishing causal relationships.

[0109] 3. Conflict Detection Phase: Concurrent conflict detection. If there are no concurrent conflicts, the initial state change operation is applied directly; if there are concurrent conflicts, there are conflicts that need to be resolved.

[0110] 4. Conflict Resolution Phase: Conflict type analysis (e.g., field-level conflicts, list operation conflicts, and transaction-level conflicts), and resolution of concurrent operation conflicts based on strategy selection criteria (e.g., data type, conflict complexity, and service performance requirements) and three conflict resolution strategies (e.g., OT conflict resolution strategy, CRDT conflict resolution strategy, and LLW conflict resolution strategy).

[0111] 5. Verification and Validation Phase: Perform operation verification on initial state change operations without concurrent conflicts or state change operations after concurrent conflict transformation (i.e., target state change operations). Examples include state consistency checks and business rule verification.

[0112] 6. Persistence Phase: Operation log recording. Examples include Indexed DB persistence and vector clock indexing.

[0113] 7. Synchronous Broadcast Phase: Cross-tab broadcasting. For example, Broadcast Channel or Shared Worker.

[0114] 8. Continuous monitoring phase: Optimize feedback.

[0115] This is achieved through logging, such as Indexed DB persistence and vector clock indexes.

[0116] 7. Synchronous Broadcast Phase: Cross-tab broadcasting. For example, Broadcast Channel or Shared Worker.

[0117] 8. Continuous monitoring phase: Optimize feedback.

[0118] In this way, intelligent conflict resolution is achieved through OT conflict resolution, CRDT conflict resolution, and LLW conflict resolution strategies, ensuring that state change operations are automatically merged and data consistency is maintained when multiple tabs are modified concurrently. Furthermore, browser-side distributed transaction processing capabilities are provided, supporting atomic execution of multiple operations and automatic rollback mechanisms to guarantee the atomicity of complex business operations. Moreover, a reliable operation log mechanism is established to ensure that all state change operations are correctly recorded, propagated, and executed, reducing the risk of message loss and duplicate processing. In addition, a declarative state synchronization API is provided, allowing developers to focus on business logic without worrying about synchronization details, reducing development complexity.

[0119] In summary, in the tab data synchronization method provided in this application embodiment, when concurrent operation conflicts exist between initial state change operations initiated by a target object for any two active tabs in the browser within a set time range, a target conflict resolution strategy matching the two initial state change operations can be selected from a preset pool of candidate conflict resolution strategies. Based on the target conflict resolution strategy, the two initial state change operations are transformed to obtain a target state change operation. This target state change operation is then applied to any two active tabs to synchronize the tab states corresponding to the target state change operation. Thus, the target state change operation obtained by transforming the two initial state change operations using the target conflict resolution strategy effectively resolves concurrent conflicts arising when synchronizing tab states between any two active tabs, ensuring data consistency across different tabs.

[0120] It should be noted that the above-mentioned data synchronization method can also be used in scenarios such as blockchain, event tracing, Actor model and reactive programming, and the embodiments of this application do not specifically limit this.

[0121] Furthermore, based on the same technical concept, embodiments of this application provide a tab page data synchronization device, which is used to implement the above-described method flow of the embodiments of this application. For example, see [link to relevant documentation]. Figure 6 As shown, the data synchronization device 600 for this tab may include: a conflict detection module 601, a strategy filtering module 602, an operation conversion module 603, and a state synchronization module 604, wherein: The conflict detection module 601 is used to respond to the initial state change operations initiated by the target object against any two active tabs in the browser within a set time range, to perform concurrent operation conflict detection on the two initial state change operations, and to obtain the conflict detection result. The strategy filtering module 602 is used to filter out the target conflict resolution strategy that matches the two initial state change operations from a number of preset candidate conflict resolution strategies if the conflict detection result indicates that there is a concurrent operation conflict between the two initial state change operations. The operation conversion module 603 is used to convert two initial state change operations based on the target conflict resolution strategy to obtain the target state change operation. The state synchronization module 604 is used to apply the target state change operation to any two active tabs respectively, so that the two active tabs synchronize the tab state corresponding to the target state change operation.

[0122] In an optional embodiment, when performing concurrent operation conflict detection on two initial state change operations and obtaining the conflict detection result, the conflict detection module 601 is specifically used for: The two initial state change operations are serialized to obtain the operation instruction sequences corresponding to the two initial state change operations respectively. If the sequence similarity between two operation instruction sequences is greater than the set sequence similarity threshold, then the conflict detection result indicates that there is a concurrent operation conflict between the two initial state change operations. If the sequence similarity is less than or equal to the sequence similarity threshold, then the conflict detection result indicates that there is no concurrent operation conflict between the two initial state change operations.

[0123] In an optional embodiment, when selecting a target conflict resolution strategy that matches two initial state change operations from a plurality of preset candidate conflict resolution strategies, the strategy selection module 602 is specifically used for: Obtain the data type of the tab content corresponding to the two initial state change operations, the conflict complexity between the two initial state change operations, and the browser's service performance requirements; Based on strategy selection rules built according to data type, conflict complexity, and service performance requirements, the target conflict resolution strategy is selected from multiple candidate conflict resolution strategies.

[0124] In one optional embodiment, the multiple candidate conflict resolution strategies include: OT conflict resolution strategy, CRDT conflict resolution strategy, and LLW conflict resolution strategy; When selecting a target conflict resolution strategy from multiple candidate conflict resolution strategies based on strategy selection rules built according to data type, conflict complexity, and service performance requirements, the strategy selection module 602 is specifically used for: If the conflict complexity exceeds the set conflict complexity threshold, or if the data type is text or list, then the OT conflict resolution strategy will be used as the target conflict resolution strategy. If the service performance requirements meet the preset high service performance requirements, or if the data type is a counter type or a set type, then the CRDT conflict resolution strategy will be used as the target conflict resolution strategy. If the data type is a simple value type, then the LLW conflict resolution strategy will be used as the target conflict resolution strategy.

[0125] In an optional embodiment, after performing operation transformation on the two initial state change operations based on the target conflict resolution strategy to obtain the target state change operation, the state synchronization module 604 is further configured to: Determine the distributed transaction to which the target state change operation belongs, and generate the transaction identifier for the distributed transaction; Upon successfully acquiring the distributed lock set for each state change operation included in the distributed transaction, execute each state change operation and generate the operation log of the distributed transaction based on the transaction identifier; After each state change operation is completed, the distributed lock is released based on the transaction identifier, and the transaction commit message of the distributed transaction is broadcast to any two active tabs.

[0126] In an optional embodiment, after generating the transaction identifier for the distributed transaction, the state synchronization module 604 is further configured to: If the distributed lock is not successfully acquired, roll back at least one state change operation that has been executed in each state change operation based on the transaction identifier, release the sub-distributed lock corresponding to at least one state change operation, and broadcast the transaction rollback message of the distributed transaction to any two active tabs.

[0127] In an optional embodiment, when generating the operation log of a distributed transaction based on the transaction identifier, the state synchronization module 604 is specifically used for: For each state change operation, perform the following operations respectively: During the execution of the first state change operation, a timestamp index and a vector clock index are created for the first state change operation; wherein, the first state change operation is any one of the various state change operations; Based on the timestamp index, vector clock index, and the operation identifier and execution data of the first state change operation, the operation data of the first state change operation is generated; The operation data is treated as a sub-operation log, and the sub-operation log is stored in a preset storage space.

[0128] In an optional embodiment, the state synchronization module 604 is further configured to: Obtain the tab identifiers corresponding to each active tab in the browser; wherein each active tab includes: a first active tab and multiple second active tabs, and the first active tab is any one of the active tabs; Send a primary instance election request for the first active tab to multiple second active tabs; the primary instance election request must carry at least the tab identifier of the first active tab; Receive the primary instance election results returned by multiple second active tabs based on their tab identifiers and primary instance election requests; wherein, each primary instance election result indicates whether the corresponding second active tab has selected the first active tab as the primary instance tab; If the number of primary instance election results that indicate the first active tab as the primary instance tab exceeds a set threshold, then the first active tab will be selected as the primary instance tab.

[0129] Based on the description of the method and apparatus embodiments above, an exemplary embodiment of the present invention also provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by the at least one processor, which, when executed by the at least one processor, causes the electronic device to perform the method according to an embodiment of the present invention.

[0130] This application also provides a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a computer's processor, is used to cause the computer to perform a method according to an embodiment of this application.

[0131] This application also provides a computer program product, including a computer program, wherein the computer program, when executed by a computer's processor, is used to cause the computer to perform a method according to an embodiment of this application.

[0132] See Figure 7 The diagram shown below illustrates the structure of an electronic device 700 that can serve as a server or client in this application, and is an example of a hardware device that can be applied to various aspects of this application. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.

[0133] like Figure 7 As shown, the electronic device 700 includes a computing unit 701, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. The RAM 703 may also store various programs and data required for the operation of the device 700. The computing unit 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0134] Multiple components in electronic device 700 are connected to I / O interface 705, including: input unit 706, output unit 707, storage unit 708, and communication unit 709. Input unit 706 can be any type of device capable of inputting information to electronic device 700. Input unit 706 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of electronic device. Output unit 707 can be any type of device capable of presenting information and may include, but is not limited to, a display, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 708 may include, but is not limited to, disk and optical disk. Communication unit 709 allows electronic device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers and / or chipsets, such as Bluetooth devices, WiFi devices, worldwide interoperability for microwave access (WiMax) devices, cellular communication devices, and / or the like.

[0135] The computing unit 701 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above. For example, in some embodiments, the tab data synchronization method described above can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 700 via ROM 702 and / or communication unit 709. In some embodiments, the computing unit 701 can be configured to perform the tab data synchronization method described above by any other suitable means (e.g., by means of firmware).

[0136] The program code used to implement the methods of this application may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0137] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, erasable programmable read-only memory (EPROM) or flash memory, optical fibers, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0138] As used in this application, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or apparatus (e.g., disk, optical disk, memory, programmable logic device, PLD) used to provide machine instructions and / or data to a programmable processor, including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal used to provide machine instructions and / or data to a programmable processor.

[0139] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a cathode ray tube (CRT) or liquid crystal display (LCD) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0140] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0141] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.

[0142] Furthermore, it should be understood that the above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of the invention. Therefore, any equivalent variations made in accordance with the claims of this invention are still within the scope of this application.

Claims

1. A method for synchronizing data across tabs, characterized in that, include: In response to the initial state change operations initiated by the target object for any two active tabs in the browser within a set time range, concurrent operation conflict detection is performed on the two initial state change operations to obtain the conflict detection result. If the conflict detection result indicates that the two initial state change operations have concurrent operation conflicts, then a target conflict resolution strategy that matches the two initial state change operations is selected from a plurality of preset candidate conflict resolution strategies. Based on the target conflict resolution strategy, the two initial state change operations are transformed to obtain the target state change operation; The target state change operation is applied to any two active tabs respectively, so that the tabs synchronize the state of the tabs corresponding to the target state change operation.

2. The method as described in claim 1, characterized in that, The concurrent operation conflict detection for the two initial state change operations, and the resulting conflict detection results, include: The two initial state change operations are serialized to obtain the operation instruction sequences corresponding to the two initial state change operations respectively. If the sequence similarity between two operation instruction sequences is greater than a set sequence similarity threshold, then the conflict detection result indicates that the two initial state change operations have a concurrent operation conflict. If the sequence similarity is less than or equal to the sequence similarity threshold, then the conflict detection result indicates that there is no concurrent operation conflict between the two initial state change operations.

3. The method as described in claim 1, characterized in that, The step of selecting a target conflict resolution strategy that matches the two initial state change operations from a set of multiple candidate conflict resolution strategies includes: Obtain the data type of the tab content corresponding to the two initial state change operations, the conflict complexity between the two initial state change operations, and the service performance requirements of the browser; Based on the strategy selection rules constructed for the data type, the conflict complexity, and the service performance requirements, the target conflict resolution strategy is selected from the multiple candidate conflict resolution strategies.

4. The method as described in claim 3, characterized in that, The multiple candidate conflict resolution strategies include: Operation Transition (OT) conflict resolution strategy, Conflict Free Copy Data Type (CRDT) conflict resolution strategy, and Last Writer Wins (LLW) conflict resolution strategy. The strategy selection rules, constructed based on the data type, the conflict complexity, and the service performance requirements, select the target conflict resolution strategy from the multiple candidate conflict resolution strategies, including: If the conflict complexity is greater than the set conflict complexity threshold, or if the data type is text or list, then the OT conflict resolution strategy will be used as the target conflict resolution strategy. If the service performance requirement meets the preset high service performance requirement condition, or if the data type is a counter type or a set type, then the CRDT conflict resolution strategy will be used as the target conflict resolution strategy. If the data type is a simple value type, then the LLW conflict resolution strategy will be used as the target conflict resolution strategy.

5. The method according to any one of claims 1-4, characterized in that, After performing operation transformation on the two initial state change operations based on the target conflict resolution strategy to obtain the target state change operation, the process further includes: Determine the distributed transaction to which the target state change operation belongs, and generate the transaction identifier of the distributed transaction; Upon successfully acquiring the distributed lock set for each state change operation included in the distributed transaction, each state change operation is executed, and an operation log of the distributed transaction is generated based on the transaction identifier. After each state change operation is completed, the distributed lock is released based on the transaction identifier, and the transaction commit message of the distributed transaction is broadcast to any two active tabs.

6. The method as described in claim 5, characterized in that, After generating the transaction identifier for the distributed transaction, the method further includes: If the distributed lock is not successfully acquired, roll back at least one of the executed state change operations based on the transaction identifier and release the sub-distributed lock corresponding to the at least one state change operation, and broadcast the transaction rollback message of the distributed transaction to any two active tabs.

7. The method as described in claim 5, characterized in that, The step of generating the operation log of the distributed transaction based on the transaction identifier includes: For each of the aforementioned state change operations, the following operations are performed respectively: During the execution of the first state change operation, a timestamp index and a vector clock index are created for the first state change operation; wherein, the first state change operation is any one of the various state change operations; Based on the timestamp index, the vector clock index, and the operation identifier and execution data of the first state change operation, the operation data of the first state change operation is generated; The operation data is used as a sub-operation log, and the sub-operation log is stored in a preset storage space.

8. The method according to any one of claims 1-4, characterized in that, The method further includes: Obtain the tab identifiers corresponding to each active tab in the browser; wherein, each active tab includes: a first active tab and a plurality of second active tabs, and the first active tab is any one of the active tabs; Send a master instance election request for the first active tab to the plurality of second active tabs; the master instance election request carries at least the tab identifier of the first active tab; The system receives the tab identifier of each of the plurality of second active tabs based on the tab identifier of the second active tab and the main instance election result returned by the main instance election request; wherein, each main instance election result indicates whether the corresponding second active tab selects the first active tab as the main instance tab; If the number of primary instance election results in which the first active tab is selected as the primary instance tab exceeds a set threshold, then the first active tab is selected as the primary instance tab.

9. A data synchronization device for tab pages, characterized in that, include: The conflict detection module is used to respond to the initial state change operations initiated by the target object against any two active tabs in the browser within a set time range, and to perform concurrent operation conflict detection on the two initial state change operations to obtain the conflict detection results. The strategy filtering module is used to filter out a target conflict resolution strategy that matches the two initial state change operations from a set of multiple candidate conflict resolution strategies if the conflict detection result indicates that the two initial state change operations have concurrent operation conflicts. The operation conversion module is used to convert the two initial state change operations based on the target conflict resolution strategy to obtain the target state change operation. The state synchronization module is used to apply the target state change operation to any two active tabs respectively, so that the two active tabs synchronize the tab state corresponding to the target state change operation.

10. An electronic device, characterized in that, include: processor; A memory storing a program; wherein the program includes instructions that, when executed by the processor, cause the processor to perform the method as described in any one of claims 1-8.