kinesis-producer
kinesis-producer copied to clipboard
Retain user record partition keys
With shard mapping and the KPL architecture not implemented, user records are potentially already being aggregated to the wrong shards. However, it would still be nice to retain the original user records' partition keys so that on the consumer side we could expect the documented aggregation format.
I also fixed a bug where we were miscalculating the record size. In edge cases that are easier to reproduce with small user records, I was seeing the following error:
com.amazonaws.services.kinesis.model.AmazonKinesisException: 1 validation error detected:
Value 'java.nio.HeapByteBuffer[pos=0 lim=1048954 cap=1048954]' at 'data' failed to satisfy
constraint: Member must have length less than or equal to 1048576 (Service: AmazonKinesis; Status
Code: 400; Error Code: ValidationException; Request ID: f114615a-9256-5a12-a33c-39f52eb5e9c3)
Following the discussion on this issue: https://github.com/awslabs/kinesis-aggregation/issues/30 I found that we aren't taking into account the size of the protobuf wire type. See Node.js aggregation library for example: https://github.com/awslabs/kinesis-aggregation/blob/master/node/lib/kpl-agg.js#L60.
@a8m any chance this will be reviewed? Even if the partition keys change is not approved I think the bug fix is valuable.