diff options
Diffstat (limited to 'src/conn')
-rw-r--r-- | src/conn/conn_cache.c | 63 | ||||
-rw-r--r-- | src/conn/conn_ckpt.c | 46 | ||||
-rw-r--r-- | src/conn/conn_log.c | 4 | ||||
-rw-r--r-- | src/conn/conn_stat.c | 2 | ||||
-rw-r--r-- | src/conn/conn_sweep.c | 2 |
5 files changed, 61 insertions, 56 deletions
diff --git a/src/conn/conn_cache.c b/src/conn/conn_cache.c index 6788b1f7f47..1b8b3183d3c 100644 --- a/src/conn/conn_cache.c +++ b/src/conn/conn_cache.c @@ -42,47 +42,38 @@ __cache_config_local(WT_SESSION_IMPL *session, bool shared, const char *cfg[]) WT_RET(__wt_config_gets(session, cfg, "eviction_trigger", &cval)); cache->eviction_trigger = (u_int)cval.val; - if (F_ISSET(conn, WT_CONN_IN_MEMORY)) - cache->eviction_checkpoint_target = - cache->eviction_dirty_target = - cache->eviction_dirty_trigger = 100U; - else { - WT_RET(__wt_config_gets( - session, cfg, "eviction_checkpoint_target", &cval)); - cache->eviction_checkpoint_target = (u_int)cval.val; + WT_RET(__wt_config_gets( + session, cfg, "eviction_checkpoint_target", &cval)); + cache->eviction_checkpoint_target = (u_int)cval.val; - WT_RET(__wt_config_gets( - session, cfg, "eviction_dirty_target", &cval)); - cache->eviction_dirty_target = (u_int)cval.val; + WT_RET(__wt_config_gets(session, cfg, "eviction_dirty_target", &cval)); + cache->eviction_dirty_target = (u_int)cval.val; - /* - * Don't allow the dirty target to be larger than the overall - * target. - */ - if (cache->eviction_dirty_target > cache->eviction_target) - cache->eviction_dirty_target = cache->eviction_target; + /* + * Don't allow the dirty target to be larger than the overall + * target. + */ + if (cache->eviction_dirty_target > cache->eviction_target) + cache->eviction_dirty_target = cache->eviction_target; - /* - * Sanity check the checkpoint target: don't allow a value - * lower than the dirty target. - */ - if (cache->eviction_checkpoint_target > 0 && - cache->eviction_checkpoint_target < - cache->eviction_dirty_target) - cache->eviction_checkpoint_target = - cache->eviction_dirty_target; + /* + * Sanity check the checkpoint target: don't allow a value + * lower than the dirty target. + */ + if (cache->eviction_checkpoint_target > 0 && + cache->eviction_checkpoint_target < cache->eviction_dirty_target) + cache->eviction_checkpoint_target = + cache->eviction_dirty_target; - WT_RET(__wt_config_gets( - session, cfg, "eviction_dirty_trigger", &cval)); - cache->eviction_dirty_trigger = (u_int)cval.val; + WT_RET(__wt_config_gets(session, cfg, "eviction_dirty_trigger", &cval)); + cache->eviction_dirty_trigger = (u_int)cval.val; - /* - * Don't allow the dirty trigger to be larger than the overall - * trigger or we can get stuck with a cache full of dirty data. - */ - if (cache->eviction_dirty_trigger > cache->eviction_trigger) - cache->eviction_dirty_trigger = cache->eviction_trigger; - } + /* + * Don't allow the dirty trigger to be larger than the overall + * trigger or we can get stuck with a cache full of dirty data. + */ + if (cache->eviction_dirty_trigger > cache->eviction_trigger) + cache->eviction_dirty_trigger = cache->eviction_trigger; WT_RET(__wt_config_gets(session, cfg, "eviction.threads_max", &cval)); WT_ASSERT(session, cval.val > 0); diff --git a/src/conn/conn_ckpt.c b/src/conn/conn_ckpt.c index b4913043d63..faeef4e71a2 100644 --- a/src/conn/conn_ckpt.c +++ b/src/conn/conn_ckpt.c @@ -87,22 +87,36 @@ __ckpt_server(void *arg) */ __wt_cond_wait(session, conn->ckpt_cond, conn->ckpt_usecs); - /* Checkpoint the database. */ - WT_ERR(wt_session->checkpoint(wt_session, NULL)); - - /* Reset. */ - if (conn->ckpt_logsize) { - __wt_log_written_reset(session); - conn->ckpt_signalled = false; - - /* - * In case we crossed the log limit during the - * checkpoint and the condition variable was already - * signalled, do a tiny wait to clear it so we don't do - * another checkpoint immediately. - */ - __wt_cond_wait(session, conn->ckpt_cond, 1); - } + /* + * Checkpoint the database if the connection is marked dirty. + * A connection is marked dirty whenever a btree gets marked + * dirty, which reflects upon a change in the database that + * needs to be checkpointed. Said that, there can be short + * instances when a btree gets marked dirty and the connection + * is yet to be. We might skip a checkpoint in that short + * instance, which is okay because by the next time we get to + * checkpoint, the connection would have been marked dirty and + * hence the checkpoint will not be skipped this time. + */ + if (conn->modified) { + WT_ERR(wt_session->checkpoint(wt_session, NULL)); + + /* Reset. */ + if (conn->ckpt_logsize) { + __wt_log_written_reset(session); + conn->ckpt_signalled = false; + + /* + * In case we crossed the log limit during the + * checkpoint and the condition variable was + * already signalled, do a tiny wait to clear + * it so we don't do another checkpoint + * immediately. + */ + __wt_cond_wait(session, conn->ckpt_cond, 1); + } + } else + WT_STAT_CONN_INCR(session, txn_checkpoint_skipped); } if (0) { diff --git a/src/conn/conn_log.c b/src/conn/conn_log.c index 2786526c2fa..34743034877 100644 --- a/src/conn/conn_log.c +++ b/src/conn/conn_log.c @@ -839,10 +839,10 @@ __log_server(void *arg) /* Wait until the next event. */ - WT_ERR(__wt_epoch(session, &start)); + __wt_epoch(session, &start); __wt_cond_auto_wait_signal(session, conn->log_cond, did_work, &signalled); - WT_ERR(__wt_epoch(session, &now)); + __wt_epoch(session, &now); timediff = WT_TIMEDIFF_MS(now, start); } diff --git a/src/conn/conn_stat.c b/src/conn/conn_stat.c index 66979dfd023..d5a31c671c0 100644 --- a/src/conn/conn_stat.c +++ b/src/conn/conn_stat.c @@ -415,7 +415,7 @@ __statlog_log_one(WT_SESSION_IMPL *session, WT_ITEM *path, WT_ITEM *tmp) conn = S2C(session); /* Get the current local time of day. */ - WT_RET(__wt_epoch(session, &ts)); + __wt_epoch(session, &ts); tm = localtime_r(&ts.tv_sec, &_tm); /* Create the logging path name for this time of day. */ diff --git a/src/conn/conn_sweep.c b/src/conn/conn_sweep.c index 03593f8951a..dba37fa2eb0 100644 --- a/src/conn/conn_sweep.c +++ b/src/conn/conn_sweep.c @@ -271,7 +271,7 @@ __sweep_server(void *arg) /* Wait until the next event. */ __wt_cond_wait(session, conn->sweep_cond, conn->sweep_interval * WT_MILLION); - WT_ERR(__wt_seconds(session, &now)); + __wt_seconds(session, &now); WT_STAT_CONN_INCR(session, dh_sweeps); |