You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are Sequence Numbers unique per partition key? Is is possible that two separate clients running on separate threads write a record to the same partition key and end up having the same seq. number?
#643
Closed
thiagoh opened this issue
Nov 4, 2019
· 2 comments
The sequence number is a unique identifier of the record in a shard of the kinesis stream.
If two concurrent clients make a request using the same partition key and if the hash value calculated based on the partition key lies with the hash key range of the same shard in the kinesis stream.. they both will try to put to the same shard and will get a unique sequence number in return.
However, if hash value for the two clients using the same partition key are different causing the record to go to different shard, its possible they get the same sequence number. But the records would belong to different shards in this scenario.
If you want the records to be put to same shard every time.. use ExplicitHashKey which falls within the hash key range of the shard.
The preceding code sample uses setSequenceNumberForOrdering to guarantee strictly increasing ordering within each partition key. To use this parameter effectively, set the SequenceNumberForOrdering of the current record (record n) to the sequence number of the preceding record (record n-1). To get the sequence number of a record that has been added to the stream, call getSequenceNumber on the result of putRecord.
No description provided.
The text was updated successfully, but these errors were encountered: