Skip to content

Commit

Permalink
disk: migration comment update
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-levan committed Feb 7, 2024
1 parent 6f5b5f3 commit 1294a60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
22 changes: 6 additions & 16 deletions pkg/vere/disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1409,22 +1409,12 @@ static c3_o
_disk_migrate(u3_disk* log_u, c3_d eve_d)
{
/* migration steps:
* 0. detect whether we need to migrate or not
* a. if it's a fresh boot via u3_Host.ops_u.nuu -> skip migration
* b. if log/data.mdb is readable and is not v3 -> execute migration
* if not -> skip migration (returns yes)
* 1. set log/data.mdb to version 2 (migration in progress)
* 2. initialize epoch 0i0
* a. creates epoch directory
* b. creates epoch version file
* c. creates binary version file
* d. creates hard links to data.mdb and lock.mdb in 0i0/
* e. deletes backup snapshot
* 3. create hard links to data.mdb and lock.mdb in 0i0/
* 4. use scratch space to initialize new log/data.db in log/tmp
* 5. save old metadata to new db in scratch space
* 6. clobber old log/data.mdb with new log/tmp/data.mdb
* 7. open epoch lmdb and set it in log_u
* 1. initialize epoch 0i0 (see u3_disk_epoc_zero)
* 2. create hard links to data.mdb and lock.mdb in 0i0/
* 3. use scratch space to initialize new log/data.db in log/tmp
* 4. save old metadata to new db in scratch space
* 5. clobber old log/data.mdb with new log/tmp/data.mdb
* 6. open epoch lmdb and set it in log_u
*/

// NB: requires that log_u->mdb_u is initialized to log/data.mdb
Expand Down
2 changes: 1 addition & 1 deletion pkg/vere/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2222,7 +2222,7 @@ _cw_play_impl(c3_d eve_d, c3_d sap_d, c3_o mel_o, c3_o sof_o, c3_o ful_o)
//
if ( u3_Host.eve_d < log_u->epo_d ) {
fprintf(stderr, "mars: pier corrupt: "
"snapshot (%" PRIu64 ") out of epoc (%" PRIu64 "\r\n",
"snapshot (%" PRIu64 ") out of epoc (%" PRIu64 ")\r\n",
u3_Host.eve_d, log_u->epo_d);
exit(1);
}
Expand Down

0 comments on commit 1294a60

Please sign in to comment.