You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by Eric Lee <er...@gmail.com> on 2018/02/06 14:46:12 UTC

[Saga Discussion] Support for db's update operation of complicate types

Hi all,

Currently, saga pack intercept all arguments to be processed by spring aop.
However, when developers execute the SQL's update operations with
complicate types like update the status, it will be really hard to
compensate because neither alpha and omega knows what's the previous status
before execute the update statement. In other words, it can not rollback to
the original state by compensating.

Possible solution:
Add a new method for developers to customize their payloads needed to
recover when compensating. Suppose we need to change the task status to
DONE regardless of its previous status, before that, we just query for the
current task status and save it to payloads which will be stored in alpha
and return to omega when compensation happens. In this way, we can recover
the task status to the original one.

Any idea on this is welcome. Thanks.


Best Regards!
Eric Lee

Re: [Saga Discussion] Support for db's update operation of complicate types

Posted by Zheng Feng <zh...@gmail.com>.
Well it could be very hard to write the compensate method sometimes. I
don't think it would be an easy way to rollback or undo the UPDATE
statement.


2018-02-07 21:11 GMT+08:00 Willem Jiang <wi...@gmail.com>:

> It's good way to provide the custom extension of the compensating message.
> But it's a challenge for the user to know about the whole compensation
> message.
>
> It's could more easier for the user to write the code by using forward
> recovery which means we just let the omega retry the transaction method.
>
>
> Willem Jiang
>
> Blog: http://willemjiang.blogspot.com (English)
>           http://jnn.iteye.com  (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
> On Tue, Feb 6, 2018 at 10:46 PM, Eric Lee <er...@gmail.com> wrote:
>
> > Hi all,
> >
> > Currently, saga pack intercept all arguments to be processed by spring
> aop.
> > However, when developers execute the SQL's update operations with
> > complicate types like update the status, it will be really hard to
> > compensate because neither alpha and omega knows what's the previous
> status
> > before execute the update statement. In other words, it can not rollback
> to
> > the original state by compensating.
> >
> > Possible solution:
> > Add a new method for developers to customize their payloads needed to
> > recover when compensating. Suppose we need to change the task status to
> > DONE regardless of its previous status, before that, we just query for
> the
> > current task status and save it to payloads which will be stored in alpha
> > and return to omega when compensation happens. In this way, we can
> recover
> > the task status to the original one.
> >
> > Any idea on this is welcome. Thanks.
> >
> >
> > Best Regards!
> > Eric Lee
> >
>

Re: [Saga Discussion] Support for db's update operation of complicate types

Posted by Willem Jiang <wi...@gmail.com>.
It's good way to provide the custom extension of the compensating message.
But it's a challenge for the user to know about the whole compensation
message.

It's could more easier for the user to write the code by using forward
recovery which means we just let the omega retry the transaction method.


Willem Jiang

Blog: http://willemjiang.blogspot.com (English)
          http://jnn.iteye.com  (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem

On Tue, Feb 6, 2018 at 10:46 PM, Eric Lee <er...@gmail.com> wrote:

> Hi all,
>
> Currently, saga pack intercept all arguments to be processed by spring aop.
> However, when developers execute the SQL's update operations with
> complicate types like update the status, it will be really hard to
> compensate because neither alpha and omega knows what's the previous status
> before execute the update statement. In other words, it can not rollback to
> the original state by compensating.
>
> Possible solution:
> Add a new method for developers to customize their payloads needed to
> recover when compensating. Suppose we need to change the task status to
> DONE regardless of its previous status, before that, we just query for the
> current task status and save it to payloads which will be stored in alpha
> and return to omega when compensation happens. In this way, we can recover
> the task status to the original one.
>
> Any idea on this is welcome. Thanks.
>
>
> Best Regards!
> Eric Lee
>