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

dolt pull fails in the presence of ignored tables #7973

Closed
daxon71 opened this issue Jun 7, 2024 · 4 comments
Closed

dolt pull fails in the presence of ignored tables #7973

daxon71 opened this issue Jun 7, 2024 · 4 comments
Labels

Comments

@daxon71
Copy link

daxon71 commented Jun 7, 2024

If you make tables ignored (add dolt_ignore to the table), then it is expected that they will not interfere with regular work with the repository and will be completely ignored by dolt, but they interfere and with the next dolt pull they will cause the error "Error 1105 (HY000): cannot merge with uncommitted changes", although the dolt status command shows a clear state.

I'm testing on a local computer with windows and dolt version 1.39.3.

@timsehn
Copy link
Contributor

timsehn commented Jun 7, 2024

This is not a simple repro with merge. Trying pull next.

$ dolt init --fun
Successfully initialized dolt data repository.
$ dolt sql -q "create table t (id int primary key, words varchar(100))"
$ dolt commit -Am "Added table"
commit 00bsg9s16meuesvdpldqgpokl9u9i2pe (HEAD -> main) 
Author: timsehn <[email protected]>
Date:  Fri Jun 07 09:57:09 -0700 2024

        Added table

$ dolt branch test-branch      
$ dolt sql -q "create table ignore_this (id int primary key, words varchar(100))"
$ dolt sql -q "INSERT INTO dolt_ignore VALUES ('ignore_*', true)"
Query OK, 1 row affected (0.01 sec)
$ dolt status
On branch main
Untracked tables:
  (use "dolt add <table>" to include in what will be committed)
	new table:        dolt_ignore
$ dolt commit -Am "Added ignore_this table and added a rule in dolt_ignore"
commit pritv0h0vkk3h65pjijso5sl8lgcme2q (HEAD -> main) 
Author: timsehn <[email protected]>
Date:  Fri Jun 07 10:01:56 -0700 2024

        Added ignore_this table and added a rule in dolt_ignore

$ dolt checkout test-branch
Switched to branch 'test-branch'
$ dolt sql -q "insert into t values (0, 'First row')" 
Query OK, 1 row affected (0.00 sec)
$ dolt commit -am "Added a row"
commit mmb701tpfqekpsvgigahrf014qt34pbv (HEAD -> test-branch) 
Author: timsehn <[email protected]>
Date:  Fri Jun 07 10:02:40 -0700 2024

        Added a row

$ dolt checkout main
Switched to branch 'main'
$ dolt merge test-branch
Updating 58s2crr0h65pir3k3ecb1rfnqqum6rb5..mmb701tpfqekpsvgigahrf014qt34pbv
commit 58s2crr0h65pir3k3ecb1rfnqqum6rb5 (HEAD -> main) 
Merge: pritv0h0vkk3h65pjijso5sl8lgcme2q mmb701tpfqekpsvgigahrf014qt34pbv
Author: timsehn <[email protected]>
Date:  Fri Jun 07 10:02:52 -0700 2024

        Merge branch 'test-branch' into main

t | 1 +
1 tables changed, 1 rows added(+), 0 rows modified(*), 0 rows deleted(-)
$ dolt sql -q "create table ignore_that (id int primary key, words varchar(100))"
$ dolt status
On branch main
nothing to commit, working tree clean
$ dolt checkout test-branch                           
Switched to branch 'test-branch'
$ dolt sql -q "insert into t values (0, 'Second row')" 
error on line 1 for query insert into t values (0, 'Second row'): duplicate primary key given: [0]
$ dolt sql -q "insert into t values (1, 'Second row')" 
Query OK, 1 row affected (0.00 sec)
$ dolt commit -am "Added second row"                   
commit bhisqv0lv2k1v31glb35f5r4ckrvur15 (HEAD -> test-branch) 
Author: timsehn <[email protected]>
Date:  Fri Jun 07 10:04:29 -0700 2024

        Added second row

$ dolt checkout main
Switched to branch 'main'
$ dolt merge test-branch
Updating bqddfg8sjdogdfi5ugpprjmdnsro8sda..bhisqv0lv2k1v31glb35f5r4ckrvur15
commit bqddfg8sjdogdfi5ugpprjmdnsro8sda (HEAD -> main) 
Merge: 58s2crr0h65pir3k3ecb1rfnqqum6rb5 bhisqv0lv2k1v31glb35f5r4ckrvur15
Author: timsehn <[email protected]>
Date:  Fri Jun 07 10:04:42 -0700 2024

        Merge branch 'test-branch' into main

t | 1 +
1 tables changed, 1 rows added(+), 0 rows modified(*), 0 rows deleted(-)
$ dolt sql -q "show tables"
+-----------------------------+
| Tables_in_test_ignore_merge |
+-----------------------------+
| ignore_that                 |
| ignore_this                 |
| t                           |
+-----------------------------+

@timsehn
Copy link
Contributor

timsehn commented Jun 7, 2024

So now I create a repository on dolthub. timsehn/test_ignore_merge.

Locally run:

$ dolt remote add origin timsehn/test_ignore_merge
$ dolt push
| Uploading...
To https://doltremoteapi.dolthub.com/timsehn/test_ignore_merge
 * [new branch]          main -> main

Make a change to the main branch on DoltHub:
image

Then the pull fails in the way the user reports.

$ dolt pull origin main
/ Pulling...cannot merge with uncommitted changes
$ dolt status
On branch main
nothing to commit, working tree clean

@timsehn timsehn changed the title Tables that were added to dolt_ignore are not completely ignored and interfere with normal operation dolt pull fails in the presence of ignored tables Jun 7, 2024
@timsehn timsehn added bug Something isn't working version control labels Jun 7, 2024
@nicktobey
Copy link
Contributor

I can reproduce the issue.

It also reproduces with a local remote, which is a relief, and gives an unusual status message:

nick@Nicks-MBP ignore % dolt status
On branch main
Your branch is behind 'origin/main' by 1 commit, and can be fast-forwarded.
  (use "dolt pull" to update your local branch)
	%
nick@Nicks-MBP ignore % dolt pull
- Pulling...cannot merge with uncommitted changes

Definitely seems like dolt pull doesn't care that the changes are in ignored tables. I remember there were issues like this when we first rolled out dolt_ignore, and we wrote an alternate code path for ignoring these tables when checking if the working set was clean. Most likely dolt pull isn't properly using this path.

@timsehn
Copy link
Contributor

timsehn commented Jun 10, 2024

This is fixed in the latest release.

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

No branches or pull requests

4 participants