You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by Zhang Lei <zh...@boco.com.cn> on 2019/05/13 15:50:23 UTC

[Saga] A little thought about Using StateMachine for tracing the transaction states

I wrote a preliminary design [1] based on wiki [2], , Maybe not perfect or something I don't know.

Any suggestions?

[1] https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md <https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md>
[2] https://cwiki.apache.org/confluence/display/SERVICECOMB/Using+StateMachine+for+tracing+the+transaction+states <https://cwiki.apache.org/confluence/display/SERVICECOMB/Using+StateMachine+for+tracing+the+transaction+states>

Lei Zhang

Re: [Saga] A little thought about Using StateMachine for tracing the transaction states

Posted by Zhang Lei <zh...@boco.com.cn>.
Hi Zheng Feng

I'm very glad it helps

As you said, SUSPEND COMMITTED COMPENSATED are the three final states

About SagaTimeoutEvent, At some point, we are not sure if alpha is actually recording the transaction. For example, the request timeout exception or network interrupt exception. I want to log this by sending a SagaTimeoutEvent and suspending the transaction

I have added a description for the status and events[1]

I look forward to your suggestions

[1] https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md <https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md>

Lei Zhang

> 在 2019年5月14日,下午3:48,Zheng Feng <zh...@gmail.com> 写道:
> 
> Thanks Zhang Lei - it is really great work !
> 
> I think we could describe every event and state with more details, e.g.
> SagaStartedEvent: it is the event to start a global transaction
> SagaEnededEvent: it is the event to close a global transaction
> SagaAbortedEvent: it is the event to abort a global transaction and cause
> the sub-transactions to do the compensate
> SagaTimeoutEvent: it is the event to indicate the global transaction is
> timeout and need the checking manually ? (I am not very if I understand
> this event correctly)
> 
> Also we could add the similar descriptions with the states.
> SUSPEND, COMMITTED, COMPENSATED are the three final states, right ?
> 
> Thanks again !
> Zheng Feng
> 
> 
> Zhang Lei <zh...@boco.com.cn> 于2019年5月13日周一 下午11:50写道:
> 
>> I wrote a preliminary design [1] based on wiki [2], , Maybe not perfect or
>> something I don't know.
>> 
>> Any suggestions?
>> 
>> [1]
>> https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md
>> <
>> https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md
>>> 
>> [2]
>> https://cwiki.apache.org/confluence/display/SERVICECOMB/Using+StateMachine+for+tracing+the+transaction+states
>> <
>> https://cwiki.apache.org/confluence/display/SERVICECOMB/Using+StateMachine+for+tracing+the+transaction+states
>>> 
>> 
>> Lei Zhang


Re: [Saga] A little thought about Using StateMachine for tracing the transaction states

Posted by Zheng Feng <zh...@gmail.com>.
+1 for using the message broker.

Willem Jiang <wi...@gmail.com> 于2019年5月15日周三 上午10:04写道:

> Sure,as the omega can tell if the service invocation is timeout, we
> could simplify timeout handling on the Alpha side.
> But there still long way to go, I will ping you this afternoon for
> more discussion.
> BTW, I'm thinking using the message broker to pass the invocation
> event between Omega and Alpha
>
> Regards,
>
> Willem Jiang
>
> Twitter: willemjiang
> Weibo: 姜宁willem
>
> On Tue, May 14, 2019 at 11:07 PM Zhang Lei <zh...@boco.com.cn> wrote:
> >
> > Hi Willem
> >
> > Thanks for your kind words
> > Can you give me some tips about other cases of timeout? Or indicate the
> possible action number in the success scene timing diagram
> >
> > Thanks,
> > Lei Zhang
> >
> > > 在 2019年5月14日,下午6:55,Willem Jiang <wi...@gmail.com> 写道:
> > >
> > > If we want to tell the timeout issue, it still need to add more states.
> > > But ZhangLei showed us a fantastical document for checking the states
> > > of Saga use case.
> > >
> > > Willem Jiang
> > >
> > > Twitter: willemjiang
> > > Weibo: 姜宁willem
> > >
> > > On Tue, May 14, 2019 at 3:49 PM Zheng Feng <zh...@gmail.com> wrote:
> > >>
> > >> Thanks Zhang Lei - it is really great work !
> > >>
> > >> I think we could describe every event and state with more details,
> e.g.
> > >> SagaStartedEvent: it is the event to start a global transaction
> > >> SagaEnededEvent: it is the event to close a global transaction
> > >> SagaAbortedEvent: it is the event to abort a global transaction and
> cause
> > >> the sub-transactions to do the compensate
> > >> SagaTimeoutEvent: it is the event to indicate the global transaction
> is
> > >> timeout and need the checking manually ? (I am not very if I
> understand
> > >> this event correctly)
> > >>
> > >> Also we could add the similar descriptions with the states.
> > >> SUSPEND, COMMITTED, COMPENSATED are the three final states, right ?
> > >>
> > >> Thanks again !
> > >> Zheng Feng
> > >>
> > >>
> > >> Zhang Lei <zh...@boco.com.cn> 于2019年5月13日周一 下午11:50写道:
> > >>
> > >>> I wrote a preliminary design [1] based on wiki [2], , Maybe not
> perfect or
> > >>> something I don't know.
> > >>>
> > >>> Any suggestions?
> > >>>
> > >>> [1]
> > >>>
> https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md
> > >>> <
> > >>>
> https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md
> > >>>>
> > >>> [2]
> > >>>
> https://cwiki.apache.org/confluence/display/SERVICECOMB/Using+StateMachine+for+tracing+the+transaction+states
> > >>> <
> > >>>
> https://cwiki.apache.org/confluence/display/SERVICECOMB/Using+StateMachine+for+tracing+the+transaction+states
> > >>>>
> > >>>
> > >>> Lei Zhang
> >
>

Re: [Saga] A little thought about Using StateMachine for tracing the transaction states

Posted by Zhang Lei <zh...@boco.com.cn>.
message broker is good choice

Lei Zhang

> 在 2019年5月15日,上午10:03,Willem Jiang <wi...@gmail.com> 写道:
> 
>  the message broker 


Re: [Saga] A little thought about Using StateMachine for tracing the transaction states

Posted by Willem Jiang <wi...@gmail.com>.
Sure,as the omega can tell if the service invocation is timeout, we
could simplify timeout handling on the Alpha side.
But there still long way to go, I will ping you this afternoon for
more discussion.
BTW, I'm thinking using the message broker to pass the invocation
event between Omega and Alpha

Regards,

Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Tue, May 14, 2019 at 11:07 PM Zhang Lei <zh...@boco.com.cn> wrote:
>
> Hi Willem
>
> Thanks for your kind words
> Can you give me some tips about other cases of timeout? Or indicate the possible action number in the success scene timing diagram
>
> Thanks,
> Lei Zhang
>
> > 在 2019年5月14日,下午6:55,Willem Jiang <wi...@gmail.com> 写道:
> >
> > If we want to tell the timeout issue, it still need to add more states.
> > But ZhangLei showed us a fantastical document for checking the states
> > of Saga use case.
> >
> > Willem Jiang
> >
> > Twitter: willemjiang
> > Weibo: 姜宁willem
> >
> > On Tue, May 14, 2019 at 3:49 PM Zheng Feng <zh...@gmail.com> wrote:
> >>
> >> Thanks Zhang Lei - it is really great work !
> >>
> >> I think we could describe every event and state with more details, e.g.
> >> SagaStartedEvent: it is the event to start a global transaction
> >> SagaEnededEvent: it is the event to close a global transaction
> >> SagaAbortedEvent: it is the event to abort a global transaction and cause
> >> the sub-transactions to do the compensate
> >> SagaTimeoutEvent: it is the event to indicate the global transaction is
> >> timeout and need the checking manually ? (I am not very if I understand
> >> this event correctly)
> >>
> >> Also we could add the similar descriptions with the states.
> >> SUSPEND, COMMITTED, COMPENSATED are the three final states, right ?
> >>
> >> Thanks again !
> >> Zheng Feng
> >>
> >>
> >> Zhang Lei <zh...@boco.com.cn> 于2019年5月13日周一 下午11:50写道:
> >>
> >>> I wrote a preliminary design [1] based on wiki [2], , Maybe not perfect or
> >>> something I don't know.
> >>>
> >>> Any suggestions?
> >>>
> >>> [1]
> >>> https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md
> >>> <
> >>> https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md
> >>>>
> >>> [2]
> >>> https://cwiki.apache.org/confluence/display/SERVICECOMB/Using+StateMachine+for+tracing+the+transaction+states
> >>> <
> >>> https://cwiki.apache.org/confluence/display/SERVICECOMB/Using+StateMachine+for+tracing+the+transaction+states
> >>>>
> >>>
> >>> Lei Zhang
>

Re: [Saga] A little thought about Using StateMachine for tracing the transaction states

Posted by Zhang Lei <zh...@boco.com.cn>.
Hi Willem

Thanks for your kind words
Can you give me some tips about other cases of timeout? Or indicate the possible action number in the success scene timing diagram

Thanks,
Lei Zhang

> 在 2019年5月14日,下午6:55,Willem Jiang <wi...@gmail.com> 写道:
> 
> If we want to tell the timeout issue, it still need to add more states.
> But ZhangLei showed us a fantastical document for checking the states
> of Saga use case.
> 
> Willem Jiang
> 
> Twitter: willemjiang
> Weibo: 姜宁willem
> 
> On Tue, May 14, 2019 at 3:49 PM Zheng Feng <zh...@gmail.com> wrote:
>> 
>> Thanks Zhang Lei - it is really great work !
>> 
>> I think we could describe every event and state with more details, e.g.
>> SagaStartedEvent: it is the event to start a global transaction
>> SagaEnededEvent: it is the event to close a global transaction
>> SagaAbortedEvent: it is the event to abort a global transaction and cause
>> the sub-transactions to do the compensate
>> SagaTimeoutEvent: it is the event to indicate the global transaction is
>> timeout and need the checking manually ? (I am not very if I understand
>> this event correctly)
>> 
>> Also we could add the similar descriptions with the states.
>> SUSPEND, COMMITTED, COMPENSATED are the three final states, right ?
>> 
>> Thanks again !
>> Zheng Feng
>> 
>> 
>> Zhang Lei <zh...@boco.com.cn> 于2019年5月13日周一 下午11:50写道:
>> 
>>> I wrote a preliminary design [1] based on wiki [2], , Maybe not perfect or
>>> something I don't know.
>>> 
>>> Any suggestions?
>>> 
>>> [1]
>>> https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md
>>> <
>>> https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md
>>>> 
>>> [2]
>>> https://cwiki.apache.org/confluence/display/SERVICECOMB/Using+StateMachine+for+tracing+the+transaction+states
>>> <
>>> https://cwiki.apache.org/confluence/display/SERVICECOMB/Using+StateMachine+for+tracing+the+transaction+states
>>>> 
>>> 
>>> Lei Zhang


Re: [Saga] A little thought about Using StateMachine for tracing the transaction states

Posted by Willem Jiang <wi...@gmail.com>.
If we want to tell the timeout issue, it still need to add more states.
But ZhangLei showed us a fantastical document for checking the states
of Saga use case.

Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Tue, May 14, 2019 at 3:49 PM Zheng Feng <zh...@gmail.com> wrote:
>
> Thanks Zhang Lei - it is really great work !
>
> I think we could describe every event and state with more details, e.g.
> SagaStartedEvent: it is the event to start a global transaction
> SagaEnededEvent: it is the event to close a global transaction
> SagaAbortedEvent: it is the event to abort a global transaction and cause
> the sub-transactions to do the compensate
> SagaTimeoutEvent: it is the event to indicate the global transaction is
> timeout and need the checking manually ? (I am not very if I understand
> this event correctly)
>
> Also we could add the similar descriptions with the states.
> SUSPEND, COMMITTED, COMPENSATED are the three final states, right ?
>
> Thanks again !
> Zheng Feng
>
>
> Zhang Lei <zh...@boco.com.cn> 于2019年5月13日周一 下午11:50写道:
>
> > I wrote a preliminary design [1] based on wiki [2], , Maybe not perfect or
> > something I don't know.
> >
> > Any suggestions?
> >
> > [1]
> > https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md
> > <
> > https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md
> > >
> > [2]
> > https://cwiki.apache.org/confluence/display/SERVICECOMB/Using+StateMachine+for+tracing+the+transaction+states
> > <
> > https://cwiki.apache.org/confluence/display/SERVICECOMB/Using+StateMachine+for+tracing+the+transaction+states
> > >
> >
> > Lei Zhang

Re: [Saga] A little thought about Using StateMachine for tracing the transaction states

Posted by Zheng Feng <zh...@gmail.com>.
Thanks Zhang Lei - it is really great work !

I think we could describe every event and state with more details, e.g.
SagaStartedEvent: it is the event to start a global transaction
SagaEnededEvent: it is the event to close a global transaction
SagaAbortedEvent: it is the event to abort a global transaction and cause
the sub-transactions to do the compensate
SagaTimeoutEvent: it is the event to indicate the global transaction is
timeout and need the checking manually ? (I am not very if I understand
this event correctly)

Also we could add the similar descriptions with the states.
SUSPEND, COMMITTED, COMPENSATED are the three final states, right ?

Thanks again !
Zheng Feng


Zhang Lei <zh...@boco.com.cn> 于2019年5月13日周一 下午11:50写道:

> I wrote a preliminary design [1] based on wiki [2], , Maybe not perfect or
> something I don't know.
>
> Any suggestions?
>
> [1]
> https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md
> <
> https://github.com/coolbeevip/playground/blob/master/state_machine_demo/saga-akkafsm/README.md
> >
> [2]
> https://cwiki.apache.org/confluence/display/SERVICECOMB/Using+StateMachine+for+tracing+the+transaction+states
> <
> https://cwiki.apache.org/confluence/display/SERVICECOMB/Using+StateMachine+for+tracing+the+transaction+states
> >
>
> Lei Zhang