Commit Graph
7791 Commits
Author SHA1 Message Date
chrislu 581392638b s3: add retry logic for filer consistency in versioned object operations
- Add retry logic to updateLatestVersionInDirectory to handle cases where
  .versions directory creation succeeds but is not immediately visible
- Add retry logic to getLatestObjectVersion for the same consistency issue
- Use 3 retries with 50ms delays to handle filer store consistency timing
- Addresses CI failures where 'filer: no entry is found in filer store'
  occurs after successful directory creation
- Maintains CI debug logging to track retry attempts and outcomes
2025-09-14 22:24:53 -07:00
chrislu 1f275afc8f Add CI debug logging for versioning race condition investigation
- Add detailed logging for .versions metadata updates in putVersionedObject
- Add logging for latest version resolution in getLatestObjectVersion
- Add logging for HeadObject latest version requests
- All logs use glog.V(0) with CI-DEBUG prefix for easy filtering
- Will help diagnose timing issues between object creation and retrieval in CI

Debug logs will show:
- When .versions metadata updates start and complete
- When HeadObject tries to read latest version metadata
- Race conditions if HeadObject runs before metadata update completes
- Missing metadata if .versions directory exists but metadata keys are missing
- File access issues if version files exist but can't be accessed
2025-09-14 22:07:18 -07:00
chrislu f24a50e001 Update s3api_object_handlers_put.go 2025-09-14 21:45:15 -07:00
chrislu 20ab0960a3 less debug 2025-09-14 21:39:28 -07:00
chrislu e5ef704cdd add debug messages 2025-09-14 21:35:09 -07:00
chrislu 19daf8371a fix Error: s3api/s3api_object_handlers_put.go:595:12: no new variables on left side of := 2025-09-14 21:17:10 -07:00
chrislu a22b63927e Ensure the .versions directory exists before uploading 2025-09-14 21:12:48 -07:00
chrislu 206191a2d3 ensure .versions directory exists 2025-09-14 21:04:07 -07:00
chrislu ea1978e2af Bucket already exists - always return BucketAlreadyExists per S3 specification 2025-09-14 20:27:25 -07:00
chrislu b0392731b7 bucket re-creation error handling
Different Owner: Always fails with 409 BucketAlreadyExists
Checks the s3-identity-id header against the stored bucket owner
Returns error immediately if owners don't match
Same Owner + Conflicting Settings: Fails with 409 BucketAlreadyExists
Compares requested Object Lock settings with existing bucket configuration
Returns error if settings are incompatible (e.g., trying to enable Object Lock on a bucket that doesn't have it)
Same Owner + Compatible Settings: Returns 200 OK (idempotent)
If the bucket already exists with the same owner and compatible settings
Returns success response without recreating the bucket
2025-09-14 20:10:24 -07:00
chrislu ec7adc5a36 Update fetch_multibatch.go 2025-09-14 14:10:44 -07:00
chrislu d0059cb65b update plans 2025-09-14 13:36:20 -07:00
chrislu ef6a1f3798 Delete size.txt 2025-09-14 13:11:38 -07:00
chrislu 61bfe73029 Revert "Merge branch 'master' into feature/mq-kafka-gateway-m1"
This reverts commit 78382b380e, reversing
changes made to 56aa5278af.
2025-09-14 12:50:19 -07:00
chrislu 0437957db5 Update offset_management.go 2025-09-14 11:15:33 -07:00
chrislu 4e11a378fd fix tests 2025-09-14 10:52:23 -07:00
chrislu 58eb40db01 ctx.Done() 2025-09-13 21:29:27 -07:00
chrislu e501abcde6 timeout 2025-09-13 21:24:32 -07:00
chrislu 4a2642e54d more timeout 2025-09-13 21:20:54 -07:00
chrislu 1c21527179 timout 2025-09-13 21:15:05 -07:00
chrislu 5d5c820c88 timeouts 2025-09-13 21:07:24 -07:00
chrislu 75ffd30a03 goroutine-based context-cancellable I/O + aggressive goroutine timeouts 2025-09-13 20:58:51 -07:00
chrislu 48803d9a68 server shutdown timeout 2025-09-13 20:53:29 -07:00
chrislu 031c67dd5d Both io.ReadFull and time.Sleep are now context-aware 2025-09-13 20:45:34 -07:00
chrislu 015f6f2910 cancel ctx 2025-09-13 20:30:31 -07:00
chrislu 5a2fd1413f context-cancellable read 2025-09-13 20:23:58 -07:00
chrislu 18840d3f65 debug with 5 seconds timeout 2025-09-13 20:18:34 -07:00
chrislu b0ae15eac7 debug 2025-09-13 20:12:30 -07:00
chrislu 1904ba93a8 update 2025-09-13 20:07:08 -07:00
chrislu 5895f22d69 context is cancelled, the server will detect it immediately and exit gracefully 2025-09-13 20:02:11 -07:00
chrislu ddbbbaa1dd debug 2025-09-13 19:41:55 -07:00
chrislu cf584a35ef Update server.go 2025-09-13 19:40:17 -07:00
chrislu f5871524be add debug messages 2025-09-13 19:04:17 -07:00
chrislu 8e69446112 fix tests 2025-09-13 18:49:04 -07:00
chrislu 368f526b9f fix Incorrect flexible version mapping 2025-09-13 18:36:39 -07:00
chrislu 93c3e0c784 fix tests 2025-09-13 18:27:35 -07:00
chrislu 2f040a0fe4 fix undefined method errors 2025-09-13 17:34:06 -07:00
chrislu d7e1c83ca8 Update Produce v2+ to store all records from batch to SMQ
Update Produce v2+ to store all records from batch to SMQ
2025-09-13 17:30:05 -07:00
chrislu a8bee174f4 Update fetch.go
Skip long-polling if any requested topic does not exist.
Only long-poll when MinBytes > 0, data isn’t available yet, and all topics exist.
Cap the long-polling wait to 1s in tests to prevent hanging on shutdown.
2025-09-13 17:14:51 -07:00
chrislu 9a4ad5047b Update handler.go
Busy fetch loop: Implemented basic long-polling in Fetch. If no data and min_bytes>0 with max_wait_ms>0, we wait up to max_wait_ms, and populate throttle_time_ms accordingly. This stops the rapid loop for kafka-go on empty partitions.
2025-09-13 16:55:56 -07:00
chrislu bbc8668fd6 Fix kafka-go client infinite polling loop 2025-09-13 16:39:55 -07:00
chrislu 78629d69c5 Delete IMPLEMENTATION_PHASES.md 2025-09-13 15:40:48 -07:00
chrislu 287c323fb6 Update IMPLEMENTATION_PHASES.md 2025-09-13 15:40:08 -07:00
chrislu 297c662191 Phase 7: Comprehensive error handling and edge cases
- Added centralized errors.go with complete Kafka error code definitions
- Implemented timeout detection and network error classification
- Enhanced connection handling with configurable timeouts and better error reporting
- Added comprehensive error handling test suite with 21 test cases
- Unified error code usage across all protocol handlers
- Improved request/response timeout handling with graceful fallbacks
- All protocol and E2E tests passing with robust error handling
2025-09-13 15:30:34 -07:00
chrislu 2e2ccbf488 Phase 6: Add basic flexible versions support
- Added flexible_versions.go with utilities for Kafka flexible versions (v3+)
- Implemented ParseRequestHeader for compact string parsing and tagged fields
- Added fallback mechanism in handler.go for backward compatibility
- Updated handleApiVersions to support flexible version responses
- Added comprehensive tests for flexible version utilities
- All protocol tests passing with robust error handling
2025-09-13 14:29:27 -07:00
chrislu 92d6bbe575 fmt 2025-09-13 14:15:42 -07:00
chrislu 82705a214f Update implementation phases: Phase 5 completed
- Phase 1 ✅: SeaweedMQ record retrieval implemented
- Phase 2 ✅: CreateTopics v0-v5 compliance implemented
- Phase 3 ✅: ApiVersions matrix accuracy fixed
- Phase 4 ✅: Consumer group protocol metadata parsing enhanced
- Phase 5 ✅: Multi-batch Fetch concatenation support implemented (MaxBytes compliance, 17 tests)
- Ready to start Phase 6: Basic flexible versions support
2025-09-13 14:14:48 -07:00
chrislu 8762a1a4af Phase 5: Implement multi-batch Fetch concatenation support
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
2025-09-13 14:14:05 -07:00
chrislu 95fd10e743 Update implementation phases: Phase 4 completed
- Phase 1 ✅: SeaweedMQ record retrieval implemented
- Phase 2 ✅: CreateTopics v0-v5 compliance implemented
- Phase 3 ✅: ApiVersions matrix accuracy fixed (OffsetFetch v0-v5, CreateTopics v0-v5)
- Phase 4 ✅: Consumer group protocol metadata parsing enhanced (ClientHost, robust parsing)
- Ready to start Phase 5: Multi-batch Fetch concatenation support
2025-09-13 14:02:05 -07:00
chrislu 7149b723ec Phase 4: Implement consumer group protocol metadata parsing
Consumer Group Protocol Metadata completed:

## Core Enhancements
- **ClientHost extraction**: Real client IP/host instead of hardcoded 'unknown'
  - ExtractClientHost() extracts IP from connection context
  - Populates GroupMember.ClientHost with actual remote address
- **Enhanced protocol metadata parsing**: Robust parsing with error handling
  - ParseConsumerProtocolMetadata() with validation and graceful fallbacks
  - Handles malformed metadata, oversized fields, and edge cases
- **Improved assignment strategy selection**: Priority-based protocol selection
  - SelectBestProtocol() prefers sticky > roundrobin > range
  - Considers both client capabilities and existing group protocols

## Implementation Details
- **Connection Context**: Added ConnectionContext to Handler for client info
- **Metadata Analysis**: AnalyzeProtocolMetadata() for detailed debugging
- **Enhanced Subscription Extraction**: ExtractTopicsFromMetadata() with fallbacks
- **Validation**: SanitizeConsumerGroupID() prevents malformed group IDs
- **Graceful Error Handling**: Invalid metadata handled without failures

## New Files
- : Core metadata parsing and client context logic
- : Comprehensive test suite (17 test cases)

## Integration
- **JoinGroup enhancement**: Uses real client host and robust metadata parsing
- **Backward compatibility**: Legacy methods maintained for compatibility
- **Debug improvements**: Enhanced logging shows parsed protocol details

## Testing & Verification
- **17 comprehensive tests**: Protocol parsing, client host extraction, strategy selection
- **Edge case coverage**: Empty metadata, malformed data, oversized fields
- **E2E compatibility**: Sarama tests pass, no regressions
- **Performance validation**: Benchmark tests for parsing operations

Ready for Phase 5: Multi-batch Fetch concatenation support
2025-09-13 14:01:28 -07:00