List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:April 25 2008 11:11am
Subject:bk commit into 6.0 tree (svoj:1.2635) BUG#33607
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of svoj.  When svoj does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-04-25 16:11:20+05:00, svoj@stripped +1 -0
  BUG#33607 - Falcon allows two mysqld instances to share a tablespace
  
  This is an addition to original bugfix.
  Use fcntl() instead of flock() for file locking.

  storage/falcon/IO.cpp@stripped, 2008-04-25 16:11:18+05:00, svoj@stripped +16 -4
    Use fcntl() instead of flock() for file locking.
    Throw an exception with proper error code. CONNECTION_ERROR
    is not handled properly by a caller (it re-creates files),
    whereas FILE_ACCESS_ERROR asks caller to return an error.

diff -Nrup a/storage/falcon/IO.cpp b/storage/falcon/IO.cpp
--- a/storage/falcon/IO.cpp	2008-04-23 10:22:29 +05:00
+++ b/storage/falcon/IO.cpp	2008-04-25 16:11:18 +05:00
@@ -162,13 +162,18 @@ bool IO::openFile(const char * name, boo
 	
 #ifndef _WIN32
 	signal (SIGXFSZ, SIG_IGN);
-
-	if (flock (fileId, (readOnly) ? LOCK_SH : LOCK_EX))
+#ifndef __NETWARE__
+	struct flock lock;
+	lock.l_type= readOnly ? F_RDLCK : F_WRLCK;
+	lock.l_whence= SEEK_SET;
+	lock.l_start= lock.l_len= 0;
+	if (fcntl(fileId, F_SETLK, &lock) < 0)
 		{
 		::close (fileId);
-		throw SQLEXCEPTION (CONNECTION_ERROR, "file \"%s\" in use by another process", name);
+		throw SQLEXCEPTION (FILE_ACCESS_ERROR, "file \"%s\" in use by another process", name);
 		}
 #endif
+#endif
 
 	//Log::debug("IO::openFile %s (%d) fd: %d\n", (const char*) fileName, readOnly, fileId);
 	
@@ -199,7 +204,14 @@ bool IO::createFile(const char *name, ui
 
 	isReadOnly = false;
 #ifndef _WIN32
-	flock(fileId, LOCK_EX);
+#ifndef __NETWARE__
+	struct flock lock;
+	lock.l_type= F_WRLCK;
+	lock.l_whence= SEEK_SET;
+	lock.l_start= lock.l_len= 0;
+	// We assume that no other process had a chance to lock new file.
+	fcntl(fileId, F_SETLK, &lock);
+#endif
 #endif
 
 	if (initialAllocation)
Thread
bk commit into 6.0 tree (svoj:1.2635) BUG#33607Sergey Vojtovich25 Apr
  • RE: bk commit into 6.0 tree (svoj:1.2635) BUG#33607Kevin Lewis25 Apr