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

CurrentEventsByTag query on PostgreSql returns unordered events #176

Closed
Arkatufus opened this issue Mar 23, 2023 · 0 comments · Fixed by #183
Closed

CurrentEventsByTag query on PostgreSql returns unordered events #176

Arkatufus opened this issue Mar 23, 2023 · 0 comments · Fixed by #183

Comments

@Arkatufus
Copy link
Contributor

Arkatufus commented Mar 23, 2023

Version Information
Version of Akka.Persistence.Sql? dev

Describe the bug
CurrentEventsByTag query on PostgreSql using the new TagTable returns unordered events

To Reproduce
Steps to reproduce the behavior:

[Fact]
public override void ReadJournal_query_CurrentEventsByTag_should_see_all_150_events()
{
    var queries = ReadJournal as ICurrentEventsByTagQuery;
    var a = Sys.ActorOf(SpecTestActor.Props("a"));

    for (var i = 0; i < 150; ++i) 
    {
        a.Tell("a green apple");
        ExpectMsg("a green apple-done");
    }

    var greenSrc = queries.CurrentEventsByTag("green", offset: Offset.NoOffset());
    var probe = greenSrc.RunWith(this.SinkProbe<EventEnvelope>(), Materializer);
    probe.Request(150);
    
    var list = probe.ExpectNextN(150).ToList();
    Log.Info($"Order: {string.Join(",", list.Select(e => e.SequenceNr))}");
    list.Count.Should().Be(150);
    var expectedSeqNr = 0;
    foreach (var env in list)
    {
        env.PersistenceId.Should().Be("a");
        env.Event.Should().Be("a green apple");
        expectedSeqNr++;
        env.SequenceNr.Should().Be(expectedSeqNr);
    }
    
    probe.ExpectComplete();
    probe.ExpectNoMsg(TimeSpan.FromMilliseconds(500));
}

Expected behavior
SequenceNr be a list of numbers, from 1 to 150

Actual behavior

Order: 
1,2,3,4,5,6,7,8,9,10,
11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,27,28,29,30,
31,32,33,34,35,36,37,38,39,40,
41,42,43,44,45,46,47,48,49,50,
51,52,53,54,55,56,57,58,59,60,
61,62,63,64,65,66,67,68,69,70,
71,72,73,74,75,76,77,78,79,80,
81,82,83,84,85,86,87,88,89,90,
91,92,93,94,95,96,97,98,100,102, <== SequenceNr goes out of order here
104,106,108,110,112,114,116,118,120,122,
124,126,128,130,132,134,136,138,140,142,
144,146,148,150,99,101,103,105,107,109,
111,113,115,117,119,121,123,125,127,129,
131,133,135,137,139,141,143,145,147,149
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