From 727d65dad51ed960a98fbfb1695e183cfa710d31 Mon Sep 17 00:00:00 2001 From: Alex Gorrod Date: Fri, 9 May 2014 16:26:07 +1000 Subject: Update checkpoint server reconfigure to match stat log semantics. --- src/conn/conn_ckpt.c | 72 ++++++++-------------------------------------------- 1 file changed, 11 insertions(+), 61 deletions(-) diff --git a/src/conn/conn_ckpt.c b/src/conn/conn_ckpt.c index 984f69ddb34..a466afc5a71 100644 --- a/src/conn/conn_ckpt.c +++ b/src/conn/conn_ckpt.c @@ -50,52 +50,6 @@ __ckpt_server_config(WT_SESSION_IMPL *session, const char **cfg, int *startp) return (0); } -/* - * __ckpt_server_reconfig -- - * Parse checkpoint server options, and update checkpoint server - * to reflect changes. - */ -static int -__ckpt_server_reconfig(WT_SESSION_IMPL *session, const char **cfg, int *stopp) -{ - WT_CONFIG_ITEM cval; - WT_CONNECTION_IMPL *conn; - WT_DECL_ITEM(tmp); - WT_DECL_RET; - - conn = S2C(session); - *stopp = 0; - - /* The checkpoint configuration is disabled by not setting a wait */ - WT_RET(__wt_config_gets(session, cfg, "checkpoint.wait", &cval)); - if (cval.val == 0) { - *stopp = 1; - return (0); - } - conn->ckpt_usecs = (long)cval.val * 1000000; - - /* - * If the old server had a name, free it. Worst case scenario here - * is that the checkpoint server is still running and will create - * a checkpoint with the default name while we are reconfiguring. We - * could avoid that by locking around reconfigure if we care. - */ - __wt_free(session, conn->ckpt_config); - WT_RET(__wt_config_gets(session, cfg, "checkpoint.name", &cval)); - - if (!WT_STRING_MATCH(WT_CHECKPOINT, cval.str, cval.len)) { - WT_RET(__wt_scr_alloc(session, cval.len + 20, &tmp)); - strcpy((char *)tmp->data, "name="); - strncat((char *)tmp->data, cval.str, cval.len); - ret = __wt_strndup(session, - tmp->data, strlen("name=") + cval.len, &conn->ckpt_config); - __wt_scr_free(&tmp); - WT_RET(ret); - } - - return (0); -} - /* * __ckpt_server -- * The checkpoint server thread. @@ -168,21 +122,17 @@ __ckpt_server_start(WT_CONNECTION_IMPL *conn) int __wt_checkpoint_server_create(WT_CONNECTION_IMPL *conn, const char *cfg[]) { - int start, stop; - - start = stop = 0; - /* Handle configuration. */ - if (conn->ckpt_session == NULL) { - WT_RET_NOTFOUND_OK(__ckpt_server_config( - conn->default_session, cfg, &start)); - if (start) - WT_RET(__ckpt_server_start(conn)); - } else { - WT_RET_NOTFOUND_OK(__ckpt_server_reconfig( - conn->default_session, cfg, &stop)); - if (stop) - WT_RET(__wt_checkpoint_server_destroy(conn)); - } + int start; + + start = 0; + + /* If there is already a server running, shut it down. */ + if (conn->ckpt_session != NULL) + WT_RET(__wt_checkpoint_server_destroy(conn)); + + WT_RET(__ckpt_server_config(conn->default_session, cfg, &start)); + if (start) + WT_RET(__ckpt_server_start(conn)); return (0); } -- cgit v1.2.1