hello/suripu

Split-shard kinesis Sense data

Opened this issue · 0 comments

pims commented

Example from http://awsdocs.s3.amazonaws.com/kinesis/latest/kinesis-dg.pdf

SplitShardRequest splitShardRequest = new SplitShardRequest();
splitShardRequest.setStreamName(myStreamName);
splitShardRequest.setShardToSplit(shard.getShardId());

/*
Determine the hash key value which is half-way between the lowest and highest values in the shard.This
is the starting hash key value for the child shard that will contain the upper half of the hash keys from the
parent shard. Specify this value in the setNewStartingHashKey() method.You need specify only this
value; the Amazon Kinesis service automatically distributes the hash keys below this value to the other
child shard that is created by the split.The last step is to call the splitShard() method on the Amazon
Kinesis service client.
*/
BigInteger startingHashKey = new BigInteger(shard.getHashKeyRange().getStarting
HashKey());
BigInteger endingHashKey = new BigInteger(shard.getHashKeyRange().getEnding
HashKey());
String newStartingHashKey = startingHashKey.add(endingHashKey).divide(new Bi
gInteger("2")).toString();
splitShardRequest.setNewStartingHashKey(newStartingHashKey);
client.splitShard(splitShardRequest);