Page MenuHomePhabricator

[RFC] Detect edit conflicts in ChangeOp instead of using diff-and-patch in EditEntity
Open, NormalPublic

Description

Currently, saving a change to an entity works something like this:

  1. Let r2 be the current revision of page Foo, and r1 an older revision.
  2. The client submits a change to Foo, with r1 as the base revision
  3. The API creates a ChangeOp to represent the modification
  4. The change op is validated and applied to r1, producing r1'
  5. r1' is diffed against r1, producing patch p
  6. p is applied to r2, producing r2'. If p does not apply cleanly, we have an edit conflict.

This procedure is rather wasteful and error prone. Alternatively, we should:

  1. Let r2 be the current revision of page Foo, and r1 an older revision.
  2. The client submits a change to Foo, with r1 as the base revision
  3. The API creates a ChangeOp to represent the modification
  4. The change op checks for conflicts, given both r1 and r2
  5. The change op is validated and applied to r2, producing r2'

Note that we should take care to make sure to supply the current revision ID we used for validation, r2, as the "$baseRevId" parameter of EntityStore::saveEntity, to avoid a race condition in case of concurrent edits.

Event Timeline

daniel created this task.Feb 8 2016, 4:05 PM
daniel raised the priority of this task from to Needs Triage.
daniel updated the task description. (Show Details)
daniel added a subscriber: daniel.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptFeb 8 2016, 4:05 PM
daniel updated the task description. (Show Details)Feb 8 2016, 4:12 PM
daniel set Security to None.
daniel updated the task description. (Show Details)
daniel updated the task description. (Show Details)Feb 8 2016, 4:44 PM
daniel updated the task description. (Show Details)
Johsthao closed this task as a duplicate of T126250: <spam>.Feb 8 2016, 6:24 PM
matmarex reopened this task as Open.Feb 8 2016, 6:32 PM
thiemowmde renamed this task from Detect edit conflicts in ChangeOp instead of using diff-and-patch in EditEntity to [RFC] Detect edit conflicts in ChangeOp instead of using diff-and-patch in EditEntity.Feb 16 2016, 1:54 PM
thiemowmde added a project: Proposal.
thiemowmde added subscribers: thiemowmde, aude, hoo, JanZerebecki.
Lydia_Pintscher triaged this task as Normal priority.Feb 19 2016, 9:57 AM

@thiemowmde – Did you mean to tag this as TechCom-RFC or do you not want their input? Right now it's just generally tagged as TechCom-RFC, which essentially is merely "needs discussion".

Not sure what TechCom is. this is internal to Wikidata and doesn't need input from outside of the project. The TechCom-RFC tag is probably not helpful then.

Bene added a subscriber: Bene.Mar 10 2016, 10:27 AM