0
votes

I am new to Kinesis and when I read the Kinesis doc, I realize that messages provided with the same partition key will be mapped to the same Shard to guarantee the order. This totally makes sense. However, I'd like to know if we increase the number of topic Shards in runtime, will the new messages with the same partition key be hashed to the same Shards (old one) as before?

If so, what if all messages are provided with partition keys, then none of them will be mapped to new Shard? This doesn't make sense to me.

If not, then how Kinesis guarantee the order to messages with the same partition key in order?

1

1 Answers

1
votes

It's important to understand what Kinesis does while resharding:

There are two types of resharding operations: shard split and shard merge. In a shard split, you divide a single shard into two shards. In a shard merge, you combine two shards into a single shard. Resharding is always pairwise in the sense that you cannot split into more than two shards in a single operation, and you cannot merge more than two shards in a single operation. The shard or pair of shards that the resharding operation acts on are referred to as parent shards. The shard or pair of shards that result from the resharding operation are referred to as child shards.

When you increase the size of a kinesis stream, you will split shards

When you split the shard, you specify a value in this range. That hash key value and all higher hash key values are distributed to one of the child shards. All the lower hash key values are distributed to the other child shard.

Actually AWS just guarantees order on shard level, so after a split you will need to read from both shards and order on consumer side, see here.