m erge p olicies
play

M ERGE P OLICIES Prasun Dewan Department of Computer Science - PowerPoint PPT Presentation

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. M ERGE P OLICIES Prasun Dewan Department of Computer Science University of North Carolina at Chapel Hill dewan@cs.unc.edu

  2. 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

  3. 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

  4. 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

  5. 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

  6. 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

  7. 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

  8. C ONCURRENT O PERATION h User intention? Conflict! hi h1 ??? 8

  9. A CCEPT B OTH h Accept both as they can resolve the conflict hi h1 h1i 9

  10. A CCEPT N ONE h Accept none as there is a conflict and cannot afford a wrong merge hi h1 h 10

  11. A CCEPT S ERVER h Accept earlier (server) so later person can see it and correct it hi h1 hi 11

  12. A CCEPT C LIENT h Accept later (client) as more recent information available hi h1 h1 12

  13. 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

  14. 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

  15. 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

  16. 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

  17. G ENERAL S EQUENCES AND R EPLACE /D ELETE bat Replace(1, “c’) Delete(1, “c’) cat at cat 17

  18. 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

  19. 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

  20. T ABLES put (“bob, false) remove (“bob”) 20

  21. 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

  22. 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

  23. B EANS /R ECORDS set (“ ticketPrice ”, 24.0) set (“ ticketPrice ”, 24.1) 23

  24. 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

  25. A TOMIC M ATRIX Atomic Set () Set () Server 25

  26. 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

  27. 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

  28. 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

  29. 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

  30. 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

  31. 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

  32. 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

  33. 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

  34. M ERGE M ATRIX Covered all asynchronous merge policies known in 94-97 Had mechanisms to extend the default matrix 34

  35. 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