cockroachdb / cockroachdb/cockroach
RESTORE job description is sometimes semantically incorrect
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Describe the problem**
The two following two restores:
```
> select job_id, job_type, description, statement from [show jobs] where job_type = 'RESTORE';
job_id | job_type | description | statement
---------------------+----------+----------------------------------------------------------------------------------------------------------------------------+------------
948579866317520897 | RESTORE | RESTORE DATABASE defaultdb FROM 'nodelocal://1/restore-desc/2024/03/04-120551.27' WITH OPTIONS (new_db_name = 'restore_1') |
948580038300106753 | RESTORE | RESTORE DATABASE defaultdb FROM 'nodelocal://1/restore-desc/2024/03/04-120551.27' WITH OPTIONS (new_db_name = 'restore_2') |
```
Look very similar with the exception of the db name. But, they are actually from very different restore attempts and restored different data:
```
demo@127.0.0.1:26257/demoapp/defaultdb> select * from restore_1.foo;
pk
------
1
2
3
4
(4 rows)
Time: 2ms total (execution 1ms / network 0ms)
demo@127.0.0.1:26257/demoapp/defaultdb> select * from restore_2.foo;
pk
------
1
2
(2 rows)
```
**To Reproduce**
- Create a backup with a few incremental layers.
- Restore from the latest incremental layer
- `restore database defaultdb from latest in 'nodelocal://1/restore-desc' with new_db_name='restore_1'; `
- Take the description from that job and use it to restore again.
- Note that both have the same job description but the second job will be a restore from the first full layer, not the latest incremental layer.
Ideally, we would preserve the collection-based `IN` syntax when it was used originally.
Jira issue: CRDB-36361
Contributor guide
Assessment
This issue has not been assessed yet.