M ERGE P OLICIES Prasun Dewan Department of Computer Science University of North Carolina at Chapel Hill dewan@cs.unc.edu
C ONCURRENT I NTERACTION 5 4 0 0 0 5 0 0 PC PC 1 2 I,6, ? I,6, ? Insert same character at same position? 1 2 3 4 5 6 1 2 3 4 5 6 l u n c h ? l u n c h ? 2
C ONCURRENT I NTERACTION 4 5 0 0 0 5 0 0 PC PC 1 2 I,6, ? I,6, ? I,7, ? Insert same character at same position? I,6, ? 1 2 3 4 5 6 7 1 2 3 4 5 6 7 Duplicate l u n c h ? ? l u n c h ? ? character! Work preserving Does not meet “user intention” 3
C ONCURRENT I NTERACTION InsertOperation TransformInsertInsert (InsertOperation Remote, InsertOperation L ocal) { Operation Remote T = Remote.clone(); 4 5 0 0 0 5 0 0 if (Remote.index == Local.index && Remote.element.equal(Local.element)) return NullOperation PC PC if (Remote.index > Local.index || 1 2 (Remote.index === Local.index && Remote.id < Local.id)) Remote T .index = Remote.index + 1; I,6, ? return Remote T ; I,6, ? } 1 2 3 4 5 6 1 2 3 4 5 6 l u n c h ? l u n c h ? Meets “user intention” 4
G OAL OF C ONSISTENCY At quiescence (no user interacting) all displays are the same When concurrent command is executed, could ignore it and clear object Meets TP1 (and TP2!) Meets user intention How to describe what it is? Even if we cannot describe it, how to describe what algorithm does More than one “reasonable” merge acceptable Application-specific merger Application-specific merge procedure Declarative scheme? 5
A SSUMPTIONS AND I NTENTION I SSUE One-level sequence with inserts only. Inserts at different positions are both accepted (as define by initial transformation functions). If both users insert the same element at the same position, only one is executed. What happens when both users insert different elements at the same position? 6
M ERGE M ATRIX F OR I NSERTABLE S EQUENCES Cell Choices? Server Operation at Same index Sequence Insert(#) Client operation Insert(#) at same index Default value for flexible algorithm? Describes merge Merge matrix not A particular algorithm can semantics of different relevant when indices give the application and/or insert operations at are different or user a subset of choices in same index insertions are the same the merge matrix 7
C ONCURRENT O PERATION h User intention? Conflict! hi h1 ??? 8
A CCEPT B OTH h Accept both as they can resolve the conflict hi h1 h1i 9
A CCEPT N ONE h Accept none as there is a conflict and cannot afford a wrong merge hi h1 h 10
A CCEPT S ERVER h Accept earlier (server) so later person can see it and correct it hi h1 hi 11
A CCEPT C LIENT h Accept later (client) as more recent information available hi h1 h1 12
M ERGE M ATRIX F OR I NSERTABLE S EQUENCES Cell Choices Server Operation at Same index Server Sequence Insert(#) Client Client operation Insert(#) at same index None Both Default value for flexible algorithm? Describes merge Merge matrix not A particular algorithm can semantics of different relevant when indices give the application and/or insert operations at are different or user a subset of choices in same index insertions are the same the merge matrix 13
D EFAULT FOR I NSERTABLE S EQUENCES Server Sequence Insert(#) Client Insert(#) Both None Both Default value for flexible algorithm Delete and Modify Operations? 14
M ERGE M ATRIX FOR I NSERTABLE S EQUENCES Sequence Insert(#) Delete(#) Replace(#) Server Insert(#) Client Delete(#) None Replace(#) Both Describes merge semantics of different sequence operations at same index Default values for flexible algorithm? 15
D EFAULTS FOR G ENERAL S EQUENCES Sequence Insert(#, a) Delete(#) Replace(#) Server Insert(#, b) Both Both Both Client Delete(#) Both NoOp Server None Replace(#) Both Client Server Both Deletes at the same Replacement means it index always the same is relevant and perhaps operation and hence Tables? should not be deleted NoOp 16
G ENERAL S EQUENCES AND R EPLACE /D ELETE bat Replace(1, “c’) Delete(1, “c’) cat at cat 17
T ABLE M ATRIX Table Put (key) Delete(key) Server Put (key) Client Delete(key) None Both Assume operations at different keys are non conflicting Default values? Describes merge semantics of different table operations at key 18
D EFAULTS FOR G ENERAL T ABLES Table Put (key) Delete(key) Server Put (key) Server Client Client Delete(key) Server NoOp None Both Putting the same value at the same key is a NoOP 19
T ABLES put (“bob, false) remove (“bob”) 20
R ECORD M ATRIX Record Set (Property) Server Set (Property) Client None Both Describes merge Putting the same value Default value? at the same property is semantics of different record operations at a NoOP same property 21
D EFAULTS FOR R ECORD Record Set (Property) Server Set (Property) Server Client None Both Accept earlier (server) so later person can see it and correct it 22
B EANS /R ECORDS set (“ ticketPrice ”, 24.0) set (“ ticketPrice ”, 24.1) 23
A TOMIC O BJECTS 23.5 Accept earlier (server) so later person can see it set (24.1) set (24.0) and correct it 24 24.1 24.1 24
A TOMIC M ATRIX Atomic Set () Set () Server 25
G ENERAL M ERGE M ATRIX Type Operation 1 … Operation N Server Operation 1 Default 11 ... Default 1N Client … … … … None Operation N Default N1 … Default NN Both Some type-specific operand (index, key, value) whose value determines when two dissimilar operations are compared 26
A SYNCHRONOUS B UFFERED C HANGES Joe UNC Joe UNC- Joe UNCC Joe UNC-C Joe UNC-CH Joe UNCC-CH Need to capture “Joe” and “UNC” are Can we extend model to add multiple levels of sequences in a record the option of accepting all of changes with name and affiliation server or client changes to properties affiliation? 27
H IERARCHICAL D OCUMENT Record Name Affiliation Sequence Sequence Set(Affiliation) Set(Affiliation) J o e U N C I(4, ‘ - ’) I(5, ‘C’) I(6, ‘H’) I(4, ‘C’) Record Record Name Affiliation Name Affiliation Sequence Sequence Sequence Sequence J o e U N C - C H J o e U N C C 28
L EVEL 1 S TEP Record Hot to go to next Name Affiliation level? Sequence Sequence Set(Affiliation) Set(Affiliation) J o e U N C I(4, ‘ - ’) I(5, ‘C’) I(6, ‘H’) I(4, ‘C’) Record Set (Property) Set (Property) Server Record Record Name Affiliation Name Affiliation Sequence Sequence Sequence Sequence J o e U N C C C H J o e U N C C 29 U N C C
M ERGE N EXT L EVEL O PTION Type Operation 1 … Operation N Server Operation 1 Default 11 ... Default 1N Client … … … … None Operation N Default N1 … Default NN Both Merge 30
L EVEL 1 S TEP Record Name Affiliation Sequence Sequence Set(Affiliation) Set(Affiliation) J o e U N C I(4, ‘ - ’) I(5, ‘C’) I(6, ‘H’) I(4, ‘C’) Record Set (Property) Set (Property) Merge Record Record Name Affiliation Name Affiliation Sequence Sequence Sequence Sequence J o e U N C - C H J o e U N C C 31 U N C C
L EVEL 2 S TEP Record Hot to go to next Name Affiliation level? Sequence Sequence Set(Affiliation) Set(Affiliation) J o e U N C I(4, ‘ - ’) I(5, ‘C’) I(6, ‘H’) I(4, ‘C’) Sequence Insert(#) Delete(#) Replace(#) Insert(#) Both Both Both Record Record Delete(#) Both NoOp Server Name Affiliation Name Affiliation Replace(#) Both Client Server Sequence Sequence Sequence Sequence J o e U N C - C H J o e U N C C 32 U N C C - C H
M ERGE M ATRIX VS . M ERGE P ROCEDURES InsertOperation TransformInsertInsert (InsertOperation R, InsertOperation L) { Operation R T = deepClone(); if ((R.index > L.index) || (R.index === L.index && R.isServer())) R T .index = R.index + 1; Procedural return R T ; } InsertOperation TransformInsertInsert (InsertOperation R, InsertOperation L) { Operation R T = deepClone(); if ((R.index > L.index) || Declarative is higher level (R.index === L.index && !R.isServer())) R T .index = R.index + 1; allows easy customization return R T ; } But it is less expressive Declarative Sequence Insert(#) Delete(#) Replace(#) Server Insert(#) Client Delete(#) None Replace(#) 33 Both
M ERGE M ATRIX Covered all asynchronous merge policies known in 94-97 Had mechanisms to extend the default matrix 34
R EFERENCE FOR M ERGE M ATRIX Munson and Dewan ‘94, ’97 Showed that all merge procedures at that time for spreadsheets, file systems, databases, .. could be supported using the merge matrix Merge matrix entry could itself have merge procedures in it for a specific combination of operations or level 35
Recommend
More recommend