Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Dmitry
    @dvelopp
    @coolbeevip , thank you! It helps a lot!
    Lei Zhang
    @coolbeevip
    @WillemJiang I just updated the PR apache/servicecomb-pack#616
    Lei Zhang
    @coolbeevip
    @WillemJiang Please take a look at apache/servicecomb-pack#627
    Willem Jiang
    @WillemJiang
    reverted.
    Lei Zhang
    @coolbeevip
    Thx
    Dmitry
    @dvelopp

    Hey guys, what happens if in the middle of the transaction, my omegas go down for a certain amount of time?
    For example,
    I have a saga:

    book a hotel
    book a car
    book a flight
    And during booking a car omega got shut down.

    1. Will it compensate hotel transaction when omega goes up?
    2. Will it restart the whole saga and go through it again?
    Amos Feng
    @zhfeng
    @dvelopp I think it depends on the saga events which coordinator (alpha server) receives from the car omega.
    Amos Feng
    @zhfeng
    1. the car omega crash down and can not send the TxStartEvent. The whole transaction will be cancelled and the hotel will be compensated.
    1. the car omega down after the business logic and can not send the TxEndEvent. The whole transaction will be time out and be compensated.
    Dmitry
    @dvelopp
    Hi Amos,
    Thank you for clarifications.
    zhangkai
    @zk1007271083
    hello
    How to integrate springmvc
    Lei Zhang
    @coolbeevip
    @zk1007271083 here is a demo of spring boot integration https://github.com/apache/servicecomb-pack/tree/master/demo/saga-spring-demo
    gjguanjie
    @gjguanjie

    使用https://hub.docker.com/r/coolbeevip/servicecomb-pack中 docker-compose.yaml 方式启动标准镜像只包含 Alpha 服务。 客户端引入<dependency>
    <groupId>org.apache.servicecomb.pack</groupId>
    <artifactId>omega-spring-starter</artifactId>
    </dependency>
    <dependency>
    <groupId>org.apache.servicecomb.pack</groupId>
    <artifactId>omega-transport-resttemplate</artifactId>
    </dependency>

    测试如下
    服务1::
    @RestController
    @RequestMapping("/saga")
    public class SagaController {

    private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
    
    @Resource
    private RestTemplate template;
    
    @GetMapping("/start")
    @SagaStart
    public void start() {
        LOGGER.error("调服务");
        template.postForObject("http://localhost:9001/service/test",null,String.class);
    }

    }

    服务2:
    @RestController
    @RequestMapping("service")
    public class SagaServiceController {

    private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().getClass());
    
    @Resource
    private SagaService sagaService;
    
    @PostMapping("test")
    public void test(){
        sagaService.test();
    }

    }

    @Service
    public class SagaService {

    private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().getClass());
    
    @Compensable(compensationMethod = "cancel")
    public void test() {
        int aa = 1;
        LOGGER.error("测试方法");
        int bb = 1/0;
    }
    
    public void cancel() {
        LOGGER.error("Cancel方法");
    }

    }

    当调用服务1http://localhost:9000/saga/start时,遇到服务2中报错,原则上,会调用cancel方法,但没有执行。

    Lei Zhang
    @coolbeevip
    @gjguanjie 能看一下你这三个服务的日志以及alpha的日志吗?
    @gjguanjie 你只有两个服务?service2的test方法如果出错了,那么应该依赖test方法的本地事务回滚,此时并不会调用service2的cancel方法
    demo中的场景一般说明是三个服务,a->b->c, 如果此时b成功并且c失败,那么b的cancel会被调用
    gjguanjie
    @gjguanjie
    @coolbeevip 确实,三个服务没啥问题,如你所说,a->b->c, 如果此时b成功并且c失败,那么b的cancel会被调用。 alpha日志太大,我docker卡死了。
    Lei Zhang
    @coolbeevip
    你可以使用卷映射到外边
    @gjguanjie
    VOLUME /servicecomb-pack/logs
    VOLUME /servicecomb-pack/plugins
    VOLUME /var/lib/postgresql/data
    gjguanjie
    @gjguanjie
    @coolbeevip 之前关于几个服务调用问题。确实我可能在架构理念上理解与设计者不同。saga: a->b,a->c
    a先调b,再a调c,若a调b时成功,而a调c 不成功,此时,b执行cancel. 若a调b不成功,那么程序异常,不会再调用c. 异常返回a时,a感知异常,将中断后续处理。 这样理解也说得通。
    Lei Zhang
    @coolbeevip
    @gjguanjie 是的
    gjguanjie
    @gjguanjie
    @coolbeevip 还有一个问题。关于TCC的,如,还是a->b,a->c, 若 两个 try调用都成功了,但在confirm时出问题了。如,b中comfirm执行了,但c中comfirm异常(或b中confirm异常,c中comfirm成功)。 发现也没有进一步再处理了。我这里验证,comfirm出错问题。
    Lei Zhang
    @coolbeevip
    @gjguanjie 抱歉,我主要是参与了Saga部分,TCC没有参与, 可以问问 @WillemJiang
    gjguanjie
    @gjguanjie
    @coolbeevip 使用es作为状态机,SAGA不是不存入DB了?
    @WillemJiang 关于TCC的,如,还是a->b,a->c, 若 两个 try调用都成功了,但在confirm时出问题了。如,b中comfirm执行了,但c中comfirm异常(或b中confirm异常,c中comfirm成功)。 发现也没有进一步再处理了。我这里验证,comfirm出错问题。
    Lei Zhang
    @coolbeevip
    @gjguanjie 工作在状态机模式时,事务结束后的数据时存储在ES里的,运行中的事务在Akka集群中
    @gjguanjie 以前时基于DB记录事务的事件的,考虑到性能问题,saga基于akka状态机模式,最后的数据时存储在es中
    gjguanjie
    @gjguanjie
    @coolbeevip 感谢。
    我只看了基于DB的原码,上次本地调试启动状态机有问题,状态机那块原码没看。
    Lei Zhang
    @coolbeevip
    @gjguanjie 状态机从个0.5.0版本提供,建议你使用主干代码自己编译一下,会比较新
    cmonkey
    @cmonkey
    请问一下: sonar 地址是多少,或者可以在什么地方查看?
    王家园
    @wangjiayuanGit
    image.png
    image.png
    @coolbeevip 请问为什么alpha-server 启动失败了呢
    cmonkey
    @cmonkey
    看起来说端口被占用了
    Lei Zhang
    @coolbeevip
    @wangjiayuanGit 确实,端口被占用了,看看你的启动命令中配置的端口是不是已经被占用了,默认会使用 8080,8090两个端口
    justdebugit
    @wyzssw
    大家好, saga有个问题,就是本地事务abort了,比如insert表记录成功,但是和数据库连接断开了,这个时候会发送本地事务abort事件,但是却不会回滚,需要业务自己做回滚
    单库单表还可以,分库分表场景怎么解决这种问题
    Amos Feng
    @zhfeng
    insert表记录成功,那表明数据库层的事务已经完成?那数据库连接断开就不会对全局事务有影响,不会发送abort事件。分库分表的场景中,可以考虑采用数据库中间件的方式来做,可以参考一下apache sharding-sphere
    vvenli
    @vvenli
    是否有计划支持Oracle?
    Alpha是否有计划支持Oracle?
    vvenli
    @vvenli
    在k8s环境中遇到一些问题。确认一下:alpha和omega之间采用gRPC通讯,是互为server/client不? omega会启动一个服务,服务端口自适应? 感谢回复。 @WillemJiang
    Lei Zhang
    @coolbeevip
    @vvenli 应该没有支持 Oracle计划,alpha和omega采用grpc双向流方式连接
    yjjnls
    @yjjnls
    目前 TCC 是否有 golang 的客户端?
    Jevgenija Pantiuchina
    @jpantiuchina_twitter
    Dear contributors,
    As part of a research team from Università della Svizzera italiana (Switzerland) and University of Sannio (Italy), we have analyzed refactoring pull requests in apache/servicecomb-pack repository and are looking for developers for a short 5-10 min survey (https://usi.eu.qualtrics.com/jfe/form/SV_cO6Ayah0D6q4eSF). Would you please spare your time by answering some questions about refactoring-related contributions? We would greatly appreciate your input — it would help us understand how developers can improve the quality of refactoring contributions, and benefit the development process. The responses will be anonymized and handled confidentially! Thank you a lot!
    If you consider this message to be spam, I'm very sorry! There will be no follow-up to bug you.
    bingo
    @finesoft
    还。66$66
    Hiling
    @hiling
    有没有跨语言使用Saga的实例?我们是Java+PHP,两种语言的服务互调,需要做分布式事务。
    hellokitty2009
    @hellokitty2009
    @coolbeevip 请教个问题,saga模式下 三个子事务,第一个子事务执行失败,向前恢复的情况下,第二个 和第三个子事务还会被框架执行吗?