Skip to content

Handle stale sequence numbers when adding parentless snapshots #1199

Backlog

Description

@manuzhang

On V2+ tables, TableMetadataBuilder::AddSnapshot() checks for a stale sequence number only when the incoming snapshot has a parent. A parentless snapshot skips that check, and the builder assigns its sequence number to the table’s last_sequence_number.

For example, start with V2 metadata containing a retained snapshot at sequence 2. Add a different snapshot with no parent and sequence 1. The builder lowers the table counter to 1. With the validation in #1169, Build() then reports kValidationFailed because the retained snapshot is at sequence 2. An incoming snapshot with a parent would have triggered kRetryableValidationFailed before changing the counter. The parentless behavior predates #1169.

Handle stale parentless snapshots before updating the table counter. Add builder tests for a lower sequence number and for equality at a positive sequence number. Cover sequence zero separately to make the intended initialization behavior explicit.

Raised in the review of #1169.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions