-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Cleanup BlobStoreRepository Abort and Failure Handling #46208
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
Changes from all commits
6e4bd15
f44fa90
9e5465f
74b152d
d1845f6
bf9e608
fbf90ab
c09a8f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,6 +110,7 @@ | |
| import java.util.Optional; | ||
| import java.util.Set; | ||
| import java.util.concurrent.Executor; | ||
| import java.util.concurrent.atomic.AtomicBoolean; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import static org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot.FileInfo.canonicalName; | ||
|
|
@@ -1048,17 +1049,27 @@ public void snapshotShard(Store store, MapperService mapperService, SnapshotId s | |
| final GroupedActionListener<Void> filesListener = | ||
| new GroupedActionListener<>(allFilesUploadedListener, indexIncrementalFileCount); | ||
| final Executor executor = threadPool.executor(ThreadPool.Names.SNAPSHOT); | ||
| // Flag to signal that the snapshot has been aborted/failed so we can stop any further blob uploads from starting | ||
| final AtomicBoolean alreadyFailed = new AtomicBoolean(); | ||
| for (BlobStoreIndexShardSnapshot.FileInfo snapshotFileInfo : filesToSnapshot) { | ||
| executor.execute(new ActionRunnable<>(filesListener) { | ||
| @Override | ||
| protected void doRun() { | ||
| try { | ||
| snapshotFile(snapshotFileInfo, indexId, shardId, snapshotId, snapshotStatus, store); | ||
| if (alreadyFailed.get() == false) { | ||
| snapshotFile(snapshotFileInfo, indexId, shardId, snapshotId, snapshotStatus, store); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we call filesListener.onFailure() with a IndexShardSnapshotFailedException and an appropriate comment in case the upload is skipped because of the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we do that, we get all those execeptions added to the overall exception again, precisely what I tried avoiding here. Note that you could theoretically have a pretty large number of files here.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right - then at least a trace log would be helpful?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be honest, I can't see what it would be useful for?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK (Monday morning reviews, you know) |
||
| filesListener.onResponse(null); | ||
| } catch (IOException e) { | ||
| throw new IndexShardSnapshotFailedException(shardId, "Failed to perform snapshot (index files)", e); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void onFailure(Exception e) { | ||
| alreadyFailed.set(true); | ||
| super.onFailure(e); | ||
| } | ||
| }); | ||
| } | ||
| } catch (Exception e) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.