ApplyPatches - Moving Shadow copy to Shadow Backup

35 views
Skip to first unread message

Patrick Burrows

unread,
Apr 25, 2014, 11:46:22 AM4/25/14
to mobw...@googlegroups.com
In mobwrite_core.py in the function applyPatches at lines 309 - 313, there is this code:

    # First, update the client's shadow.
    viewobj.shadow = DMP.diff_text2(diffs)
    viewobj.backup_shadow = viewobj.shadow
    viewobj.backup_shadow_server_version = viewobj.shadow_server_version
    viewobj.changed = True

shouldn't this code instead be:
    # First, update the client's shadow.
    viewobj.backup_shadow = viewobj.shadow
    viewobj.backup_shadow_server_version = viewobj.shadow_server_version
    viewobj.shadow = DMP.diff_text2(diffs)
    viewobj.changed = True

Otherwise the backup_shadow is always equal to the shadow. My understanding is that the backup shadow should be a backup in case of a duplicate packet or some other rollback scenario.

Patrick Burrows

unread,
Apr 25, 2014, 11:56:38 AM4/25/14
to mobw...@googlegroups.com
(I mean, obviously the unit tests pass with the code the way it is, and they don't if they make the change I just mentioned -- so it is obviously this way for a reason).

Patrick Burrows

unread,
Oct 2, 2014, 5:05:14 PM10/2/14
to mobw...@googlegroups.com
FWIW, I was wrong about how this worked. The Backup_Shadow is only used in the event that the client did not receive a response. Applying the patch to both the shadow and backup is appropriate here (which is after receiving diffs and applying patches from the client side -- the backup check was already passed).
Reply all
Reply to author
Forward
0 new messages