Skip to content

Commit

Permalink
TEST: Skip assertSeqNos for closed shards (#33130)
Browse files Browse the repository at this point in the history
If a shard was closed, we return null for SeqNoStats. Therefore the
assertion assertSeqNos will hit NPE when it verifies a closed shard.

This commit skips closed shards in assertSeqNos and enables this
assertion in AbstractDisruptionTestCase.
  • Loading branch information
dnhatn authored Aug 25, 2018
1 parent 739a8d3 commit 9dad82e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public void setDisruptionScheme(ServiceDisruptionScheme scheme) {
protected void beforeIndexDeletion() throws Exception {
if (disableBeforeIndexDeletion == false) {
super.beforeIndexDeletion();
assertSeqNos();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2349,6 +2349,9 @@ protected void assertSeqNos() throws Exception {
final ObjectLongMap<String> globalCheckpoints = indexShard.getInSyncGlobalCheckpoints();
for (ShardStats shardStats : indexShardStats) {
final SeqNoStats seqNoStats = shardStats.getSeqNoStats();
if (seqNoStats == null) {
continue; // this shard was closed
}
assertThat(shardStats.getShardRouting() + " local checkpoint mismatch",
seqNoStats.getLocalCheckpoint(), equalTo(primarySeqNoStats.getLocalCheckpoint()));
assertThat(shardStats.getShardRouting() + " global checkpoint mismatch",
Expand Down

0 comments on commit 9dad82e

Please sign in to comment.