Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle shardInfo being null while registering records as processed #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,13 @@ private void RegisterAsProcessed(String shardId, String sequenceNumber) {
ShardInfo shardInfo = shardRegister.get(shardId);
String currentSeqNo = shardInfo.getLastCommittedRecordSeqNo();

// shardInfo could be null if the AWS KCL lib has removed it from the registry
if (shardInfo == null) {
LOGGER.info("Skipping commitRecord: ShardID: {} lastPushedSequenceNumber: {}" +
" because shardId is not present any longer in the shardRegister", shardId, sequenceNumber);
return;
}

// Prevent issues with out of order registration.
// Since we "commit" some records before sending to Kafka(and them being committed) in some cases.
if (currentSeqNo != null && !currentSeqNo.equals("")) {
Expand All @@ -440,4 +447,4 @@ ArrayBlockingQueue<KclRecordsWrapper> getEventsQueue() {
SourceInfo getSourceInfo() {
return sourceInfo;
}
}
}