@@ -236,13 +236,11 @@ protected Response shardOperation(Request request, ShardId shardId) throws IOExc
236236 IndexService indexService = indicesService .indexServiceSafe (request .getShard ().getIndex ());
237237 IndexShard indexShard = indexService .getShard (request .getShard ().id ());
238238 final long indexMetaDataVersion = clusterService .state ().metaData ().index (shardId .getIndex ()).getVersion ();
239- // The following shard generates the request based on the global checkpoint which may not be synced to all leading copies.
240- // However, this guarantees that the requesting range always be below the local-checkpoint of any leading copies.
241- final long localCheckpoint = indexShard .getLocalCheckpoint ();
242- if (localCheckpoint < request .minSeqNo || localCheckpoint < request .maxSeqNo ) {
243- throw new IllegalStateException ("invalid request from_seqno=[" + request .minSeqNo + "], " +
244- "to_seqno=[" + request .maxSeqNo + "], local_checkpoint=[" + localCheckpoint + "], shardId=[" + shardId + "]" );
245- }
239+ // The following shard generates this request based on the global checkpoint on the primary copy on the leader.
240+ // Although this value might not have been synced to all replica copies on the leader, the requesting range
241+ // is guaranteed to be at most the local-checkpoint of any shard copies on the leader.
242+ assert request .maxSeqNo <= indexShard .getLocalCheckpoint () : "invalid request from_seqno=[" + request .minSeqNo + "]," +
243+ " to_seqno=[" + request .maxSeqNo + "], local_checkpoint=[" + indexShard .getLocalCheckpoint () + "]" ;
246244 final Translog .Operation [] operations =
247245 getOperationsBetween (indexShard , request .minSeqNo , request .maxSeqNo , request .maxTranslogsBytes );
248246 return new Response (indexMetaDataVersion , operations );
0 commit comments