Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27732/mal

Modified Files:
        mal_sabaoth.mx mal_session.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: mal_sabaoth.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_sabaoth.mx,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- mal_sabaoth.mx      29 Aug 2007 08:58:07 -0000      1.34
+++ mal_sabaoth.mx      31 Aug 2007 16:54:23 -0000      1.35
@@ -273,7 +273,7 @@
                /* emit a warning if we are in maintenance mode */
                rethrow("sabaoth.getMyStatus", tmp,
                                SABAOTHgetMyStatus(&stats));
-               if (stats->state == SABdbMaintenance)
+               if (stats->locked == 1)
                        fprintf(stderr, "#warning: database is running in "
                                        "maintenance mode\n");
                SABAOTHfreeStatus(&stats);
@@ -415,13 +415,13 @@
        SABdbIllegal = 0,
        SABdbRunning,
        SABdbCrashed,
-       SABdbInactive,
-       SABdbMaintenance
+       SABdbInactive
 } SABdbState;
 
 typedef struct Ssabdb {
-       str dbname;              /* database name as string */
-       /* str path; */
+       str dbname;              /* database name */
+       str path;                /* full path to database */
+       int locked;              /* whether this database is under maintenance 
*/
        SABdbState state;        /* current database state */
        sablist* scens;          /* scenarios available for this database */
        sablist* conns;          /* connections available for this database */
@@ -486,7 +486,9 @@
                sdb->next = NULL;
 
                /* store the database name */
-               sdb->dbname = strdup(e->d_name);
+               snprintf(buf, PATHLENGTH, "%s/%s", path, e->d_name);
+               sdb->path = strdup(buf);
+               sdb->dbname = sdb->path + strlen(sdb->path) - strlen(e->d_name);
 
                /* add scenarios that are supported */
                sdb->scens = NULL;
@@ -538,8 +540,6 @@
                 *   running
                 * - to distinguish between a crash and proper shutdown, consult
                 *   the uplog
-                * the existance of the maintenance file overrules any check and
-                * puts the server in maintenance mode
                 */
                snprintf(buf, PATHLENGTH, "%s/%s/%s", path, e->d_name, 
".gdk_lock");
                if (_sabaoth_internal_dbname != NULL &&
@@ -586,7 +586,9 @@
                f = fopen(buf, "r");
                if (f != NULL) {
                        fclose(f);
-                       sdb->state = SABdbMaintenance;
+                       sdb->locked = 1;
+               } else {
+                       sdb->locked = 0;
                }
        }
        (void) closedir(d);
@@ -610,7 +612,7 @@
 
        p = *ret;
        while (p != NULL) {
-               if (p->dbname != NULL) free(p->dbname);
+               if (p->path != NULL) free(p->path);
                r = p->scens;
                while (r != NULL) {
                        if (r->val != NULL)

Index: mal_session.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_session.mx,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -d -r1.142 -r1.143
--- mal_session.mx      28 Aug 2007 12:40:26 -0000      1.142
+++ mal_session.mx      31 Aug 2007 16:54:23 -0000      1.143
@@ -305,7 +305,7 @@
                        return;
                }
 
-               if (stats->state == SABdbMaintenance) {
+               if (stats->locked == 1) {
                        if (uid == 0) {
                                stream_printf(fout, "#server is running in "
                                                "maintenance mode\n");


-------------------------------------------------------------------------
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

Reply via email to