From: Date: September 1 2006 9:32am Subject: bk commit into 4.1 tree (dli:1.2533) BUG#21345 List-Archive: http://lists.mysql.com/commits/11227 X-Bug: 21345 Message-Id: <200609010732.k817WixS007663@dev3-76.dev.cn.tlan> Below is the list of changes that have just been committed into a local 4.1 repository of dli. When dli 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, 2006-09-01 15:32:40+08:00, dli@stripped +3 -0 Fix for BUG#21345, Error in cluster logfile rotation. Fixed the cluster logfile rotation code, let the cluster logfile be renamed correctly when the main logfile exceeds the configured maximum size. ndb/include/util/File.hpp@stripped, 2006-09-01 15:32:38+08:00, dli@stripped +8 -0 Fix for BUG#21345, Error in cluster logfile rotation. ndb/src/common/logger/FileLogHandler.cpp@stripped, 2006-09-01 15:32:38+08:00, dli@stripped +10 -1 Fix for BUG#21345, Error in cluster logfile rotation. ndb/src/common/util/File.cpp@stripped, 2006-09-01 15:32:38+08:00, dli@stripped +12 -0 Fix for BUG#21345, Error in cluster logfile rotation. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: dli # Host: dev3-76.dev.cn.tlan # Root: /home/dli/mysql/mysql-4.1/mysql-4.1-bug-21345 --- 1.4/ndb/include/util/File.hpp 2006-09-01 15:32:45 +08:00 +++ 1.5/ndb/include/util/File.hpp 2006-09-01 15:32:45 +08:00 @@ -29,6 +29,14 @@ { public: /** + * Returns time for last contents modification of a file. + * + * @param aFileName a filename to check. + * @return the time for last contents modificaton of the file. + */ + static time_t mtime(const char* aFileName); + + /** * Returns true if the file exist. * * @param aFileName a filename to check. --- 1.10/ndb/src/common/logger/FileLogHandler.cpp 2006-09-01 15:32:45 +08:00 +++ 1.11/ndb/src/common/logger/FileLogHandler.cpp 2006-09-01 15:32:45 +08:00 @@ -147,6 +147,7 @@ bool rc = true; int fileNo = 1; char newName[PATH_MAX]; + time_t newMtime, preMtime = 0; do { @@ -159,7 +160,15 @@ } BaseString::snprintf(newName, sizeof(newName), "%s.%d", m_pLogFile->getName(), fileNo++); - + newMtime = File_class::mtime(newName); + if (newMtime < preMtime) + { + break; + } + else + { + preMtime = newMtime; + } } while (File_class::exists(newName)); m_pLogFile->close(); --- 1.9/ndb/src/common/util/File.cpp 2006-09-01 15:32:45 +08:00 +++ 1.10/ndb/src/common/util/File.cpp 2006-09-01 15:32:45 +08:00 @@ -24,6 +24,18 @@ // // PUBLIC // +time_t +File_class::mtime(const char* aFileName) +{ + MY_STAT stmp; + time_t rc = 0; + + if (my_stat(aFileName, &stmp, MYF(0)) != NULL) { + rc = stmp.st_mtime; + } + + return rc; +} bool File_class::exists(const char* aFileName)