Skip to content

Commit

Permalink
Fix thread reinitialize in time-series source operator (#108751) (#10…
Browse files Browse the repository at this point in the history
…8813)

Currently, we only reinitialize the Lucene internal of the new top if 
the tsid changes. This isn't enough. We should always ensure the new top
is reinitialized if necessary, regardless of tsid.

Closes #108727
  • Loading branch information
dnhatn committed May 19, 2024
1 parent f83f0bc commit 93f6b31
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,14 @@ void consume() throws IOException {
queue.pop();
newTop = queue.size() > 0 ? queue.top() : null;
}
if (newTop != null && newTop.timeSeriesHash.equals(currentTsid) == false) {
newTop.reinitializeIfNeeded(Thread.currentThread());
globalTsidOrd++;
currentTsid = BytesRef.deepCopyOf(newTop.timeSeriesHash);
if (newTop != null) {
if (newTop != leaf) {
newTop.reinitializeIfNeeded(Thread.currentThread());
}
if (newTop.timeSeriesHash.equals(currentTsid) == false) {
globalTsidOrd++;
currentTsid = BytesRef.deepCopyOf(newTop.timeSeriesHash);
}
}
}
} else {
Expand Down

0 comments on commit 93f6b31

Please sign in to comment.