[Tablet report] Fix bug that tablet report throw NPE. (#2578)
When processing tablet reports, some tablets carry transaction information. This information is used by the FE to determine whether to publish these transactions or clear these transactions. During this process, Doris may try to obtain the commit information of some deleted partitions, resulting in a null pointer exception.
This commit is contained in:
@ -196,18 +196,28 @@ public class TabletInvertedIndex {
|
||||
TableCommitInfo tableCommitInfo = transactionState.getTableCommitInfo(tabletMeta.getTableId());
|
||||
PartitionCommitInfo partitionCommitInfo = tableCommitInfo.getPartitionCommitInfo(partitionId);
|
||||
if (partitionCommitInfo == null) {
|
||||
LOG.warn("failed to find partition commit info. table: {}, partition: {}, tablet: {}, txn id: {}",
|
||||
/*
|
||||
* This may happen as follows:
|
||||
* 1. txn is committed on BE, and report commit info to FE
|
||||
* 2. FE received report and begin to assemble partitionCommitInfos.
|
||||
* 3. At the same time, some of partitions have been dropped, so partitionCommitInfos does not contain these partitions.
|
||||
* 4. So we will not able to get partitionCommitInfo here.
|
||||
*
|
||||
* Just print a log to observe
|
||||
*/
|
||||
LOG.info("failed to find partition commit info. table: {}, partition: {}, tablet: {}, txn id: {}",
|
||||
tabletMeta.getTableId(), partitionId, tabletId, transactionState.getTransactionId());
|
||||
} else {
|
||||
TPartitionVersionInfo versionInfo = new TPartitionVersionInfo(tabletMeta.getPartitionId(),
|
||||
partitionCommitInfo.getVersion(),
|
||||
partitionCommitInfo.getVersionHash());
|
||||
ListMultimap<Long, TPartitionVersionInfo> map = transactionsToPublish.get(transactionState.getDbId());
|
||||
if (map == null) {
|
||||
map = ArrayListMultimap.create();
|
||||
transactionsToPublish.put(transactionState.getDbId(), map);
|
||||
}
|
||||
map.put(transactionId, versionInfo);
|
||||
}
|
||||
TPartitionVersionInfo versionInfo = new TPartitionVersionInfo(tabletMeta.getPartitionId(),
|
||||
partitionCommitInfo.getVersion(),
|
||||
partitionCommitInfo.getVersionHash());
|
||||
ListMultimap<Long, TPartitionVersionInfo> map = transactionsToPublish.get(transactionState.getDbId());
|
||||
if (map == null) {
|
||||
map = ArrayListMultimap.create();
|
||||
transactionsToPublish.put(transactionState.getDbId(), map);
|
||||
}
|
||||
map.put(transactionId, versionInfo);
|
||||
}
|
||||
}
|
||||
} // end for txn id
|
||||
|
||||
Reference in New Issue
Block a user