Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Change offset commit behaviour to be in line with Java consumers #45

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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 @@ -142,7 +142,7 @@ public void CommitOffsets()
var topicDirs = new ZKGroupTopicDirs(this.config.GroupId, topic.Key);
foreach (KeyValuePair<int, PartitionTopicInfo> partition in topic.Value)
{
var newOffset = partition.Value.ConsumeOffset;
var newOffset = partition.Value.ConsumeOffset + 1;
try
{
if (partition.Value.ConsumeOffsetValid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,26 +501,24 @@ private void AddPartitionTopicInfo(ZKGroupTopicDirs topicDirs, string partition,

//if first time starting a consumer, set the initial offset based on the config
long offset = -1;
long offsetCommited = -1;
if (offsetCommitedString != null)
{
offsetCommited = long.Parse(offsetCommitedString);
offset = offsetCommited + 1;
offset = long.Parse(offsetCommitedString);
}
Logger.InfoFormat("Final offset {0} for topic {1} partition {2} OffsetCommited {3}"
, offset, topic, partition, offsetCommited);
Logger.InfoFormat("Final offset {0} for topic {1} partition {2}."
, offset, topic, partition);

var queue = this.queues[new Tuple<string, string>(topic, consumerThreadId)];
var partTopicInfo = new PartitionTopicInfo(
topic,
leader,
partitionId,
queue,
offsetCommited,
offset - 1,
offset,
offset,
this.config.FetchSize,
offsetCommited);
offset);
partTopicInfoMap[partitionId] = partTopicInfo;
Logger.InfoFormat("{0} selected new offset {1}", partTopicInfo, offset);
}
Expand Down