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: [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]