A multi-terminal data synchronization control system and method
By using a multi-terminal data synchronization control system, the problems of data loss and inaccurate conflict identification in multi-terminal data synchronization are solved, thereby improving data consistency and reliability and reducing manual processing costs.
Patent Information
- Application Number
- CN202611501074.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-24
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies for multi-device data synchronization suffer from problems such as data loss, inaccurate conflict identification, concurrency risks caused by the separation of merging calculation and database writing, repeated operations caused by network retries, lack of preconditions and irreversible constraints for business state migration, and insufficient conflict feedback.
A multi-terminal data synchronization control system is adopted, including modules such as session recognition, version snapshot, semantic patch generation, idempotency control, concurrent operation extraction, operation commutability judgment, field dependency graph, state transition constraints, patch replay and atomic commit. The system saves the modification intent through semantic operation patches, identifies commutability and field dependencies, ensures the legality of state transitions, and realizes atomic write and confirmation level management.
It avoids data loss caused by overwriting entire objects, identifies commutative set operations, identifies cross-field business semantic conflicts, prevents implicit state rollback, eliminates the risk of overwriting during concurrency, reduces manual processing costs, and ensures data consistency and reliability.
Smart Images

Figure CN123178359A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of multi-terminal data synchronization, and in particular to a multi-terminal data synchronization control system and method. Background Technology
[0002] Educational platforms typically provide an administrative backend, a web interface for teachers, a mobile interface for parents, and mobile and tablet interfaces for students. The same user may edit the same notifications, assessment tasks, student files, data collection forms, or review records on multiple devices. Some devices may also save drafts offline and submit them after network connectivity is restored.
[0003] Existing solutions typically employ whole-object overriding, last-committer-only, or simple optimistic locking. Whole-object overriding loses valid modifications already made by other endpoints; simple optimistic locking only prompts for a refresh and retry; judging conflicts solely by field name fails to identify business dependencies between two fields. For example, if one endpoint modifies a task deadline while another publishes the task, even though the fields are different, the publication operation depends on a valid deadline, still constituting a semantic conflict. For fields like attachment lists and recipient sets, even if two endpoints modify the same field, they can safely merge the changes if they add different elements separately, and should not be automatically classified as conflicts.
[0004] The defects and shortcomings of the existing technology are as follows:
[0005] 1. Only the final object is saved; the baseline on which the terminal is based and the actual operational intent are not saved.
[0006] 2. Modifications to the same field are always considered conflicts; operations on commutable sets cannot be recognized.
[0007] 3. Comparing only whether fields overlap cannot detect semantic conflicts caused by cross-field dependencies;
[0008] 4. The lack of preconditions and irreversible constraints for business state migration may cause the state to revert to its previous state on older terminals.
[0009] 5. Merging calculations and database writes are separated, and version changes may occur again during concurrency.
[0010] 6. Network retries may result in repeated appending of attachments, repeated submission of answers, or repeated triggering of state transitions;
[0011] 7. The synchronization notification only informs that "the data has been updated," and other terminals cannot determine whether the local draft can continue to be replayed;
[0012] 8. Conflict feedback lacks baseline values, current values, submitted values, and conflict reasons, resulting in high manual processing costs. Summary of the Invention
[0013] This invention aims to address at least one of the technical problems existing in the prior art. To this end, this invention proposes a multi-terminal data synchronization control system and method, which can convert terminal editing into replayable semantic operation patches; comprehensively determine real conflicts by considering field overlap, operation commutativity, field dependency, and state constraints; retain compatible modifications when versions have changed; and ensure eventual consistency across multiple terminals through atomic writing, idempotent control, and confirmation levels.
[0014] One embodiment of the present invention provides a multi-terminal data synchronization control system, comprising: a session identification module for identifying online editing sessions of the same business object on multiple terminals; a version snapshot module for returning the current version and snapshot summary to the terminal when the target business object is opened on the terminal; a semantic patch generation module, located on the terminal side, for converting the terminal's editing operations relative to the baseline snapshot into semantic operation patches, wherein the semantic operation patch includes at least a request identifier, a terminal identifier, an object identifier, a baseline version, an operation sequence number, an operation type, a target path, a previous value summary, operation parameters, and a expected summary of dependent fields; a patch receiving and idempotency module for receiving semantic operation patches submitted by the terminal and identifying duplicate requests using an idempotency key composed of an object identifier, a terminal identifier, a request identifier, and an operation sequence number; a concurrent operation extraction module for extracting a set of effective server operations located between the terminal baseline version and the server's current version from the object change log when the terminal baseline version is inconsistent with the server's current version; and an operation commutability judgment module for determining the operation type. The system includes: a type and target path module to determine whether terminal and server operations are interchangeable; a field dependency graph module to maintain field dependency graphs by object type and identify cross-field semantic conflicts; a state transition constraint module to perform state transition legality checks on state type operations, allowing only explicit transition operations to change the state and prohibiting implicit state rollback; a patch replay and atomic commit module to apply replayable operations to the current object in causal order and perform atomic writes with the current version number as the update condition, committing successfully and generating a new version only when the version condition is met; if the version condition is not met, the current execution plan is abandoned and recalculation is triggered; an incremental distribution and confirmation module to send version update notifications and summaries of effective operations to online terminals and receive terminal confirmation to advance the confirmation level; a conflict package generation module to generate structured conflict packages for operations that cannot be automatically processed and return them to the terminal; and an audit backtracking module to record baseline snapshots, committed versions, difference fields, automatic merging results, conflict adjudication processes, and the final effective version.
[0015] According to some embodiments of the present invention, the operation types include at least scalar assignment, set addition, set deletion, attachment addition, attachment deletion, and state transition.
[0016] According to some embodiments of the present invention, the determination rules of the operation commutability determination module include: operations that add different elements to the same set are commutable; deletion of element X and addition of element Y are commutable when X≠Y; different assignments to the same scalar field are not commutable; deletion of a parent node and modification of a child node are not commutable; deletion and renaming of the same attachment are not commutable.
[0017] According to some embodiments of the present invention, the field dependency graph maintained by the field dependency graph module is G=(F,E), where F is the set of fields and E is the set of dependency edges; when the server concurrently changes the path set and there is an intersection with the dependency field closure of the current terminal operation, the system recalculates the preconditions according to the current object, and if the preconditions fail, it is determined to be a semantic conflict.
[0018] According to some embodiments of the present invention, the state transition constraint module is configured with a state transition graph, and the legality of the state transition is determined as follows: there is a legal transition edge between the current state and the target state, the preconditions are met, and the operator's permissions are satisfied. State transition can only be performed when all three conditions are met simultaneously.
[0019] According to some embodiments of the present invention, the atomic write performed by the patch replay and atomic commit module is as follows: the current version number is used as the update condition, and the write is successful only when the current version of the database is consistent with the version on which the execution plan is based, and the version number is incremented; the operation log, new version record and idempotent result are in the same database transaction as the data update.
[0020] According to some embodiments of the present invention, the incremental distribution and confirmation module sends at least the new version number, the summary of the effective operation, and the set of invalid paths to the terminal; if the terminal has local uncommitted operations, the new version number is used as the new baseline to re-verify the uncommitted patch.
[0021] According to some embodiments of the present invention, the structured conflict package generated by the conflict package generation module includes at least the conflict path, baseline value summary, current server value, terminal submitted value, related server operations, dependency failure items, and recommended processing method.
[0022] Another embodiment of the present invention provides a multi-terminal data synchronization control method, comprising the following steps: S1, when a terminal opens a target business object, a baseline snapshot is acquired and saved; S2, the terminal converts the editing operation relative to the baseline snapshot into a semantic operation patch and submits it to the server; S3, the server uses an object identifier, a terminal identifier, a request identifier, and an operation sequence number to construct an idempotent key for duplicate request identification; S4, the server reads the current version, and when the terminal baseline version is inconsistent with the current version, extracts the set of effective server operations between the two; S5, the terminal operations and server operations are sequentially judged for path relationship, operation commutability, and field dependency. S6. Perform replayable operations on the current object in causal order; S7. Perform atomic writes with the current version number as the update condition, and only commit successfully and generate a new version when the version condition is met; S8. Send version update notifications and summaries of effective operations to the online terminal, and receive terminal confirmation to advance the confirmation level; S9. Generate structured conflict packets for operations that cannot be automatically processed and return them to the terminal, and record audit logs; When atomic writes fail, the system rereads the increment and verifies it again within the preset maximum number of retries. If the number of retries exceeds the preset threshold, the circuit breaker mechanism is triggered, retries are stopped and a conflict packet is returned.
[0023] According to some embodiments of the present invention, the field dependency conflict identification in step S5 includes: when the server concurrently changes the path set and the dependency field closure of the current terminal operation have an intersection, the preconditions are recalculated according to the current object, and if the preconditions fail, it is determined to be a semantic conflict.
[0024] According to some embodiments of the present invention, the semantic operation patch described in step S2 is submitted according to atomic groups. Operations within the same atomic group are subjected to conflict detection on the server side in units of atomic groups. When any operation within the group has an unresolved conflict with concurrent operations on the server, all operations in the entire atomic group are not executed.
[0025] According to some embodiments of the present invention, the field dependency conflict identification in step S5 includes: the system maintains the field dependency graph G=(F,E) and calculates its transitive closure; when the server concurrently changes the path set and the transitive closure of the dependent field of the current terminal operation intersects, the preconditions are recalculated according to the current object.
[0026] According to some embodiments of the present invention, the state transition legality verification in step S5 includes: configuring a state transition graph in the system, wherein the transition edge includes at least the initial state, the target state, the preconditions, the operator's permissions, and the side effect identifier; and synchronously verifying the integrity and legality of the fields involved in the side effect identifier during the state transition execution, and rejecting the state transition operation as a whole if the side effect verification fails.
[0027] According to some embodiments of the present invention, step S8 further includes: the system pushes concurrent editing activity information of the current object to the terminal; the terminal calculates a conflict probability score based on the difference between the local confirmed water level and the current version of the server, the historical conflict rate of the terminal on the target object, and the concurrent editing activity of the current object; when the score exceeds a preset threshold, the server actively pushes the change summary of the current version for the terminal to pre-merge before the terminal formally submits the change.
[0028] The embodiments of the present invention achieve at least the following beneficial effects:
[0029] 1. Save modification intent with semantic operation patches to avoid losing valid data due to overwriting the entire object;
[0030] 2. Operations on the same field are subdivided based on commutativity, and can automatically merge and add to collections, etc., to make compatible modifications.
[0031] 3. Identifying business semantic conflicts between different fields through field dependency graphs is superior to simple field intersection judgment;
[0032] 4. The state can only be changed through explicit transition operations with preconditions to prevent implicit rollback of the old terminal state;
[0033] 5. The merge results are committed atomically via version conditions, eliminating the risk of overwriting due to concurrency during computation;
[0034] 6. Idempotent keys prevent network retries from causing duplicate attachments, duplicate records, or duplicate side effects;
[0035] 7. Confirm that water level and incremental replay support offline terminal recovery and secure log compression;
[0036] 8. Structured conflict packages provide the sources of conflict and the basis for handling them, reducing the cost of manual verification.
[0037] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0038] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:
[0039] Figure 1 This is a schematic block diagram of the system modules according to an embodiment of the present invention.
[0040] Figure 2 This is a flowchart illustrating the method according to an embodiment of the present invention. Detailed Implementation
[0041] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0042] In the description of this invention, "several" means one or more, "multiple" means two or more, "greater than," "less than," and "exceeding" are understood to exclude the stated number, while "above," "below," and "within" are understood to include the stated number. The use of "first" and "second" in the description is merely for distinguishing technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the order of the indicated technical features.
[0043] Reference Figure 1 This invention provides a multi-terminal data synchronization control system, which includes a session identification module, a version snapshot module, a semantic patch generation module, a patch receiving and idempotency module, a concurrent operation extraction module, an operation commutativity judgment module, a field dependency graph module, a state transition constraint module, a patch replay and atomic commit module, an incremental distribution and confirmation module, a conflict packet generation module, and an audit backtracking module. Overall, the system operates according to the signal path of "baseline snapshot acquisition → semantic patch generation → idempotency identification → concurrent interval extraction → path and commutativity judgment → field dependency and state constraint verification → patch replay → atomic commit → incremental distribution and confirmation".
[0044] The session identification module establishes a session upon terminal login and assigns a unique identifier to each terminal session to identify concurrent editing of the same business object across multiple terminals. When a terminal opens a target business object, the version snapshot module reads the current version and snapshot summary of the object from the server and returns it to the terminal as the baseline for subsequent editing. The business object snapshot includes at least the object identifier, object type, version number, field content summary, status value, schema version, and generation time. The schema version identifies the field structure and validation rule version of the business object; when business rules are upgraded, the system can convert the path and data type of old patches based on the schema version.
[0045] After the terminal obtains a baseline snapshot, the user can begin editing. At this time, the semantic patch generation module located on the terminal side converts each user's editing operation into a structured patch. The semantic patch includes at least the request identifier RequestId, terminal identifier DeviceId, object identifier ObjectId, baseline version Vbase, operation sequence number OpSeq, operation type OpType, target path Path, beforeHash, operation parameter Payload, and expected conditional summaries of dependent fields Preconditions. In addition, the semantic patch also includes the client schema version SchemaVersion, which is used to identify the object schema version used by the terminal when generating the patch, so that the server can perform compatibility judgment in schema upgrade scenarios. The operation type includes at least scalar assignment, text replacement, set addition, set deletion, mapping item update, attachment addition, attachment deletion, and state transition. Among them, text replacement is used for text editing operations performed by paragraph or structured node, and mapping item update is used to update the value corresponding to a specific key in the key-value pair structure.
[0046] After the terminal submits the semantic operation patch to the server, the patch receiving and idempotency modules construct an idempotency key using ObjectId+DeviceId+RequestId+OpSeq. If the idempotency key already has a processing result, the original result is returned directly without re-execution. After idempotency identification, the concurrent operation extraction module reads the server's current version Vcurrent. If the terminal's baseline version Vbase equals the server's current version Vcurrent, the patch can directly enter constraint verification; if they are different, the set of effective server operations OpsServer within the version range (Vbase, Vcurrent) is extracted from the object change log as the object for this concurrent comparison. Here, the extracted operations are those already effective on the server side, rather than simply comparing the differences between two final objects, in order to accurately reconstruct the server-side change process.
[0047] After extracting the set of concurrent operations, the operation commutativity judgment module determines the target path relationship and commutativity between the current terminal operation op_c and each server operation op_s. For mutually independent paths, field dependency judgment can be directly performed; for paths that are the same or have an inclusion relationship, the operation commutativity matrix is queried to determine whether the two operations are semantically commutative. The judgment rules of the operation commutativity matrix include: operations that add different elements to the same set are commutative; deleting element X and adding element Y are commutative when X≠Y; different assignments to the same scalar field are not commutative; deleting a parent node and modifying a child node are not commutative; deleting and renaming the same attachment are not commutative.
[0048] Regardless of whether the paths are independent, the system needs to further determine field dependencies. The field dependency graph module maintains a field dependency graph G=(F,E) by object type, where F is the set of fields, E is the set of dependency edges, and the edge f_i→f_j indicates that field f_i needs to be re-validated before operation field f_j takes effect. To determine whether concurrent changes on the server side will affect the dependency conditions of the current operation, the system calculates the dependency recheck set. Let the direct target path of the current operation be Target(op_c), and all fields that this operation depends on constitute the dependency field closure DepClosure(op_c); the set of fields actually changed by the server within the concurrent interval is Changed(OpsServer), then the dependency recheck set is RecheckSet = DepClosure(op_c) ∩ Changed(OpsServer). When this set is not empty, the system recalculates the preconditions according to the current object; if the preconditions fail, it is determined to be a semantic conflict, even if the target fields of the two operations are different. In a preferred embodiment, the field dependency graph module further includes a dependency graph dynamic update submodule, used to automatically mine potential dependencies between fields based on historical conflict handling records. Let C_fail be the number of validation failures of field f_j after modification of field f_i within a historical time period T, and C_total be the total number of modifications to field f_i. Then, the confidence of a candidate dependency edge is calculated as C_fail / C_total. When confidence exceeds a preset threshold (e.g., 0.7), the system automatically generates a candidate dependency edge f_i→f_j, which is then included in the field dependency graph after administrator confirmation. Different object types maintain independent dependency graph versions, and the old version of the dependency graph is converted to the new version via a mapping table during schema upgrades.
[0049] If the patch includes state-type operations, it also needs to be validated by the state transition constraint module. The state transition constraint module is configured with a state transition graph, and each transition edge includes at least the starting state, target state, preconditions, operator permissions, and side-effect identifiers. Let the current state be S_current, the patch request migrate to S_target, and the state graph edge set be E_state. The validity of the state transition is determined by StateValid = ((S_current, S_target) ∈ E_state)∧ Preconditions(CurrentObject) ∧ AuthorityValid; the state transition can only be executed if all three conditions are met. There are no ordinary assignment operations on state fields; only explicit transition operations are allowed to change them. This avoids implicit state rollback when the old snapshot is submitted along with the entire form. In a preferred embodiment, the state transition constraint module also supports compensatory transaction semantics. The state transition operation is executed in two phases: the first phase executes the state transition, updating the state fields to the target state and marking the transition transaction status as "pending confirmation"; the second phase executes side-effect validation, verifying the completeness and validity of the fields involved in the side-effect identifier. If the second-stage verification fails, the system automatically performs a compensation operation, restoring the state to its pre-migration value based on the inverse operation of the migration edge, and marking the migration transaction status as "compensated". The execution record of the compensation operation is written to the audit log.
[0050] After passing the above verification, the patch replay and atomic commit modules apply replayable operations to the current object in causal order, generating an execution plan. "Causal order" refers to the dependencies between operations; for example, a state transition operation must be executed only after its dependent fields have passed verification. Subsequently, atomic writes use the current version number as the update condition, and the write succeeds only if the current database version matches the version on which the execution plan is based. Operation logs, new version records, and idempotent results are all within the same database transaction as the data update. In a preferred implementation, if an atomic write fails, the system rereads the increment and verifies it again within a preset maximum number of retries N (N≥3). If the number of retries is exceeded, a circuit breaker mechanism is triggered, retrying is abandoned, the current commit request is marked as "requires manual processing," and a structured conflict packet containing the latest server version, the client's commit content, and all conflict detection records is returned to the terminal.
[0051] After successful write, the incremental distribution and confirmation module sends the new version number, a summary of effective operations, and a set of invalid paths to online terminals. Upon terminal confirmation, the server advances the terminal's confirmation level. Only after all valid terminals have crossed a certain log interval or exceeded the retention period can the relevant historical snapshots and logs be compressed. In a preferred embodiment, the incremental distribution and confirmation module also pushes concurrent editing activity information of the current object to the terminal, including the number of currently online terminals and the frequency of recent version changes. Before submission, the terminal calculates a conflict probability score P_conflict = α·ΔV + β·R_history + γ·A_concurrent based on the difference ΔV between its local confirmation level and the server's current version, the terminal's historical conflict rate R_history on the target object, and the current object's concurrent editing activity A_concurrent. Here, α, β, and γ are preset weighting coefficients. When P_conflict exceeds a preset threshold, the server proactively pushes a change summary of the current version before the terminal's formal submission. The terminal pre-simulates the merge result locally and displays a preview to the user. After the user confirms the preview result, the terminal regenerates the patch based on the latest version and submits it.
[0052] If the operation cannot be handled automatically, the conflict packet generation module generates a structured conflict packet and returns it to the terminal. The structured conflict packet includes at least the conflict path, baseline value summary, current server value, terminal submitted value, related server operations, dependency failures, and recommended handling methods. In a preferred embodiment, the system also establishes a three-layer conflict detection and adjudication architecture. L1 field-level conflicts refer to different modifications to the same field, handled by the operation commutativity judgment module based on the operation exchange matrix; L2 record-level conflicts refer to cross-field dependency conflicts within the same record, handled by the field dependency graph module based on the field dependency graph and transitive closures; L3 cross-object-level conflicts refer to semantic dependencies between different business objects, handled by the global dependency graph module. The system maintains a global dependency graph G_Global=(O, R) according to business object type, where O is the set of object types, R is the set of dependencies between objects, and the edge o_i→o_j indicates that changes to object o_i require re-verification of the relevant fields of object o_j. Conflicts at different levels are routed to the corresponding adjudication engines, with L3 conflict adjudication results taking precedence over L2 and L1. During the above process, the audit backtracking module records baseline snapshots, commit versions, difference fields, automatic merging results, conflict resolution process, and the final effective version for auditing and backtracking purposes.
[0053] For the current operation `op_c` and the set of concurrent server operations, the system also employs a comprehensive conflict determination rule. The condition for automatic replayability of the current operation is defined as `Replayable = IdempotentNew AND SchemaCompatible AND PathCompatible AND ConstraintValid`, where `IdempotentNew` indicates that the operation has not been hit by an idempotent key and is being processed for the first time; `SchemaCompatible` indicates that the client schema version is compatible with the server's current schema version; `PathCompatible` indicates that independent or overlapping operations on the target path are interchangeable; and `ConstraintValid` indicates that field dependency conditions, state transition conditions, and object integrity conditions are all met. If any of the above conditions are not met, the operation cannot be written directly and must enter the conflict package handling process.
[0054] Reference Figure 2 This invention provides a multi-terminal data synchronization control method, comprising the following steps:
[0055] Step S1: Establish an editing session and baseline snapshot; when the terminal opens the target object, the server returns the current version of Vbase, the snapshot summary of Hbase, and the object schema version. The terminal saves the baseline snapshot, and subsequent edits are performed relative to this snapshot record.
[0056] Step S2: Generate semantic operation patches; the terminal converts user actions into ordered operations. Text editing generates replacement operations by paragraph or structured node; when it cannot be further subdivided, it generates scalar assignment operations carrying a summary of the previous value.
[0057] Step S3: Receive the patch and perform idempotency identification;
[0058] The server uses an idempotent key consisting of ObjectId, DeviceId, RequestId, and OpSeq. If this key already has a result, the original result is returned directly.
[0059] Step S4: Determine the concurrent operation range; the server reads the current version Vcurrent. If Vbase=Vcurrent, the patch can enter constraint verification; if they are different, extract the set of operations that have taken effect within the version range (Vbase, Vcurrent) OpsServer from the object change log.
[0060] Step S5: Determine path relationships and operation commutativity; the system determines whether the target path of the current operation op_c is the same as, contains the ancestor of, contains the child nodes of, or is independent of each other. For independent paths, continue to perform field dependency checks; for the same paths, query the operation exchange matrix.
[0061] Step S6: Identify semantic conflicts based on the field dependency graph; the system maintains a field dependency graph G=(F,E) by object type. Let the dependency field closure of the current operation be DepClosure(op_c), and the set of concurrent server change paths be Changed(OpsServer), then the dependency recheck set is RecheckSet = DepClosure(op_c) ∩ Changed(OpsServer). When RecheckSet is not empty, the system recalculates the preconditions based on the current object. Failure of the preconditions indicates a semantic conflict.
[0062] In a preferred embodiment of step S6, the system also automatically updates the field dependency graph based on historical conflict handling records. Let C_fail be the number of validation failures of field f_j after modification of field f_i within a historical time period T, and C_total be the total number of modifications to field f_i. Then, the confidence of the candidate dependency edge is calculated as C_fail / C_total. When confidence exceeds a preset threshold, the system automatically generates a candidate dependency edge f_i→f_j and incorporates it into the field dependency graph. Different object types maintain independent versions of the dependency graph.
[0063] Step S7: Execute state transition constraints; validate state operations using a state transition graph. Transition edges define not only the start and end points, but also preconditions, operator permissions, and side effect identifiers. State transition validity is determined by: StateValid = ((S_current, S_target) ∈ E_state) ∧ Preconditions(CurrentObject) ∧ AuthorityValid. Ordinary field patches submitted by older terminals must not implicitly carry over the current state with the old state; explicit state transitions can only be executed if a corresponding transition edge exists in the current state and the preconditions are met.
[0064] In a preferred embodiment of step S7, the state transition operation is performed in two phases: the first phase executes the state transition and marks the transition transaction status as "pending confirmation"; the second phase performs side effect verification. If the side effect verification fails, the system automatically performs a compensation operation, restoring the state to its pre-migration state according to the inverse operation of the transition edge, and marking the transition transaction as "compensated". The compensation record is written to the audit log.
[0065] Step S8: Generate an execution plan and replay the patch; the system categorizes operations into three types: those that can be directly replayed, those that are replayed after transformation, and those that cannot be automatically processed. Replayable operations are applied to the Vcurrent object in causal order.
[0066] Step S9: Atomic commit with version conditions; the system performs condition updates within the same transaction. If the database version is not equal to Vcurrent when calculating the execution plan, it indicates a new commit has occurred. The system rereads the increment and reconstructs the execution plan within a limited number of attempts.
[0067] In a preferred embodiment of step S9, the system sets a maximum number of retries N (N≥3). If the maximum number of retries is exceeded, a circuit breaker mechanism is triggered, retrying is abandoned, the currently submitted request is marked as "requires manual processing," and a structured conflict packet is returned to the terminal.
[0068] Step S10: Incremental Distribution and Confirmation Level Advancement; The server sends Vnew, a summary of effective operations, and a set of failed paths to the online terminal. After the terminal confirms, the server advances the confirmation level for that terminal.
[0069] In a preferred embodiment of step S10, the incremental distribution and confirmation module also pushes concurrent editing activity information to the terminal. Before submission, the terminal calculates the conflict probability score P_conflict = α·ΔV + β·R_history + γ·A_concurrent. When P_conflict exceeds a preset threshold, the server actively pushes a summary of the current version changes, and the terminal pre-merges the changes locally and displays a preview to the user.
[0070] Step S11: Generate a structured conflict package; if it cannot be handled automatically, the server returns the conflict path, baseline value summary, current server value, terminal submitted value, related server operations, dependency failure items, and recommended handling method.
[0071] In one specific scenario, both the teacher's computer and mobile app are based on assessment task version V10. The computer changes the deadline from June 10th to June 20th and submits, generating V11 on the server. The mobile app executes a "publish task," with its patch targeting the status field. Although it doesn't directly modify the deadline, the publish patch carries preconditions: the deadline summary equals the value in V10, the deadline is later than the current time, and the receiving range is not empty. The server detects that the mobile app's baseline is V10 and extracts the deadline change from V10 to V11. A dependency edge exists in the field dependency graph where "deadline points to publish status," so the publish conditions are re-validated. If the new deadline is still valid, the publish operation can be replayed on V11 and V12 generated; if the computer changes the deadline to an already past time, the preconditions fail, and the server returns a dependency conflict package. In another scenario, both the computer and mobile app are based on notification version V20. The computer adds attachment A to the attachment set, submits, and generates V21; the mobile app adds attachment B to the same attachment set. This invention identifies two operations as adding to a set, but with different element identifiers. Therefore, they are interchangeable. The server replays the operation of adding B on V21, generating V22 which contains both A and B, without overwriting the entire attachment array. If the mobile device deletes attachment A, then "add A" and "delete A" are not interchangeable, and the system returns an element-level conflict.
[0072] In another scenario, a school administrator publishes a data collection task from "Editing" to "In Progress" on a web interface, generating V31. Another offline tablet, still based on V30, modifies the task description, while its local object retains the old "Editing" state. When the tablet submits, it only generates a semantic patch for "Modifying Task Description," without assigning a state value. Therefore, the server can replay the description modification on V31 and generate V32, with the state still "In Progress." If the tablet explicitly requests to migrate to "Editing," and there is no normal migration edge from "In Progress to Editing" in the state graph, the state operation is rejected. Furthermore, after a terminal submits an operation to add a recipient, it does not receive a response due to network interruption. It then retryes with the same RequestId, and the server returns the initially generated version based on the idempotent key, without adding a recipient again. While the server is calculating the merge result, another terminal submits a new version. The number of records affected by the database condition update is zero, the execution plan is discarded, and the server re-extracts the increment and verifies it again.
[0073] In a preferred embodiment, the school administrator updates the task status from "Editing" to "Published" on the computer, while simultaneously submitting a task description modification and status rollback request on the mobile device based on the old version. The server recognizes the mobile device's request as the first submission using an idempotent key and enters the normal processing flow. The incremental distribution and confirmation module detects that the mobile device's confirmation level lags behind the current version by two versions, calculating a conflict probability score of 0.75, exceeding the threshold of 0.6. It proactively pushes a summary of the current version's changes to the mobile device, which then pre-merges the changes and displays a preview to the user. L1 field-level detection finds that the task description modification and the server's concurrent changes do not overlap, determining that automatic merging is possible. L2 record-level detection finds a dependency conflict between the status rollback request and the current status "Published," initiating state transition constraint verification. The state transition constraint module performs a two-phase verification. In the first phase, it finds that there is no valid transition edge between "Published → Editing," directly rejecting the status rollback. The task description modification, being unrelated to the status field, is still automatically merged and written. The system records the "status field verification failure" event during this processing and updates the confidence statistics of the field dependency graph. If an atomic submission fails three times consecutively due to concurrent changes during the entire process, the system will trigger the circuit breaker mechanism and return a structured conflict packet instead of retrying indefinitely.
[0074] This invention also supports various exception and boundary handling. For example, if a terminal submits a semantic patch after network recovery, and the log corresponding to the terminal's baseline version has been compressed, the server returns the latest snapshot, and the terminal reconstructs the patch based on the locally stored operation log and resubmits it; when an idempotent key is hit, the initial processing result is returned, and no further side-effect operations are performed; gaps are detected by operation sequence number OpSeq for the same device, and if a gap exists, the server temporarily stores subsequent operations, waiting for the missing operations to be transmitted before processing them in sequence; patches in the same batch can be divided into atomic groups, and if any operation within a group conflicts with concurrent operations on the server in a way that cannot be automatically resolved, all operations in the entire atomic group are not executed, and different atomic groups are not executed. Groups can return either success or conflict results; except for recovery operations, all modification requests for deleted objects return object lifecycle conflict, and the system does not automatically rebuild the object; when the client's schema version lags behind the server's current schema version, the old path that can be mapped is replayed after being transformed by the schema mapping table, and a schema conflict is returned when a field has been deleted or its semantics have changed; incremental distribution failure does not affect committed versions, and the terminal pulls the missing incremental updates from the server based on the confirmation level after reconnection; the system retains a snapshot of the compression point and its summary when compressing logs to ensure that old terminals can verify their baseline version and rebuild patches after reconnection.
[0075] Although specific embodiments are described herein, those skilled in the art will recognize that many other modifications or alternative embodiments are also within the scope of this disclosure. For example, any of the functions and / or processing capabilities described in connection with a particular device or component can be performed by any other device or component. Furthermore, while various exemplary embodiments and architectures have been described according to embodiments of this disclosure, those skilled in the art will recognize that many other modifications to the exemplary embodiments and architectures described herein are also within the scope of this disclosure.
[0076] The foregoing description, with reference to block diagrams and flowcharts of systems, methods, systems, and / or computer program products according to exemplary embodiments, has described certain aspects of this disclosure. It should be understood that one or more blocks in the block diagrams and flowcharts, as well as combinations of blocks in the block diagrams and flowcharts, can be implemented by executing computer-executable program instructions, respectively. Similarly, according to some embodiments, some blocks in the block diagrams and flowcharts may not need to be executed in the order shown, or may not all need to be executed. Furthermore, additional components and / or operations beyond those shown in the blocks in the block diagrams and flowcharts may exist in some embodiments.
[0077] Therefore, blocks in block diagrams and flowcharts support combinations of means for performing a specified function, combinations of elements or steps for performing a specified function, and program instruction means for performing a specified function. It should also be understood that each block in a block diagram and flowchart, and combinations of blocks in block diagrams and flowcharts, can be implemented by a dedicated hardware computer system or a combination of dedicated hardware and computer instructions that performs a specific function, element, or step.
[0078] The program modules, applications, etc., described herein may include one or more software components, including, for example, software objects, methods, data structures, etc. Each such software component may include computer-executable instructions that, in response to execution, cause at least a portion of the functionality described herein (e.g., one or more operations of the exemplary methods described herein) to be performed.
[0079] Software components can be coded using any of a variety of programming languages. An exemplary programming language could be a low-level programming language, such as assembly language associated with a specific hardware architecture and / or operating system platform. Software components including assembly language instructions may need to be converted into executable machine code by an assembler before being executed by the hardware architecture and / or platform. Another exemplary programming language could be a higher-level programming language that is portable across multiple architectures. Software components including higher-level programming languages may need to be converted into an intermediate representation by an interpreter or compiler before execution. Other examples of programming languages include, but are not limited to, macro languages, shell or command languages, job control languages, scripting languages, database query or search languages, or report writing languages. In one or more exemplary embodiments, a software component containing instructions from one of the above-described programming language examples can be executed directly by the operating system or other software components without first being converted into another form.
[0080] Software components can be stored as files or other data storage structures. Software components of similar type or related function can be stored together in a specific directory, folder, or library. Software components can be static (e.g., pre-defined or fixed) or dynamic (e.g., created or modified at runtime).
[0081] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.
Claims
1. A multi-terminal data synchronization control system, characterized in that, include: The session recognition module is used to identify online editing sessions of the same business object on multiple terminals; The version snapshot module is used to return the current version and snapshot summary to the terminal when the target business object is opened in the terminal; The semantic patch generation module, located on the terminal side, is used to convert the terminal's editing operations relative to the baseline snapshot into semantic operation patches. The semantic operation patch includes at least the request identifier, terminal identifier, object identifier, baseline version, operation sequence number, operation type, target path, previous value summary, operation parameters, and expected summary of dependent fields. The patch receiving and idempotency module is used to receive semantic operation patches submitted by the terminal and identify duplicate requests by using an idempotency key composed of object identifier, terminal identifier, request identifier and operation sequence number. The concurrent operation extraction module is used to extract the set of effective server operations between the terminal baseline version and the current server version from the object change log when the terminal baseline version is inconsistent with the current server version. The operation interchangeability determination module is used to determine whether terminal operations and server operations are interchangeable based on the operation type and target path. The field dependency graph module is used to maintain a field dependency graph by object type and identify cross-field semantic conflicts. The State Transition Constraint module is used to validate the legality of state transitions for state type operations. It only allows changes to the state through explicit transition operations and prohibits implicit state rollback. The patch replay and atomic commit module is used to apply replayable operations to the current object in causal order and perform atomic writes with the current version number as the update condition. The commit is successful and a new version is generated only when the version condition is met. If the version condition is not met, the current execution plan is abandoned and a recalculation is triggered. The incremental distribution and confirmation module is used to send version update notifications and summaries of effective operations to online terminals, and to receive terminal confirmations to advance the confirmation level. The conflict packet generation module is used to generate structured conflict packets for operations that cannot be handled automatically and return them to the terminal. The audit backtracking module is used to record baseline snapshots, commit versions, difference fields, automatic merging results, conflict resolution process, and the final effective version.
2. The multi-terminal data synchronization control system according to claim 1, characterized in that, The operation types include at least scalar assignment, set addition, set deletion, attachment addition, attachment deletion, and state transition.
3. The multi-terminal data synchronization control system according to claim 1, characterized in that, The rules for determining the commutability of operations include: operations that add different elements to the same set are commutable; operations that delete element X and add element Y are commutable when X≠Y; different assignments to the same scalar field are not commutable; operations that delete a parent node and modify a child node are not commutable; and operations that delete and rename the same attachment are not commutable.
4. The multi-terminal data synchronization control system according to claim 1, characterized in that, The field dependency graph maintained by the field dependency graph module is G=(F,E), where F is the set of fields and E is the set of dependency edges. When the server concurrently changes the path set and there is an intersection with the dependency field closure of the current terminal operation, the system recalculates the preconditions according to the current object. If the preconditions fail, it is determined to be a semantic conflict.
5. The multi-terminal data synchronization control system according to claim 1, characterized in that, The state transition constraint module is configured with a state transition graph. The legality of state transition is determined as follows: there is a legal transition edge between the current state and the target state, the preconditions are met, and the operator's permissions are satisfied. State transition can only be executed when all three conditions are met.
6. The multi-terminal data synchronization control system according to claim 1, characterized in that, The atomic write performed by the patch replay and atomic commit module is as follows: the current version number is used as the update condition, and the write is successful only when the current version of the database is consistent with the version on which the execution plan is based, and the version number is incremented; the operation log, new version record and idempotent result are in the same database transaction as the data update.
7. The multi-terminal data synchronization control system according to claim 1, characterized in that, The incremental distribution and confirmation module sends at least the new version number, the summary of the effective operations, and the set of invalid paths to the terminal; if there are uncommitted local operations on the terminal, the new version number is used as the new baseline to re-verify the uncommitted patches.
8. The multi-terminal data synchronization control system according to claim 1, characterized in that, The structured conflict package generated by the conflict package generation module includes at least the conflict path, baseline value summary, current server value, terminal submitted value, related server operations, dependency failure items, and recommended handling methods.
9. A multi-terminal data synchronization control method, used in the system as described in any one of claims 1 to 8, characterized in that, include: S1. When the terminal opens the target business object, obtain and save a baseline snapshot; S2. The terminal converts the editing operation relative to the baseline snapshot into a semantic operation patch and submits it to the server; S3. The server uses an idempotent key composed of object identifier, terminal identifier, request identifier and operation sequence number to identify duplicate requests. S4. The server reads the current version. When the terminal baseline version is inconsistent with the current version, it extracts the set of effective server operations between the two. S5. Sequentially perform path relationship judgment, operation interchangeability judgment, field dependency conflict identification, and state transition legality verification on terminal operations and server operations. S6. Apply replayable operations to the current object in causal order; S7. Perform an atomic write using the current version number as the update condition. The commit will succeed and a new version will be generated only when the version condition is met. S8. Send a version update notification and a summary of the effective operations to the online terminal, and receive terminal confirmation to advance the confirmation level; S9. For operations that cannot be processed automatically, a structured conflict packet is generated and returned to the terminal, and an audit log is recorded. When an atomic write fails, the system rereads the increment and verifies it again within the preset maximum number of retries. If the number of retries exceeds the preset threshold, the circuit breaker mechanism is triggered, retries are stopped, and a conflict packet is returned.
10. The multi-terminal data synchronization control method according to claim 9, characterized in that, The field dependency conflict identification in step S5 includes: when the server concurrently changes the path set and the dependency field closure of the current terminal operation have an intersection, the preconditions are recalculated according to the current object, and if the preconditions fail, it is determined to be a semantic conflict.
