You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
你好:
我看demo 中saga的例子是扣减库存,大概总结下来是:
transaction 1: set amount = amount+1 where id = 1;
transaction 2: set amount = amount +2 where id = 1;
当transaction 1 发生错误,需要补偿的时候:业务端 写个方法是: set amount = amount-1 where id = 1;
当transaction 2 发生错误,需要补偿的时候:业务端 写个方法是: set amount = amount-2 where id = 1;
这是正确的。
如果换成字符串好像就不对了,例如:
transaction 1: set name = 'n1' where id = 1;
transaction 2: set name = 'n2' where id = 1;
当transaction 1 发生错误,需要补偿的时候:业务端 写个方法是: set name = null where id = 1;
当 transaction 2 补偿的时候 set name = 'n1' where id = 1。最后name 变成了 n1 了。
The text was updated successfully, but these errors were encountered:
你好:
我看demo 中saga的例子是扣减库存,大概总结下来是:
transaction 1: set amount = amount+1 where id = 1;
transaction 2: set amount = amount +2 where id = 1;
当transaction 1 发生错误,需要补偿的时候:业务端 写个方法是: set amount = amount-1 where id = 1;
当transaction 2 发生错误,需要补偿的时候:业务端 写个方法是: set amount = amount-2 where id = 1;
这是正确的。
如果换成字符串好像就不对了,例如:
transaction 1: set name = 'n1' where id = 1;
transaction 2: set name = 'n2' where id = 1;
当transaction 1 发生错误,需要补偿的时候:业务端 写个方法是: set name = null where id = 1;
当 transaction 2 补偿的时候 set name = 'n1' where id = 1。最后name 变成了 n1 了。
The text was updated successfully, but these errors were encountered: