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 2 commits
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,21 @@ 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 0 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.

add the failure reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

status.getPath());
SetAttributePOptions.Builder optionsBuilder =
SetAttributePOptions.newBuilder();
try {
context.getFileSystem().setAttribute(new AlluxioURI(config.getPath()),
optionsBuilder.setReplicationMin(0).setPinned(false).build());
} catch (Throwable e2) {
e.addSuppressed(e2);
Copy link
Contributor

@apc999 apc999 Jul 31, 2023

Choose a reason for hiding this comment

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

add LOG.warn here so at least we can find this suppressed issues in logs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

}
throw e;
}
LOG.info("Replicated file " + config.getPath() + " block " + config.getBlockId());
}
}
Loading