diff options
author | Csaba Henk <csaba@redhat.com> | 2012-05-27 03:56:24 +0530 |
---|---|---|
committer | Csaba Henk <csaba@redhat.com> | 2012-06-14 00:50:16 +0530 |
commit | 6330fdca82fccf730636f93f37384b0ab02f3ec0 (patch) | |
tree | 5a345f475bae73caa28427dc3f417a09681a7b0c /cli/src/cli-cmd-parser.c | |
parent | d082aa12f597ec56ca8dcf01d680c956627e8789 (diff) |
geo-rep: checkpointing
- gluster vol geo-rep M S conf checkpoint <LABEL|now>
sets a checkpoint with LABEL (the keyword "now" is special,
it's rendered to the label "as of <timestamp of current time>")
that's used to refer to the checkpoint in the sequel.
(Technically, gsyncd makes a note of the xtime of master's root
as of setting the checkpoint, called the "checkpoint target".)
- gluster vol geo-rep M S conf \!checkpoint
deletes the checkpoint.
- gluster vol geo-rep M S stat
if status is OK, and there is a checkpoint configured, the checkpoint
info is appended to status (either "not yet reached", or
"completed at <timestamp of completion>").
(Technically, the worker runs a thread that monitors / serializes /
verifies checkpoint status, and answers checkpoint status requests
through a UNIX socket; monitoring boils down to querying the xtime
of slave's root and comparing with the target.)
- gluster vol geo-rep M S conf log-file | xargs grep checkpoint
displays the checkpoint history. Set, delete and completion events
are logged properly.
Change-Id: I4398e0819f1504e6e496b4209e91a0e156e1a0f8
BUG: 826512
Signed-off-by: Csaba Henk <csaba@redhat.com>
Diffstat (limited to 'cli/src/cli-cmd-parser.c')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index f590a4a5acc..43a4bae00ce 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -1563,6 +1563,29 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options) } append_str[append_len - 2] = '\0'; + /* "checkpoint now" is special: we resolve that "now" */ + if (strcmp (words[cmdi + 1], "checkpoint") == 0 && + strcmp (append_str, "now") == 0) { + struct timeval tv = {0,}; + struct tm *tm = NULL; + + ret = gettimeofday (&tv, NULL); + if (ret == -1) + goto out; + tm = localtime (&tv.tv_sec); + + GF_FREE (append_str); + append_str = GF_CALLOC (1, 300, cli_mt_append_str); + if (!append_str) { + ret = -1; + goto out; + } + strcpy (append_str, "as of "); + strftime (append_str + strlen ("as of "), + 300 - strlen ("as of "), + "%Y-%m-%d %H:%M:%S", tm); + } + ret = dict_set_dynstr (dict, "op_value", append_str); } |