Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let AggregateStore use 'ChangeSets' rather than separate Commands and Events #1078

Closed
timbru opened this issue Jun 7, 2023 · 1 comment · Fixed by #1087
Closed

Let AggregateStore use 'ChangeSets' rather than separate Commands and Events #1078

timbru opened this issue Jun 7, 2023 · 1 comment · Fixed by #1087

Comments

@timbru
Copy link
Contributor

timbru commented Jun 7, 2023

Currently we save a Command key, and then 0 (in case of an error) or more Events (in case there was a change).

We can simplify this by saving a single ChangeSet structure that includes all this. Just like WalStore does.

This will simplify the logic around finding these files. Each change will be in a single atomic stored key. It will also reduce the number of keys (files for most deployments).

@timbru
Copy link
Contributor Author

timbru commented Jun 14, 2023

We will also need to re-work command history when we do this:

  • Update StoredCommand:
    • Update StoredEffect to include full events
    • Use as the single thing to save in AggregateStore
    • Use as the single thing to apply in Aggregate
    • Fix recover function to archive corrupt StoredCommands
    • Use predictable keys for processed commands in AggregateStore (sequence)
    • Remove sequence from Command (Command version is used)
    • Remove version from Event (Command version is used)
    • Remove info file (no longer needed with predictable command keys)
    • Use command and event (specific variant) for init
    • Get init event from command 0 for get_aggregate without snapshots.
  • Support migrations
    • Use OldStoredCommand for migrations (it includes event nrs not events)
    • Pre_0_14_0
      • Parse all commands and events in old,
      • convert to new style StoredComment
      • save in new
      • ignore the info (won't be needed with new predictable key names)
    • Pre_0_10_0
      • Same as above.. convert old command
  • Keep history structure now that command keys are simple
    • Add optional history_cache to AggregateStore
    • Add disable_history_cache option (save memory if needed)
    • Fill cache on warmup
    • Add new command to cache
    • Show history records from cache / key value store

timbru pushed a commit that referenced this issue Jun 26, 2023
@timbru timbru linked a pull request Jun 30, 2023 that will close this issue
@timbru timbru closed this as completed Jul 11, 2023
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 a pull request may close this issue.

1 participant