mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-04 02:57:44 +01:00
CRITICAL FIX: Resolve kafka-go client CreateTopics failures ## Issues Fixed: - CreateTopics handler was missing apiVersion parameter - v2+ compact array/string format parsing was incorrect - Wrong topics count (1274981) due to parsing from incorrect offset - Response format didn't match v2+ compact format requirements ## Implementation: - Added apiVersion parameter to handleCreateTopics - Implemented proper v2+ compact format parsing: - Compact arrays: length + 1 (0 = empty, n+1 = n elements) - Compact strings: length + 1 (0 = null, n+1 = n chars) - Tagged fields support (empty for now) - Separated v0/v1 and v2+ parsing logic - Fixed response format for v2+ with compact strings and tagged fields ## Protocol Details: CreateTopics v2+ request format: - topics_array (compact) + timeout_ms(4) + validate_only(1) + tagged_fields CreateTopics v2+ response format: - correlation_id(4) + throttle_time(4) + topics_array (compact) + tagged_fields Each topic response: - name (compact string) + error_code(2) + error_message (compact nullable string) + tagged_fields ## Testing: - Compilation successful - Debug logging shows proper parsing of topic names and parameters - Should resolve kafka-go client CreateTopics API failures This fix addresses the most critical compatibility issue preventing kafka-go clients from creating topics successfully.