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

m erge p olicies
SMART_READER_LITE
LIVE PREVIEW

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?


slide-1
SLIDE 1

MERGE POLICIES

Prasun Dewan Department of Computer Science University of North Carolina at Chapel Hill dewan@cs.unc.edu

slide-2
SLIDE 2

2

CONCURRENT INTERACTION

PC 1 PC 2 4 5 5

I,6, ? I,6, ?

l u n c 1 2 3 4 5 h ? 6 l u n c 1 2 3 4 5 h 6 ?

Insert same character at same position?

slide-3
SLIDE 3

3

CONCURRENT INTERACTION

PC 1 PC 2 4 5 5

I,6, ? I,6, ?

l u n c 1 2 3 4 5 h ? 6 l u n c 1 2 3 4 5 h 6 ? ? 7 7 ?

Insert same character at same position? Duplicate character!

I,6, ? I,7, ?

Work preserving Does not meet “user intention”

slide-4
SLIDE 4

4

CONCURRENT INTERACTION

PC 1 PC 2 4 5 5

I,6, ? I,6, ?

l u n c 1 2 3 4 5 h ? 6 l u n c 1 2 3 4 5 h 6 ? InsertOperation TransformInsertInsert (InsertOperation Remote, InsertOperation L ocal) { Operation RemoteT = Remote.clone(); if (Remote.index == Local.index && Remote.element.equal(Local.element)) return NullOperation if (Remote.index > Local.index || (Remote.index === Local.index && Remote.id < Local.id)) RemoteT.index = Remote.index + 1; return RemoteT ; }

Meets “user intention”

slide-5
SLIDE 5

5

GOAL OF CONSISTENCY

 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?

slide-6
SLIDE 6

6

ASSUMPTIONS AND INTENTION ISSUE

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?

slide-7
SLIDE 7

7

MERGE MATRIX FOR INSERTABLE SEQUENCES

Sequence Insert(#) Insert(#) Server Operation at Same index Client operation at same index Cell Choices? A particular algorithm can give the application and/or user a subset of choices in the merge matrix Describes merge semantics of different insert operations at same index Default value for flexible algorithm? Merge matrix not relevant when indices are different or insertions are the same

slide-8
SLIDE 8

8

CONCURRENT OPERATION

h hi h1 ??? User intention? Conflict!

slide-9
SLIDE 9

9

ACCEPT BOTH

Accept both as they can resolve the conflict h hi h1 h1i

slide-10
SLIDE 10

10

ACCEPT NONE

Accept none as there is a conflict and cannot afford a wrong merge h hi h1 h

slide-11
SLIDE 11

11

ACCEPT SERVER

Accept earlier (server) so later person can see it and correct it h hi h1 hi

slide-12
SLIDE 12

12

ACCEPT CLIENT

Accept later (client) as more recent information available h hi h1 h1

slide-13
SLIDE 13

13

MERGE MATRIX FOR INSERTABLE SEQUENCES

Sequence Insert(#) Insert(#) Server Operation at Same index Client operation at same index Server Client None Both Cell Choices A particular algorithm can give the application and/or user a subset of choices in the merge matrix Describes merge semantics of different insert operations at same index Default value for flexible algorithm? Merge matrix not relevant when indices are different or insertions are the same

slide-14
SLIDE 14

14

DEFAULT FOR INSERTABLE SEQUENCES

Sequence Insert(#) Insert(#) Both Default value for flexible algorithm Delete and Modify Operations? Server Client None Both

slide-15
SLIDE 15

15

MERGE MATRIX FOR INSERTABLE SEQUENCES

Sequence Insert(#) Delete(#) Replace(#) Insert(#) Delete(#) Replace(#) Server Client None Both Describes merge semantics of different sequence operations at same index Default values for flexible algorithm?

slide-16
SLIDE 16

16

DEFAULTS FOR GENERAL SEQUENCES

Deletes at the same index always the same

  • peration and hence

NoOp Sequence Insert(#, a) Delete(#) Replace(#) Insert(#, b) Both Both Both Delete(#) Both NoOp Server Replace(#) Both Client Server Server Client None Both Replacement means it is relevant and perhaps should not be deleted Tables?

slide-17
SLIDE 17

17

GENERAL SEQUENCES AND REPLACE/DELETE

bat cat at

Replace(1, “c’) Delete(1, “c’)

cat

slide-18
SLIDE 18

18

TABLE MATRIX

Table Put (key) Delete(key) Put (key) Delete(key) Server Client None Both Describes merge semantics of different table operations at key Default values? Assume operations at different keys are non conflicting

slide-19
SLIDE 19

19

DEFAULTS FOR GENERAL TABLES

Putting the same value at the same key is a NoOP Table Put (key) Delete(key) Put (key) Server Client Delete(key) Server NoOp Server Client None Both

slide-20
SLIDE 20

20

TABLES

put (“bob, false) remove (“bob”)

slide-21
SLIDE 21

21

RECORD MATRIX

Putting the same value at the same property is a NoOP Record Set (Property) Set (Property) Server Client None Both Describes merge semantics of different record operations at same property Default value?

slide-22
SLIDE 22

22

DEFAULTS FOR RECORD

Record Set (Property) Set (Property) Server Server Client None Both Accept earlier (server) so later person can see it and correct it

slide-23
SLIDE 23

23

BEANS/RECORDS

set (“ticketPrice”, 24.0) set (“ticketPrice”, 24.1)

slide-24
SLIDE 24

24

ATOMIC OBJECTS

Accept earlier (server) so later person can see it and correct it 23.5 24 24.1 24.1

set (24.0) set (24.1)

slide-25
SLIDE 25

25

ATOMIC MATRIX

Atomic Set () Set () Server

slide-26
SLIDE 26

26

GENERAL MERGE MATRIX

Type Operation1 … OperationN Operation1 Default11 ... Default1N … … … … OperationN DefaultN1 … DefaultNN Some type-specific operand (index, key, value) whose value determines when two dissimilar operations are compared Server Client None Both

slide-27
SLIDE 27

27

ASYNCHRONOUS BUFFERED CHANGES

Joe UNC Joe UNC- Joe UNC-C Joe UNC-CH Joe UNCC Joe UNCC-CH

Can we extend model to add the option of accepting all of server or client changes to affiliation? “Joe” and “UNC” are sequences in a record with name and affiliation properties Need to capture multiple levels of changes

slide-28
SLIDE 28

28

HIERARCHICAL DOCUMENT

Record J

  • e

U N C Sequence Set(Affiliation) I(4, ‘-’) Name Affiliation Sequence Record J

  • e

U N C Sequence Name Affiliation Sequence Record J

  • e

U N C Sequence Name Affiliation Sequence

  • C

H C I(5, ‘C’) I(6, ‘H’) Set(Affiliation) I(4, ‘C’)

slide-29
SLIDE 29

29

LEVEL 1 STEP

Record J

  • e

U N C Sequence Set(Affiliation) I(4, ‘-’) Name Affiliation Sequence Record J

  • e

U N C Sequence Name Affiliation Sequence Record J

  • e

U N C Sequence Name Affiliation Sequence C C H C I(5, ‘C’) I(6, ‘H’) Set(Affiliation) I(4, ‘C’) U N C C

Hot to go to next level? Record Set (Property) Set (Property) Server

slide-30
SLIDE 30

30

MERGE NEXT LEVEL OPTION

Type Operation1 … OperationN Operation1 Default11 ... Default1N … … … … OperationN DefaultN1 … DefaultNN Server Client None Both Merge

slide-31
SLIDE 31

31

LEVEL 1 STEP

Record J

  • e

U N C Sequence Set(Affiliation) I(4, ‘-’) Name Affiliation Sequence Record J

  • e

U N C Sequence Name Affiliation Sequence Record J

  • e

U N C Sequence Name Affiliation Sequence

  • C

H C I(5, ‘C’) I(6, ‘H’) Set(Affiliation) I(4, ‘C’)

Record Set (Property) Set (Property) Merge

U N C C

slide-32
SLIDE 32

32

LEVEL 2 STEP

Record J

  • e

U N C Sequence Set(Affiliation) I(4, ‘-’) Name Affiliation Sequence Record J

  • e

U N C Sequence Name Affiliation Sequence Record J

  • e

U N C Sequence Name Affiliation Sequence

  • C

H C I(5, ‘C’) I(6, ‘H’) Set(Affiliation) I(4, ‘C’) U N C C

Hot to go to next level? Sequence Insert(#) Delete(#) Replace(#) Insert(#) Both Both Both Delete(#) Both NoOp Server Replace(#) Both Client Server

  • C

H

slide-33
SLIDE 33

33

InsertOperation TransformInsertInsert (InsertOperation R, InsertOperation L) { Operation RT = deepClone(); if ((R.index > L.index) || (R.index === L.index && R.isServer())) RT.index = R.index + 1; return RT ; }

MERGE MATRIX VS. MERGE PROCEDURES

InsertOperation TransformInsertInsert (InsertOperation R, InsertOperation L) { Operation RT = deepClone(); if ((R.index > L.index) || (R.index === L.index && !R.isServer())) RT.index = R.index + 1; return RT ; }

Sequence Insert(#) Delete(#) Replace(#) Insert(#) Delete(#) Replace(#) Server Client None Both Procedural Declarative Declarative is higher level allows easy customization But it is less expressive

slide-34
SLIDE 34

34

MERGE MATRIX

Covered all asynchronous merge policies known in 94-97 Had mechanisms to extend the default matrix

slide-35
SLIDE 35

35

REFERENCE FOR MERGE MATRIX

 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

  • perations or level