@Override
    public TGetLoadTxnStatusResult getLoadTxnStatus(TGetLoadTxnStatusRequest request) throws TException {
        String clientAddr = getClientAddrAsString();
        LOG.info("receive get txn status request. db: {}, tbl: {}, txn_id: {}, backend: {}",
                request.getDb(), request.getTbl(), request.getTxnId(), clientAddr);
        LOG.debug("get txn status request: {}", request);

        TGetLoadTxnStatusResult result = new TGetLoadTxnStatusResult();
        // if current node is not master, reject the request
        if (!GlobalStateMgr.getCurrentState().isLeader()) {
            LOG.warn("current fe is not leader");
            result.setStatus(TTransactionStatus.UNKNOWN);
            return result;
        }

        // get database
        GlobalStateMgr globalStateMgr = GlobalStateMgr.getCurrentState();
        String dbName = request.getDb();
        Database db = globalStateMgr.getDb(dbName);
        if (db == null) {
            LOG.warn("unknown database, database=" + dbName);
            result.setStatus(TTransactionStatus.UNKNOWN);
            return result;
        }

        try {
            TTransactionStatus status =
                    GlobalStateMgr.getCurrentState().getGlobalTransactionMgr().getTxnStatus(db, request.getTxnId());
            LOG.debug("txn {} status is {}", request.getTxnId(), status);
            result.setStatus(status);
        } catch (Throwable e) {
            result.setStatus(TTransactionStatus.UNKNOWN);
            LOG.warn("catch unknown result.", e);
        }
        return result;
    }
@Test
    public void testGetLoadTxnStatus() throws Exception {
        Database db = GlobalStateMgr.getCurrentState().getDb("test");
        Table table = db.getTable("site_access_day");
        UUID uuid = UUID.randomUUID();
        TUniqueId requestId = new TUniqueId(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits());
        long transactionId = GlobalStateMgr.getCurrentState().getGlobalTransactionMgr().beginTransaction(db.getId(),
                Lists.newArrayList(table.getId()), "1jdc689-xd232", requestId,
                new TxnCoordinator(TxnSourceType.BE, "1.1.1.1"),
                TransactionState.LoadJobSourceType.BACKEND_STREAMING, -1, 600);
        FrontendServiceImpl impl = new FrontendServiceImpl(exeEnv);
        TGetLoadTxnStatusRequest request = new TGetLoadTxnStatusRequest();
        request.setDb("non-exist-db");
        request.setTbl("non-site_access_day-tbl");
        request.setTxnId(100);
        TGetLoadTxnStatusResult result1 = impl.getLoadTxnStatus(request);
        Assert.assertEquals(TTransactionStatus.UNKNOWN, result1.getStatus());
        request.setDb("test");
        TGetLoadTxnStatusResult result2 = impl.getLoadTxnStatus(request);
        Assert.assertEquals(TTransactionStatus.UNKNOWN, result2.getStatus());
        request.setTxnId(transactionId);
        GlobalStateMgr.getCurrentState().setFrontendNodeType(FrontendNodeType.FOLLOWER);
        TGetLoadTxnStatusResult result3 = impl.getLoadTxnStatus(request);
        Assert.assertEquals(TTransactionStatus.UNKNOWN, result3.getStatus());
        GlobalStateMgr.getCurrentState().setFrontendNodeType(FrontendNodeType.LEADER);
        TGetLoadTxnStatusResult result4 = impl.getLoadTxnStatus(request);
        Assert.assertEquals(TTransactionStatus.PREPARE, result4.getStatus());
    }