This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new b0d1166989 [fix](meta) fix concurrent modification exception and
potential NPE (#17602)
b0d1166989 is described below
commit b0d1166989a74f2c82473be74e6f1e19fbcdaccc
Author: Mingyu Chen <[email protected]>
AuthorDate: Sun Mar 12 22:12:07 2023 +0800
[fix](meta) fix concurrent modification exception and potential NPE (#17602)
---
.../java/org/apache/doris/analysis/DescriptorTable.java | 12 ++++++------
.../apache/doris/transaction/GlobalTransactionMgr.java | 17 +++++++++++++++--
2 files changed, 21 insertions(+), 8 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DescriptorTable.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DescriptorTable.java
index 2f8303915c..42c69bba6e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DescriptorTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DescriptorTable.java
@@ -27,14 +27,12 @@ import org.apache.doris.thrift.TDescriptorTable;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -185,7 +183,7 @@ public class DescriptorTable {
public TDescriptorTable toThrift() {
TDescriptorTable result = new TDescriptorTable();
- HashSet<TableIf> referencedTbls = Sets.newHashSet();
+ Map<Long, TableIf> referencedTbls = Maps.newHashMap();
for (TupleDescriptor tupleD : tupleDescs.values()) {
// inline view of a non-constant select has a non-materialized
tuple descriptor
// in the descriptor table just for type checking, which we need
to skip
@@ -195,7 +193,7 @@ public class DescriptorTable {
// but its table has no id
if (tupleD.getTable() != null
&& tupleD.getTable().getId() >= 0) {
- referencedTbls.add(tupleD.getTable());
+ referencedTbls.put(tupleD.getTable().getId(),
tupleD.getTable());
}
for (SlotDescriptor slotD : tupleD.getMaterializedSlots()) {
result.addToSlotDescriptors(slotD.toThrift());
@@ -203,9 +201,11 @@ public class DescriptorTable {
}
}
- referencedTbls.addAll(referencedTables);
+ for (TableIf tbl : referencedTables) {
+ referencedTbls.put(tbl.getId(), tbl);
+ }
- for (TableIf tbl : referencedTbls) {
+ for (TableIf tbl : referencedTbls.values()) {
result.addToTableDescriptors(tbl.toThrift());
}
return result;
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
b/fe/fe-core/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
index 18bf57bb19..bd47576ce8 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
@@ -335,11 +335,24 @@ public class GlobalTransactionMgr implements Writable {
return !dbTransactionMgr.getCommittedTxnList().isEmpty();
}
- for (TransactionState transactionState :
dbTransactionMgr.getCommittedTxnList()) {
+ List<TransactionState> committedTxnList =
dbTransactionMgr.getCommittedTxnList();
+ for (TransactionState transactionState : committedTxnList) {
if (transactionState.getTableIdList().contains(tableId)) {
if (partitionId == null) {
return true;
- } else if
(transactionState.getTableCommitInfo(tableId).getPartitionCommitInfo(partitionId)
!= null) {
+ }
+ TableCommitInfo tableCommitInfo =
transactionState.getTableCommitInfo(tableId);
+ if (tableCommitInfo == null) {
+ // FIXME: this is a bug, should not happen
+ // If table id is in transaction state's table list, and
it is COMMITTED,
+ // table commit info should not be null.
+ // return true to avoid following process.
+ LOG.warn("unexpected error. tableCommitInfo is null. dbId:
{} tableId: {}, partitionId: {},"
+ + " transactionState: {}",
+ dbId, tableId, partitionId, transactionState);
+ return true;
+ }
+ if (tableCommitInfo.getPartitionCommitInfo(partitionId) !=
null) {
return true;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]