Update of /cvsroot/monetdb/MonetDB5/src/tools
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27732/tools
Modified Files:
merovingian.mx monetdb.mx
Log Message:
Setting the maintenance mode as status was a bad idea, merovingian and
monetdb need to be able to know whether the mserver is running or not,
in the end.
Index: merovingian.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/tools/merovingian.mx,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- merovingian.mx 31 Aug 2007 14:45:25 -0000 1.34
+++ merovingian.mx 31 Aug 2007 16:54:23 -0000 1.35
@@ -240,10 +240,6 @@
fflush(stdout);
SABAOTHfreeStatus(&stats);
return;
- case SABdbMaintenance:
- fprintf(stderr, "database '%s' remains under
maintenance, not attempting to shut down\n", d->dbname);
- SABAOTHfreeStatus(&stats);
- return;
default:
fprintf(stderr, "unknown state: %d", (int)stats->state);
SABAOTHfreeStatus(&stats);
@@ -282,11 +278,6 @@
fflush(stdout);
SABAOTHfreeStatus(&stats);
return;
- case SABdbMaintenance:
- fprintf(stderr, "database '%s' is under
maintenance, "
- "we shouldn't have
killed it!\n", d->dbname);
- SABAOTHfreeStatus(&stats);
- return;
default:
fprintf(stderr, "unknown state: %d",
(int)stats->state);
break;
@@ -396,6 +387,11 @@
return(e);
}
+ if ((*stats)->locked == 1) {
+ merlog("database '%s' is under maintenance", database);
+ return(NO_ERR);
+ }
+
switch ((*stats)->state) {
case SABdbRunning:
t = localtime(&info.laststart);
@@ -430,10 +426,6 @@
info.crashavg1, info.crashavg10,
info.crashavg30,
info.startcntr, info.stopcntr,
info.crashcntr);
break;
- case SABdbMaintenance:
- merlog("database '%s' is under maintenance", database);
- return(NO_ERR);
- break;
default:
SABAOTHfreeStatus(stats);
*stats = NULL;
@@ -539,14 +531,14 @@
return(newErr(
"database '%s'
appears to cleanly shut down "
"itself after
starting", database));
- case SABdbMaintenance:
- return(newErr(
- "database '%s'
has been put into maintenance "
- "mode during
startup", database));
default:
return(newErr("unknown state: %d",
(int)(*stats)->state));
}
}
+ if ((*stats)->locked == 1) {
+ merlog("database '%s' has been put into maintenance "
+ "mode during startup", database);
+ }
return(NO_ERR);
}
Index: monetdb.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/tools/monetdb.mx,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- monetdb.mx 31 Aug 2007 15:51:02 -0000 1.17
+++ monetdb.mx 31 Aug 2007 16:54:23 -0000 1.18
@@ -192,13 +192,13 @@
case SABdbInactive:
state = "stopped";
break;
- case SABdbMaintenance:
- state = "mainten";
- break;
default:
state = "unknown";
break;
}
+ /* override if locked for brevity */
+ if (stats->locked == 1)
+ state = "mainten";
secondsToString(avg, uplog.avguptime, 0);
@@ -234,18 +234,16 @@
case SABdbInactive:
state = "stopped";
break;
- case SABdbMaintenance:
- state = "maintenance";
- break;
default:
state = "unknown";
break;
}
printf("%s:\n", stats->dbname);
- printf(" location: %s/%s\n", dbfarm, stats->dbname);
+ printf(" location: %s\n", stats->path);
printf(" database name: %s\n", stats->dbname);
printf(" state: %s\n", state);
+ printf(" under maintenance: %s\n", stats->locked == 1 ? "yes"
: "no");
entry = stats->scens;
printf(" available scenarios:");
if (entry == NULL) {
@@ -319,13 +317,12 @@
case SABdbInactive:
snprintf(buf, 64, "not running");
break;
- case SABdbMaintenance:
- snprintf(buf, 64, "under maintenance");
- break;
default:
snprintf(buf, 64, "unknown");
break;
}
+ if (stats->locked == 1)
+ strcat(buf, ", under maintenance");
printf("database %s, %s\n", stats->dbname, buf);
printf(" crash average: %d.00 %.2f %.2f (over 1, 15, 30
starts) "
"in total %d crashes\n",
@@ -616,20 +613,17 @@
char path[8096];
err e;
- switch (stats->state) {
- case SABdbRunning:
- fprintf(stderr, "destroy: database %s
is still running, "
- "stop database
first\n", dbname);
- SABAOTHfreeStatus(&stats);
- exit(1);
- case SABdbMaintenance:
- fprintf(stderr, "destroy: database %s
is under maintenance"
- ", release database
first\n", dbname);
- SABAOTHfreeStatus(&stats);
- exit(1);
- default:
- /* make compiler happy */
- break;
+ if (stats->state == SABdbRunning) {
+ fprintf(stderr, "destroy: database %s is still
running, "
+ "stop database first\n",
dbname);
+ SABAOTHfreeStatus(&stats);
+ exit(1);
+ }
+ if (stats->locked == 1) {
+ fprintf(stderr, "destroy: database %s is under
maintenance"
+ ", release database first\n",
dbname);
+ SABAOTHfreeStatus(&stats);
+ exit(1);
}
SABAOTHfreeStatus(&stats);
@@ -687,7 +681,7 @@
if (stats != NULL) {
char path[8096];
- if (stats->state == SABdbMaintenance) {
+ if (stats->locked == 1) {
fprintf(stderr, "lock: database %s already is "
"under maintenance\n", dbname);
SABAOTHfreeStatus(&stats);
@@ -729,7 +723,7 @@
if (stats != NULL) {
char path[8096];
- if (stats->state != SABdbMaintenance) {
+ if (stats->locked != 1) {
fprintf(stderr, "release: database %s is not "
"under maintenance\n", dbname);
SABAOTHfreeStatus(&stats);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins