@@ -136,30 +136,34 @@ public void testNodesCachesStats() throws Exception {
136
136
.collect (toSet ())
137
137
.toArray (String []::new );
138
138
139
- final NodesCachesStatsResponse response = client ().execute (
140
- TransportSearchableSnapshotsNodeCachesStatsAction .TYPE ,
141
- new NodesRequest (dataNodesWithFrozenShards )
142
- ).actionGet ();
143
- assertThat (
144
- response .getNodes ().stream ().map (r -> r .getNode ().getId ()).collect (Collectors .toList ()),
145
- containsInAnyOrder (dataNodesWithFrozenShards )
146
- );
147
- assertThat (response .hasFailures (), equalTo (false ));
148
-
149
- for (NodeCachesStatsResponse nodeCachesStats : response .getNodes ()) {
150
- if (nodeCachesStats .getNumRegions () > 0 ) {
151
- assertThat (nodeCachesStats .getWrites (), greaterThan (0L ));
152
- assertThat (nodeCachesStats .getBytesWritten (), greaterThan (0L ));
153
- assertThat (nodeCachesStats .getReads (), greaterThan (0L ));
154
- assertThat (nodeCachesStats .getBytesRead (), greaterThan (0L ));
155
- assertThat (nodeCachesStats .getEvictions (), greaterThan (0L ));
156
- } else {
157
- assertThat (nodeCachesStats .getWrites (), equalTo (0L ));
158
- assertThat (nodeCachesStats .getBytesWritten (), equalTo (0L ));
159
- assertThat (nodeCachesStats .getReads (), equalTo (0L ));
160
- assertThat (nodeCachesStats .getBytesRead (), equalTo (0L ));
161
- assertThat (nodeCachesStats .getEvictions (), equalTo (0L ));
139
+ // We've seen `getWrites` inexplicably return zero. `assertBusy` to test the theory of it being due
140
+ // to contention on the `LongAdder` at `SharedBlobCacheService#writeCount`.
141
+ assertBusy (() -> {
142
+ final NodesCachesStatsResponse response = client ().execute (
143
+ TransportSearchableSnapshotsNodeCachesStatsAction .TYPE ,
144
+ new NodesRequest (dataNodesWithFrozenShards )
145
+ ).actionGet ();
146
+ assertThat (
147
+ response .getNodes ().stream ().map (r -> r .getNode ().getId ()).collect (Collectors .toList ()),
148
+ containsInAnyOrder (dataNodesWithFrozenShards )
149
+ );
150
+ assertThat (response .hasFailures (), equalTo (false ));
151
+
152
+ for (NodeCachesStatsResponse nodeCachesStats : response .getNodes ()) {
153
+ if (nodeCachesStats .getNumRegions () > 0 ) {
154
+ assertThat (nodeCachesStats .getWrites (), greaterThan (0L ));
155
+ assertThat (nodeCachesStats .getBytesWritten (), greaterThan (0L ));
156
+ assertThat (nodeCachesStats .getReads (), greaterThan (0L ));
157
+ assertThat (nodeCachesStats .getBytesRead (), greaterThan (0L ));
158
+ assertThat (nodeCachesStats .getEvictions (), greaterThan (0L ));
159
+ } else {
160
+ assertThat (nodeCachesStats .getWrites (), equalTo (0L ));
161
+ assertThat (nodeCachesStats .getBytesWritten (), equalTo (0L ));
162
+ assertThat (nodeCachesStats .getReads (), equalTo (0L ));
163
+ assertThat (nodeCachesStats .getBytesRead (), equalTo (0L ));
164
+ assertThat (nodeCachesStats .getEvictions (), equalTo (0L ));
165
+ }
162
166
}
163
- }
167
+ });
164
168
}
165
169
}
0 commit comments