Merge all the changes from tokudb.2370. We hope to deprecate 2370.

{{{
svn merge -r17811:18633 https://svn.tokutek.com/tokudb/toku/tokudb.2370
}}}
Refs #2370. [t:2370]


git-svn-id: file:///svn/toku/tokudb@18637 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
Bradley C. Kuszmaul 2013-04-16 23:59:03 -04:00 committed by Yoni Fogel
parent 416e8c43db
commit b4d376d908
4 changed files with 23 additions and 1 deletions

View file

@ -213,6 +213,8 @@ int toku_brt_zombie_needed (BRT brt);
int toku_brt_get_fragmentation(BRT brt, TOKU_DB_FRAGMENTATION report); int toku_brt_get_fragmentation(BRT brt, TOKU_DB_FRAGMENTATION report);
double get_tdiff(void) __attribute__((__visibility__("default")));
//TODO: #1485 once we have multiple main threads, restore this code, analyze performance. //TODO: #1485 once we have multiple main threads, restore this code, analyze performance.
#ifndef TOKU_MULTIPLE_MAIN_THREADS #ifndef TOKU_MULTIPLE_MAIN_THREADS
#define TOKU_MULTIPLE_MAIN_THREADS 0 #define TOKU_MULTIPLE_MAIN_THREADS 0

View file

@ -582,6 +582,20 @@ void toku_logger_trim_log_files (TOKULOGGER logger, BOOL trim_log_files)
logger->trim_log_files = trim_log_files; logger->trim_log_files = trim_log_files;
} }
double get_tdiff(void) {
static struct timeval prev={0,0};
if (prev.tv_sec==0) {
gettimeofday(&prev, 0);
return 0.0;
} else {
struct timeval now;
gettimeofday(&now, 0);
double diff = now.tv_sec - prev.tv_sec + 1e-6*(now.tv_usec - prev.tv_usec);
prev = now;
return diff;
}
}
int toku_logger_maybe_fsync (TOKULOGGER logger, LSN lsn, int do_fsync) int toku_logger_maybe_fsync (TOKULOGGER logger, LSN lsn, int do_fsync)
// Effect: If fsync is nonzero, then make sure that the log is flushed and synced at least up to lsn. // Effect: If fsync is nonzero, then make sure that the log is flushed and synced at least up to lsn.
// Entry: Holds input lock. The log entry has already been written to the input buffer. // Entry: Holds input lock. The log entry has already been written to the input buffer.

View file

@ -65,6 +65,9 @@
toku_set_assert_on_write_enospc; toku_set_assert_on_write_enospc;
test_db_redirect_dictionary; test_db_redirect_dictionary;
get_tdiff;
local: *; local: *;
}; };

View file

@ -83,8 +83,11 @@ get_fsync_count (void) {
static int static int
do_fsync (int fd) { do_fsync (int fd) {
//fprintf(stderr, "%8.6fs Thread %ld start fsyncing\n", get_tdiff(), pthread_self());
inc_fsync_count(); inc_fsync_count();
return fsync(fd); int r = fsync(fd);
//fprintf(stderr, "%8.6fs Thread %ld done fsyncing\n", get_tdiff(), pthread_self());
return r;
} }
static const char *progname; static const char *progname;