morningman commented on a change in pull request #3130: [Alter]Clear expire alterJobV2 URL: https://github.com/apache/incubator-doris/pull/3130#discussion_r393714159
########## File path: fe/src/main/java/org/apache/doris/alter/AlterHandler.java ########## @@ -119,6 +121,30 @@ public AlterJobV2 getUnfinishedAlterJobV2ByJobId(long jobId) { return this.alterJobsV2; } + private void clearExpireFinishedOrCancelledAlterJobs() { + long curTime = System.currentTimeMillis(); + // clean history job + Iterator<AlterJob> iter = finishedOrCancelledAlterJobs.iterator(); + while (iter.hasNext()) { + AlterJob historyJob = iter.next(); + if ((curTime - historyJob.getCreateTimeMs()) / 1000 > Config.history_job_keep_max_second) { + iter.remove(); + LOG.info("remove history {} job[{}]. created at {}", historyJob.getType(), + historyJob.getTableId(), TimeUtils.longToTimeString(historyJob.getCreateTimeMs())); + } + } + } + + private void clearExpireFinishedOrCancelledAlterJobsV2() { + for (AlterJobV2 alterJobV2 : finishedOrCancelledAlterJobsV2) { + if (alterJobV2.isExpire()) { + finishedOrCancelledAlterJobsV2.remove(alterJobV2); + LOG.info("remove history {} jobV2[{}]. created at {}", alterJobV2.getType(), Review comment: ```suggestion LOG.info("remove history {} jobV2[{}]. finish at {}", alterJobV2.getType(), ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org