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

[Bug] MySQL Outbox - PagedDispatchedCommand fails #3194

Open
romtur opened this issue Jul 9, 2024 · 6 comments
Open

[Bug] MySQL Outbox - PagedDispatchedCommand fails #3194

romtur opened this issue Jul 9, 2024 · 6 comments
Labels
0 - Backlog Bug v10 Allocal to a v10 release

Comments

@romtur
Copy link

romtur commented Jul 9, 2024

Describe the bug

The PagedDispatchedCommand query fails in MySQL, causing the Archiver to stop working due to unknown column 'NUMBER' error.
Noticed in 10.0.0-preview.3 but persists in the latest master version

To Reproduce

Just setting up the archiver. Managed to make the archiver work in 10.0.0-preview.3 by using a workaround to register IAmAnOutbox, as described here: #3075

Exceptions (if any)

MySqlConnector.MySqlException (0x80004005): Unknown column 'NUMBER' in 'where clause'

Further technical details

  • Brighter version: 10.0.0-preview.3
  • The OS: Windows
@romtur
Copy link
Author

romtur commented Jul 9, 2024

@iancooper @preardon Is there any chance that this could be included in the next pre-release version?

@romtur romtur changed the title [Bug] MySQL Outbox - PagedDispatchedCommand query doesn't work [Bug] MySQL Outbox - PagedDispatchedCommand fails Jul 9, 2024
@iancooper
Copy link
Member

@romtur Yes, hopefully we will be at a point to do a release in the next few days. I want to get one more PR in.

@iancooper iancooper added Bug v10 Allocal to a v10 release labels Jul 10, 2024
@iancooper
Copy link
Member

@romtur Possibly could be schema issues between V9 and V10; we will investigate but it may be because you need to migrate

@romtur
Copy link
Author

romtur commented Jul 10, 2024

@iancooper It looks like this query never worked for MySql
Same query for MsSql:
public string PagedDispatchedCommand { get; } = "SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY Timestamp DESC) AS NUMBER, * FROM {0}) AS TBL WHERE DISPATCHED IS NOT NULL AND DISPATCHED < DATEADD(millisecond, @OutStandingSince, getutcdate()) AND NUMBER BETWEEN ((@PageNumber-1)*@PageSize+1) AND (@PageNumber*@PageSize) ORDER BY Timestamp DESC";

we are selecting NUMBER and then using it. For MySql we are not selecting it but trying to use:
public string PagedDispatchedCommand { get; } = "SELECT * FROM {0} AS TBL WHERE CreatedID BETWEEN ((?PageNumber-1)*?PageSize+1) AND (?PageNumber*?PageSize) AND DISPATCHED IS NOT NULL AND DISPATCHED < DATE_ADD(UTC_TIMESTAMP(), INTERVAL ?OutstandingSince MICROSECOND) AND NUMBER BETWEEN ((?PageNumber-1)*?PageSize+1) AND (?PageNumber*?PageSize) ORDER BY Timestamp DESC";

Maybe we can use the same approach as for OutstandingCommand: LIMIT and OFFSET

@iancooper
Copy link
Member

Ah yes! Thanks that will be what is wrong. //cc @preardon

@romtur
Copy link
Author

romtur commented Jul 10, 2024

@iancooper @preardon Another thing to mention (not directly related to this issue), but I noticed that in the latest master code, archiveBatchSize is no longer configurable and is always set to 100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 - Backlog Bug v10 Allocal to a v10 release
Projects
None yet
Development

No branches or pull requests

2 participants