Resolve the incorrect scroll_current when delete or close index (#45226)
Resolve the incorrect current scroll for deleted or closed index
This commit is contained in:
parent
f2a6c88f83
commit
7582af27b0
|
@ -117,6 +117,22 @@ public class SearchStats implements Writeable, ToXContentFragment {
|
|||
suggestCurrent += stats.suggestCurrent;
|
||||
}
|
||||
|
||||
public void addForClosingShard(Stats stats) {
|
||||
queryCount += stats.queryCount;
|
||||
queryTimeInMillis += stats.queryTimeInMillis;
|
||||
|
||||
fetchCount += stats.fetchCount;
|
||||
fetchTimeInMillis += stats.fetchTimeInMillis;
|
||||
|
||||
scrollCount += stats.scrollCount;
|
||||
scrollTimeInMillis += stats.scrollTimeInMillis;
|
||||
// need consider the count of the shard's current scroll
|
||||
scrollCount += stats.scrollCurrent;
|
||||
|
||||
suggestCount += stats.suggestCount;
|
||||
suggestTimeInMillis += stats.suggestTimeInMillis;
|
||||
}
|
||||
|
||||
public long getQueryCount() {
|
||||
return queryCount;
|
||||
}
|
||||
|
@ -274,6 +290,13 @@ public class SearchStats implements Writeable, ToXContentFragment {
|
|||
totalStats.add(searchStats.totalStats);
|
||||
}
|
||||
|
||||
public void addTotalsForClosingShard(SearchStats searchStats) {
|
||||
if (searchStats == null) {
|
||||
return;
|
||||
}
|
||||
totalStats.addForClosingShard(searchStats.totalStats);
|
||||
}
|
||||
|
||||
public Stats getTotal() {
|
||||
return this.totalStats;
|
||||
}
|
||||
|
|
|
@ -727,7 +727,8 @@ public class IndicesService extends AbstractLifecycleComponent
|
|||
if (indexShard != null) {
|
||||
getStats.addTotals(indexShard.getStats());
|
||||
indexingStats.addTotals(indexShard.indexingStats());
|
||||
searchStats.addTotals(indexShard.searchStats());
|
||||
// if this index was closed or deleted, we should eliminate the effect of the current scroll for this shard
|
||||
searchStats.addTotalsForClosingShard(indexShard.searchStats());
|
||||
mergeStats.addTotals(indexShard.mergeStats());
|
||||
refreshStats.addTotals(indexShard.refreshStats());
|
||||
flushStats.addTotals(indexShard.flushStats());
|
||||
|
|
Loading…
Reference in New Issue