diff --git a/weed/mq/kafka/protocol/handler.go b/weed/mq/kafka/protocol/handler.go index 0366acd56..e0903138d 100644 --- a/weed/mq/kafka/protocol/handler.go +++ b/weed/mq/kafka/protocol/handler.go @@ -1688,20 +1688,20 @@ func (h *Handler) handleDeleteTopics(correlationID uint32, requestBody []byte) ( // validateAPIVersion checks if we support the requested API version func (h *Handler) validateAPIVersion(apiKey, apiVersion uint16) error { supportedVersions := map[uint16][2]uint16{ - 18: {0, 3}, // ApiVersions: v0-v3 - 3: {0, 7}, // Metadata: v0-v7 - 0: {0, 7}, // Produce: v0-v7 - 1: {0, 7}, // Fetch: v0-v7 - 2: {0, 2}, // ListOffsets: v0-v2 - 19: {0, 4}, // CreateTopics: v0-v4 - 20: {0, 4}, // DeleteTopics: v0-v4 - 10: {0, 2}, // FindCoordinator: v0-v2 - 11: {0, 7}, // JoinGroup: v0-v7 - 14: {0, 5}, // SyncGroup: v0-v5 - 8: {0, 2}, // OffsetCommit: v0-v2 - 9: {0, 2}, // OffsetFetch: v0-v2 - 12: {0, 4}, // Heartbeat: v0-v4 - 13: {0, 4}, // LeaveGroup: v0-v4 + 18: {0, 3}, // ApiVersions: v0-v3 + 3: {0, 7}, // Metadata: v0-v7 + 0: {0, 7}, // Produce: v0-v7 + 1: {0, 7}, // Fetch: v0-v7 + 2: {0, 2}, // ListOffsets: v0-v2 + 19: {0, 4}, // CreateTopics: v0-v4 + 20: {0, 4}, // DeleteTopics: v0-v4 + 10: {0, 2}, // FindCoordinator: v0-v2 + 11: {0, 7}, // JoinGroup: v0-v7 + 14: {0, 5}, // SyncGroup: v0-v5 + 8: {0, 2}, // OffsetCommit: v0-v2 + 9: {0, 2}, // OffsetFetch: v0-v2 + 12: {0, 4}, // Heartbeat: v0-v4 + 13: {0, 4}, // LeaveGroup: v0-v4 } if versionRange, exists := supportedVersions[apiKey]; exists { diff --git a/weed/mq/kafka/protocol/handler_test.go b/weed/mq/kafka/protocol/handler_test.go index f0f885069..f756b0906 100644 --- a/weed/mq/kafka/protocol/handler_test.go +++ b/weed/mq/kafka/protocol/handler_test.go @@ -142,8 +142,8 @@ func TestHandler_ApiVersions(t *testing.T) { if minVersion3 != 0 { t.Errorf("expected min version 0, got: %d", minVersion3) } - if maxVersion3 != 5 { - t.Errorf("expected max version 5, got: %d", maxVersion3) + if maxVersion3 != 2 { + t.Errorf("expected max version 2, got: %d", maxVersion3) } // Fourth API key (CreateTopics) @@ -202,8 +202,8 @@ func TestHandler_ApiVersions(t *testing.T) { if minVersion7 != 0 { t.Errorf("expected min version 0, got: %d", minVersion7) } - if maxVersion7 != 11 { - t.Errorf("expected max version 11, got: %d", maxVersion7) + if maxVersion7 != 7 { + t.Errorf("expected max version 7, got: %d", maxVersion7) } // Close client to end handler