Changeset: 21680277ea02 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=21680277ea02 Modified Files: tools/merovingian/daemon/argvcmds.c tools/merovingian/daemon/controlrunner.c Branch: default Log Message:
Merged from Aug2011 (fix conflicts) diffs (80 lines): diff --git a/tools/merovingian/ChangeLog.Aug2011 b/tools/merovingian/ChangeLog.Aug2011 --- a/tools/merovingian/ChangeLog.Aug2011 +++ b/tools/merovingian/ChangeLog.Aug2011 @@ -1,6 +1,9 @@ # ChangeLog file for sql/src/backends/monet5/merovingian # This file is updated with mchangelog +* Fri Oct 7 2011 Fabian Groffen <[email protected]> +- monetdbd get status now also reports the version of the running monetdbd + * Thu Oct 6 2011 Fabian Groffen <[email protected]> - Improved response time of 'monetdb start' when the database fails to start. diff --git a/tools/merovingian/daemon/argvcmds.c b/tools/merovingian/daemon/argvcmds.c --- a/tools/merovingian/daemon/argvcmds.c +++ b/tools/merovingian/daemon/argvcmds.c @@ -30,6 +30,7 @@ #include <mcrypt.h> /* mcrypt_BackendSum */ #include <utils/utils.h> #include <utils/properties.h> +#include <utils/control.h> #include "merovingian.h" #include "argvcmds.h" @@ -242,8 +243,33 @@ command_get(confkeyval *ckv, int argc, c value = buf; } else if (strcmp(p, "status") == 0) { if (meropid > 0) { + char *res; + + /* try to retrieve running merovingian version */ + kv = findConfKey(ckv, "sockdir"); + value = kv->val; + kv = findConfKey(ckv, "controlport"); + if (kv == NULL) + kv = findConfKey(ckv, "port"); /* forward compat */ + snprintf(buf, sizeof(buf), "%s/" CONTROL_SOCK "%d", + value, kv->ival); + value = control_send(&res, buf, -1, "", "version", 0, NULL); + if (value != NULL) { + free(value); + value = NULL; + } else { + if (strncmp(res, "OK\n", 3) != 0) { + free(res); + } else { + value = res + 3; + } + } + snprintf(buf, sizeof(buf), - "monetdbd[%d] is serving this dbfarm", meropid); + "monetdbd[%d] %s is serving this dbfarm", + meropid, value == NULL ? "(unknown version)" : value); + if (value != NULL) + free(res); value = buf; } else if (meropid < 0) { value = "a monetdbd is serving this dbfarm, " diff --git a/tools/merovingian/daemon/controlrunner.c b/tools/merovingian/daemon/controlrunner.c --- a/tools/merovingian/daemon/controlrunner.c +++ b/tools/merovingian/daemon/controlrunner.c @@ -502,8 +502,15 @@ static void ctl_handle_client(int msgsoc len = snprintf(buf2, sizeof(buf2), "OK\n"); send(msgsock, buf2, len, 0); - /* comands below this point are multi line and hence you can't - * combine them, so they disconnect the client afterwards */ + /* comands below this point are multi line and hence you can't + * combine them, so they disconnect the client afterwards */ + } else if (strcmp(p, "version") == 0) { + len = snprintf(buf2, sizeof(buf2), "OK\n"); + send(msgsock, buf2, len, 0); + len = snprintf(buf2, sizeof(buf2), "%s (%s)\n", + MERO_VERSION, MONETDB_RELEASE); + send(msgsock, buf2, len, 0); + break; } else if (strcmp(p, "get") == 0) { confkeyval *props = getDefaultProps(); char *pbuf; _______________________________________________ Checkin-list mailing list [email protected] http://mail.monetdb.org/mailman/listinfo/checkin-list
