C ONCURRENT E DITING : I NITIAL S TATE (R EVIEW ) 4 0 4 0 PC PC - - PowerPoint PPT Presentation

c oncurrent e diting i nitial s tate r eview
SMART_READER_LITE
LIVE PREVIEW

C ONCURRENT E DITING : I NITIAL S TATE (R EVIEW ) 4 0 4 0 PC PC - - PowerPoint PPT Presentation

O PERATION T RANSFORMATION Prasun Dewan Department of Computer Science University of North Carolina at Chapel Hill dewan@cs.unc.edu I MMEDIATELY D ELIVERING C ONCURRENT M ESSAGES A tree of message paths exist Create vector time stamp and


slide-1
SLIDE 1

OPERATION TRANSFORMATION

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

slide-2
SLIDE 2

2

IMMEDIATELY DELIVERING CONCURRENT MESSAGES

 A tree of message paths exist  Create vector time stamp and buffer for each leaf in

the path

 When a message arrives see if its vector time stamp

> one of the vector time stamps, put in the buffer for that vector time stamp

 Otherwise create a new vector time stamp and

buffer (VectorTimeStampCopiedAndNewBufferCreated) deliver the message after flagging concurrency

slide-3
SLIDE 3

3

CONCURRENCY: DIFFERENT SUCCESSOR

1 1 1 1 1 1 1 1

v1 = (a1, .. an) Not successor! is a successor of for all j != i, aj== bj There exists 1 ≤ i ≤ n, ai== 1 + bi

slide-4
SLIDE 4

4

CONCURRENT SUCCESSORS

1 1 1 1 1 1 1 1

v1 = (a1, .. an) v2 =(b1, .. bn) is a successor of for all j != i, aj <= bj There exists 1 ≤ i ≤ n, ai== 1 + bi

Need to buffer messages along each path

slide-5
SLIDE 5

5

DELIVERING CONCURRENT MESSAGES

 A DAG of message paths exist  Create buffer for each leaf in the DAG  When a message arrives find a buffer  See if a buffer exists in which the head message is not

concurrent with this message

Otherwise create a new buffer

 Insert message at appropriate position in buffer  Process buffer as before but now use a different

successor function

 (b1, b2, …. bn) is successor of (a1, a2, … an) if for some j, bj

= aj + 1 and for all i!= j, bi <= ai

 Takes into account that a message on a different path

from an ancestor of the current time stamp node arrived

slide-6
SLIDE 6

6

DELIVERING CONCURRENT MESSAGES – FULL SEARCH

 A DAG of message paths exist  Create a single buffer for all messages  When a message arrives put it in the buffer at some

position

 Process buffer as before  but now use a different successor function

 (b1, b2, …. bn) is successor of (a1, a2, … an) if for some j, bj = aj + 1

and for all i != j, bi <= ai

 Takes into account that a message on a different path from an

ancestor of the current time stamp node arrived

 Search the entire buffer rather than look at the head of

the buffer

slide-7
SLIDE 7

7

OPERATION TRANSFORMATION

slide-8
SLIDE 8

8

DELIVERING CONCURRENT MESSAGES – FULL SEARCH

 A DAG of message paths exist  Create a single buffer for all messages  When a message arrives put it in the buffer at some

position

 Process buffer as before  but now use a different successor function

 (b1, b2, …. bn) is successor of (a1, a2, … an) if for some j, bj = aj + 1

and for all i != j, bi <= ai

 Takes into account that a message on a different path from an

ancestor of the current time stamp node arrived

 Search the entire buffer rather than look at the head of

the buffer

Are causality guarantees among concurrent paths enough?

slide-9
SLIDE 9

9

CONCURRENT EDITING: INITIAL STATE

PC 1 PC 2 l n c 1 2 3 4 l n c 1 2 3 4 4 4 h h

slide-10
SLIDE 10

10

CONCURRENT INSERTIONS

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

slide-11
SLIDE 11

11

IMMEDIATELY DELIVERING CONFLICTING REMOTE OPERATION

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

I,2, u I,5, ?

slide-12
SLIDE 12

12

PARTIALLY ORDERED VECTOR TIME STAMPS

v = (x1, .. xn) at Site Sj  Site Sj has received xi messages from Site Si for all 1≤ i ≤ n v1= (a1, .. an) v2 = (b1, .. bn)

< 

for all 1≤ i ≤ n, ai ≤ bi for some 1 ≤ i ≤ n, ai < bi v1= (a1, .. an) v2 = (b1, .. bn)

== 

for all 1≤ i ≤ n, ai == bi v1= (a1, .. an) v2 = (b1, .. bn)

|| 

for some 1 ≤ j ≤ n, aj > bj for some 1 ≤ i ≤ n, ai < bi Concurrent Input

slide-13
SLIDE 13

13

CONCURRENT INTERACTION

PC 1 PC 2 PC 3

v1 v2 v3

1 1

Causal time stamps allow computer to determine concurrent actions Do not impose a common or total

  • rder, which

inherently does not exist. Total order often important Broadcast supporting total

  • rder called

atomic broadcast

slide-14
SLIDE 14

14

ASYNCHRONOUS BROADCAST

PC 1 PC 2

  • 1. Perform operation o
  • 2. toOthers send the operation using peer to peer

communication Done?

PC 3

Done?

  • 3. Perform received operation (in causal order)

Done? No coordination before performing operation Atomic asynchronous, application-unaware broadcast impossible Synchronous and Coordination?

slide-15
SLIDE 15

15

SYNCHRONOUS RELAYED BROADCAST

PC 1 PC 2

  • 1. Perform operation o
  • 2. toAll send the
  • peration using relayed

communication Done?

PC 3

  • 3. perform operation on its

receipt

Relayer “Done”

Done? Done? Each site performs operations in the same sequence assuming ordered unicast Delay (extra hop) state of operation issue not same as state of execution, though all sites are consistent

slide-16
SLIDE 16

16

ORDERING WITH ATOMIC BROADCAST

PC 1 PC 2 l n c 1 2 3 4 l n c 1 2 3 4 h h

I,2, u I,5, ? I,2, u I,5, ?

slide-17
SLIDE 17

17

FIRST OPERATION EXECUTES

PC 1 PC 2 l u n 1 2 3 4 l u n 1 2 3 4 c c 5 h 5 h

I,5, ? I,5, ?

slide-18
SLIDE 18

18

SECOND OPERATION EXECUTES

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

Context of operation not the same as when it was issued Common state but “intention” violation Worse outcome than intention violation?

slide-19
SLIDE 19

19

CONCURRENT INTERACTION: DELETE, MODIFY

PC 1 PC 2 l 1 l 1

D,1 M,1, L

slide-20
SLIDE 20

20

ATOMIC BROADCAST ORDERING

PC 1 PC 2 l 1 l 1

D,1 M,1, L M,1, L D,1

slide-21
SLIDE 21

21

FIRST OPERATION EXECUTES

PC 1 PC 2

M,1, L M,1, L

slide-22
SLIDE 22

22

SECOND OPERATION CAUSES EXCEPTION

PC 1 PC 2

M,1, L

Context of operation not the same as when it was issued Common behavior but exception Can concurrency control explain or fix this?

M,1, L

ArrayIndexOutOfBounds

slide-23
SLIDE 23

23

CONCURRENT EDITING: INITIAL STATE (REVIEW)

PC 1 PC 2 l n c 1 2 3 4 l n c 1 2 3 4 4 4 h h

slide-24
SLIDE 24

24

CONCURRENT INSERTIONS (REVIEW)

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

slide-25
SLIDE 25

25

DELIVERING CONFLICTING REMOTE OPERATION (REVIEW)

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

I,2, u I,5, ?

slide-26
SLIDE 26

26 lnch lnch lnch

SYNCHRONOUS RELAYED BROADCAST (REVIEW)

PC 1 PC 2

lunch

PC 3 Relayer I, 2, u

lunch lunch Delay (extra hop) state of operation issue not same as state of execution, though all sites are consistent

I, 2, u

slide-27
SLIDE 27

27

ORDERING WITH ATOMIC BROADCAST (REVIEW)

PC 1 PC 2 l n c 1 2 3 4 l n c 1 2 3 4 h h

I,2, u I,5, ? I,2, u I,5, ?

slide-28
SLIDE 28

28

SECOND OPERATION EXECUTES (REVIEW)

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

Context of operation not the same as when it was issued Common state but “intention” violation

slide-29
SLIDE 29

29

ATOMIC BROADCAST ORDERING

PC 1 PC 2 l 1 l 1

D,1 M,1, L M,1, L D,1

slide-30
SLIDE 30

30

SECOND OPERATION CAUSES EXCEPTION

PC 1 PC 2

Context of operation not the same as when it was issued Common behavior but exception ArrayIndexOutOfBounds ArrayIndexOutOfBounds

slide-31
SLIDE 31

31

SINGLE-USER CASE: SELECTIVE UNDO

PC 1 l 1

D, 1 M,1, L

Undoing non last

  • peration is done

in a context different from the

  • ne in which it was

executed

L

undo

slide-32
SLIDE 32

32

CONCURRENCY CONTROL?

PC 1 PC 2

I,2, u I,5, ? I,2, u I,5, ?

Can concurrency control explain or fix this?

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

slide-33
SLIDE 33

33

OPTIMISTIC TRANSACTION

PC 1 PC 2

I,2, u I,5, ? I,2, u I,5, ?

W1(Text) R2(Text) R1(Text) W2(Text) Validate Write Validate Abort Non serializable transactions If we employed optimistic CC we would abort, but no CC was employed, hence divergent state

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

slide-34
SLIDE 34

34

VALIDATION/CHECKING TIME (REVIEW)

 Early  Pessimistic  Late  Optimistic  Merging

slide-35
SLIDE 35

35

EARLY VS. LATE VALIDATION (REVIEW)

 Per-operation checking

and communication

  • verhead

 No compression possible.  Prevents inconsistency.  Tight coupling:

incremental results shared

 Not functional if

disconnected

 Unless we lock very

conservatively, limiting concurrency.

 No per-operation checking,

communication overhead

 Compression possible.  Inconsistency possible

resulting in lost work.

 Allows parallel

development.

 Functional when

disconnected.

slide-36
SLIDE 36

36

MERGING (REVIEW)

 Like optimistic  Allow operation to execute without local checks  But no aborts  Merge conflicting operations  E.g. insert 1,a || insert 2, b = insert 1, a; insert 3, b

|| insert 2, b; insert 1, a

 Serializability not guaranteed  Ignore reads  New transaction to replace conflicting transactions  Strange results possible

 E.g. concurrent dragging of an object in whiteboard

 App-specific

slide-37
SLIDE 37

37

TRANSFORMING REMOTE OPERATION

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

I,2,u I,6,?

Sometimes semantics can be used to transform concurrent operations to give desired result Bound to text buffer?

slide-38
SLIDE 38

38

ASSUME INDEXED SEQUENCE DATA TYPE

Lunch? Lunch? No, Yes

I(nsert) (index, element)

Element 1 Element 2 Element 3

Operations

1 2 3

Arbitrary element type

1 2 3

String element type (message sequence)

l u n c h 1 2 3 4 5

char element type (text editors) D(elete)( index))

slide-39
SLIDE 39

39

CONCURRENT INORDER INTERACTION

PC 1 PC 2 Received Buffer1 Received Buffer2 4 1 5

No need for received buffer Assume only two sites Assume messages are received in order from

  • ther site

Still need time stamp to discover concurrency

I,2,u I,6,?

General rule for transforming operation

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

slide-40
SLIDE 40

40

TRANSFORMATION FUNCTION

PC 1 PC 2 4 1 5

Increment index of remote

  • peration if it has higher

index before processing it

I,2,u I,6,?

Based on index of concurrent local operation, L Remote operation, R transformed! RT = Transform (R, L) Apply RT instead of R at local site

Local Buffer2 Local Buffer1

4 1 I,5,? 5 I,2,u

R Transformed if RT != R Need local buffer to store L rather than remote buffer

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

slide-41
SLIDE 41

41

CONTROL ALGORITHM: SINGLE LOCAL CONCURRENT OPERATION

PC 1 PC 2 4 1 5

I,2,u I,6,?

Given Remote op R, concurrent with exactly one local op L RT = Transform (R, L) Execute RT Site.TimeStamp.increment(R.site)

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

slide-42
SLIDE 42

42

OT SYSTEM COMPONENTS

Transformation function: Handles single local and concurrent operations Control algorithm: Calls transformation function, processed buffer and local time stamps Both must be correct.

slide-43
SLIDE 43

43

INCLUSION TRANSFORMATION

Operation Transform (Operation R, Operation L) { if (R.type == Insert && L.type == Insert) return TransformInsertInsert (R,L); else …. } Operation TransformInsertInsert (InsertOperation R, InsertOperation L) { Operation RT = R.deepCopy(); if (R.index > L.index) RT.index = R.index + 1 return RT ; }

Correct? Correctness criterion? Transform includes effect of second operand on first

  • perand

Names indicate we include effect of earlier executed local operation on later received concurrent remote

  • peration

Other uses in which first and second operands are not remote and local operations Called inclusion transformation

slide-44
SLIDE 44

44

CORRECTNESS CRITERION

Operation Transform (Operation R, Operation L) { if (R.type == Insert && L.type == Insert) return TransformInsertInsert (R,L); else …. } Operation TransformInsertInsert (InsertOperation R, InsertOperation L) { Operation RT = R.deepCopy(); if (R.index > L.index) RT.index = R.index + 1 return RT ; } O1 T(O2, O1) O2 T(O1, O2)

Constraint for Transform

S S S12 S12 S12 S1 S2 S

Distributed Merge == ==?

slide-45
SLIDE 45

45

INITIAL STATE

PC 1 PC 2 4 5 5 l u n c 1 2 3 4 l u n c 1 2 3 4 5 5 h h

slide-46
SLIDE 46

46

INSERTION AT SAME INDEX

PC 1 PC 2 4 5 1 6

I,6,?

Local Buffer2 Local Buffer1

5 1 I,6,! 6 I,6,? I,6,!

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

slide-47
SLIDE 47

47

INSERTION AT SAME INDEX

PC 1 PC 2 4 5 1 6

I,6,?

Local Buffer2 Local Buffer1

5 1 I,6,! 6 I,6,? I,6,!

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

I,6,! I,6,?

InsertOperation TransformInsertInsert (InsertOperation Remote, InsertOperation L ocal) { Operation RemoteT = Remote.clone(); if (Remote.index > Local.index) RemoteT.index = Remote.index + 1 return RemoteT ; }

Neither operation is transformed

slide-48
SLIDE 48

48

INSERTION AT SAME INDEX ALGORITHM

PC 1 PC 2 4 6 1 6 1

I,6,?

Local Buffer2 Local Buffer1

5 1 I,6,! 6 I,6,? I,6,!

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

I,6,! I,6,?

Neither operation is transformed

7 ? 7 !

Inconsistency

InsertOperation TransformInsertInsert (InsertOperation Remote, InsertOperation L ocal) { Operation RemoteT = Remote.clone(); if (Remote.index > Local.index) RemoteT.index = Remote.index + 1 return RemoteT ; }

slide-49
SLIDE 49

49

INSERTION AT SAME INDEX: ERROR

PC 1 PC 2 4 5 1 6

I,6,?

Local Buffer2 Local Buffer1

5 1 I,6,! 6 I,6,? I,6,!

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

I,6,! I,6,?

O1 T(O2, O1) O2 T(O1, O2)

Constraint for Transform

S S S12 S12

==

7 ? 7 ! Operation TransformInsertInsert (InsertOperation R, InsertOperation L) { Operation RT = R.deepCopy(); if (R.index > L.index) RT.index = R.index + 1 return RT ; }

slide-50
SLIDE 50

50

PRIORITY-BASED

PC 1 PC 2 4 6 1 6 1

I,6,?

Local Buffer2 Local Buffer1

5 1 I,6,! 6 I,6,? I,6,! I,6,! I,7,?

O1 T(O2, O1) O2 T(O1, O2) S S S12 S12

==

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

Insert concurrent text at some position in order of priority

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

Constraint for Transform Can two remote operations be transformed wrt to the same local operation?

slide-51
SLIDE 51

51

CONTROL ALGORITHM: SINGLE LOCAL CONCURRENT OPERATION

PC 1 PC 2 4 1 5

I,2,u I,6,?

Given Remote op, R, concurrent with exactly one local op L RT = Transform (R, L) Execute RT Site.TimeStamp.increment(R.site)

Local Buffer2 Local Buffer1 l u n c 1 2 3 4 l n c 1 2 3 4 5 5 h h ?

slide-52
SLIDE 52

52

MULTIPLE TRANSFORMED REMOTE CONCURRENT OPERATIONS

PC 1 PC 2 4 4 4 l n c h 1 2 3 4 l n c h 1 2 3 4 Local Buffer2 Local Buffer1

A remote site can execute multiple

  • perations that are concurrent wrt to

local buffer

slide-53
SLIDE 53

53

MULTIPLE TRANSFORMED REMOTE CONCURRENT OPERATIONS

PC 1 PC 2

I,5,?

4 4 2 5

I,2,u I,6,!

l u n c 1 2 3 4 l n c h 1 2 3 4 5 5 h ? ! 6 Local Buffer2 Local Buffer1

4 1 I,5,? 5 I,2,u 4 2 I,6,!

slide-54
SLIDE 54

54

SITE 1 OPERATION ARRIVES AND IS NOT TRANSFORMED

PC 1 PC 2

I,5,?

4 5 2 5

I,2,u I,6,!

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

I,2,u

! 7

4 1 I,5,? 5 I,2,u 4 2 I,6,!

slide-55
SLIDE 55

55

FIRST SITE 2 OPERATION ARRIVES

PC 1 PC 2

I,5,?

4 5 2 5

I,2,u I,6,!

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

I,2,u

! 7

I,5,? 4 1 I,5,? 5 I,2,u 4 2 I,6,!

slide-56
SLIDE 56

56

FIRST OPERATION TRANSFORMED

PC 1 PC 2

I,5,?

4 5 2 5 1

I,2,u I,6,!

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

I,2,u

! 7

I,6,?

6 ?

4 1 I,5,? 5 I,2,u 4 2 I,6,!

slide-57
SLIDE 57

57

SECOND OPERATION ARRIVES

PC 1 PC 2

I,5,?

4 5 2 5 2

I,2,u I,6,!

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

I,2,u I,6,?

6 !

I,6,! 4 1 I,5,? 5 I,2,u 4 2 I,6,!

! 7 7 ?

Multiple remote

  • perations

transformed with respect to same local

  • peration
slide-58
SLIDE 58

58

BUFFER CLEANUP

PC 1 PC 2

I,5,?

4 5 3 5 3

I,2,u I,6,!

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

I,2,u

! 7

I,6,!

6 ?

I,7,!

7 !

How long should local buffer be kept?

? 8

I,8,?

No need to transform

4 1 I,5,? 5 I,2,u 4 2 I,6,! I,8,?

> If local.timestamp < msg.timestamp Each subsequent message has larger time stamp Remove all locals from buffer with time stamp smaller than time stamp

  • f received message

? 8

Multiple remote

  • perations transformed

with respect to same local

  • peration
slide-59
SLIDE 59

59

TRANSFORMING REMOTE OPERATION (REVIEW START)

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

I,2, u I,6, ?

Sometimes semantics can be used to transform concurrent operations to give desired result

slide-60
SLIDE 60

60

OT SYSTEM COMPONENTS

Transformation function: Handles single local and concurrent operations Control algorithm: Calls transformation function, processed buffer and local time stamps Both must be correct.

slide-61
SLIDE 61

61

PRIORITY-BASED TRANSFORMATION

O1 T(O2, O1) O2 T(O1, O2) S S S12 S12

==

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

Constraint for Transform

slide-62
SLIDE 62

62

CONTROL ALGORITHM: SINGLE LOCAL CONCURRENT OPERATION

Given Remote op R, concurrent with exactly one local op L RT = Transform (R, L) Execute RT Site.TimeStamp.increment(R.site)

slide-63
SLIDE 63

63

NEED FOR LOCAL BUFFER

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

I,2, u

Local Buffer2

4 1 I,5, ?

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

5 I,2, u

slide-64
SLIDE 64

64

BUFFER CLEANUP (REVIEW END)

PC 1 PC 2

I,5, ?

4 5 3 5 3

I,2, u I,6, !

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

I,2, u

! 7

I,6, !

6 ?

I,7, !

7 !

How long should local buffer be kept?

? 8

I,8, ?

No need to transform

4 1 I,5, ? 5 I,2, u 4 2 I,6, ! I,8,?

> If local.timestamp < msg.timestamp Each subsequent message has larger time stamp Remove all locals from buffer with time stamp smaller than time stamp

  • f received message

? 8

Multiple remote

  • perations transformed

with respect to same local

  • peration
slide-65
SLIDE 65

65

DUAL: OPERATION TRANSFORMED MULTIPLE TIMES

PC 1 PC 2

I,5, !

4 5 3 5 3

I,2, u I,6, !

Local Buffer2 Local Buffer1

I,2, u I,6, ! I,7, !

Dual?

I,8, ! I,8, ! 4 1 I,5, ? 5 I,2, u 4 2 I,6, !

Multiple remote

  • perations

transformed with respect to same local

  • peration

A remote operation transformed with respect to multiple local operations

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

slide-66
SLIDE 66

66

INITIAL STATE

PC 1 PC 2 4 3 3 Local Buffer2 Local Buffer1 n c h 1 2 3 n c h 1 2 3

slide-67
SLIDE 67

67

MULTIPLE CONCURRENT LOCAL OPERATIONS WRT REMOTE CONFLICTING OPERATION

PC 1 PC 2

I,1,l

4 3 2 4

I,4, ? I,2, u

Local Buffer2 Local Buffer1

3 1 I,1,l 4 I,4, ? 3 2 I,2, u

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

slide-68
SLIDE 68

68

MULTIPLE CONCURRENT LOCAL OPERATIONS WRT REMOTE CONFLICTING OPERATION

PC 1 PC 2

I,1,l

4 3 2 4

I,4, ?

Local Buffer2 Local Buffer1

I,1,1 4 I,2, u

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

I,2, u 3 1 I,1,l 3 2 I,2, u

slide-69
SLIDE 69

69

MULTIPLE CONCURRENT LOCAL OPERATIONS WRT REMOTE CONFLICTING OPERATION

PC 1 PC 2

I,1,l

4 3 2 4 1

I,4, ?

Local Buffer2 Local Buffer1

3 1 I,1,l 4 I,4, ? 3 2 I,2, u

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

I,1,1

5 ?

I,2, u

slide-70
SLIDE 70

70

MULTIPLE CONCURRENT LOCAL OPERATIONS WRT REMOTE CONFLICTING OPERATION

PC 1 PC 2

I,1,l

4 3 2 4 1

I,4, ? I,2, u

Local Buffer2 Local Buffer1

3 1 I,1,l 4 I,4, ? 3 2 I,2, u

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

I,2, u I,1,1

5 ?

slide-71
SLIDE 71

71

MULTIPLE CONCURRENT LOCAL OPERATIONS WRT REMOTE CONFLICTING OPERATION

PC 1 PC 2

I,1,l

4 3 2 4 2

I,4, ?

Local Buffer2 Local Buffer1

3 1 I,1,l 3 I,4, ? 3 2 I,2, u

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

I,2, u I,1,1

5 h ? 6

I,2, u

slide-72
SLIDE 72

72

MULTIPLE CONCURRENT LOCAL OPERATIONS WRT REMOTE CONFLICTING OPERATION

PC 1 PC 2

I,1,l

4 3 2 4 2

I,4, ?

Local Buffer2 Local Buffer1

3 1 I,1,l 3 I,4, ? 3 2 I,2, u

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

I,2, u I,1,1

5 h ? 6

I,2, u I,4,?

slide-73
SLIDE 73

73

FIRST TRANSFORMATION

PC 1 PC 2

I,1,l

4 3 2 4 2

I,4, ?

Local Buffer2 Local Buffer1

3 1 I,1,l 3 I,4, ? 3 2 I,2, u

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

I,2, u I,1,1

5 h ? 6

I,2, u I,5,?

Transform wrt to first concurrent local operation

slide-74
SLIDE 74

74

SECOND TRANSFORMATION/CONTROL ALGORITHM

PC 1 PC 2

I,1,l

4 4 2 4 2

I,4, ?

Local Buffer2 Local Buffer1

3 1 I,1,l 3 I,4, ? 3 2 I,2, u

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

I,2, u I,1,1

5 h ? 6

I,2, u I,6,?

? 6

Run transform function with respect to all concurrent

  • perations in the local log:

Transform (Transform (Transform (R, L1), L2) …LN) A remote operation transformed with respect to multiple local operations Transform wrt to second concurrent local operation Control algorithm now handles multiple concurrent/local operations using Transform function addressing single concurrent remote/local operation

slide-75
SLIDE 75

75

CONTROL ALGORITHM: SINGLE LOCAL CONCURRENT OPERATION

Given Remote op, R, concurrent with exactly one local op L RT = Transform (R, L) Execute RT Site.TimeStamp.increment(R.site) Algorithm for multiple local concurrent operations?

slide-76
SLIDE 76

76

CONTROL ALGORITHM: MULTIPLE CONCURRENT LOCAL OPERATIONS

Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L R = Transform (R, L) Execute R Site.TimeStamp.increment(R.site)

slide-77
SLIDE 77

77

SINGLE SITE TRANSFORMATION

All examples so far involved transformation(s) at one site Transformation at both sites?

PC 1 PC 2

I,1,l

4 4 2 4 2

I,4, ?

Local Buffer2 Local Buffer1

3 1 I,1,l 3 I,4, ? 3 2 I,2, u

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

I,2, u I,1,1

5 h ? 6

I,2, u I,6,?

? 6

slide-78
SLIDE 78

78

INITIAL STATE

PC 1 PC 2 4 4 4 Local Buffer2 Local Buffer1 u n c h 1 2 3 4 u n c h 1 2 3 4

slide-79
SLIDE 79

79

MULTIPLE CONCURRENT REMOTE OPERATIONS

PC 1 PC 2

I,1,l

4 4 2 5

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 I,5, ? 4 2 I,6, !

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

slide-80
SLIDE 80

80

ARRIVAL AT SITE 1

PC 1 PC 2

I,1,l

4 4 2 5

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 I,5, ? 4 2 I,6, !

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

I,1,l

slide-81
SLIDE 81

81

RESULT OF TRANSFORM

PC 1 PC 2

I,1,l

4 4 2 5

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 I,5, ? 4 2 I,6, !

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

I,1,l

Remote operation not transformed

slide-82
SLIDE 82

82

UNTRANSFORMED APPLICATION

PC 1 PC 2

I,1,l

4 4 2 5 1

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 I,5, ? 4 2 I,6, !

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

I,1,l

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

slide-83
SLIDE 83

83

ARRIVAL AT SECOND SITE

PC 1 PC 2

I,1,l

4 4 2 5 1

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 I,5, ? 4 2 I,6, !

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

I,1,l

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

I,5, ?

slide-84
SLIDE 84

84

TRANSFORMED WRT TO FIRST LOCAL OPERATION

PC 1 PC 2

I,1,l

4 4 2 5 1

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 I,5, ? 4 2 I,6, !

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

I,1,l

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

I,6, ?

slide-85
SLIDE 85

85

EXAMINING SECOND LOCAL OPERATION

PC 1 PC 2

I,1,l

4 4 2 5 1

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 I,5, ? 4 2 I,6, !

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

I,1,l

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

I,6, ?

slide-86
SLIDE 86

86

SECOND TRANSFORMATION AND APPLICATION

PC 1 PC 2

I,1,l

4 5 2 5 1

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 I,5, ? 4 2 I,6, !

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

I,1,l

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

I,7, ?

? 7

User 1 < User 2

slide-87
SLIDE 87

87

SECOND ARRIVAL AT SITE 1

PC 1 PC 2

I,1,l

4 5 2 5 1

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 I,5, ? 4 2 I,6, !

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

I,1,l

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

I,7, ?

? 7

I,6, !

slide-88
SLIDE 88

88

OPERATION TRANSFORMED

PC 1 PC 2

I,1,l

4 5 2 5 1

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 I,5, ? 4 2 I,6, !

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

I,1,l

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

I,7, ?

? 7

I,7, !

slide-89
SLIDE 89

89

APPLICATION OF TRANSFORMED OPERATION

PC 1 PC 2

I,1,l

4 5 2 5 2

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 I,5, ? 4 2 I,6, !

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

I,1,l

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

I,7, ?

? 7

I,7, !

Never compared user ids at site 1

7 !

Inconsistency! What went wrong?

slide-90
SLIDE 90

90

WHAT WENT WRONG?

PC 1 PC 2

I,1,l

4 5 2 5 2

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 I,5, ? 4 2 I,6, !

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

I,1,l

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

I,7, ?

? 7

I,7, !

7 !

Never compared site ids at site 1 Effect of remote I, 1, 1 on local I, 5, ? not recorded Must change time stamp and if necessary operands of local operation Transform gives effect of an operation

  • n another

Used it so far to get effect of local

  • peration on remote operation

Need to also use it to determine effect of remote operation on local

  • peration
slide-91
SLIDE 91

91

RUNNING TRANSFORM IN PAIRS

PC 1 PC 2

I,1,l

4 5 2 5 2

I,5, ? I,6, !

Local Buffer2 Local Buffer1

5 2 I,1,l 5 2 I,6, ? 5 2 I,6, !

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

I,1,l

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

I,7, ?

? 7

I,6, !

7 ?

Transform (Insert (1, ‘l’), Insert (5, ‘?’)) Transform (Insert (5, ‘?’), Insert (1, ‘l’)) Time stamps of local operations changed Each transformation computed at both sites !

slide-92
SLIDE 92

92

PREVIOUS CONTROL ALGORITHM

PC 1 PC 2

I,1,l

4 5 2 5 2

I,5, ? I,6, !

Local Buffer2 Local Buffer1

5 2 I,1,l 5 2 I,6, ? 5 2 I,6, !

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

I,1,l

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

I,7, ?

? 7

I,6, !

7 ?

R = Transform (R, L) Execute R Site.TimeStamp.increment(R.site) Effects of L1, L2, .. LN included in R Effects of R must also be included in L1, L2, .. LN Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L

slide-93
SLIDE 93

93

NEW CONTROL ALGORITHM

PC 1 PC 2

I,1,l

4 5 2 5 2

I,5, ? I,6, !

Local Buffer2 Local Buffer1

5 2 I,1,l 5 2 I,6, ? 5 2 I,6, !

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

I,1,l

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

I,7, ?

? 7

I,6, !

7 ?

R = Transform (R, L) L = Transform (L, R) Execute R L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Effects of L1, L2, .. LN included in R Effects of R included in L1, L2, .. LN Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L

slide-94
SLIDE 94

94

GEOMETRIC PROOF OF CORRECTNESS

S11,21 S11 S21 S Distributed Merge

Site1 Site 2

One-step process Multiple one-step processes to reach state Given two sequences of concurrent ops, transformation merge process can be derived Perpendiculars to two non dashed lines meet at a unique point SW : process site 1 op SE: process site 2 op Local op not changed Same transformation computed at both sites Including effect of multiple locals on a remote at site 1 Including effect of multiple remotes on a single local at site 2

S12 S12, 21

Intermediate state not reached at both sites Without undo

slide-95
SLIDE 95

95

GEOMETRIC PROOF OF CORRECTNESS

S11,21 S11 S21 S Distributed Merge

Site1 Site 2

SW : process site 1 op SE: process site 2 op Including effect of multiple locals on a remote at site 1 Including effect of multiple remotes on a single local at site 2

S12 S12, 21

Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L R = Transform (R, L) L = Transform (L, R) Execute R L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site)

slide-96
SLIDE 96

96

RE-RUN WITH TRANSFORMATIONS

PC 1 PC 2 4 4 4 Local Buffer2 Local Buffer1 u n c h 1 2 3 4 u n c h 1 2 3 4

slide-97
SLIDE 97

97

CONCURRENT INTERACTION

PC 1 PC 2

I,1,l

4 4 2 5

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 I,5, ? 4 2 I,6, !

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

R = Transform (R, L) L = Transform (L, R) L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Execute R Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L

slide-98
SLIDE 98

98

REMOTE I, 1, L ARRIVES AT SITE 1

PC 1 PC 2

I,1,l

4 4 2 5

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 I,5, ? 4 2 I,6, !

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

I,1,l

R = Transform (R, L) L = Transform (L, R) L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Execute R Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L

slide-99
SLIDE 99

99

REMOTE NOT TRANSFORMED

PC 1 PC 2

I,1,l

4 4 2 5

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 I,5, ? 4 2 I,6, !

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

I,1,l

Remote not transformed R = Transform (R, L) L = Transform (L, R) L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Execute R Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L

slide-100
SLIDE 100

10

LOCAL TRANSFORMED

PC 1 PC 2

I,1,l

4 4 2 5

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 1 I,6, ? 4 2 I,6, !

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

I,1,l

Local transformed R = Transform (R, L) L = Transform (L, R) L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Execute R Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L

slide-101
SLIDE 101

10 1

REMOTE APPLIED

PC 1 PC 2

I,1,l

4 4 2 5 1

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 1 I,6, ? 4 2 I,6, !

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

I,1,l

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

R = Transform (R, L) L = Transform (L, R) L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Execute R Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L

slide-102
SLIDE 102

10 2

I,5, ? ARRIVES AT SITE 2

PC 1 PC 2

I,1,l

4 4 2 5 1

I,5, ? I,6, !

Local Buffer2 Local Buffer1

4 1 I,1,l 5 1 I,6, ? 4 2 I,6, !

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

I,1,l

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

I,5, ?

R = Transform (R, L) L = Transform (L, R) L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Execute R Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L

slide-103
SLIDE 103

10 3

REMOTE TRANSFORMED BUT NOT FIRST LOCAL

PC 1 PC 2

I,1,l

4 4 2 5 1

I,5, ? I,6, !

Local Buffer2 Local Buffer1

5 1 I,1,l 5 1 I,6, ? 4 2 I,6, !

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

I,1,l

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

I,6, ?

R = Transform (R, L) L = Transform (L, R) L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Execute R Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L

slide-104
SLIDE 104

10 4

COMPARED WITH SECOND LOCAL (I. 6, !) AT SAME LOCATION

PC 1 PC 2

I,1,l

4 4 2 5 1

I,5, ? I,6, !

Local Buffer2 Local Buffer1

5 1 I,1,l 5 1 I,6, ? 4 2 I,6, !

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

I,1,l

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

I,6, ?

R = Transform (R, L) L = Transform (L, R) L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Execute R Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L

slide-105
SLIDE 105

10 5

TRANSFORMATION AND APPLICATION

PC 1 PC 2

I,1,l

4 5 2 5 1

I,5, ? I,6, !

Local Buffer2 Local Buffer1

5 1 I,1,l 5 1 I,6, ? 5 2 I,6, !

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

I,1,l

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

I,7, ?

R = Transform (R, L) L = Transform (L, R) L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Execute R Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L

? 7

slide-106
SLIDE 106

10 6

SECOND REMOTE OPERATION ARRIVES AT SITE 1

PC 1 PC 2

I,1,l

4 5 2 5 1

I,5, ? I,6, !

Local Buffer2 Local Buffer1

5 1 I,1,l 5 1 I,6, ? 5 2 I,6, !

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

I,1,l

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

I,7, ? I,6, !

R = Transform (R, L) L = Transform (L, R) L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Execute R Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L

? 7

slide-107
SLIDE 107

10 7

LOWER PRIORITY PREVIOUSLY TRANSFORMED LOCAL TRANSFORMED AGAIN BUT NOT REMOTE

PC 1 PC 2

I,1,l

4 5 2 5

I,5, ? I,6, !

Local Buffer2 Local Buffer1

5 2 I,7, ?

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

I,1,l

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

I,7, ?

? 7

I,6, ! 5 1 I,1,l 5 2 I,6, !

? 7

R = Transform (R, L) L = Transform (L, R) L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Execute R Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L

slide-108
SLIDE 108

10 8

UNTRANSFORMED REMOTE APPLIED

PC 1 PC 2

I,1,l

4 4 2 4

I,5, ? I,6, !

Local Buffer2 Local Buffer1

5 1 I,1,l 5 2 I,7,? 5 2 I,6, !

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

I,1,l

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

I,7, ?

? 7

I,6, !

7 ?

Consistency! N Users? R = Transform (R, L) L = Transform (L, R) L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Execute R Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L

slide-109
SLIDE 109

10 9

ALGORITHM AND PROOF OF CORRECTNESS

S11,21 S11 S21 S Distributed Merge

Site1 Site 2

S12 S12, 21

Consistency! RT = Transform (R, L) L = Transform (L R) L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Execute R Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L R= RT N Users?

slide-110
SLIDE 110

11

3-USER CONCURRENT

PC 1 PC 2 PC 3 1

v1 v2

1

v3

Local Buffer1 Local Buffer2 Local Buffer3 1 a b c

1 I,1, a 1 I,1, b I,1, c 1

slide-111
SLIDE 111

11 1

13

PC 1 PC 2 PC 3 1

v1 v2

1

v3

Local Buffer1 Local Buffer2 Local Buffer3 1 a b c

1 I,1, a 1 I,1, b I,1, c 1 I,1, a

slide-112
SLIDE 112

11 2

TRANSFORM AND APPLY RECEIVED COMMAND

PC 1 PC 2 PC 3 Local Buffer1 Local Buffer2 Local Buffer3 a b c

1 I,1, a 1 I,1, b I,1, c 1 I,2, a

a 1

v1 v2

1 1

slide-113
SLIDE 113

11 3

TRANSFORM LOCAL COMMAND

PC 1 PC 2 PC 3 Local Buffer1 Local Buffer2 Local Buffer3 a b c

1 I,1, a 1 I,1, b 1 I,1, c 1 I,2, a

a 1

v1 v2

1 1

slide-114
SLIDE 114

11 4

23

PC 1 PC 2 PC 3 Local Buffer1 Local Buffer2 Local Buffer3 a b c

1 I,1, a 1 I,1, b 1 I,1, c 1 I,2, a

a

I,1, b

1

v1 v2

1 1

slide-115
SLIDE 115

11 5

TRANSFORM AND APPLY RECEIVED COMMAND

PC 1 PC 2 PC 3 Local Buffer1 Local Buffer2 Local Buffer3 a b c

1 I,1, a 1 I,1, b 1 I,1, c 1 I,2, a

b

I,2, b

a 1

v1 v2

1 1

slide-116
SLIDE 116

11 6

TRANSFORM LOCAL COMMAND

116

PC 1 PC 2 PC 3 Local Buffer1 Local Buffer2 Local Buffer3 a b c

1 I,1, a 1 I,1, b 1 1 I,1, c 1 I,2, a

b

I,2, b

a 1

v1 v2

1 1

Characters in descending id

  • rder

But id of 1 and 2 not compared

slide-117
SLIDE 117

11 7

DIFFERENT RECEIVE ORDER

PC 1 PC 2 PC 3 Local Buffer1 Local Buffer2 Local Buffer3 a b c

1 I,1, a 1 I,1, b I,1, c 1

1

v1 v2

1 1

slide-118
SLIDE 118

11 8

23

PC 1 PC 2 PC 3 Local Buffer1 Local Buffer2 Local Buffer3 a b c

1 I,1, a 1 I,1, b I,1, c 1 I,1, b

1

v1 v2

1 1

slide-119
SLIDE 119

11 9

TRANSFORM AND APPLY RECEIVED COMMAND

PC 1 PC 2 PC 3 Local Buffer1 Local Buffer2 Local Buffer3 a b

1 I,1, a 1 I,1, b I,1, c 1 I,2, b

1

v1 v2

1 1 c b

slide-120
SLIDE 120

12

TRANSFORM LOCAL COMMAND

PC 1 PC 2 PC 3 Local Buffer1 Local Buffer2 Local Buffer3 a b

1 I,1, a 1 I,1, b 1 I,1, c 1 I,2, b

1

v1 v2

1 1 c b

slide-121
SLIDE 121

12 1

13

PC 1 PC 2 PC 3 Local Buffer1 Local Buffer2 Local Buffer3 a b

1 I,1, a 1 I,1, b 1 I,1, c 1 I,2, b

1

v1 v2

1 1 c b

I,1, a

slide-122
SLIDE 122

12 2

TRANSFORM AND APPLY RECEIVED COMMAND

PC 1 PC 2 PC 3 Local Buffer1 Local Buffer2 Local Buffer3 a b

1 I,1, a 1 I,1, b 1 I,1, c 1 I,2, b

1

v1 v2

1 1

I,2, a

c a b

slide-123
SLIDE 123

12 3

TRANSFORM LOCAL COMMAND

PC 1 PC 2 PC 3 Local Buffer1 Local Buffer2 Local Buffer3 a b

1 I,1, a 1 I,1, b 1 1 I,1, c 1 I,2, b

1

v1 v2

1 1

I,2, a

c a b

slide-124
SLIDE 124

12 4

PROBLEM WITH 2 USERS

 Order of concurrent messages influences output.  Same output not guaranteed at a single site.  Same output not guaranteed at all sites.  Problem independent of whether local operation is

transformed.

 To understand better, need state transition diagram

slide-125
SLIDE 125

12 5

MULTIPLE REMOTE CONCURRENT OPERATIONS

S12 S1 S2 S Distributed Merge

At Site1 At Site 2 3-User Transition Diagram?

slide-126
SLIDE 126

12 6

N-USERS?

S1 S O3

slide-127
SLIDE 127

12 7

PATH 1 FOR USER 1

S1 S O3

slide-128
SLIDE 128

12 8

PATH 2 FOR USER 1

S1 S O3

The two paths must give equivalent results. In our example, our transformation functions did not! Necessary condition for new transformation functions? Each edge should have a unique label Edge can have multiple labels

slide-129
SLIDE 129

12 9

MULTIPLE PATHS AND EDGE LABELS

S1 S O3 T(O3, O1) T(T(O3, O1), T(O2, O1) ) T(T(O3, O2), T(O1, O2)) T(T(O3, O1), T(O2, O1) )

==

O1 T(O2, O1) O2 T(O1, O2)

Constraints for Transform == TP1 TP2

T(O3, O2) T(T(O3, O2), T(O1, O2) )

slide-130
SLIDE 130

13

LINEAR BUFFER VS INTERACTION MODEL

S1 S O3 T(O3, O1) T(T(O3, O1), T(O2, O1) ) T(T(O3, O2), T(O1, O2)) T(T(O3, O1), T(O2, O1) )

==

O1 T(O2, O1) O2 T(O1, O2)

== TP1 TP2

T(O3, O2) T(T(O3, O2), T(O1, O2) )

Linear local buffer does not suffice, local operation wrt to which a remote

  • peration is transformed

depends on received concurrent operations from

  • ther sites

Constraints for Transform

slide-131
SLIDE 131

13 1

LINEAR BUFFER VS INTERACTION MODEL (POST LECTURE)

S1 S O3 T(O3, O1)

O1 no longer in buffer to compute T(O2, O1) Multiple concurrent paths from a vertex, must store path

O1 Local Buffer1 T(O1, O3)

slide-132
SLIDE 132

13 2

SUFFICIENT CONDITIONS?

S1 S O3 T(O3, O1) T(T(O3, O1), T(O2, O1) ) T(T(O3, O2), T(O1, O2)) T(T(O3, O1), T(O2, O1) )

==

O1 T(O2, O1) O2 T(O1, O2)

== TP1 TP2

T(O3, O2) T(T(O3, O2), T(O1, O2) )

Creating functions meeting TP2 has been problematic Claim: TP1 and TP2 sufficient for N users Constraints for Transform Google implementation?

slide-133
SLIDE 133

13 3 lnch lnch lnch

SYNCHRONOUS RELAYED BROADCAST (REVIEW)

PC 1 PC 2

lunch

PC 3 Relayer I, 2, u

lunch lunch Delay (extra hop) state of operation issue not same as state of execution, though all sites are consistent

I, 2, u

slide-134
SLIDE 134

13 4

ORDERING WITH ATOMIC BROADCAST (REVIEW)

PC 1 PC 2 l n c 1 2 3 4 l n c 1 2 3 4 h h

I,2, u I,5, ? I,2, u I,5, ?

slide-135
SLIDE 135

13 5

SECOND OPERATION EXECUTES (REVIEW)

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

Context of operation not the same as when it was issued Common state but “intention” violation

slide-136
SLIDE 136

13 6 lnch lnch lnch

SYNCHRONOUS RELAYED BROADCAST

PC 1 PC 2

lunch

PC 3 Relayer I, 2, u

lunch lunch

I, 2, u

slide-137
SLIDE 137

13 7 lnch lnch lnch

ASYNCHRONOUS MERGED RELAYED BROADCAST

PC 1 PC 2

lunch

PC 3 Relaying Merger

lunch lunch

I, 2, u

slide-138
SLIDE 138

13 8

2 TO N USERS

 Can do one N-user merge  Can do N 2-User messages  Through a server  Each client is consistent with the server  Implies each client is consistent with the server  But server does not issue any operations  For each client, server operations are those issued by

  • ther clients
slide-139
SLIDE 139

13 9

REPLICATED ARCHITECTURE WITH CENTRAL MERGER : LOCAL, REMOTE TIME STAMP

Replicated Mapping

UI 1 PC 1 UI 2 UI 3 PC 2 PC 3 Merger Local Buffer2 Local Buffer3 Local Buffer1 Local Buffer Local Buffer Local Buffer #2 #1 +#3 #3 #1 +#2 #1 #2 +#3 #1 #2 +#3 #3 #1 +#2 #2 #1 +#3 O OT (OT)T (OT)T

slide-140
SLIDE 140

14

CLIENT AND SERVER RECEIVE ALGORITHM

For all other sites assume server executed R Client Server Consistency! RT = Transform (R, L) L = Transform (L R) L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Execute R Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L R= RT Consistency! RT = Transform (R, L) L = Transform (L R) L.TimeStamp.increment(R.site) Site.TimeStamp.increment(R.site) Given Remote op, R, concurrent with local ops L1, L2, .. LN For each L R= RT

slide-141
SLIDE 141

14 1

TRANSFORM OPERATION FOR CLIENT-SERVER CASE

InsertOperation TransformInsertInsert (InsertOperation R, InsertOperation L) { Operation RT = deepClone(); if ((R.index > L.index) || (R.index === L.index && R.id < L.id)) RT.index = R.index + 1; return RT ; } 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 ; }

P2P Client-Server

slide-142
SLIDE 142

14 2

CAUSALITY MANAGER

Causality-unaware Communication system Causality –Unaware Application Send Filter Receive Filter Causality Manager

slide-143
SLIDE 143

14 3

CLIENT OT MANAGER

OT-unaware Communication system OT –Unaware Application Send Filter Receive Filter OT Manager Single OT Manager? One for each sequence

slide-144
SLIDE 144

14 4

SERVER OT MANAGER

OT-unaware Communication system OT –Unaware Relayer Send Filter Receive Filter OT Manager Receiver immediately sends, no execution

slide-145
SLIDE 145

14 5

CLIENT OT MANAGER (REVIEW)

OT-unaware Communication system OT –Unaware Application Send Filter Receive Filter OT Manager Single OT Manager? One for each sequence

slide-146
SLIDE 146

14 6

SINGLE SERVER FILTER

OT-unaware Communication system OT –Unaware Relayer Send Filter Receive Filter OT Manager Receiver immediately sends, no execution Can use only one filter Receiver does not know identities of destinations but sender may (in current implementation filter called before multicasting) Single send filter sufficient

slide-147
SLIDE 147

14 7

SERVER OT MANAGERS

OT-unaware Communication system OT –Unaware Relayer Send Filter OT Manager One OT Manager for each client and sequence How to attach send filter to server?

slide-148
SLIDE 148

14 8

MESSAGE FILTER INTERFACE

public interface MessageFilter<MessageType> { public void setMessageProcessor (MessageProcessor<MessageType> newVal; public void filterMessage(MessageType message); }

Next stage in pipeline, processing the filtered message ReceivedMessage

  • r SentMessage

Called by communication system when pipeline setup Called by communication system when new message to be filtered available

slide-149
SLIDE 149

14 9

SERVER MESSAGE FILTER INTERFACE

public interface ServerMessageFilter extends MessageFilter<SentMessage> { public void userJoined(String aSessionName, String anApplicationName, String userName); public void userLeft(String aSessionName, String anApplicationName, String userName); }

slide-150
SLIDE 150

15

SERVER FACTORY INTERFACE

public interface ServerMessageFilterCreator { ServerMessageFilter getServerMessageFilter(); }

slide-151
SLIDE 151

15 1

SEND FILTER (FACTORY) SELECTOR OR ABSTRACT FACTORY

public class SentMessageFilterSelector { static MessageFilterCreator<SentMessage> filterFactory = new AMessageForwarderCreator<SentMessage>(); public static MessageFilterCreator<SentMessage> getMessageFilterCreator() { return filterFactory; } public static void setMessageFilterCreator( MessageFilterCreator<SentMessage> theFactory) { filterFactory = theFactory; } }

slide-152
SLIDE 152

15 2

SERVER OT MANAGERS

OT-Unaware communication system OT –Unaware Relayer Send Filter OT Manager One OT Manager for each client and sequence How to attach send filter to server?

slide-153
SLIDE 153

15 3

CLIENT OT MANAGER

OT-Unaware communication system OT –Unaware Application Send Filter Receive Filter OT Manager Single OT Manager? One for each sequence

slide-154
SLIDE 154

15 4

CLIENT INITIALIZATION

Init For each List, L Create Client Send and Receive Filter Factories, passing them OTManager so they can pass them to the two filters Create <List, OT Manager> Mapping ListOTManager ListOTManager(L)  new OT Manager (ClientName, Not Server)

slide-155
SLIDE 155

15 5

SEND FILTER TRACEABLE STEPS

Send Filter On each user edit about OT List L Ask ListOTManager(L) to time stamp edit OTListEditSend the timestamped edit through message processor Ask ListOTManager(L) to store copy of sent message As in causality must ensure changing site time stamp does not change message time stamp

slide-156
SLIDE 156

15 6

RECEIVE FILTER TRACEABLE STEPS

Receive Filter On each OTListEditReceived for list L received (through server) OTListEditFlipped time stamp Ask OTManager(L) to transform received edit Pass transformed edit to message processor

slide-157
SLIDE 157

15 7

OT MANAGER: INIT

Init (User Name, IsServer) InitialOTTimeStampCreated

slide-158
SLIDE 158

15 8

OT MANAGER: SEND STEPS

Store Sent Message MessageBuffered Time stamp edit LocalSiteCountIncremented Timestamp edit with local time stamp

slide-159
SLIDE 159

15 9

OT MANAGER: RECEIVE FILTER COMMUNICATION

Process received timestamped edit For each local message not concurrent with received edit Local MessageUnBuffered For each local buffered concurrent edit L L= TransformationResult from Transform(L, R) R= TransformationResult from Transform(R, L) OTListEditRemoteCountIncremented in L RemoteSiteCountIncremented User name in trace step is name of user who executed the operation, for local edit, the local user, for remote edit, the remote user (exact name, not server)

slide-160
SLIDE 160

16

CLIENT OT MANAGER

OT-Unaware communication system OT –Unaware Application Send Filter Receive Filter OT Manager

slide-161
SLIDE 161

16 1

SERVER OT MANAGERS

OT-Unaware communication system OT –Unaware Relayer Send Filter OT Manager One OT Manager for each client and sequence May want to extend

  • ne list

implementation to multiple lists

slide-162
SLIDE 162

16 2

FILTER COMPOSITION

OT-Unaware communication system OT –Unaware Relayer Master Send Filter OT Manager List Send Filter List Send Filter OT Manager Could have used this architecture (master/delegate filters) also for clients, but client filters were simple and there were two of them, so it is not clear creating two additional master filters for clients is worth it

slide-163
SLIDE 163

16 3

SERVER INITIALIZATION

Init For each List, L Create Send Filter Factory, passing it ServerFilterMapping Create <List, ServerFilter> Mapping ServerFilter ServerFilter(L)  new ServerFilter()

slide-164
SLIDE 164

16 4

SERVER MESSAGE FILTER INTERFACE

public interface ServerMessageFilter extends MessageFilter<SentMessage> { public void userJoined(String aSessionName, String anApplicationName, String userName); public void userLeft(String aSessionName, String anApplicationName, String userName); }

slide-165
SLIDE 165

16 5

MASTER SERVER SEND FILTER: FORWARDING

Join For each list L ServerFilter(L).userJoined() Leave For each list L ServerFilter(L).userLeft() Set Message Processor For each list L ServerFilter(L).setMesageProcessor()

slide-166
SLIDE 166

16 6

MASTER SERVER SEND FILTER

New Message On each client edit of list L ServerFilter(L).filterMessage()

slide-167
SLIDE 167

16 7

SERVER SEND FILTER

Init Create <User, OTManager> Mapping UserOTManager Join On join of each user U UserOTManager(U)  new OTManager(U, Is Server)

slide-168
SLIDE 168

16 8

SERVER SEND FILTER

New Message On each OTListEditReceived from Sending User S Ask UserOTManager(S) to create transform received edit, OT Ask UserOTManager(R) to time stamp OTR OTListEditFlipped time stamp For each user R in UserOTManager other than S Create unicast copy of message containing, OTR By calling ASentMessage.toSpecificUser(message, R) Send timestamped edit through message processor Ask ListOTManager(R) to store copy of sent message

slide-169
SLIDE 169

16 9

CENTRALIZED ALGORITHM

 Assume all users merge through central server  Output is produced locally immediately  Server keeps local buffer and timestamp for each client  Each client treats server as second user and sends it each

command

 Instead of applying (possibly transformed) command to

its local state server sends time-stamped command to each remote client

 Client transforms it further if it has executed

concurrently

 Client assumes command executed directly by server  Each client consistent with server, and thus with each

  • ther client

 Unique ordering of all commands from remote machines

slide-170
SLIDE 170

17

HISTORY

 dOPT (Distributed Operation Transformation) –

Ellis and Gibbs ’89

 Did not transform local operation  Had known problem with multiple users  adOPTed (Ressel et al ‘96)  Transformed local operation  Give conditions for N-user replicated merging  Jupiter (Nichols, Curtis, et al ‘95)  Centralized merging  Inventors of LiveMeeting  Implemented in GoogleWave