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

Akka.Persistence.Query.TCK Bug: TestActor acknowledges delete whether it actually happened or not #3935

Closed
Aaronontheweb opened this issue Sep 25, 2019 · 0 comments · Fixed by #3936
Assignees
Milestone

Comments

@Aaronontheweb
Copy link
Member

Version: v1.4.0-beta2

Found this while investigating akkadotnet/Akka.Persistence.MongoDB#77 (comment)

Issue is this:

Error in this case appears to be a stale read coming from the MongoDB journal:

[Fact]
public virtual void ReadJournal_CurrentEventsByPersistenceId_should_return_remaining_values_after_partial_journal_cleanup()
{
var queries = ReadJournal.AsInstanceOf<ICurrentEventsByPersistenceIdQuery>();
var pref = Setup("h");
pref.Tell(new TestActor.DeleteCommand(2));
AwaitAssert(() => ExpectMsg("2-deleted"));
var src = queries.CurrentEventsByPersistenceId("h", 0L, long.MaxValue);
src.Select(x => x.Event).RunWith(this.SinkProbe<object>(), Materializer)
.Request(1)
.ExpectNext("h-3")
.ExpectComplete();
}

Setup writes 3 events to the journal - arrange phase of the test deletes the first two - assertion expects only the third one back. Instead we got the first event straight away.

Sounds to me like Mongo being Mongo, but I'll take a look real fast.

And determined cause:

Ah, the problem is actually with the TestActor in the Akka.Persistence.Query.TCK

case DeleteCommand delete:
DeleteMessages(delete.ToSequenceNr);
Sender.Tell($"{delete.ToSequenceNr}-deleted");
break;

We send a reply back that the message has been deleted without actually knowing if the journal has done that or not.

Proposed fix: Probably need to wait until we get a DeleteMessagesSuccess or a DeleteMessagesFailure message back, since DeleteMessages(long seqNo) is an asynchronous operation.

@Aaronontheweb Aaronontheweb added this to the 1.4.0 milestone Sep 25, 2019
@Aaronontheweb Aaronontheweb self-assigned this Sep 25, 2019
Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this issue Sep 25, 2019
…s for delete confirmation before replying
Aaronontheweb added a commit that referenced this issue Sep 27, 2019
Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this issue Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant