Skip to content

Commit 49ebf20

Browse files
committed
modify the counter logic
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
1 parent c5ee63f commit 49ebf20

File tree

4 files changed

+102
-23
lines changed

4 files changed

+102
-23
lines changed

rest-api-spec/src/main/resources/rest-api-spec/test/cat.shards/10_basic.yml

+97-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,108 @@
11
"Help":
22
- skip:
3-
version: " - 2.11.99"
3+
version: " - 2.99.99"
4+
reason: search idle reactivate count total is only added in 3.0.0
5+
features: node_selector
6+
- do:
7+
cat.shards:
8+
help: true
9+
node_selector:
10+
version: "3.0.0 - "
11+
12+
- match:
13+
$body: |
14+
/^ index .+ \n
15+
shard .+ \n
16+
prirep .+ \n
17+
state .+ \n
18+
docs .+ \n
19+
store .+ \n
20+
ip .+ \n
21+
id .+ \n
22+
node .+ \n
23+
sync_id .+ \n
24+
unassigned.reason .+ \n
25+
unassigned.at .+ \n
26+
unassigned.for .+ \n
27+
unassigned.details .+ \n
28+
recoverysource.type .+ \n
29+
completion.size .+ \n
30+
fielddata.memory_size .+ \n
31+
fielddata.evictions .+ \n
32+
query_cache.memory_size .+ \n
33+
query_cache.evictions .+ \n
34+
flush.total .+ \n
35+
flush.total_time .+ \n
36+
get.current .+ \n
37+
get.time .+ \n
38+
get.total .+ \n
39+
get.exists_time .+ \n
40+
get.exists_total .+ \n
41+
get.missing_time .+ \n
42+
get.missing_total .+ \n
43+
indexing.delete_current .+ \n
44+
indexing.delete_time .+ \n
45+
indexing.delete_total .+ \n
46+
indexing.index_current .+ \n
47+
indexing.index_time .+ \n
48+
indexing.index_total .+ \n
49+
indexing.index_failed .+ \n
50+
merges.current .+ \n
51+
merges.current_docs .+ \n
52+
merges.current_size .+ \n
53+
merges.total .+ \n
54+
merges.total_docs .+ \n
55+
merges.total_size .+ \n
56+
merges.total_time .+ \n
57+
refresh.total .+ \n
58+
refresh.time .+ \n
59+
refresh.external_total .+ \n
60+
refresh.external_time .+ \n
61+
refresh.listeners .+ \n
62+
search.fetch_current .+ \n
63+
search.fetch_time .+ \n
64+
search.fetch_total .+ \n
65+
search.open_contexts .+ \n
66+
search.query_current .+ \n
67+
search.query_time .+ \n
68+
search.query_total .+ \n
69+
search.concurrent_query_current .+ \n
70+
search.concurrent_query_time .+ \n
71+
search.concurrent_query_total .+ \n
72+
search.concurrent_avg_slice_count .+ \n
73+
search.scroll_current .+ \n
74+
search.scroll_time .+ \n
75+
search.scroll_total .+ \n
76+
search.point_in_time_current .+ \n
77+
search.point_in_time_time .+ \n
78+
search.point_in_time_total .+ \n
79+
search.search_idle_reactivate_count_total .+ \n
80+
segments.count .+ \n
81+
segments.memory .+ \n
82+
segments.index_writer_memory .+ \n
83+
segments.version_map_memory .+ \n
84+
segments.fixed_bitset_memory .+ \n
85+
seq_no.max .+ \n
86+
seq_no.local_checkpoint .+ \n
87+
seq_no.global_checkpoint .+ \n
88+
warmer.current .+ \n
89+
warmer.total .+ \n
90+
warmer.total_time .+ \n
91+
path.data .+ \n
92+
path.state .+ \n
93+
docs.deleted .+ \n
94+
$/
95+
---
96+
"Help":
97+
- skip:
98+
version: " - 2.11.99 , 3.0.0 - "
499
reason: deleted docs and concurrent search are added in 2.12.0
5100
features: node_selector
6101
- do:
7102
cat.shards:
8103
help: true
9104
node_selector:
10-
version: "2.12.0 - "
105+
version: "2.12.0 - 2.99.99"
11106

12107
- match:
13108
$body: |

server/src/main/java/org/opensearch/index/shard/IndexShard.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -1859,10 +1859,6 @@ public Engine.Searcher acquireSearcher(String source) {
18591859
}
18601860

18611861
private void markSearcherAccessed() {
1862-
if (isSearchIdle()) {
1863-
SearchOperationListener searchOperationListener = getSearchOperationListener();
1864-
searchOperationListener.onSearchIdleReactivation();
1865-
}
18661862
lastSearcherAccess.lazySet(threadPool.relativeTimeInMillis());
18671863
}
18681864

@@ -4591,9 +4587,14 @@ public void afterRefresh(boolean didRefresh) {
45914587
* <code>true</code> if the listener was registered to wait for a refresh.
45924588
*/
45934589
public final void awaitShardSearchActive(Consumer<Boolean> listener) {
4590+
boolean isSearchIdle = isSearchIdle();
45944591
markSearcherAccessed(); // move the shard into non-search idle
45954592
final Translog.Location location = pendingRefreshLocation.get();
45964593
if (location != null) {
4594+
if (isSearchIdle) {
4595+
SearchOperationListener searchOperationListener = getSearchOperationListener();
4596+
searchOperationListener.onSearchIdleReactivation();
4597+
}
45974598
addRefreshListener(location, (b) -> {
45984599
pendingRefreshLocation.compareAndSet(location, null);
45994600
listener.accept(true);

server/src/main/java/org/opensearch/rest/action/cat/RestIndicesAction.java

-12
Original file line numberDiff line numberDiff line change
@@ -641,15 +641,6 @@ protected Table getTableWithHeader(final RestRequest request) {
641641
);
642642
table.addCell("pri.search.point_in_time_total", "default:false;text-align:right;desc:completed point in time contexts");
643643

644-
table.addCell(
645-
"search.search_idle_reactivate_count_total",
646-
"sibling:pri;alias:ssirct,searchSearchIdleReactivateCountTotal;default:false;text-align:right;desc:number of times a shard reactivated"
647-
);
648-
table.addCell(
649-
"pri.search.search_idle_reactivate_count_total",
650-
"default:false;text-align:right;desc:number of times a shard reactivated"
651-
);
652-
653644
table.addCell("segments.count", "sibling:pri;alias:sc,segmentsCount;default:false;text-align:right;desc:number of segments");
654645
table.addCell("pri.segments.count", "default:false;text-align:right;desc:number of segments");
655646

@@ -952,9 +943,6 @@ Table buildTable(
952943
table.addCell(totalStats.getSearch() == null ? null : totalStats.getSearch().getTotal().getPitCount());
953944
table.addCell(primaryStats.getSearch() == null ? null : primaryStats.getSearch().getTotal().getPitCount());
954945

955-
table.addCell(totalStats.getSearch() == null ? null : totalStats.getSearch().getTotal().getSearchIdleReactivateCount());
956-
table.addCell(primaryStats.getSearch() == null ? null : primaryStats.getSearch().getTotal().getSearchIdleReactivateCount());
957-
958946
table.addCell(totalStats.getSegments() == null ? null : totalStats.getSegments().getCount());
959947
table.addCell(primaryStats.getSegments() == null ? null : primaryStats.getSegments().getCount());
960948

server/src/main/java/org/opensearch/rest/action/cat/RestNodesAction.java

-5
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,6 @@ protected Table getTableWithHeader(final RestRequest request) {
338338
"search.point_in_time_total",
339339
"alias:scto,searchPointInTimeTotal;default:false;text-align:right;desc:completed point in time contexts"
340340
);
341-
table.addCell(
342-
"search.search_idle_reactivate_count_total",
343-
"alias:ssirct,searchSearchIdleReactivateCountTotal;default:false;text-align:right;desc:number of times a shard reactivated"
344-
);
345341

346342
table.addCell("segments.count", "alias:sc,segmentsCount;default:false;text-align:right;desc:number of segments");
347343
table.addCell("segments.memory", "alias:sm,segmentsMemory;default:false;text-align:right;desc:memory used by segments");
@@ -559,7 +555,6 @@ Table buildTable(
559555
table.addCell(searchStats == null ? null : searchStats.getTotal().getPitCurrent());
560556
table.addCell(searchStats == null ? null : searchStats.getTotal().getPitTime());
561557
table.addCell(searchStats == null ? null : searchStats.getTotal().getPitCount());
562-
table.addCell(searchStats == null ? null : searchStats.getTotal().getSearchIdleReactivateCount());
563558

564559
SegmentsStats segmentsStats = indicesStats == null ? null : indicesStats.getSegments();
565560
table.addCell(segmentsStats == null ? null : segmentsStats.getCount());

0 commit comments

Comments
 (0)