Skip to content

[Good First Issue] Write Unit Tests for WALConfirmOffsetCalculator #2367

Open
@Chillax-0v0

Description

@Chillax-0v0

Problem Description

The com.automq.stream.s3.S3Storage.WALConfirmOffsetCalculator class currently lacks comprehensive unit tests.

Required Changes

  1. Read and understand the original implementation:
    1. S3Storage sends append requests to the WAL, but the WAL does not guarantee the order of persistence completion (earlier requests may complete later).
    2. When S3Storage confirms that all requests prior to a specific offset have been persisted and uploaded to S3, it calls the WAL's trim method to discard data before that offset.
    3. WALConfirmOffsetCalculator implements a near-optimal algorithm to determine the current confirm offset. It prioritizes low overhead (O(n)) over perfect accuracy or immediacy.
  2. Focus on validating the calculate method (consider modifying method visibility for testability if needed).

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions