Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set min replicate to 0 and unpin file if we fail to replicate a file #17865

Merged
merged 4 commits into from
Aug 1, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import alluxio.conf.Configuration;
import alluxio.exception.status.NotFoundException;
import alluxio.grpc.RemoveBlockRequest;
import alluxio.grpc.SetAttributePOptions;
import alluxio.job.RunTaskContext;
import alluxio.job.SelectExecutorsContext;
import alluxio.job.plan.AbstractVoidPlanDefinition;
Expand All @@ -37,6 +38,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -168,8 +170,17 @@ private void replicate(SetReplicaConfig config, RunTaskContext context) throws E
// to avoid the the race between "replicate" and "rename", so that even a file to replicate is
// renamed, the job is still working on the correct file.
URIStatus status = context.getFileSystem().getStatus(new AlluxioURI(config.getPath()));

JobUtils.loadBlock(status, context.getFsContext(), config.getBlockId(), null, false);
try {
JobUtils.loadBlock(status, context.getFsContext(), config.getBlockId(), null, false);
} catch (IOException e) {
LOG.warn("Replication of {} failed, reduce min replication to 1 and unpin.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LOG.warn("Replication of {} failed, reduce min replication to 1 and unpin.",
LOG.warn("Replication of {} failed, reduce min replication to 0 and unpin.",

status.getPath());
SetAttributePOptions.Builder optionsBuilder =
SetAttributePOptions.newBuilder();
context.getFileSystem().setAttribute(new AlluxioURI(config.getPath()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this throw exception? how do we handle it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed as a supressed exception

optionsBuilder.setReplicationMin(0).setPinned(false).build());
throw e;
}
LOG.info("Replicated file " + config.getPath() + " block " + config.getBlockId());
}
}
Loading