Skip to content

Feature request: Option to require explicit expected version (disable ANY and exists) #77

@edge90

Description

@edge90

Hi,

First, thanks for creating SierraDB. It’s a very promising project and I’m looking forward to working with it.

I have a feature request: an option to require strict optimistic concurrency for EAPPEND. This means disallowing EXPECTED_VERSION ANY, disallowing EXPECTED_VERSION exists and rejecting appends that omit EXPECTED_VERSION entirely.

Reason

In systems that rely on strict event-sourcing semantics, every append should use an explicit expected version tied to the decision the writer made. Allowing ANY or exists makes it possible for developers or services to bypass concurrency checks, which can lead to subtle issues in multi-writer scenarios (commands being applied based on stale state without any error).

It would be very helpful if the server could enforce this rule rather than relying only on client-side discipline.

Desired behavior

When this option is enabled:

  • EAPPEND ... EXPECTED_VERSION ANY is rejected.

  • EAPPEND ... EXPECTED_VERSION exists is rejected.

  • EAPPEND without an EXPECTED_VERSION is rejected.

  • Only the following are accepted:

    • EXPECTED_VERSION empty (for creating a new stream).
    • EXPECTED_VERSION <integer> (for appending to an existing stream).

This would make concurrency guarantees explicit and enforceable at the server level.

Thanks again for the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions