Calculi for Committed Choices and Compensations Roberto Bruni - Dipartimento di Informatica, Università di Pisa joint work with Gianluigi Ferrari Hernán Melgratti Ugo Montanari Daniele Strollo Emilio Tuosto Dip. Informatica, Univ. Pisa Santa Cruz (CA) USA, 18 January 2005
131
Embed
Calculi for Committed Choices and Compensations Roberto Bruni - Dipartimento di Informatica, Università di Pisa joint work with Gianluigi Ferrari Hernán.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Calculi for Committed Choices and Compensations Roberto Bruni - Dipartimento di Informatica, Università di Pisa
Structured Activity Compensation (StAC) now evolving to compensating CSP
core flow language (FL) for sagas [BMM:POPL2005]
Calculi for Committed Choices
and Compensations 22
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Sequential Sagas:
Graphically
Accept OrderRefuse Order
Update CreditRefund Money
Prepare OrderUpdate Stock
Calculi for Committed Choices
and Compensations 23
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Sequential Sagas: Syntax
Accept OrderRefuse Order
Update CreditRefund Money
Prepare OrderUpdate Stock
(Step) X ::= 0 | A | A%B(Process) P ::= X | P;P(Saga) S ::= { P }
Calculi for Committed Choices
and Compensations 24
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Sequential Sagas: Syntax
Accept OrderRefuse Order
Update CreditRefund Money
Prepare OrderUpdate Stock
S = { AO%RO ; UC%RM ; PO%US }
(Step) X ::= 0 | A | A%B(Process) P ::= X | P;P(Saga) S ::= { P }
Calculi for Committed Choices
and Compensations 25
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Sequential Sagas:
Semantics
An activity A either commits (A ) aborts (A )
= {A1 ,…, An }
Calculi for Committed Choices
and Compensations 26
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Sequential Sagas:
Semantics
A saga S = { P } under either commits ( ) aborts ( ) fails ( )
is the observable flow
S
S
S
*
Calculi for Committed Choices
and Compensations 27
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
A process P under either commits ( ) aborts ( ) fails ( )
aborts = successfully compensated ß, ß’ are the installed compensations
Sequential Sagas: Semantics
<P,ß> < ,ß’>
<P,ß> < , 0>
<P,ß> < , 0>
*
Calculi for Committed Choices
and Compensations 28
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Sequential Sagas:
Semantics(saga) <P,0> < , ß>
{P}
Calculi for Committed Choices
and Compensations 29
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Sequential Sagas:
Semantics
<0,ß> < , ß>
0(zero)
(saga) <P,0> < , ß>
{P}
Calculi for Committed Choices
and Compensations 30
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Sequential Sagas:
Semantics
<0,ß> < , ß>
0(zero)
(saga) <P,0> < , ß>
{P}
A , <A%B, ß> < , B;ß>
A(s-act)
Calculi for Committed Choices
and Compensations 31
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Sequential Sagas:
Semantics
A , <A%B, ß> < , B;ß>
A
<0,ß> < , ß>
0
(zero)
(s-act)
(s-cmp)
(saga)
A , <A%B,ß> < , 0>
<ß,0> < , 0>
(f-cmp)A , <A%B,ß> < , 0>
<ß,0> < , 0>
*
<P,0> < , ß>
{P}
Calculi for Committed Choices
and Compensations 32
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Sequential Sagas:
Semantics
(s-step) <Q,ß’’> < ,ß’>
’ <P,ß> < ,ß’’>
<P;Q, ß> < ,ß’>
;’
(a-step’) <P;Q,ß> < ,0>
<P,ß> < , 0>
(a-step’’) <P,ß> < , 0>
<P;Q,ß> < ,0>
*
*
Calculi for Committed Choices
and Compensations 33
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Sequential Sagas:
Adequacy S
and = A1;…;An
A1 Aj Ak An
Calculi for Committed Choices
and Compensations 34
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Sequential Sagas:
Adequacy S
and = A1;…;An
S
and = A1;…;Ak-1;Bk-1;…;B1
A1 Aj Ak An
A1 Aj Ak An
BjB1
Calculi for Committed Choices
and Compensations 35
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Sequential Sagas:
Adequacy S
and = A1;…;An
S
and = A1;…;Ak-1;Bk-1;…;B1
S
and = A1;…;Ak-1;Bk-1;…;Bj+1
A1 Aj Ak An
A1 Aj Ak An
BjB1
A1 Aj Ak An
BjB1
*
Calculi for Committed Choices
and Compensations 36
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Parallel Sagas: Syntax
Accept OrderRefuse Order
Update CreditRefund Money
Prepare OrderUpdate Stock
Calculi for Committed Choices
and Compensations 37
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Parallel Sagas: Syntax
(Step) X ::= 0 | A | A%B(Process) P ::= X | P;P | P|P(Saga) S ::= { P }
Accept OrderRefuse Order
Update CreditRefund Money
Prepare OrderUpdate Stock
Calculi for Committed Choices
and Compensations 38
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Parallel Sagas: Syntax
S = { AO%RO ; UC%RM | PO%US }
(Step) X ::= 0 | A | A%B(Process) P ::= X | P;P | P|P(Saga) S ::= { P }
Accept OrderRefuse Order
Update CreditRefund Money
Prepare OrderUpdate Stock
Calculi for Committed Choices
and Compensations 39
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Parallel Sagas: NaïvelyB1 Bj Bn
C1 Ck Cm
A1 A2
B’1 B’j
A’1
C’1 C’k C’m
A1;(B1;…;Bj-1;B’j-1;…;B’1 | C1;…Cm;C’m;…;C’1);A’1
Calculi for Committed Choices
and Compensations 40
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Parallel Sagas: Revised
A1;(B1;…;Bj-1;B’j-1;…;B’1 | 0);A’1
A1;(B1;…;Bj-1;B’j-1;…;B’1 | C1;C’1);A’1
…
A1;(B1;…;Bj-1;B’j-1;…;B’1 | C1;…Cm;C’m;…;C’1);A’1
B1 Bj Bn
C1 Ck Cm
A1 A2
B’1 B’j
A’1
C’1 C’k C’m
Calculi for Committed Choices
and Compensations 41
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
<P,ß> < , 0>
A process P under either commits ( ) aborts ( ) fails ( ) is forced to abort ( ) is forced to fail ( )
is the observable concurrent flow
<P,ß> < , 0>
<P,ß> < , 0>
<P,ß> < , 0>
Parallel Sagas: Semantics
<P,ß> < ,ß’>
*
*
Calculi for Committed Choices
and Compensations 42
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Parallel Sagas: Semantics
(saga)
(forced-abt’) <P,ß> < ,0>
<ß, 0> < , 0>
(forced-abt’’) <P,ß> < ,0>
<ß, 0> < , 0>
*
{ , , } * <P,0> <, ß>
{P}
Calculi for Committed Choices
and Compensations 43
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
<P,0> < ,ß’>
Parallel Sagas: Semantics
(s-par) <Q,0> < ,ß’’>
’
<P|Q, ß> < ,ß’|ß’’; ß>
|’
Calculi for Committed Choices
and Compensations 44
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Parallel Sagas: Semantics
<Q,0> <2,0>
’ <P,0> <1,0>
<P|Q, ß> < 1 2 , 0>
|’;
(c-par’)
<ß,0> < ,0>
1, 2 { , }
*
*
* *
***** * *
Calculi for Committed Choices
and Compensations 45
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Parallel Sagas: Semantics(c-par’’)
*
*
* *
***** * *
<Q,0> <2,0>
’ <P,0> <1,0>
<P|Q, ß> < 1 2 , 0>
|’;
<ß,0> < ,0>
1, 2 { , }
*
Calculi for Committed Choices
and Compensations 46
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Parallel Sagas: Semantics
<Q,0> <2 ,0>
’ <P,0> <1,0>
<P|Q, ß> < 1 2 , 0>
|’
(f-par)
1 { , }
2 { , , , }
**
**
*
*
* *
***** * *
Calculi for Committed Choices
and Compensations 47
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Parallel Sagas: AdequacyCompletion
Calculi for Committed Choices
and Compensations 48
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Parallel Sagas: AdequacySuccessful Compensation
Calculi for Committed Choices
and Compensations 49
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Parallel Sagas: AdequacyFailed Compensation
Calculi for Committed Choices
and Compensations 50
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Nested Sagas: Graphically
Accept OrderRefuse Order
Update CreditRefund Money
Prepare OrderUpdate Stock
Add Points
Subtract Points
Calculi for Committed Choices
and Compensations 51
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Nested Sagas: Syntax
(Step) X ::= 0 | A | A%B | S (Process) P ::= X | P;P | P|P(Saga) S ::= { P }
Calculi for Committed Choices
and Compensations 52
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Nested Sagas: Syntax
S { AO%RO ; UC%RM | PO%US | {AP%SP} }
Accept OrderRefuse Order
Update CreditRefund Money
Prepare OrderUpdate Stock
Add Points
Subtract Points
Calculi for Committed Choices
and Compensations 53
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Nested Sagas: Semantics
(sub-cmt) <P,0> < , ß’>
<{P},ß> < , ß’;ß>
(sub-abt) <P,0> < , 0>
<{P},ß> < , ß>
(sub-fail) <P,0> < , 0>
<{P},ß> < , 0>
ß’ acts as default compensation
*
*
Calculi for Committed Choices
and Compensations 54
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Nested Sagas: Semantics
(sub-forced-1)
(sub-forced-2’)
<P,0> < , 0>
*
<{P},ß> < , 0> *
(sub-forced-2’’)
{ , } *
<ß,0> <,0>
<P,0> < ,0>
<{P}, ß> < ,0>
;*
<ß,0> < ,0>
<P,0> < ,0>
<{P}, ß> < ,0>
;
Calculi for Committed Choices
and Compensations 55
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Nested Sagas: Adequacy
Completion
Calculi for Committed Choices
and Compensations 56
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005 Nested Sagas: Adequacy
Successful Compensation
Calculi for Committed Choices
and Compensations 57
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Failed Compensation
Nested Sagas: Adequacy
Calculi for Committed Choices
and Compensations 58
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
More on Sagas Exception handling try S with P
Used to catch crashes during backward computation Forward recovery strategies try S or P
Can be used to retry or to improve activities Fully programmable compensations S%P
More expressive than default compensation (sub-cmt) Allowed by languages like BPEL4WS
Choices: Discriminator PQ Choices: Internal PQ Data dependencies AB
Valid executions must satisfy dependency constraints
Calculi for Committed Choices
and Compensations 59
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Outline of the talk Part I
Transactional Flows with Compensations Part II
A Process Calculus for Distributed Transactions
Part III Prototype Implementations
Calculi for Committed Choices
and Compensations 60
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Part II - cJoin Distributed Negotiations CHAM and JOIN cJOIN
Calculi for Committed Choices
and Compensations 61
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Distributed Negotiations Negotiations / Contracts
commit, abort, compensation hierarchical decisions dynamic membership fully distributed control
Process cooperation coordination / orchestration / choreography different platforms and policies
Calculi for Committed Choices
and Compensations 62
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Our Proposal: cJOIN committed JOIN
Process Description Language presentation Non ACID (unrealistic in highly distributed
systems) Multiway (several parties can start separately
but commit on reached agreement) Programmable abort / non-perfect compensation Concurrency and distribution (Distributed 2PC) Different levels of abstraction (serializability)
Calculi for Committed Choices
and Compensations 63
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Why JOIN? Well-known asynchronous calculus process calculus presentation
few constructs, based on rendez-vous (atomic non-local interactions)
basis for distributed programming language
Calculi for Committed Choices
and Compensations 64
Roberto Bruni @ Santa Cruz (CA) USA 18 Jan. 2005
Why JOIN? Extends a higher-order functional
language parallelism in expressions (fork calls) parallelism in function patterns (join patterns)