Update of /cvsroot/monetdb/sql/src/backends/monet5/merovingian In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28726
Modified Files:
merovingian_controlrunner.c
Log Message:
now clients will directly let merovingian start arbitrary cruft, do more
extensive checks to be able to return more (useful) error messages
U merovingian_controlrunner.c
Index: merovingian_controlrunner.c
===================================================================
RCS file:
/cvsroot/monetdb/sql/src/backends/monet5/merovingian/merovingian_controlrunner.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- merovingian_controlrunner.c 18 Sep 2009 12:21:04 -0000 1.17
+++ merovingian_controlrunner.c 18 Sep 2009 14:24:24 -0000 1.18
@@ -156,7 +156,37 @@
*p++ = '\0';
if (strcmp(p, "start") == 0) {
err e;
- Mfprintf(_mero_ctlout, "starting
database '%s'\n", q);
+ if ((e = SABAOTHgetStatus(&stats, q))
!= MAL_SUCCEED) {
+ len = snprintf(buf2,
sizeof(buf2),
+ "internal
error, please review the logs\n");
+ send(msgsock, buf2, len, 0);
+ Mfprintf(_mero_ctlerr, "start:
SABAOTHgetStatus: "
+ "%s\n", e);
+ freeErr(e);
+ continue;
+ } else {
+ if (stats == NULL) {
+ Mfprintf(_mero_ctlerr,
"received start signal "
+ "for
database not under merovingian "
+
"control: %s\n", q);
+ len = snprintf(buf2,
sizeof(buf2),
+ "no
such database: %s\n", q);
+ send(msgsock, buf2,
len, 0);
+ continue;
+ }
+
+ if (stats->state ==
SABdbRunning) {
+ Mfprintf(_mero_ctlerr,
"received start signal "
+ "for
already running database: %s\n", q);
+ len = snprintf(buf2,
sizeof(buf2),
+
"database is already running: %s\n", q);
+ send(msgsock, buf2,
len, 0);
+
SABAOTHfreeStatus(&stats);
+ continue;
+ }
+
+ SABAOTHfreeStatus(&stats);
+ }
if ((e = forkMserver(q, &stats, 1)) !=
NO_ERR) {
Mfprintf(_mero_ctlerr, "failed
to fork mserver: %s\n",
getErrMsg(e));
@@ -169,6 +199,7 @@
} else {
len = snprintf(buf2,
sizeof(buf2), "OK\n");
send(msgsock, buf2, len, 0);
+ Mfprintf(_mero_ctlout, "started
database '%s'\n", q);
}
if (stats != NULL)
@@ -184,13 +215,13 @@
while (dp != NULL) {
if (strcmp(dp->dbname, q) == 0)
{
if (strcmp(p, "stop")
== 0) {
-
Mfprintf(_mero_ctlout, "stopping "
-
"database '%s'\n", q);
terminateProcess(dp);
- } else {
-
Mfprintf(_mero_ctlout, "killing "
+
Mfprintf(_mero_ctlout, "stopped "
"database '%s'\n", q);
+ } else {
kill(dp->pid,
SIGKILL);
+
Mfprintf(_mero_ctlout, "killed "
+
"database '%s'\n", q);
}
len = snprintf(buf2,
sizeof(buf2), "OK\n");
send(msgsock, buf2,
len, 0);
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins
