Skip to content

Commit

Permalink
apply review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jimczi committed Nov 18, 2024
1 parent 20f7c0b commit f5cf813
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ protected Translog.Operation nextOperation() throws IOException {
private void loadNextBatch() throws IOException {
List<SearchRecord> documentsToLoad = new ArrayList<>();
long accumulatedSize = 0;
boolean reachedMemoryLimit = false;
while (reachedMemoryLimit == false) {
while (accumulatedSize < maxMemorySizeInBytes) {
if (pendingDocs.isEmpty()) {
ScoreDoc[] topDocs = nextTopDocs().scoreDocs;
if (topDocs.length == 0) {
Expand All @@ -127,9 +126,6 @@ private void loadNextBatch() throws IOException {
document.doc().shardIndex = documentsToLoad.size();
documentsToLoad.add(document);
accumulatedSize += document.size();
if (accumulatedSize > maxMemorySizeInBytes) {
reachedMemoryLimit = true;
}
}

for (var op : loadDocuments(documentsToLoad)) {
Expand Down

0 comments on commit f5cf813

Please sign in to comment.