This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 224ff33ee63 [fix](txn insert) fix txn_insert case (#42327) (#42417)
224ff33ee63 is described below
commit 224ff33ee63e80e8513eeec140989c0dae22980f
Author: meiyi <[email protected]>
AuthorDate: Mon Oct 28 15:12:49 2024 +0800
[fix](txn insert) fix txn_insert case (#42327) (#42417)
pick https://github.com/apache/doris/pull/42327
---
.../apache/doris/transaction/TransactionEntry.java | 36 ++++++++++++++--------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/transaction/TransactionEntry.java
b/fe/fe-core/src/main/java/org/apache/doris/transaction/TransactionEntry.java
index c9e2ff522ff..fcab55866ed 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/transaction/TransactionEntry.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/transaction/TransactionEntry.java
@@ -460,12 +460,14 @@ public class TransactionEntry {
Preconditions.checkState(subTransactionStates.isEmpty(),
"subTxnStates is not empty: " + subTransactionStates);
resetByTxnInfo(txnLoadInfo);
- this.transactionState =
Env.getCurrentGlobalTransactionMgr().getTransactionState(dbId, transactionId);
- Preconditions.checkNotNull(this.transactionState,
- "db_id" + dbId + " txn_id=" + transactionId + " not
found");
-
Preconditions.checkState(this.label.equals(this.transactionState.getLabel()),
"expected label="
- + this.label + ", real label=" +
this.transactionState.getLabel());
- this.isTransactionBegan = true;
+ if (this.transactionId > 0) {
+ this.transactionState =
Env.getCurrentGlobalTransactionMgr().getTransactionState(dbId, transactionId);
+ Preconditions.checkNotNull(this.transactionState,
+ "db_id=" + dbId + ", txn_id=" + transactionId + " not
found");
+
Preconditions.checkState(this.label.equals(this.transactionState.getLabel()),
"expected label="
+ + this.label + ", real label=" +
this.transactionState.getLabel());
+ this.isTransactionBegan = true;
+ }
}
LOG.info("set txn info in master, label={}, txnId={}, dbId={},
timeoutTimestamp={}, allSubTxnNum={}, "
+ "subTxnStates={}", label, transactionId, dbId,
timeoutTimestamp, allSubTxnNum, subTransactionStates);
@@ -492,17 +494,27 @@ public class TransactionEntry {
"expected label=" + this.label + ", real label=" +
txnLoadInfo.getLabel());
subTransactionStates.clear();
resetByTxnInfo(txnLoadInfo);
- this.isTransactionBegan = true;
+ if (this.transactionId > 0) {
+ this.isTransactionBegan = true;
+ }
LOG.info("set txn load info in observer, label={}, txnId={}, dbId={},
timeoutTimestamp={}, allSubTxnNum={}, "
+ "subTxnStates={}", label, transactionId, dbId,
timeoutTimestamp, allSubTxnNum, subTransactionStates);
}
private void resetByTxnInfo(TTxnLoadInfo txnLoadInfo) throws DdlException {
- this.dbId = txnLoadInfo.getDbId();
- this.database =
Env.getCurrentInternalCatalog().getDbOrDdlException(dbId);
- this.transactionId = txnLoadInfo.getTxnId();
- this.timeoutTimestamp = txnLoadInfo.getTimeoutTimestamp();
- this.allSubTxnNum = txnLoadInfo.getAllSubTxnNum();
+ if (txnLoadInfo.isSetDbId()) {
+ this.dbId = txnLoadInfo.getDbId();
+ this.database =
Env.getCurrentInternalCatalog().getDbOrDdlException(dbId);
+ }
+ if (txnLoadInfo.isSetTxnId()) {
+ this.transactionId = txnLoadInfo.getTxnId();
+ }
+ if (txnLoadInfo.isSetTimeoutTimestamp()) {
+ this.timeoutTimestamp = txnLoadInfo.getTimeoutTimestamp();
+ }
+ if (txnLoadInfo.isSetAllSubTxnNum()) {
+ this.allSubTxnNum = txnLoadInfo.getAllSubTxnNum();
+ }
if (txnLoadInfo.isSetSubTxnInfos()) {
for (TSubTxnInfo subTxnInfo : txnLoadInfo.getSubTxnInfos()) {
TableIf table =
database.getTableOrDdlException(subTxnInfo.getTableId());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]