OK to push
>-----Original Message-----
>From: Christopher Powers [mailto:cpowers@stripped]
>Sent: Friday, August 29, 2008 3:41 PM
>To: commits@stripped
>Subject: bzr commit into mysql-6.0-falcon branch (cpowers:2807) Bug#39098
>
>#At file:///home/cpowers/work/dev/dev-06/mysql/
>
> 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
>
>per-file messages:
> storage/falcon/Configuration.cpp
> Verify directory path using IO class rather than ScanDir
> storage/falcon/IO.cpp
> Added IO::isDirectory()
> storage/falcon/IOx.h
> Added IO:isDirectory()
> storage/falcon/ha_falcon.cpp
> Fixed compiler warning in StorageInterface::getDemographics()
>=== 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);
>
>
>--
>MySQL Code Commits Mailing List
>For list archives: http://lists.mysql.com/commits
>To unsubscribe: http://lists.mysql.com/commits?unsub=1