You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "sarvekshayr (via GitHub)" <gi...@apache.org> on 2026/10/21 06:49:36 UTC

[PR] HDDS-17208. Evict old container ID export job records and archives [ozone]

sarvekshayr opened a new pull request, #11662:
URL: https://github.com/apache/ozone/pull/11662

   ## What changes were proposed in this pull request?
   SCM keeps the status of every container ID export job in memory and leaves every completed `.tar.gz` archive on disk with no limit, so both grow without bound on a long-running SCM.
   
   This change keeps only the 10 most recently finished jobs queryable and only the 10 newest completed archives (oldest dropped first). Archives are also trimmed at SCM start-up, and only files that match the export archive naming are ever deleted. Failed or zero-match jobs have no archive, so they don't push good archives out.
   
   ## What is the link to the Apache JIRA
   [HDDS-17208](https://issues.apache.org/jira/browse/HDDS-17208)
   
   ## How was this patch tested?
   Added tests in `TestContainerExportManager`.
   CI: https://github.com/sarvekshayr/ozone/actions/runs/39548271051


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-17208. Evict old container ID export job records and archives [ozone]

Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr commented on code in PR #11662:
URL: https://github.com/apache/ozone/pull/11662#discussion_r4350919692


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/export/ContainerExportManager.java:
##########
@@ -70,20 +79,25 @@ public class ContainerExportManager {
   private final ExportFileManager fileManager;
   private final BooleanSupplier isLeaderReady;
   private final ExportSizing defaultSizing;
+  private final int maxRetained;
+  // Both deque are only touched by the single worker thread, and by start() before any job is submitted.
+  private final Deque<ExportJob.Id> finishedJobIds = new ArrayDeque<>();
+  private final Deque<String> completedArchiveNames = new ArrayDeque<>();
 
   public ContainerExportManager(String scmId, ContainerManager containerManager, BooleanSupplier isLeaderReady,
       OzoneConfiguration conf) {
     this(scmId, containerManager, isLeaderReady,
-        ExportFileManager.resolveExportDirectory(conf), DEFAULT_PART_SIZE, DEFAULT_BATCH_SIZE);
+        ExportFileManager.resolveExportDirectory(conf), DEFAULT_PART_SIZE, DEFAULT_BATCH_SIZE, DEFAULT_MAX_RETAINED);
   }
 
   ContainerExportManager(String scmId, ContainerManager containerManager, BooleanSupplier isLeaderReady,
-      String exportDirectory, int partSize, int batchSize) {
+      String exportDirectory, int partSize, int batchSize, int maxRetained) {
     this.defaultSizing = new ExportSizing(0, 0, 0, batchSize, partSize);
     this.containerManager = Objects.requireNonNull(containerManager, "containerManager == null");
     this.isLeaderReady = Objects.requireNonNull(isLeaderReady, "isLeaderReady == null");
     this.fileManager = new ExportFileManager(exportDirectory);
     this.workerPool = newWorkerPool(scmId);
+    this.maxRetained = maxRetained;

Review Comment:
   I had planned to add this after making it configurable, but I've updated the PR with validation now.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-17208. Evict old container ID export job records and archives [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #11662:
URL: https://github.com/apache/ozone/pull/11662#issuecomment-6367471579

   Thanks @sarvekshayr for the patch, @smengcl, @sreejasahithi for the review.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-17208. Evict old container ID export job records and archives [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #11662:
URL: https://github.com/apache/ozone/pull/11662


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-17208. Evict old container ID export job records and archives [ozone]

Posted by "sreejasahithi (via GitHub)" <gi...@apache.org>.
sreejasahithi commented on code in PR #11662:
URL: https://github.com/apache/ozone/pull/11662#discussion_r4349204762


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/export/ContainerExportManager.java:
##########
@@ -70,20 +79,25 @@ public class ContainerExportManager {
   private final ExportFileManager fileManager;
   private final BooleanSupplier isLeaderReady;
   private final ExportSizing defaultSizing;
+  private final int maxRetained;
+  // Both deque are only touched by the single worker thread, and by start() before any job is submitted.
+  private final Deque<ExportJob.Id> finishedJobIds = new ArrayDeque<>();
+  private final Deque<String> completedArchiveNames = new ArrayDeque<>();
 
   public ContainerExportManager(String scmId, ContainerManager containerManager, BooleanSupplier isLeaderReady,
       OzoneConfiguration conf) {
     this(scmId, containerManager, isLeaderReady,
-        ExportFileManager.resolveExportDirectory(conf), DEFAULT_PART_SIZE, DEFAULT_BATCH_SIZE);
+        ExportFileManager.resolveExportDirectory(conf), DEFAULT_PART_SIZE, DEFAULT_BATCH_SIZE, DEFAULT_MAX_RETAINED);
   }
 
   ContainerExportManager(String scmId, ContainerManager containerManager, BooleanSupplier isLeaderReady,
-      String exportDirectory, int partSize, int batchSize) {
+      String exportDirectory, int partSize, int batchSize, int maxRetained) {
     this.defaultSizing = new ExportSizing(0, 0, 0, batchSize, partSize);
     this.containerManager = Objects.requireNonNull(containerManager, "containerManager == null");
     this.isLeaderReady = Objects.requireNonNull(isLeaderReady, "isLeaderReady == null");
     this.fileManager = new ExportFileManager(exportDirectory);
     this.workerPool = newWorkerPool(scmId);
+    this.maxRetained = maxRetained;

Review Comment:
   Could we validate maxRetained >= 1 in the constructor?
   
   If maxRetained is 0, retain() removes the just-finished job from jobMap immediately (finishedJobIds.size() > 0), so getExportStatus(jobId) can return null even when the export succeeded. Callers that poll by id only (e.g. waitForDone) can time out.
   
   We currently use 10 (DEFAULT_MAX_RETAINED), so this is not an issue today, but validating the constructor argument would still catch invalid values in tests and future config wiring.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-17208. Evict old container ID export job records and archives [ozone]

Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr commented on PR #11662:
URL: https://github.com/apache/ozone/pull/11662#issuecomment-6398761078

   Thanks @smengcl and @sreejasahithi for the review and @adoroszlai for merging.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org