Skip to content

Add EnableBigIntEvents flag for 64-bit event sequences#4250

Merged
jeremydmiller merged 2 commits intomasterfrom
fix/4246-enable-bigint-events
Apr 14, 2026
Merged

Add EnableBigIntEvents flag for 64-bit event sequences#4250
jeremydmiller merged 2 commits intomasterfrom
fix/4246-enable-bigint-events

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Summary

Closes #4246

  • Adds StoreOptions.Events.EnableBigIntEvents opt-in flag (defaults to false) that switches the mt_quick_append_events PostgreSQL function to use bigint types for event version, sequence, and return values
  • Prevents integer overflow when the global event sequence counter exceeds the ~2.1 billion int32 limit
  • Includes 6 tests verifying behavior with the flag both enabled and disabled
  • Adds documentation to the event store configuration guide noting this will default to true in Marten 9.0

Test plan

  • default_flag_is_false — verifies backward-compatible default
  • events_work_with_bigint_enabled — end-to-end event append/read with flag on
  • events_work_with_bigint_disabled — end-to-end event append/read with flag off
  • sequence_above_int32_max_with_bigint_enabled — verifies sequences beyond 2.1B work
  • quick_append_function_uses_bigint_when_enabled — DDL inspection
  • quick_append_function_uses_int_when_disabled — DDL inspection

🤖 Generated with Claude Code

jeremydmiller and others added 2 commits April 14, 2026 15:53
Introduces an opt-in EnableBigIntEvents flag on StoreOptions.Events that
switches the mt_quick_append_events PostgreSQL function to use bigint types
for event version, sequence, and return values. This prevents integer
overflow when sequence values exceed the ~2.1 billion int32 limit.

The flag defaults to false for backward compatibility and will become
true by default in Marten 9.0. Includes 6 tests verifying behavior
with the flag both enabled and disabled, and documentation in the
event store configuration guide.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jeremydmiller jeremydmiller merged commit a52694c into master Apr 14, 2026
4 of 6 checks passed
@jeremydmiller jeremydmiller deleted the fix/4246-enable-bigint-events branch April 14, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mt_quick_append_events can fail with 22003: integer out of range when sequence / stream version exceeds int32 range

1 participant