StarRocks / starrocks-connector-for-apache-flink

Apache License 2.0
194 stars 162 forks source link

[Bugfix] Prepare failed when the transaction still in processing #384

Open gohalo opened 2 months ago

gohalo commented 2 months ago

What type of PR is this:

Which issues of this PR fixes :

Fixes #383

Problem Summary(Required) :

When invoking the prepare method for some transaction, there maybe get some chance failed, with the following code.

Status TransactionMgr::commit_transaction(const HttpRequest* req, std::string* resp) {
    // ......
        if (!ctx->lock.try_lock()) {
            st = Status::TransactionInProcessing("Transaction in processing, please retry later");
            *resp = _build_reply(label, TXN_COMMIT, st);
            return st;
        }
    // ......
}

And the flink connector just throw an exception without retry.

Checklist: