List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:August 29 2008 10:42pm
Subject:bzr push into mysql-6.0-falcon branch (cpowers:2806 to 2807) Bug#39098
View as plain text  
 2807 Christopher Powers	2008-08-29 [merge]
      Bug #39098, Falcon sometimes reports 'Invalid serial log directory path'
      
      Incorporated patch provided by Lars-Erik, which works on OpenSuSE but fails on
Windows
      Fixed Windows code in IO::isDirectory()
modified:
  storage/falcon/Configuration.cpp
  storage/falcon/IO.cpp
  storage/falcon/IOx.h
  storage/falcon/ha_falcon.cpp

 2806 Vladislav Vaintroub	2008-08-29
      Fix build error - generic-msvc.h does not compile in C++.
      The error occurs only when using Visual Studio 2005 
      together with Windows SDK 6.0 and 6.1. The cause of the 
      error is the  conflicting definition for some atomic 
      intrinsics in winnt.h and  intrin.h, as reported on
     
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=262047
      
      The fix is not to include <intrin.h> for VS2005
      but declare intinsics the same way as we do for 
      VS2003.
modified:
  include/atomic/generic-msvc.h

=== modified file 'storage/falcon/Configuration.cpp'
--- a/storage/falcon/Configuration.cpp	2008-08-19 14:27:42 +0000
+++ b/storage/falcon/Configuration.cpp	2008-08-29 20:41:13 +0000
@@ -146,10 +146,7 @@ Configuration::Configuration(const char 
 	
 		// Verify that the directory exists
 		
-		ScanDir scanDir(serialLogDir, "*.*");
-		scanDir.next();
-		
-		if (!scanDir.isDirectory())
+		if (!io.isDirectory(serialLogDir.getString()))
 			{
 			fprintf(stderr, 
 					"Falcon: The specified serial log directory, \"%s\", "

=== modified file 'storage/falcon/IO.cpp'
--- a/storage/falcon/IO.cpp	2008-08-18 20:17:15 +0000
+++ b/storage/falcon/IO.cpp	2008-08-29 20:41:13 +0000
@@ -456,12 +456,10 @@ void IO::expandFileName(const char *file
 	const char *path;
 	JString fname = getPath(fileName);
 	fileName = fname.getString();
-
 #ifdef _WIN32
 	char *base;
-	
+
 	GetFullPathName(fileName, sizeof (expandedName), expandedName, &base);
-	
 	path = expandedName;
 #else
 	const char *base;
@@ -510,6 +508,43 @@ bool IO::doesFileExist(const char *fileN
 	return fileStat(fileName, &stats, &errnum) == 0;
 }
 
+bool IO::isDirectory(const char *path)
+{
+	struct stat buf;
+	char tmpPath[PATH_MAX+1];
+
+#ifdef _WIN32	
+	strncpy(tmpPath, path, MIN(PATH_MAX, (int)strlen(path)+1));
+	tmpPath[PATH_MAX] = '\0';
+	char *last = tmpPath + strlen(tmpPath) - 1;
+	
+	// Win32 stat() fails for paths with a terminating backslash
+	// If this is a non-empty string, then zap the trailing backslash
+	
+	if (last > tmpPath)
+		{
+		if (*last == '\\')
+			*last = '\0';
+		
+		if (!stat(tmpPath, &buf))
+			return ((buf.st_mode & S_IFDIR) != 0);
+		}
+		
+	return false;
+#else
+	const char *resolvedPath;
+	resolvedPath = realpath (path, tmpPath);
+
+	if (!resolvedPath)
+		return false;
+
+	if (stat(resolvedPath, &buf))
+		return false;
+		
+	return S_ISDIR (buf.st_mode);
+#endif
+}
+
 int IO::fileStat(const char *fileName, struct stat *fileStats, int *errnum)
 {
 	struct stat stats;

=== modified file 'storage/falcon/IOx.h'
--- a/storage/falcon/IOx.h	2008-08-14 11:24:18 +0000
+++ b/storage/falcon/IOx.h	2008-08-29 20:41:13 +0000
@@ -55,6 +55,7 @@ public:
 	int		read(int length, UCHAR *buffer);
 	void	write(uint32 length, const UCHAR *data);
 	static bool	doesFileExist(const char *fileName);
+	static bool isDirectory(const char *path);
 	static int	fileStat(const char *fileName, struct stat *stats = NULL, int *errnum =
NULL);
 	void	declareFatalError();
 	void	seek (int pageNumber);

=== modified file 'storage/falcon/ha_falcon.cpp'
--- a/storage/falcon/ha_falcon.cpp	2008-08-27 12:55:46 +0000
+++ b/storage/falcon/ha_falcon.cpp	2008-08-29 20:41:13 +0000
@@ -692,7 +692,7 @@ void StorageInterface::getDemographics(v
 			{
 			ha_rows rows = 1 << indexDesc->numberSegments;
 
-			for (uint segment = 0; segment < indexDesc->numberSegments
/*key->key_parts*/; ++segment, rows >>= 1)
+			for (uint segment = 0; segment < (uint)indexDesc->numberSegments
/*key->key_parts*/; ++segment, rows >>= 1)
 				{
 				ha_rows recordsPerSegment = (ha_rows)indexDesc->segmentRecordCounts[segment];
 				key->rec_per_key[segment] = (ulong) MAX(recordsPerSegment, rows);

Thread
bzr push into mysql-6.0-falcon branch (cpowers:2806 to 2807) Bug#39098Christopher Powers29 Aug