@@ -222,22 +222,30 @@ func (c *claim) fetchRecordBatch(location string) (string, error) {
222222
223223func (c * claim ) getCurrentShardLocation (shardID int ) (string , error ) {
224224
225+ initialLocation := c .member .streamConsumerGroup .config .Claim .RecordBatchFetch .InitialLocation
226+
225227 // get the location from persistency
226- currentShardLocation , err := c .member .streamConsumerGroup .getShardLocationFromPersistency (shardID )
228+ currentShardLocation , err := c .member .streamConsumerGroup .getShardLocationFromPersistency (shardID , initialLocation )
227229 if err != nil && errors .RootCause (err ) != ErrShardNotFound {
228230 return "" , errors .Wrap (err , "Failed to get shard location from persistency" )
229231 }
230232
231233 // if shard wasn't found, try again periodically
232234 if errors .RootCause (err ) == ErrShardNotFound {
235+
236+ // if the shard does not exist yet, turn seek-latest to seek-earliest (IG-19366)
237+ if initialLocation == v3io .SeekShardInputTypeLatest {
238+ initialLocation = v3io .SeekShardInputTypeEarliest
239+ }
240+
233241 for {
234242 select {
235243
236244 // TODO: from configuration
237245 case <- time .After (c .member .streamConsumerGroup .config .SequenceNumber .ShardWaitInterval ):
238246
239247 // get the location from persistency
240- currentShardLocation , err = c .member .streamConsumerGroup .getShardLocationFromPersistency (shardID )
248+ currentShardLocation , err = c .member .streamConsumerGroup .getShardLocationFromPersistency (shardID , initialLocation )
241249 if err != nil {
242250 if errors .RootCause (err ) == ErrShardNotFound {
243251
0 commit comments