Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ft/cachetable/cachetable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@ int toku_cachefile_of_filenum (CACHETABLE ct, FILENUM filenum, CACHEFILE *cf) {
return ct->cf_list.cachefile_of_filenum(filenum, cf);
}

// Check a cachefile is in checkpoint or NOT
bool toku_cachefile_forcheckpoint(CACHEFILE cf) {
return cf->for_checkpoint;
}

// TEST-ONLY function
// If something goes wrong, close the fd. After this, the caller shouldn't close the fd, but instead should close the cachefile.
int toku_cachetable_openfd (CACHEFILE *cfptr, CACHETABLE ct, int fd, const char *fname_in_env) {
Expand Down
3 changes: 3 additions & 0 deletions ft/cachetable/cachetable.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ int toku_cachefile_of_filenum (CACHETABLE t, FILENUM filenum, CACHEFILE *cf);
// During a transaction, we cannot reuse an iname.
int toku_cachefile_of_iname_in_env (CACHETABLE ct, const char *iname_in_env, CACHEFILE *cf);

// Check a cachefile is in checkpoint or NOT
bool toku_cachefile_forcheckpoint(CACHEFILE cf);

// Get the iname (within the cwd) associated with the cachefile
// Return the filename
char *toku_cachefile_fname_in_cwd (CACHEFILE cf);
Expand Down
4 changes: 3 additions & 1 deletion ft/ft.cc
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ static void ft_close(CACHEFILE cachefile, int fd, void *header_v, bool oplsn_val
}
if (ft->h->dirty) { // this is the only place this bit is tested (in currentheader)
bool do_checkpoint = true;
if (logger && logger->rollback_cachefile == cachefile) {
bool for_checkpoint = toku_cachefile_forcheckpoint(cachefile);
// It would be better for FT to update header only in checkpoint, so all FT files keep consistency before next checkpoint.
if ((!for_checkpoint) || (logger && logger->rollback_cachefile == cachefile)) {
do_checkpoint = false;
}
if (do_checkpoint) {
Expand Down