Commit 0f347178 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

get db truncate working

git-svn-id: file:///svn/tokudb.1131b+1080a@6191 c7de825b-a66e-492c-adef-691d508d4ae1
parent 3cb84520
......@@ -2344,10 +2344,10 @@ int toku_brt_reopen(BRT brt, const char *fname, const char *fname_in_env, TOKUTX
// set the cachefile
r = toku_cachefile_set_fd(brt->cf, fd, fname_in_env);
assert(r == 0);
brt->h = 0; // set_fd should close the header
toku_logger_log_fopen(txn, fname_in_env, toku_cachefile_filenum(brt->cf));
// init the tree header
assert(brt->h == 0);
r = toku_read_brt_header_and_store_in_cachefile(brt->cf, &brt->h);
if (r == -1) {
r = brt_alloc_init_header(brt, NULL, txn);
......
......@@ -260,6 +260,12 @@ int toku_cachefile_set_fd (CACHEFILE cf, int fd, const char *fname) {
if (r != 0) {
r=errno; close(fd); return r;
}
if (cf->close_userdata && (r = cf->close_userdata(cf, cf->userdata))) {
return r;
}
cf->close_userdata = NULL;
cf->userdata = NULL;
close(cf->fd);
cf->fd = -1;
if (cf->fname) {
......
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