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

MySqlBulkLoader not working with Azure Mariadb #853

Closed
naitikmalaviya opened this issue Jul 20, 2020 · 6 comments
Closed

MySqlBulkLoader not working with Azure Mariadb #853

naitikmalaviya opened this issue Jul 20, 2020 · 6 comments
Assignees
Labels

Comments

@naitikmalaviya
Copy link

naitikmalaviya commented Jul 20, 2020

Dotnet core version: 2.1
ORM: Dapper
Azure Mariadb version: 10.2 / 10.3
OS platform: CentOS 7 / Windows 10
MySqlConnector Version: 0.64.1

I am migrating from Mysql.Data library to Mysqlconnector library. I am facing this issue only on Azure Mariadb.

I've followed this troubleshooting guide as well. I've changed code and used MysqlBulkLoader class to use local data infile. And it is working properly with mariadb 10.2 docker image and windows mariadb 10.2 as well. It is only failing on Azure Mariadb. I am not sure why maybe because they have different architecture and there is some weird issue with version as well (the MySQL client displays the version of MariaDB set in the gateway, not the actual version running on your MariaDB server instance.).

It is working with old mysql connector so I am assuming it is not related to any Mariadb server settings.

Error:

Message: The used command is not allowed with this MariaDB version
StackTrace:
at MySql.Data.MySqlClient.MySqlDataReader.ActivateResultSet() in /_/src/MySqlConnector/MySql.Data.MySqlClient/MySqlDataReader.cs:line 116
   at MySql.Data.MySqlClient.MySqlDataReader.CreateAsync(CommandListPosition commandListPosition, ICommandPayloadCreator payloadCreator, IDictionary`2 cachedProcedures, IMySqlCommand command, CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySql.Data.MySqlClient/MySqlDataReader.cs:line 391
   at MySqlConnector.Core.CommandExecutor.ExecuteReaderAsync(IReadOnlyList`1 commands, ICommandPayloadCreator payloadCreator, CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/CommandExecutor.cs:line 62
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQueryAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySql.Data.MySqlClient/MySqlCommand.cs:line 220
   at MySql.Data.MySqlClient.MySqlBulkLoader.LoadAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySql.Data.MySqlClient/MySqlBulkLoader.cs:line 116
   at MySql.Data.MySqlClient.MySqlBulkLoader.Load() in /_/src/MySqlConnector/MySql.Data.MySqlClient/MySqlBulkLoader.cs:line 60

Notes:

  • I've also tried to run mysql query from dotnet code with VerifyCA option in connection string. It also failed on Azure Mariadb.
  • I've also tried latest version of MySqlConnector library - same result.
@bgrainger
Copy link
Member

I can confirm that MySqlBulkLoader works with MySql.Data 8.0.21 but not MySqlConnector 1.0.0; I don't yet know what's different about the request that would cause the The used command is not allowed with this MariaDB version error.

@bgrainger
Copy link
Member

The Azure Database for MariaDB server (or proxy, more likely) doesn't set the CLIENT_LOCAL_FILES flag in its initial handshake packet, so MySqlConnector clears this in the response, regardless of the MySqlConnectionStringBuilder.AllowLoadLocalInfile setting:

(cs.AllowLoadLocalInfile ? (serverCapabilities & ProtocolCapabilities.LocalFiles) : 0) |

The solution here is probably for MySqlConnector to always set that flag all the time.

@bgrainger bgrainger self-assigned this Jul 20, 2020
@bgrainger bgrainger added the bug label Jul 20, 2020
@bgrainger
Copy link
Member

This was a bug introduced here, where the flag became dependent on both the local connection-string setting and the server's support: a6c595a#diff-815cb1931b120a93f45b68aaec3975c0

@bgrainger
Copy link
Member

Fixed in 0.69.8.

Fix for 1.x is in GitHub Package Registry, 1.0.1-beta.0.11 or later: https://github.com/mysql-net/MySqlConnector/packages/39735

@naitikmalaviya
Copy link
Author

Thanks a lot for the prompt response and release. I can confirm that it's fixed in 0.69.8. 🙂

@bgrainger
Copy link
Member

Fixed in 1.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants