REFLOG is empty after backup restore
- Dominant language
- Go
- Stars
- 24.4k
- Forks
- 873
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 108
Description
With local backup and restore feature, dolt returns empty reflog (no commits, branches or tags are returned).
If you make a new commit, reflog returns, but still some entries are missing in it
I reproduced the whole issue I have in production on the small example repository:
```bash
# Creating the repository for test
> dolt init
Successfully initialized dolt data repository.
> dolt sql -q 'CREATE TABLE new_table (id int, text varchar(255))'
> dolt sql -q "INSERT INTO new_table VALUES (1, '123')"
Query OK, 1 row affected (0.00 sec)
> dolt status
On branch main
Untracked tables:
(use "dolt add " to include in what will be committed)
new table: new_table
> dolt commit -Am 'First commit'
commit puvcqu92gk6lj68rqd35dtg5e1lf7fl7 (HEAD -> main)
Author: Vladislav Nagorny
Date: Sat May 25 13:34:54 +0300 2024
First commit
> dolt tag init 61hjcko0qs6gl1b4obat3t7o096kdjbl
# Checking the content
> dolt log
commit puvcqu92gk6lj68rqd35dtg5e1lf7fl7 (HEAD -> main)
Author: Vladislav Nagorny
Date: Sat May 25 13:34:54 +0300 2024
First commit
commit 61hjcko0qs6gl1b4obat3t7o096kdjbl
Author: Vladislav Nagorny
Date: Sat May 25 13:32:24 +0300 2024
Initialize data repository
> dolt reflog
62ndsq1pug0qfmt9n8vu8s7hiubm278c (tag: init) Initialize data repository
puvcqu92gk6lj68rqd35dtg5e1lf7fl7 (HEAD -> main) First commit
61hjcko0qs6gl1b4obat3t7o096kdjbl (main) Initialize data repository
# Everything is fine here, reflog works as expected
# Creating backup
> mkdir -p backup; dolt backup add local file://$(pwd)/backup; dolt backup sync local
Uploaded 2.2 kB of 2.2 kB @ 0 B/s.
# Restoring backup and checking content
> mkdir new_dolt_instance; dolt backup restore file://$(pwd)/backup new_dolt_instance/.; cd new_dolt_instance
> dolt log
commit puvcqu92gk6lj68rqd35dtg5e1lf7fl7 (HEAD -> main)
Author: Vladislav Nagorny
Date: Sat May 25 13:34:54 +0300 2024
First commit
commit 61hjcko0qs6gl1b4obat3t7o096kdjbl
Author: Vladislav Nagorny
Date: Sat May 25 13:32:24 +0300 2024
Initialize data repository
> dolt sql -q 'SELECT * FROM new_table'
+----+------+
| id | text |
+----+------+
| 1 | 123 |
+----+------+
# Log and data is fine, checking reflog
> dolt reflog
> dolt sql -q 'SELECT * FROM DOLT_REFLOG()'
> dolt reflog --all
# Reflog is empty in all of the results
# Creating new commit in restored repository and checking reflog
> dolt sql -q "INSERT INTO new_table VALUES (2, '321')"
Query OK, 1 row affected (0.00 sec)
> dolt commit -Am 'Second commit'
commit ig8e3srb3pb6fcfknfan3d9nvbjmf8ng (HEAD -> main)
Author: Vladislav Nagorny
Date: Sat May 25 13:49:43 +0300 2024
Second commit
> dolt reflog
ig8e3srb3pb6fcfknfan3d9nvbjmf8ng (HEAD -> main) Second commit
62ndsq1pug0qfmt9n8vu8s7hiubm278c (tag: init) Initialize data repository
puvcqu92gk6lj68rqd35dtg5e1lf7fl7 (main) First commit
# Doing the same in the original repository, checking reflog
> cd ..
> dolt sql -q "INSERT INTO new_table VALUES (2, '321')"
Query OK, 1 row affected (0.00 sec)
> dolt commit -Am 'Second commit'
commit uc3ucklsnm2el5j7c9culoph9vtdjp9f (HEAD -> main)
Author: Vladislav Nagorny
Date: Sat May 25 13:50:52 +0300 2024
Second commit
> dolt reflog
uc3ucklsnm2el5j7c9culoph9vtdjp9f (HEAD -> main) Second commit
62ndsq1pug0qfmt9n8vu8s7hiubm278c (tag: init) Initialize data repository
puvcqu92gk6lj68rqd35dtg5e1lf7fl7 (main) First commit
61hjcko0qs6gl1b4obat3t7o096kdjbl (main) Initialize data repository
# Reflog has different entries
```
All of it was reproduced on this dolt version:
```bash
> dolt version
dolt version 1.39.1
```
OS: `Linux 6.9.1-zen1-1-zen`
---
Update: I found that `gc` command makes the same, but not the `gc --shallow`
Example in previous example repository:
```bash
> dolt reflog
uc3ucklsnm2el5j7c9culoph9vtdjp9f (HEAD -> main) Second commit
62ndsq1pug0qfmt9n8vu8s7hiubm278c (tag: init) Initialize data repository
puvcqu92gk6lj68rqd35dtg5e1lf7fl7 (main) First commit
61hjcko0qs6gl1b4obat3t7o096kdjbl (main) Initialize data repository
# Everything is fine, making gc
> dolt gc
> dolt reflog
# Reflog is empty, trying to "fix" it
> dolt sql -q "INSERT INTO new_table VALUES (3, '333')"
Query OK, 1 row affected (0.00 sec)
> dolt commit -Am 'Third commit'
commit tqvmhrvf85co57hmh8mh849ho0v6d651 (HEAD -> main)
Author: Vladislav Nagorny
Date: Sat May 25 14:16:13 +0300 2024
Third commit
> dolt reflog
tqvmhrvf85co57hmh8mh849ho0v6d651 (HEAD -> main) Third commit
62ndsq1pug0qfmt9n8vu8s7hiubm278c (tag: init) Initialize data repository
uc3ucklsnm2el5j7c9culoph9vtdjp9f (main) Second commit
# Some of the reflog is fixed, trying shallow gc
> dolt gc --shallow
> dolt reflog
tqvmhrvf85co57hmh8mh849ho0v6d651 (HEAD -> main) Third commit
62ndsq1pug0qfmt9n8vu8s7hiubm278c (tag: init) Initialize data repository
uc3ucklsnm2el5j7c9culoph9vtdjp9f (main) Second commit
# Nothing is changed in reflog
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.