美文网首页
BrokerLoadJob的JobState流转过程

BrokerLoadJob的JobState流转过程

作者: 专职掏大粪 | 来源:发表于2021-10-10 17:38 被阅读0次
  • There are 3 steps in BrokerLoadJob: BrokerPendingTask, LoadLoadingTask, CommitAndPublishTxn.
  • Step1: BrokerPendingTask will be created on method of unprotectedExecuteJob.
  • Step2: LoadLoadingTasks will be created by the method of onTaskFinished when BrokerPendingTask is finished.
  • Step3: CommitAndPublicTxn will be called by the method of onTaskFinished when all of LoadLoadingTasks are finished.

BrokerLoadJob.onTaskFinished

 if (attachment instanceof BrokerPendingTaskAttachment) {
            onPendingTaskFinished((BrokerPendingTaskAttachment) attachment);
        } else if (attachment instanceof BrokerLoadingTaskAttachment) {
            onLoadingTaskFinished((BrokerLoadingTaskAttachment) attachment);
        }

BrokerLoadJob.cancelJobWithoutCheck

Job状态转换为cancel

#LoadJob.unprotectedExecuteCancel 
   // change state
        state = JobState.CANCELLED;

BrokerLoadJob.onLoadingTaskFinished

 Catalog.getCurrentGlobalTransactionMgr().commitTransaction(
                    dbId, transactionId, commitInfos,
                    new LoadJobFinalOperation(id, loadingStatus, progress, loadStartTimestamp,
                            finishTimestamp, state, failMsg));

DatabaseTransactionMgr.commitTransaction

transactionState.afterStateTransform

   public void afterStateTransform(TransactionStatus transactionStatus, boolean txnOperated,
                                    String txnStatusChangeReason)
            throws UserException {
        // after status changed
        TxnStateChangeCallback callback = Catalog.getCurrentGlobalTransactionMgr()
                .getCallbackFactory().getCallback(callbackId);
        if (callback != null) {
            switch (transactionStatus) {
                case ABORTED:
                   //ABORTED的时候会调用unprotectedExecuteCancel ,canal Job
                   //更新JobState 为CANCELLED
                    callback.afterAborted(this, txnOperated, txnStatusChangeReason);
                    break;
                 //COMMITTED 的时候更新JobState 为COMMITTED
                case COMMITTED:
                    callback.afterCommitted(this, txnOperated);
                    break;
                //VISIBLE 的时候更新JobState 为FINISHED
                case VISIBLE:
                    callback.afterVisible(this, txnOperated);
                    break;
                default:
                    break;
            }
        }
    }

相关文章

  • BrokerLoadJob的JobState流转过程

    There are 3 steps in BrokerLoadJob: BrokerPendingTask, Lo...

  • 【Kafka零基础学习】日志存储

    1、消息流转过程 下图演示了一个简单的Kafka消息流转过程。Kafka Produce仅发送包含有topic为s...

  • 深有体会的信息流转过程

    信息微收集:在时间线上,就某个主题,有意识的微积累,哪怕一小点经验和思考结晶,都是你开始变得不一样的关键点。并且将...

  • tc端 rollback和commit时 globla stat

    对rollback的源码debug的过程中,大概就是这个状态流转图 commit全局事务

  • 【RealChain】基于区块链的高端消费品鉴定数据中心

    项目概况 RealChain 产品中的区块链技术会使交易过程、鉴定评估过程,资金流转过程全部分散式记录在各个节点中...

  • 构建SpringMVC应用的两种方法

    dispatchServlet是Spring MVC的核心。一次Spring MVC请求的流转过程如下: 请求到达...

  • 流转

    真像是做了个梦 从我们相遇起,一直到分离的境遇 而我又真想,这不过是个梦 所有的夜晚我都喜欢 所有的夜晚也都害怕 ...

  • 流转

    我并不觉得我的生活充满情趣,反尔在岁月的磨砺中学会冷静,旁观。 有时候回忆会象一把明晃晃的刀,扼杀美好的臆象,疼痛...

  • 流转

    夏天的时候 麻雀在枝头恋爱 他们陪伴彼此一个季节 然后分开 然后相互忘却 这是麻雀的爱情 秋天的时候 燕子向南方飞...

  • 流转

    夕阳斜挂,淡金色的暖色铺满小县城里每一条的小道。身着红白相间校服的孩子吵吵闹闹的推拥而来,手捧着刚刚买来的小吃,笑...

网友评论

      本文标题:BrokerLoadJob的JobState流转过程

      本文链接:https://www.haomeiwen.com/subject/glwholtx.html