Open
Description
Problem Description
The com.automq.stream.s3.S3Storage.WALConfirmOffsetCalculator
class currently lacks comprehensive unit tests.
Required Changes
- Read and understand the original implementation:
S3Storage
sendsappend
requests to the WAL, but the WAL does not guarantee the order of persistence completion (earlier requests may complete later).- When
S3Storage
confirms that all requests prior to a specific offset have been persisted and uploaded to S3, it calls the WAL'strim
method to discard data before that offset. WALConfirmOffsetCalculator
implements a near-optimal algorithm to determine the current confirm offset. It prioritizes low overhead (O(n)) over perfect accuracy or immediacy.
- Focus on validating the
calculate
method (consider modifying method visibility for testability if needed).