use of com.amazonaws.services.kinesis.clientlibrary.exceptions.ThrottlingException in project samza by apache.
the class KinesisRecordProcessor method checkpoint.
/**
* Invoked by the Samza thread to commit checkpoint for the shard owned by the record processor instance.
*
* @param seqNumber sequenceNumber to checkpoint for the shard owned by this processor instance.
*/
public void checkpoint(String seqNumber) {
ExtendedSequenceNumber seqNumberToCheckpoint = new ExtendedSequenceNumber(seqNumber);
if (initSeqNumber.compareTo(seqNumberToCheckpoint) > 0) {
LOG.warn("Samza called checkpoint with seqNumber {} smaller than initial seqNumber {} for {}. Ignoring it!", seqNumber, initSeqNumber, this);
return;
}
if (checkpointer == null) {
// checkpointer could be null as a result of shard re-assignment before the first record is processed.
LOG.warn("Ignoring checkpointing for {} with seqNumber {} because of re-assignment.", this, seqNumber);
return;
}
try {
checkpointer.checkpoint(seqNumber);
lastCheckpointedRecordSeqNumber = seqNumberToCheckpoint;
} catch (ShutdownException e) {
// This can happen as a result of shard re-assignment.
String msg = String.format("Checkpointing %s with seqNumber %s failed with exception. Dropping the checkpoint.", this, seqNumber);
LOG.warn(msg, e);
} catch (InvalidStateException e) {
// This can happen when KCL encounters issues with internal state, eg: dynamoDB table is not found
String msg = String.format("Checkpointing %s with seqNumber %s failed with exception.", this, seqNumber);
LOG.error(msg, e);
throw new SamzaException(msg, e);
} catch (ThrottlingException e) {
// Throttling is handled by KCL via the client lib configuration properties. If we get an exception inspite of
// throttling back-off behavior, let's throw an exception as the configs
String msg = String.format("Checkpointing %s with seqNumber %s failed with exception. Checkpoint interval is" + " too aggressive for the provisioned throughput of the dynamoDB table where the checkpoints are stored." + " Either reduce the checkpoint interval -or- increase the throughput of dynamoDB table.", this, seqNumber);
throw new SamzaException(msg);
}
}
Aggregations