Catch AlreadyClosedException and use other IndexShard instance (#38630)
Closes #38617
This commit is contained in:
parent
884b5063a4
commit
92201ef563
|
@ -487,9 +487,14 @@ public abstract class CcrIntegTestCase extends ESTestCase {
|
|||
}
|
||||
IndexShard indexShard = cluster.getInstance(IndicesService.class, state.nodes().get(shardRouting.currentNodeId()).getName())
|
||||
.indexServiceSafe(shardRouting.index()).getShard(shardRouting.id());
|
||||
docs.put(shardRouting.shardId().id(), IndexShardTestCase.getDocIdAndSeqNos(indexShard).stream()
|
||||
.map(d -> new DocIdSeqNoAndTerm(d.getId(), d.getSeqNo(), 1L)) // normalize primary term as the follower use its own term
|
||||
.collect(Collectors.toList()));
|
||||
try {
|
||||
docs.put(shardRouting.shardId().id(), IndexShardTestCase.getDocIdAndSeqNos(indexShard).stream()
|
||||
// normalize primary term as the follower use its own term
|
||||
.map(d -> new DocIdSeqNoAndTerm(d.getId(), d.getSeqNo(), 1L))
|
||||
.collect(Collectors.toList()));
|
||||
} catch (AlreadyClosedException e) {
|
||||
// Ignore this exception and try getting List<DocIdSeqNoAndTerm> from other IndexShard instance.
|
||||
}
|
||||
}
|
||||
return docs;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue