When two or more contiguous chunks belonging to the same shards are being merged, the shard is sending to the config server a validAfter field set to the current time.
This is wrong because merging is not implying any ownership change.
Setting an unnecessary value for validAfter has the side effect of potentially breaking snapshot reads.
Example assuming history window of 300 seconds:
- Contiguous chunks A-B-C have never been migrated, so their history is empty
- A merge is called for such chunks at time 100
- The new chunk will have validAfter: 100
- A snapshot read arrives at time 99: it can't be served because the pre-100 history is missing, even if it was empty.
Purpose of this ticket is to set the validAfter field to the higher validAfter belonging to one of the chunks to merge or - in case of empty history on all of them - not setting it.