sarvekshayr commented on code in PR #10866: URL: https://github.com/apache/ozone/pull/10866#discussion_r3654595178
########## hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/export/ExportFileManager.java: ########## @@ -0,0 +1,179 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hdds.scm.container.export; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Objects; +import java.util.UUID; +import org.apache.commons.io.FileUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Manages on-disk paths and artifacts for container ID export jobs. + * Layout under the export directory ({@code {exportDirectory}}, typically {@code {scm.db.dirs}/exports}): + * <p> + * {exportDirectory}/ + * {jobId}.in-progress // marker while a job is running + * container-ids-{scope}-{timestamp}-{jobId}.tar // completed export archive + * export-{jobId}/ // per-job workspace (removed on success) Review Comment: > When this directory will be deleted? <p><b>When {@code export_{jobId}/} is deleted:</b> the export manager deletes it after the archive closes successfully, or during {@link #cleanupFailedArtifacts} on failure or cancel. On startup, {@link #start()} deletes a leftover {@code export_{jobId}/} when no in-progress marker remains. If the marker still exists, {@link #start()} deletes {@code export_{jobId}/} together with the marker and any partial archive for that job id. > What if the SCM is restarted when a job is running? <p><b>SCM restart while a job runs:</b> the in-progress marker and {@code export_{jobId}/} remain on disk, but in-memory job status is lost. {@link #start()} treats the job as incomplete, removes the marker, workspace, and any partial {@code .tar.gz} for that job id, and the operator re-submits the export on the new leader. -- 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]
