Copilot commented on code in PR #59757:
URL: https://github.com/apache/doris/pull/59757#discussion_r2681075163
##########
fe/fe-core/src/main/java/org/apache/doris/cloud/transaction/CloudGlobalTransactionMgr.java:
##########
@@ -2589,55 +2589,30 @@ private void decreaseWaitingLockCount(List<Table>
tableList) {
}
}
- public long getTableLastTxnId(long dbId, long tableId) {
- Map<Long, Long> tabletIdToTxnId = lastTxnIdMap.get(dbId);
- if (tabletIdToTxnId == null) {
- return -1;
- }
- return tabletIdToTxnId.getOrDefault(tableId, -1L);
+ private long getTableLastTxnId(long dbId, long tableId) {
+ return lastTxnIdMap.getOrDefault(tableId, -1L);
}
- public void setTableLastTxnId(long dbId, long tableId, long txnId) {
- lastTxnIdMap.compute(dbId, (k, v) -> {
- if (v == null) {
- v = Maps.newConcurrentMap();
- }
- LOG.debug("setTableLastTxnId dbId: {}, tableId: {}, txnId: {}",
dbId, tableId, txnId);
- v.put(tableId, txnId);
- return v;
- });
+ private void setTableLastTxnId(long dbId, long tableId, long txnId) {
+ lastTxnIdMap.put(tableId, txnId);
+ LOG.debug("setTableLastTxnId dbId: {}, tableId: {}, txnId: {}", dbId,
tableId, txnId);
}
- public void clearTableLastTxnId(long dbId, long tableId) {
- lastTxnIdMap.computeIfPresent(dbId, (k, v) -> {
- v.remove(tableId);
- return v.isEmpty() ? null : v;
- });
+ public void afterDropTable(long dbId, long tableId) {
+ lastTxnIdMap.remove(tableId);
+ waitToCommitTxnCountMap.remove(tableId);
}
Review Comment:
The new afterDropTable method lacks test coverage to verify that both
lastTxnIdMap and waitToCommitTxnCountMap are properly cleaned up when a table
is dropped. Consider adding a unit test in CloudGlobalTransactionMgrTest to
verify this cleanup behavior.
--
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]