mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 03:51:50 +01:00
Closes #2158 closes[t:2158] Backwards recovery of fcreate does fclose (just like backwards fopen)
git-svn-id: file:///svn/toku/tokudb.2037b@15692 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
a522ceda16
commit
b3df0166e4
1 changed files with 12 additions and 4 deletions
|
@ -338,11 +338,12 @@ static int toku_recover_fopen (struct logtype_fopen *l, RECOVER_ENV renv) {
|
|||
return internal_toku_recover_fopen_or_fcreate(renv, 0, 0, fixedfname, l->filenum, l->treeflags, 0, NULL);
|
||||
}
|
||||
|
||||
static int toku_recover_backward_fopen (struct logtype_fopen *l, RECOVER_ENV renv) {
|
||||
static int
|
||||
maybe_do_fclose_during_recover_backward(RECOVER_ENV renv, FILENUM filenum) {
|
||||
if (renv->bs.bs == BS_SAW_CKPT_END) {
|
||||
// close the tree
|
||||
struct file_map_tuple *tuple = NULL;
|
||||
int r = file_map_find(&renv->fmap, l->filenum, &tuple);
|
||||
int r = file_map_find(&renv->fmap, filenum, &tuple);
|
||||
if (r == 0) {
|
||||
//Must keep existing lsn.
|
||||
//The only way this should be dirty, is if its doing a file-format upgrade.
|
||||
|
@ -351,12 +352,18 @@ static int toku_recover_backward_fopen (struct logtype_fopen *l, RECOVER_ENV ren
|
|||
r = toku_close_brt_lsn(tuple->brt, 0, TRUE, tuple->brt->h->checkpoint_lsn);
|
||||
assert(r == 0);
|
||||
toku_free(fake_db); //Must free the DB after the brt is closed
|
||||
file_map_remove(&renv->fmap, l->filenum);
|
||||
file_map_remove(&renv->fmap, filenum);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int toku_recover_backward_fopen (struct logtype_fopen *l, RECOVER_ENV renv) {
|
||||
int r = maybe_do_fclose_during_recover_backward(renv, l->filenum);
|
||||
assert(r==0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// fcreate is like fopen except that the file must be created. Also creates the dir if needed.
|
||||
static int toku_recover_fcreate (struct logtype_fcreate *l, RECOVER_ENV renv) {
|
||||
char *fixedfname = fixup_fname(&l->iname);
|
||||
|
@ -365,7 +372,8 @@ static int toku_recover_fcreate (struct logtype_fcreate *l, RECOVER_ENV renv) {
|
|||
}
|
||||
|
||||
static int toku_recover_backward_fcreate (struct logtype_fcreate *UU(l), RECOVER_ENV UU(renv)) {
|
||||
// nothing
|
||||
int r = maybe_do_fclose_during_recover_backward(renv, l->filenum);
|
||||
assert(r==0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue