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

Fix offset_manager for Kafka 0.9.0.0 #585

Merged
merged 1 commit into from
Dec 13, 2015
Merged
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
9 changes: 0 additions & 9 deletions functional_offset_manager_test.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
package sarama

import (
"os"
"testing"
)

func TestFuncOffsetManager(t *testing.T) {
checkKafkaVersion(t, "0.8.2")
if os.Getenv("KAFKA_VERSION") == "0.9.0.0" {
t.Skip("Offset manager is broken with kafka 0.9 at the moment.")
}

setupFunctionalTest(t)
defer teardownFunctionalTest(t)

Expand All @@ -24,10 +19,6 @@ func TestFuncOffsetManager(t *testing.T) {
t.Fatal(err)
}

if _, err := offsetManager.ManagePartition("does_not_exist", 123); err != ErrUnknownTopicOrPartition {
t.Fatal("Expected ErrUnknownTopicOrPartition when starting a partition offset manager for a partition that does not exist, got:", err)
}

pom1, err := offsetManager.ManagePartition("test.1", 0)
if err != nil {
t.Fatal(err)
Expand Down
7 changes: 5 additions & 2 deletions offset_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (

// Offset Manager

const groupGenerationUndefined = -1

// OffsetManager uses Kafka to store and fetch consumed partition offsets.
type OffsetManager interface {
// ManagePartition creates a PartitionOffsetManager on the given topic/partition.
Expand Down Expand Up @@ -476,8 +478,9 @@ func (bom *brokerOffsetManager) flushToBroker() {

func (bom *brokerOffsetManager) constructRequest() *OffsetCommitRequest {
r := &OffsetCommitRequest{
Version: 1,
ConsumerGroup: bom.parent.group,
Version: 1,
ConsumerGroup: bom.parent.group,
ConsumerGroupGeneration: groupGenerationUndefined,
}

for s := range bom.subscriptions {
Expand Down