Replies: 1 comment 2 replies
-
|
So I spend some time digging into this and as somewhat expected this is yet another breaking change from mariadb. The problem is that they again overwrite the Mysql/Mariadb expects us to pass in a preallocated buffer for the data they return. For statically sized data like integers, etc we can know the size of the buffer in advance and will allocate a buffer of the right size. For dynamically sized data like strings that's not possible. We just pass in a smaller sized buffer in this case and expect libmysqlclient/libmariadb to return a "truncated" result: diesel/diesel/src/mysql/connection/stmt/mod.rs Lines 180 to 196 in 762a1a6 This sets the diesel/diesel/src/mysql/connection/bind.rs Line 172 in 762a1a6 We then use this information to resize the buffer to the correct size via diesel/diesel/src/mysql/connection/bind.rs Lines 77 to 89 in 762a1a6 and https://github.com/diesel-rs/diesel/blob/main/diesel/src/mysql/connection/bind.rs#L529-L590 In https://github.com/diesel-rs/diesel/blob/main/diesel/src/mysql/connection/bind.rs#L91 we repopulate the buffer with the now complete data. Before this call the This field is then later used for dynamically sized types to determine the right size of the stored buffer: diesel/diesel/src/mysql/connection/bind.rs Lines 436 to 453 in 762a1a6 This now assumes that the buffer has a length of zero as that is what is reported by libmariadb, which in turn causes the other failures on top of it. I'm honestly not sure why they even believe this is a sane change at all. This removes any indication about the buffer size for any subsequent call to that hits the right size by chance. It seems possible to workaround this by just copying the relevant information on diesel side before the problematic call, but that's yet another mariadb specific workaround for a regression on their side. Before doing that I would at least fill an upstream issue and hear there reasoning for repeatably breaking stuff like that. cc @robertsilen @ottok as you both tried repeatably to have Diesel declare compatibility with MariaDB. Such issues are exactly the reason why we have not done that yet. cc also @grawlinson as this might be relevant for your packing as well. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Backend
Other
Diesel version
2.3.10
Diesel Features
mysql diesel_migrations
Operating System Version
GNU/Linux
Third party libraries
No response
What do you want to do?
Run migrations via mariadb-connector-c library v3.4.9.
MariaDB v3.4.9 seems to break some queries like
min()andmax()which the Diesel Migrations makes use of.This causes the migrations to fail.
I have an example repo available here: https://github.com/BlackDex/mvp-issues/tree/diesel-mariadb-3.4.9
It shows that the
min()andmax()functions return empty, while with older versions they do return the expected values.Compile time error
n/a
What code do you already have?
Additional details
This issue is also discussed at Vaultwarden over here: dani-garcia/vaultwarden#7268
Checklist
Beta Was this translation helpful? Give feedback.
All reactions