morningman commented on code in PR #47604:
URL: https://github.com/apache/doris/pull/47604#discussion_r1947476379
##########
fe/fe-core/src/main/java/org/apache/doris/load/ExportMgr.java:
##########
@@ -543,6 +544,23 @@ public void removeOldExportJobs() {
}
}
}
+
+ int maximumHistoryJobNum = Config.maximum_history_job_num;
+ List<Map.Entry<Long, ExportJob>> jobList = new
ArrayList<>(exportIdToJob.entrySet());
+ jobList.sort(Comparator.comparingLong(entry ->
entry.getValue().getCreateTimeMs()));
Review Comment:
You can sort the jobs only when `exportIdToJob.size() >
maximumHistoryJobNum`, to save some time
##########
fe/fe-common/src/main/java/org/apache/doris/common/Config.java:
##########
@@ -190,6 +190,12 @@ public class Config extends ConfigBase {
"For ALTER, EXPORT jobs, remove the finished job if expired."})
public static int history_job_keep_max_second = 7 * 24 * 3600; // 7 days
+ @ConfField(mutable = true, masterOnly = true, description = {
+ "针对 EXPORT 作业,如果系统内 EXPORT 作业数量超过这个值,则会删除最老的记录。",
+ "For EXPORT jobs, If the number of EXPORT jobs in the system
exceeds this value, "
+ + "the oldest records will be deleted."})
+ public static int maximum_history_job_num = 1000; // 7 days
Review Comment:
```suggestion
public static int max_export_history_job_num = 1000;
```
--
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]