dataroaring commented on code in PR #41362:
URL: https://github.com/apache/doris/pull/41362#discussion_r1778712359
##########
fe/fe-core/src/main/java/org/apache/doris/transaction/TransactionEntry.java:
##########
@@ -534,4 +532,82 @@ private TTxnLoadInfo getTxnLoadInfo() {
private Set<Long> getTableIds() {
return subTransactionStates.stream().map(s ->
s.getTable().getId()).collect(Collectors.toSet());
}
+
+ public List<Long> getPartitionSubTxnIds(long tableId, Partition partition,
long indexId) {
+ List<Long> subTxnIds = new ArrayList<>();
+ MaterializedIndex index = partition.getIndex(indexId);
+ if (index == null) {
+ LOG.error("index={} not found in table={}, partition={}", indexId,
tableId, partition.getId());
+ return subTxnIds;
+ }
+ for (SubTransactionState subTransactionState : subTransactionStates) {
+ if (subTransactionState.getTable().getId() != tableId) {
+ continue;
+ }
+ for (TTabletCommitInfo tabletCommitInfo :
subTransactionState.getTabletCommitInfos()) {
+ if (index.getTablet(tabletCommitInfo.getTabletId()) != null) {
+ subTxnIds.add(subTransactionState.getSubTransactionId());
+ break;
+ }
+ }
+ }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("table_id={}, partition_id={}, sub_txn_ids={}", tableId,
partition.getId(), subTxnIds);
+ }
+ return subTxnIds;
Review Comment:
Here, we could generate duplicated sub txnids. I am not sure what is impact.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]