- Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix reused/recovered bytes for files that are only partially recovered from cache #95987
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
Conversation
…d from cache Before elastic#95891 a file was considered as reused in recovery if it was fully cached in the cold persistent cache. Otherwise the full file length was reported as recovered from the blob store during prewarming. While working on elastic#95891 I changed the CachedBlobContainerIndexInput.prefetchPart() method to be more precise on the number of bytes that were effectively read from the blob store during prewarming. But this obviously broke some tests (elastic#95970) because a file cannot be partially recovered from disk and from remote. This change restores the previous behavior with one adjustment: the file is considered as reused if less than 50% of the file is prewarmed from the blob store. Relates elastic#95891
| Hi @tlrx, I've created a changelog YAML for you. |
| Pinging @elastic/es-distributed (Team:Distributed) |
| // we can't report a file as being partially recovered from disk and partially from the blob store, but this is | ||
| // something that can happen for fully mounted searchable snapshots. So we make a choice here: if less than 50% | ||
| // of the file is prewarmed from the blob store then it is marked as reused from cache. | ||
| if ((prefetchedBytes.get() / (double) file.length()) < 0.5d) { |
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.
Is there a chance this could break for a very small segment files?
I am thinking about example where 1/3 parts were in disk already and we only downloaded 2/3.
I wonder if we should consider changins boolean reused to long reused in FileDetail and consider a file fully recovered when recovered < length && reused + recovered == length?
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 not sure to understand why it would break for small files? We're comparing the number of bytes prewarmed with the total file length so the number of parts do not really matter. Also, most small files are likely to be either fully prewarmed or fully reused.
I wonder if we should consider changins
boolean reusedtolong reusedinFileDetailand consider a file fully recovered whenrecovered < length && reused + recovered == length?
We could but this is a larger change that I don't think is really worth doing since it only makes sense for cold cache.
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 am trying to understand if there is something that guarantee that the following would not happen:
- 2/3 are already cached locally and would not be downloaded
- 1/3 is downloaded updating a stats so that it expects something would complete download before reporting it as finished.
| Is it worth adding an assertion somewhere around Line 477 in bb3ef55
that would verify that for each index for each FileDetail we have assert reused ^ recovered == length (possibly in a separate pr)? |
| Hi @tlrx, I've updated the changelog YAML for you. |
| @elasticmachine retest this please |
| Thanks @idegtiarenko for your feedback. I reworked this change to revert to the previous behavior.
I suppose we can yes. We don't have must assertions around recovery file details but I can add one as a follow up. |
| @elasticmachine run elasticsearch-ci/part-1 |
| Thanks Ievgen! |
…d from cache (elastic#95987) Before elastic#95891 a file was considered as reused in recovery if it was fully cached in the cold persistent cache. Otherwise the full file length was reported as recovered from the blob store during prewarming. While working on elastic#95891 I changed the CachedBlobContainerIndexInput.prefetchPart() method to be more precise on the number of bytes that were effectively read from the blob store during prewarming. But this obviously broke some tests (elastic#95970) because a file cannot be partially recovered from disk and from remote. This change restores the previous behavior with one adjustment: the file is considered as reused if the prewarm method effectively prefetched 0 bytes. Closes elastic#95970 Closes elastic#95994
…d from cache (elastic#95987) Before elastic#95891 a file was considered as reused in recovery if it was fully cached in the cold persistent cache. Otherwise the full file length was reported as recovered from the blob store during prewarming. While working on elastic#95891 I changed the CachedBlobContainerIndexInput.prefetchPart() method to be more precise on the number of bytes that were effectively read from the blob store during prewarming. But this obviously broke some tests (elastic#95970) because a file cannot be partially recovered from disk and from remote. This change restores the previous behavior with one adjustment: the file is considered as reused if the prewarm method effectively prefetched 0 bytes. Closes elastic#95970 Closes elastic#95994
…d from cache (#95987) (#97103) Before #95891 a file was considered as reused in recovery if it was fully cached in the cold persistent cache. Otherwise the full file length was reported as recovered from the blob store during prewarming. While working on #95891 I changed the CachedBlobContainerIndexInput.prefetchPart() method to be more precise on the number of bytes that were effectively read from the blob store during prewarming. But this obviously broke some tests (#95970) because a file cannot be partially recovered from disk and from remote. This change restores the previous behavior with one adjustment: the file is considered as reused if the prewarm method effectively prefetched 0 bytes. Closes #95970 Closes #95994
…d from cache (#95987) (#97102) Before #95891 a file was considered as reused in recovery if it was fully cached in the cold persistent cache. Otherwise the full file length was reported as recovered from the blob store during prewarming. While working on #95891 I changed the CachedBlobContainerIndexInput.prefetchPart() method to be more precise on the number of bytes that were effectively read from the blob store during prewarming. But this obviously broke some tests (#95970) because a file cannot be partially recovered from disk and from remote. This change restores the previous behavior with one adjustment: the file is considered as reused if the prewarm method effectively prefetched 0 bytes. Closes #95970 Closes #95994
…d from cache Fix in elastic#95987 wasn't complete :( Closes elastic#95994
…lastic#97278) Fix in elastic#95987 wasn't complete, I did not restore all the previous behavior. Closes elastic#95994
…lastic#97278) Fix in elastic#95987 wasn't complete, I did not restore all the previous behavior. Closes elastic#95994
Before #95891 a file was considered as reused in recovery if
it was fully cached in the cold persistent cache. Otherwise
the full file length was reported as recovered from the
blob store during prewarming.
While working on #95891 I changed the
CachedBlobContainerIndexInput.prefetchPart()
method to be more precise on the number of bytes that were
effectively read from the blob store during prewarming.
But this obviously broke some tests (#95970) because a file
cannot be partially recovered from disk and from remote. This
change restores the previous behavior with one adjustment:
the file is considered as reused if the prewarm method
effectively prefetched 0 bytes.
Closes #95970
Closes #95994