mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-20 13:30:46 +02:00
Multi-batch Fetch support completed: ## Core Features - **MaxBytes compliance**: Respects fetch request MaxBytes limits to prevent oversized responses - **Multi-batch concatenation**: Properly concatenates multiple record batches in single response - **Size estimation**: Pre-estimates batch sizes to optimize MaxBytes usage before construction - **Kafka-compliant behavior**: Always returns at least one batch even if it exceeds MaxBytes (first batch rule) ## Implementation Details - **MultiBatchFetcher**: New dedicated class for multi-batch operations - **Intelligent batching**: Adapts record count per batch based on available space (10-50 records) - **Proper concatenation format**: Each batch maintains independent headers and structure - **Fallback support**: Graceful fallback to single batch if multi-batch fails ## Advanced Features - **Compression ready**: Basic support for compressed record batches (GZIP placeholder) - **Size tracking**: Tracks total response size and batch count across operations - **Edge case handling**: Handles large single batches, empty responses, partial batches ## Integration & Testing - **Fetch API integration**: Seamlessly integrated with existing handleFetch pipeline - **17 comprehensive tests**: Multi-batch scenarios, size limits, concatenation format validation - **E2E compatibility**: Sarama tests pass with no regressions - **Performance validation**: Benchmarks for batch construction and multi-fetch operations ## Performance Improvements - **Better bandwidth utilization**: Fills available MaxBytes space efficiently - **Reduced round trips**: Multiple batches in single response - **Adaptive sizing**: Smaller batches when space limited, larger when space available Ready for Phase 6: Basic flexible versions support