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

Pomelo Entity Framework connector is not able to commit changes #7897

Closed
awarycha opened this issue May 24, 2024 · 6 comments · Fixed by #7899
Closed

Pomelo Entity Framework connector is not able to commit changes #7897

awarycha opened this issue May 24, 2024 · 6 comments · Fixed by #7899
Labels
bug Something isn't working customer issue good repro Easily reproducible bugs

Comments

@awarycha
Copy link

awarycha commented May 24, 2024

Problem exist on Dolt in Docker both dolthub/dolt-sql-server:1.38.3 and dolthub/dolt-sql-server:1.39.0 only with Pomelo connector
Pomelo.EntityFrameworkCore.MySql" Version="8.0.2", everything works if I use MySql.EntityFrameworkCore" Version="8.0.2" connector.
I tested also commit on Pomelo and Dolt dolthub/dolt-sql-server:1.34.0 and it is working fine. So I think it is regress, please confirm.

Steps to reproduce:
At the beginning of application after recreation of database scheme, I'm adding initial commit

 string sqlAddTablesQuery = $"call dolt_add('mytable1','mytable2');";
 dbContext.Database.ExecuteSqlRaw(sqlAddTablesQuery);
 dbContext.Database.ExecuteSqlRaw($"CALL DOLT_COMMIT('-a', '-m', 'Initial state','--author', 'System <system@mydomain.com>');");

Then I get the following error:

fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
      Failed executing DbCommand (4ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
      CALL DOLT_COMMIT('-a', '-m', 'Initial state.','--author', 'System <system@mydomain.com>');

Exception has occurred: CLR/MySqlConnector.MySqlException
An unhandled exception of type 'MySqlConnector.MySqlException' occurred in Microsoft.EntityFrameworkCore.Relational.dll: 'error: the table(s) __DATABASE__mydb do not exist'
   at MySqlConnector.Core.ServerSession.<ReceiveReplyAsync>d__107.MoveNext()
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1.ConfiguredValueTaskAwaiter.GetResult()
   at MySqlConnector.Core.ResultSet.<ReadResultSetHeaderAsync>d__2.MoveNext()
   at MySqlConnector.MySqlDataReader.ActivateResultSet(CancellationToken cancellationToken)
   at MySqlConnector.MySqlDataReader.<InitAsync>d__111.MoveNext()
   at MySqlConnector.Core.CommandExecutor.<ExecuteReaderAsync>d__0.MoveNext()
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at MySqlConnector.MySqlCommand.<ExecuteNonQueryAsync>d__78.MoveNext()
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at MySqlConnector.MySqlCommand.ExecuteNonQuery()
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlRaw(DatabaseFacade databaseFacade, String sql, IEnumerable`1 parameters)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlRaw(DatabaseFacade databaseFacade, String sql, Object[] parameters)
@fulghum
Copy link
Contributor

fulghum commented May 24, 2024

Hi @awarycha, thanks for opening a new issue for this one. This looks related to a recent change @jycor made to show database level changes (e.g. a collation change) as changed tables.

Here's an even simpler repro from a dolt sql shell in a new database named may24:

show create database may24;
+----------+--------------------------------------------------------------------------------------------+
| Database | Create Database                                                                            |
+----------+--------------------------------------------------------------------------------------------+
| may24    | CREATE DATABASE `may24` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_bin */ |
+----------+--------------------------------------------------------------------------------------------+

alter database may24 collate utf8mb4_0900_ai_ci;
Query OK, 1 row affected (0.00 sec)

select * from dolt_status;
+-------------------+--------+----------+
| table_name        | staged | status   |
+-------------------+--------+----------+
| __DATABASE__may24 | false  | modified |
+-------------------+--------+----------+

call dolt_commit('-a', '-m', 'changing collation', '--author', 'system <system@domain.com>');
error: the table(s) __DATABASE__may24 do not exist

I'll follow up with @jycor and see if he can pick this one up today. It should be a quick fix.

@jycor
Copy link
Contributor

jycor commented May 24, 2024

Hey @awarycha,

Just merged a fix for this to dolt main. I had missed this particular case when adding this change.
We can cut a release for you later today or early next week.

@fulghum
Copy link
Contributor

fulghum commented May 24, 2024

Hi @awarycha, we have released Dolt version 1.39.1 with the fix for this issue.

Sorry for the snag on this regression, and thank you for taking the time to report it to us so we could fix it. 🙏

I hope testing your ASP.NET Core app with this new version goes smoothly! Let us know if you hit any more issues and we'll be happy to help.

@awarycha
Copy link
Author

Thanks for the quick fix. I am not able to test it now but I will do it on monday morning and then give you a feedback.

@awarycha
Copy link
Author

Verified on Dolt version 1.39.1. Works as expected. Thanks.

@bpf120
Copy link

bpf120 commented May 30, 2024

Hi @awarycha , we'd love to learn more about your Dolt use case. Swing by our Discord or email me if you want to share.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working customer issue good repro Easily reproducible bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants