yujun777 commented on code in PR #28079: URL: https://github.com/apache/doris/pull/28079#discussion_r1427632722
########## fe/fe-core/src/main/java/org/apache/doris/transaction/PublishVersionDaemon.java: ########## @@ -132,27 +133,45 @@ private void publishVersion() { Map<Long, Long> tableIdToTotalDeltaNumRows = Maps.newHashMap(); // try to finish the transaction, if failed just retry in next loop for (TransactionState transactionState : readyTransactionStates) { - Stream<PublishVersionTask> publishVersionTaskStream = transactionState - .getPublishVersionTasks() - .values() - .stream() - .peek(task -> { - if (task.isFinished() && CollectionUtils.isEmpty(task.getErrorTablets())) { - Map<Long, Long> tableIdToDeltaNumRows = - task.getTableIdToDeltaNumRows(); - tableIdToDeltaNumRows.forEach((tableId, numRows) -> { - tableIdToTotalDeltaNumRows - .computeIfPresent(tableId, (id, orgNumRows) -> orgNumRows + numRows); - tableIdToTotalDeltaNumRows.putIfAbsent(tableId, numRows); - }); - } - }); - boolean hasBackendAliveAndUnfinishedTask = publishVersionTaskStream - .anyMatch(task -> !task.isFinished() && infoService.checkBackendAlive(task.getBackendId())); + AtomicReference<Long> finishNum = new AtomicReference<>(0L); + AtomicBoolean hasBackendAliveAndUnfinishedTask = new AtomicBoolean(false); + Set<Long> notFinishTaskBe = Sets.newHashSet(); + transactionState.getPublishVersionTasks().forEach((beId, task) -> { + if (task.isFinished()) { + finishNum.set(finishNum.get() + 1); + if (CollectionUtils.isEmpty(task.getErrorTablets())) { + Map<Long, Long> tableIdToDeltaNumRows = task.getTableIdToDeltaNumRows(); + tableIdToDeltaNumRows.forEach((tableId, numRows) -> { + tableIdToTotalDeltaNumRows + .computeIfPresent(tableId, (id, orgNumRows) -> orgNumRows + numRows); + tableIdToTotalDeltaNumRows.putIfAbsent(tableId, numRows); + }); + } + } else { + if (infoService.checkBackendAlive(task.getBackendId())) { + hasBackendAliveAndUnfinishedTask.set(true); + } + notFinishTaskBe.add(beId); + } + }); + transactionState.setTableIdToTotalNumDeltaRows(tableIdToTotalDeltaNumRows); + LOG.debug("notFinishTaskBe {}, trans {}", notFinishTaskBe, transactionState); Review Comment: log transId, do not log txnState . because transactionState toString is not effective. and this line will run a lot even it's debug. -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org