akka / akka-persistence-dynamodb

DynamoDB plugin for Akka Persistence
Other
2 stars 2 forks source link

Eventually consistent for local DynamoDB #6

Open patriknw opened 5 months ago

patriknw commented 5 months ago

Looks like reads are always eventually consistent for local DynamoDB:

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.UsageNotes.html#DynamoDBLocal.Differences

Read operations are eventually consistent. However, due to the speed of DynamoDB running on your computer, most reads appear to be strongly consistent.

patriknw commented 5 months ago

A workaround was added for JournalSpec in https://github.com/lightbend/akka-persistence-dynamodb-private/pull/5, but it doesn't cover all writes/reads. We need something for all tests.

pvlugter commented 5 months ago

Do we expect people to create their own integration tests against local DynamoDB? If we want to support that, then it probably needs to be a mode built into the journal implementation. Otherwise I guess we could make the shared journal specs flexible enough to allow inserting the consistency check.

patriknw commented 5 months ago

Good point. Any test with an event sourced entity could behave weird if it doesn't see it's own events when restarting. Less likely to happen in full integration test with actor restart in between, but then we are also in the "most of the time" territory. Sounds necessary to include a mode with read-after-write check in the journal implementation.