forked from segmentio/kafka-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Internally, kafka-go offset is consistent with itself. Unfortunately,…
… not with the rest of the world. The commit offset should be the offset of the next message to read and NOT the last message read. Verified by running sarama and kafka-go sequentially to verify they picked up each others offsets. (segmentio#62) Seeing as you were working in commits, I thought I would hop on your commit.
- Loading branch information
1 parent
7619f5f
commit 9066af4
Showing
4 changed files
with
29 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package kafka | ||
|
||
import "testing" | ||
|
||
func TestMakeCommit(t *testing.T) { | ||
msg := Message{ | ||
Topic: "blah", | ||
Partition: 1, | ||
Offset: 2, | ||
} | ||
|
||
commit := makeCommit(msg) | ||
if commit.topic != msg.Topic { | ||
t.Errorf("bad topic: expected %v; got %v", msg.Topic, commit.topic) | ||
} | ||
if commit.partition != msg.Partition { | ||
t.Errorf("bad partition: expected %v; got %v", msg.Partition, commit.partition) | ||
} | ||
if commit.offset != msg.Offset+1 { | ||
t.Errorf("expected committed offset to be 1 greater than msg offset") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters