Below is the list of changes that have just been committed into a local
5.0 repository of stewart. When stewart 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-10-27 18:59:20+10:00, stewart@willster.(none) +3 -0
BUG#22301 ndb: File_class::size() is not thread safe
ndb/include/logger/FileLogHandler.hpp@stripped, 2006-10-27 18:59:17+10:00,
stewart@willster.(none) +1 -1
use off_t for file offset
ndb/include/util/File.hpp@stripped, 2006-10-27 18:59:17+10:00, stewart@willster.(none) +2 -2
use off_t for returning file offset (size)
ndb/src/common/util/File.cpp@stripped, 2006-10-27 18:59:17+10:00, stewart@willster.(none) +9
-10
make File_class::size(FILE*) safe when having multiple threads writing to
the file
# 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: stewart
# Host: willster.(none)
# Root: /home/stewart/Documents/MySQL/5.0/ndb-mgm-work
--- 1.4/ndb/include/logger/FileLogHandler.hpp 2006-10-27 18:59:25 +10:00
+++ 1.5/ndb/include/logger/FileLogHandler.hpp 2006-10-27 18:59:25 +10:00
@@ -102,7 +102,7 @@
bool setMaxFiles(const BaseString &files);
int m_maxNoFiles;
- long m_maxFileSize;
+ off_t m_maxFileSize;
unsigned int m_maxLogEntries;
File_class* m_pLogFile;
};
--- 1.7/ndb/include/util/File.hpp 2006-10-27 18:59:25 +10:00
+++ 1.8/ndb/include/util/File.hpp 2006-10-27 18:59:25 +10:00
@@ -50,7 +50,7 @@
* @param f a pointer to a FILE descriptor.
* @return the size of the file.
*/
- static long size(FILE* f);
+ static off_t size(FILE* f);
/**
* Renames a file.
@@ -182,7 +182,7 @@
*
* @return the file size.
*/
- long size() const;
+ off_t size() const;
/**
* Returns the filename.
--- 1.13/ndb/src/common/util/File.cpp 2006-10-27 18:59:25 +10:00
+++ 1.14/ndb/src/common/util/File.cpp 2006-10-27 18:59:25 +10:00
@@ -45,17 +45,16 @@
return (my_stat(aFileName, &stmp, MYF(0))!=NULL);
}
-long
+off_t
File_class::size(FILE* f)
{
- long cur_pos = 0, length = 0;
-
- cur_pos = ::ftell(f);
- ::fseek(f, 0, SEEK_END);
- length = ::ftell(f);
- ::fseek(f, cur_pos, SEEK_SET); // restore original position
+ MY_STAT s;
+
+ // Note that my_fstat behaves *differently* than my_stat. ARGGGHH!
+ if(my_fstat(::fileno(f), &s, MYF(0)))
+ return 0;
- return length;
+ return s.st_size;
}
bool
@@ -168,8 +167,8 @@
{
return writeChar(buf, 0, ::strlen(buf));
}
-
-long
+
+off_t
File_class::size() const
{
return File_class::size(m_file);
| Thread |
|---|
| • bk commit into 5.0 tree (stewart:1.2276) BUG#22301 | Stewart Smith | 27 Oct |