- Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix unhandled exception when blobstore repository contains unexpected file #93914
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
Fix unhandled exception when blobstore repository contains unexpected file #93914
Conversation
… file If there's any file with the `index-` prefix but not a number after that at the repo root we must not throw here. If we do, we will end up throwing an unexpected exception that is not properly handled by `org.elasticsearch.snapshots.SnapshotsService#failAllListenersOnMasterFailOver`, leading to the repository generation not getting correctly set in the cluster state down the line.
| Pinging @elastic/es-distributed (Team:Distributed) |
| Hi @original-brownbear, I've created a changelog YAML for you. |
| return repositoryData.getGenId() > Long.parseLong(blob.substring(INDEX_FILE_PREFIX.length())); | ||
| } catch (NumberFormatException nfe) { | ||
| // odd case of an extra file with the index- prefix that we can't identify | ||
| return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we log that we discovered unexpected file in repository?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm mildly worried this could get really spammy in some cases and we do already log this specific case in org.elasticsearch.repositories.blobstore.BlobStoreRepository#latestGeneration actually.
This is hopefully an edge case to the point where we won't have to worry much about it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM2. @original-brownbear Does it make sense to backport the fix?
| Thanks both + jup lets backport this :) |
… file (elastic#93914) If there's any file with the `index-` prefix but not a number after that at the repo root we must not throw here. If we do, we will end up throwing an unexpected exception that is not properly handled by `org.elasticsearch.snapshots.SnapshotsService#failAllListenersOnMasterFailOver`, leading to the repository generation not getting correctly set in the cluster state down the line.
💔 Backport failed
You can use sqren/backport to manually backport by running |
… file (#93914) (#93942) If there's any file with the `index-` prefix but not a number after that at the repo root we must not throw here. If we do, we will end up throwing an unexpected exception that is not properly handled by `org.elasticsearch.snapshots.SnapshotsService#failAllListenersOnMasterFailOver`, leading to the repository generation not getting correctly set in the cluster state down the line.
… file (elastic#93914) If there's any file with the `index-` prefix but not a number after that at the repo root we must not throw here. If we do, we will end up throwing an unexpected exception that is not properly handled by `org.elasticsearch.snapshots.SnapshotsService#failAllListenersOnMasterFailOver`, leading to the repository generation not getting correctly set in the cluster state down the line.
… file (elastic#93914) If there's any file with the `index-` prefix but not a number after that at the repo root we must not throw here. If we do, we will end up throwing an unexpected exception that is not properly handled by `org.elasticsearch.snapshots.SnapshotsService#failAllListenersOnMasterFailOver`, leading to the repository generation not getting correctly set in the cluster state down the line.
… file (#93914) (#97113) If there's any file with the `index-` prefix but not a number after that at the repo root we must not throw here. If we do, we will end up throwing an unexpected exception that is not properly handled by `org.elasticsearch.snapshots.SnapshotsService#failAllListenersOnMasterFailOver`, leading to the repository generation not getting correctly set in the cluster state down the line.
If there's any file with the
index-prefix but not a number after that at the repo root we must not throw here. If we do, we will end up throwing an unexpected exception that is not properly handled byorg.elasticsearch.snapshots.SnapshotsService#failAllListenersOnMasterFailOver, leading to the repository generation not getting correctly set in the cluster state down the line.Just like with other unexpected files in the repository, we should be able to deal with this one transparently.