Skip to content

Commit

Permalink
Guaranty order of sequencenumber
Browse files Browse the repository at this point in the history
When not setting the order by the sorting of the query is not always the primary key depending on the order in the index.
For me as simple category stream query retuned the following order and thats why the projector not getting all events in the correct order:
+--------------+
|sequencenumber|
+--------------+
|83            |
|63            |
|1018          |
|209           |
|161           |
|1             |
|71            |
|623           |
|59            |
|67            |
|922           |
|178           |
|225           |
+--------------+
  • Loading branch information
saschanowak authored Apr 29, 2021
1 parent d2eef41 commit dd3fa45
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Classes/EventStore/Storage/Doctrine/DoctrineEventStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ public function load(StreamName $streamName, int $minimumSequenceNumber = 0): Ev
$this->reconnectDatabaseConnection();
$query = $this->connection->createQueryBuilder()
->select('*')
->from($this->eventTableName);
->from($this->eventTableName)
->orderBy('sequencenumber', 'ASC');

if (!$streamName->isVirtualStream()) {
$query->andWhere('stream = :streamName');
Expand Down

0 comments on commit dd3fa45

Please sign in to comment.