Skip to content

Dropping and recreating database of same name in one client is not reflected in other clients #5349

@tbantle22

Description

@tbantle22

If I connect to a sql server using two clients, drop a database in one client and then recreate it, and run use [db]/[branch] and select hashof('[branch]') the resulting hash is not the same for both clients.

Repro:

Connected to this database on Hosted in two terminals: https://hosteddoltdb.hosteddev.ld-corp.com/deployments/dolthub/workbench-test?tab=Connectivity
(also tested on a database from latest dolt and got the same result)

Client A

mysql> create database mydb;
Query OK, 1 row affected (0.04 sec)

mysql> use mydb;
Database changed
mysql> create table test (pk int primary key);
Query OK, 0 rows affected (0.04 sec)

mysql> insert into test values (1), (2);
Query OK, 2 rows affected (0.04 sec)

mysql> call dolt_commit('-Am', 'create table test 1');
+----------------------------------+
| hash                             |
+----------------------------------+
| vdveh26fpfhcdn71bk6v7bqcp5h7o15d |
+----------------------------------+
1 row in set (0.05 sec)

Client B

mysql> use `mydb/main`;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select hashof('main');
+----------------------------------+
| hashof('main')                   |
+----------------------------------+
| vdveh26fpfhcdn71bk6v7bqcp5h7o15d |
+----------------------------------+
1 row in set (0.04 sec)

Client A

mysql> drop database mydb;
Query OK, 1 row affected (0.05 sec)

mysql> create database mydb;
Query OK, 1 row affected (0.04 sec)

mysql> use mydb;
Database changed
mysql> create table test (pk int primary key);
Query OK, 0 rows affected (0.04 sec)

mysql> insert into test values (3), (4);
Query OK, 2 rows affected (0.04 sec)

mysql> call dolt_commit('-Am', 'create table test 2');
+----------------------------------+
| hash                             |
+----------------------------------+
| uetk2pfm7i183sje8l8jfr29tehud51l |
+----------------------------------+
1 row in set (0.05 sec)

Client B

mysql> use `mydb/main`;
Database changed
mysql> select hashof('main');
+----------------------------------+
| hashof('main')                   |
+----------------------------------+
| vdveh26fpfhcdn71bk6v7bqcp5h7o15d |
+----------------------------------+
1 row in set (0.04 sec)
mysql> select * from test;
+----+
| pk |
+----+
| 1  |
| 2  |
+----+
2 rows in set (0.01 sec)

Commit hash should be the new hash ("uetk2pfm7i183sje8l8jfr29tehud51l") and should show rows 3 and 4 instead of 1 and 2

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood reproEasily reproducible bugs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions