Changeset: 49311d2c1129 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=49311d2c1129 Modified Files: tools/merovingian/ChangeLog.Aug2011 tools/merovingian/daemon/argvcmds.c Branch: Aug2011 Log Message:
merovingian: don't report path to mserver5 for running monetdbds Until we can figure out a way to know the binary path of the process serving the dbfarm, the value for _mero_mserver5 needs not to be at all what is used in the dbfarm, so don't report it to avoid confusion. diffs (105 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,14 @@ # ChangeLog file for sql/src/backends/monet5/merovingian # This file is updated with mchangelog +* Fri Aug 19 2011 Fabian Groffen <fab...@cwi.nl> +- The path to the mserver5 binary is no longer returned for the mserver + property with monetdbd get for a dbfarm which is currently served by + a monetdbd. Since the called monetdbd needs not to be the same as + the running monetdbd, the reported mserver5 binary may be incorrect, + and obviously lead to confusing situations. Refer to the running + monetdbd's logfile to determine the mserver5 binary location instead. + * Wed Aug 17 2011 Fabian Groffen <fab...@cwi.nl> - Added -n option to monetdbd start command, which prevents monetdbd from forking into the background. 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 @@ -153,6 +153,7 @@ command_get(confkeyval *ckv, int argc, c char buf[512]; char vbuf[512]; confkeyval *kv; + int meropid = -1; if (argc < 2 || argc > 3) { command_help(2, &argv[-1]); @@ -194,13 +195,40 @@ command_get(confkeyval *ckv, int argc, c return(1); } + if (strstr(property, "status") != NULL || + strstr(property, "mserver") != NULL) + { + /* check if there is a merovingian serving this dbfarm */ + int ret; + if ((ret = MT_lockf(".merovingian_lock", F_TLOCK, 4, 1)) == -1) { + /* locking failed, merovingian is running */ + FILE *pf; + char *pfile = getConfVal(ckv, "pidfile"); + + if (pfile != NULL && (pf = fopen(pfile, "r")) != NULL && + fgets(buf, sizeof(buf), pf) != NULL) + { + meropid = atoi(buf); + } + } else { + if (ret >= 0) + close(ret); /* release a possible lock */ + meropid = 0; + } + } + printf(" property value\n"); while ((p = strtok(property, ",")) != NULL) { property = NULL; if (strcmp(p, "dbfarm") == 0) { value = dbfarm; } else if (strcmp(p, "mserver") == 0) { - value = _mero_mserver; + if (meropid == 0) { + value = _mero_mserver; + } else { + value = "binary in use cannot be determined " + "for a running monetdbd"; + } } else if (strcmp(p, "hostname") == 0) { value = _mero_hostname; } else if (strcmp(p, "mapisock") == 0) { @@ -218,26 +246,14 @@ command_get(confkeyval *ckv, int argc, c value, kv->ival); value = buf; } else if (strcmp(p, "status") == 0) { - /* check if there is a merovingian serving this dbfarm */ - int ret; - if ((ret = MT_lockf(".merovingian_lock", F_TLOCK, 4, 1)) == -1) { - /* locking failed, merovingian is running */ - FILE *pf; - char *pfile = getConfVal(ckv, "pidfile"); - - if (pfile != NULL && (pf = fopen(pfile, "r")) != NULL && - fgets(buf, sizeof(buf), pf) != NULL) - { - int meropid = atoi(buf); - snprintf(buf, sizeof(buf), "monetdbd[%d] is serving this dbfarm", meropid); - value = buf; - } else { - value = "a monetdbd is serving this dbfarm, " - "but a pidfile was not found/is corrupt"; - } + if (meropid > 0) { + snprintf(buf, sizeof(buf), + "monetdbd[%d] is serving this dbfarm", meropid); + value = buf; + } else if (meropid < 0) { + value = "a monetdbd is serving this dbfarm, " + "but a pidfile was not found/is corrupt"; } else { - if (ret >= 0) - close(ret); /* release a possible lock */ value = "no monetdbd is serving this dbfarm"; } } else { _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list