Do not request gaps to fill when the sub range is already completed#109212
Conversation
|
Pinging @elastic/es-distributed (Team:Distributed) |
| } | ||
|
|
||
| if (complete >= range.end()) { | ||
| if (subRange.end() <= complete) { |
There was a problem hiding this comment.
Can we make this clear in the javadoc, i.e., if the subrange is already present we may not fill the range.
I think this may not mean a lot in practice in that we already do the tryRead which should catch this except for race conditions (and there is not that far between the two checks). I am good with it anyway, seems right to me.
There was a problem hiding this comment.
I pushed 583ff31 for the doc.
I think this may not mean a lot in practice in that we already do the tryRead which should catch this except for race conditions (and there is not that far between the two checks). I am good with it anyway, seems right to me.
Yes, it seemed more correct to me too.
|
Thanks all! |
When the range to read (
subRange) is already completed, we can optimize by returning early without asking for the range to write (range) to be fully filled and save one or more fetch requests.