Commit 7d6f6fef authored by Yoni Fogel's avatar Yoni Fogel

Closes #2180 closes[t:2180] Recovery forces 'fcreate' in rollback log (when...

Closes #2180 closes[t:2180] Recovery forces 'fcreate' in rollback log (when replaying fcreate log entry)

git-svn-id: file:///svn/toku/tokudb@15841 c7de825b-a66e-492c-adef-691d508d4ae1
parent bb8cf498
......@@ -3051,7 +3051,7 @@ verify_builtin_comparisons_consistent(BRT t, u_int32_t flags) {
// fname_in_env is the iname, relative to the env_dir (data_dir is already in iname as prefix)
// fname is relative to the cwd (or absolute)
int toku_brt_open(BRT t, const char *fname, const char *fname_in_env, int is_create, int only_create, CACHETABLE cachetable, TOKUTXN txn, DB *db) {
int toku_brt_open_recovery(BRT t, const char *fname, const char *fname_in_env, int is_create, int only_create, CACHETABLE cachetable, TOKUTXN txn, DB *db, int recovery_force_fcreate) {
int r;
BOOL txn_created = FALSE;
......@@ -3099,7 +3099,7 @@ int toku_brt_open(BRT t, const char *fname, const char *fname_in_env, int is_cre
r=toku_cachetable_openfd_with_filenum(&t->cf,
cachetable, fd, fname_in_env, t->did_set_filenum||did_create, reserved_filenum, did_create);
if (r != 0) goto died1;
if (did_create) {
if (did_create || recovery_force_fcreate) {
if (txn) {
BYTESTRING bs = { .len=strlen(fname), .data = toku_strdup_in_rollback(txn, fname) };
r = toku_logger_save_rollback_fcreate(txn, toku_cachefile_filenum(t->cf), bs); // bs is a copy of the fname relative to the cwd
......@@ -3208,6 +3208,11 @@ int toku_brt_open(BRT t, const char *fname, const char *fname_in_env, int is_cre
return 0;
}
int
toku_brt_open(BRT t, const char *fname, const char *fname_in_env, int is_create, int only_create, CACHETABLE cachetable, TOKUTXN txn, DB *db) {
return toku_brt_open_recovery(t, fname, fname_in_env, is_create, only_create, cachetable, txn, db, FALSE);
}
int toku_brt_get_fd(BRT brt, int *fdp) {
*fdp = toku_cachefile_fd(brt->cf);
return 0;
......
......@@ -45,6 +45,7 @@ int toku_brt_set_filenum(BRT brt, FILENUM filenum);
int brt_set_cachetable(BRT, CACHETABLE);
int toku_brt_open(BRT, const char *fname, const char *fname_in_env, int is_create, int only_create, CACHETABLE ct, TOKUTXN txn, DB *db);
int toku_brt_open_recovery(BRT, const char *fname, const char *fname_in_env, int is_create, int only_create, CACHETABLE ct, TOKUTXN txn, DB *db, int recovery_force_fcreate);
int toku_brt_remove_subdb(BRT brt, const char *dbname, u_int32_t flags);
......
......@@ -318,7 +318,7 @@ static int internal_toku_recover_fopen_or_fcreate (RECOVER_ENV renv, int flags,
r = toku_brt_set_descriptor(brt, descriptor_version, &descriptor_dbt, abort_on_upgrade);
if (r!=0) goto close_brt;
}
r = toku_brt_open(brt, fixedfname, fixedfname, (flags & O_CREAT) != 0, FALSE, renv->ct, NULL, fake_db);
r = toku_brt_open_recovery(brt, fixedfname, fixedfname, (flags & O_CREAT) != 0, FALSE, renv->ct, NULL, fake_db, (flags&O_CREAT));
if (r != 0) {
close_brt:;
//Note: If brt_open fails, then close_brt will NOT write a header to disk.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment