Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv32495
Modified Files:
mal_sabaoth.mx
Log Message:
Fix M5's locking problem: don't release a lock which you didn't create
yourself, or better: don't touch it at all.
Index: mal_sabaoth.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_sabaoth.mx,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- mal_sabaoth.mx 28 Aug 2007 12:38:44 -0000 1.33
+++ mal_sabaoth.mx 29 Aug 2007 08:58:07 -0000 1.34
@@ -542,8 +542,13 @@
* puts the server in maintenance mode
*/
snprintf(buf, PATHLENGTH, "%s/%s/%s", path, e->d_name,
".gdk_lock");
- fd = MT_lockf(buf, F_TLOCK, 4, 1);
- if (fd == -2) {
+ if (_sabaoth_internal_dbname != NULL &&
+ strcmp(_sabaoth_internal_dbname, e->d_name) ==
0)
+ {
+ /* if we are the mserver that is running this database,
+ * don't touch the lock! */
+ sdb->state = SABdbRunning;
+ } else if ((fd = MT_lockf(buf, F_TLOCK, 4, 1)) == -2) {
/* Locking failed; this can be because the lockfile
couldn't
* be created. Probably there is no Mserver running for
* that case also.
@@ -557,8 +562,6 @@
log[PATHLENGTH] = '\0';
/* locking succeed, check for a crash in the uplog */
- close(fd);
-
snprintf(log, PATHLENGTH, "%s/%s/%s", path, e->d_name,
UPLOGFILE);
if ((f = fopen(log, "r")) != NULL) {
(void)fseek(f, -1, SEEK_END);
@@ -575,9 +578,9 @@
/* no uplog file? assume no crash */
sdb->state = SABdbInactive;
}
- fd = MT_lockf(buf, F_ULOCK, 4, 1);
- if (fd >= 0)
- close(fd);
+
+ /* release the lock */
+ close(fd);
}
snprintf(buf, PATHLENGTH, "%s/%s/%s", path, e->d_name,
MAINTENANCEFILE);
f = fopen(buf, "r");
-------------------------------------------------------------------------
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