Commit b43325e
committed
restoreDatabaseFromSite: populate metaBackup
This fixes the following problem:
```
$ glean create --db-root /tmp/g --db test/0 --finish
$ glean backup --db-root /tmp/g test/0 mock:/tmp/b
$ glean delete --db-root /tmp/g --db test/0
$ glean restore --db-root /tmp/g mock:/tmp/b/test.0
I20260107 10:30:07.484591 574661 Env.hs:65] Using schema from dir:/home/simon/.cabal/store/ghc-9.4.7/glean-0.2.0.0-l-db-b1c66a68faaa1c60cea64cb6e1de59f08ce55ddbe40247f16da611febd4a042d/share/glean/schema/source
I20260107 10:30:07.612099 574661 Restore.hs:197] Restoring from mock:/tmp/b/test.0
error: didE20260107 10:30:07.612265 574665 Backup.hs:324] test/0: restore: missing location
not find database locator mock:/tmp/b/test.0
```
`doRestore` expects to find the locator in `metaBackup`, but when we
restore a database using `glean restore`, the entry point is
`restoreDatabaseFromSite`, which gets the `Meta` from `Backup.inspect`,
which may not populate `metaBackup`. Furthermore it would be hard for
`Backup.inspect` to populate this field because it would have to
reconstruct the backup locator, which `restoreDatabaseFromSite` already
has.
So we just populate `metaBackup` in `restoreDatabaseFromSite`.1 parent 23fe3b8 commit b43325e
1 file changed
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
69 | | - | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| |||
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
| 80 | + | |
78 | 81 | | |
79 | | - | |
| 82 | + | |
80 | 83 | | |
81 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
0 commit comments