- Added convertOffsetToMessagePosition to map subscription offsets to MessagePosition
- Subscription now starts from the calculated position instead of beginning + filter
- Handles different offset types: EARLIEST, LATEST, EXACT_OFFSET, EXACT_TS_NS
- Uses timestamp approximation for exact offsets (temporary solution)
- Added comprehensive tests for offset-to-position conversion
This fixes the high-priority inefficiency where subscriptions would start from
the beginning of the log and filter messages, causing unnecessary I/O and CPU usage.
For consumers with high offsets, this provides significant performance improvement.
- Add SW_COLUMN_NAME_OFFSET field to parquet storage for offset persistence
- Create BrokerOffsetManager for coordinating offset assignment across partitions
- Integrate offset manager into MessageQueueBroker initialization
- Add PublishWithOffset method to LocalPartition for offset-aware publishing
- Update broker publish flow to assign offsets during message processing
- Create offset-aware subscription handlers for consume operations
- Add comprehensive broker offset integration tests
- Support both single and batch offset assignment
- Implement offset-based subscription creation and management
- Add partition offset information and metrics APIs
Key TODOs and Assumptions:
- TODO: Replace in-memory storage with SQL-based persistence in Phase 5
- TODO: Integrate LogBuffer to natively handle offset assignment
- TODO: Add proper partition field access in subscription requests
- ASSUMPTION: LogEntry.Offset field populated by broker during publishing
- ASSUMPTION: Offset information preserved through parquet storage integration
- ASSUMPTION: BrokerOffsetManager handles all partition offset coordination
Tests show basic functionality working, some integration issues expected
until Phase 5 SQL storage backend is implemented.