Below is the list of changes that have just been committed into a local
6.0 repository of . When 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, 2007-10-29 11:40:05-04:00, jas@rowvwade. +3 -0
Initial crack at conditionalizing serial log i/o to use
positional I/O and, optionally, direct i/o.
storage/falcon/Cache.cpp@stripped, 2007-10-29 11:39:58-04:00, jas@rowvwade. +6 -2
Bound the number of buffers Cache::continueWrite must
consider.
storage/falcon/IO.cpp@stripped, 2007-10-29 11:39:58-04:00, jas@rowvwade. +8 -36
Simplify conditionalization in IO.cpp to make it easier to
experiment with direct i/o.
storage/falcon/SerialLogFile.cpp@stripped, 2007-10-29 11:39:58-04:00, jas@rowvwade. +37 -16
Initial crack at conditionalizing serial log i/o to use
positional I/O and, optionally, direct i/o.
diff -Nrup a/storage/falcon/Cache.cpp b/storage/falcon/Cache.cpp
--- a/storage/falcon/Cache.cpp 2007-10-27 14:36:56 -04:00
+++ b/storage/falcon/Cache.cpp 2007-10-29 11:39:58 -04:00
@@ -38,7 +38,6 @@
#include "DatabaseCopy.h"
#include "Database.h"
#include "Bitmap.h"
-#include ".\cache.h"
extern uint falcon_io_threads;
@@ -1000,10 +999,13 @@ bool Cache::continueWrite(Bdb* startingB
int clean = 1;
int dirty = 0;
- for (int32 pageNumber = startingBdb->pageNumber + 1;; ++pageNumber)
+ for (int32 pageNumber = startingBdb->pageNumber + 1, end = pageNumber+ 5; pageNumber < end; ++pageNumber)
{
Bdb *bdb = findBdb(dbb, pageNumber);
+ if (dirty > clean)
+ return true;
+
if (!bdb)
return dirty >= clean;
@@ -1012,6 +1014,8 @@ bool Cache::continueWrite(Bdb* startingB
else
++clean;
}
+
+ return (dirty >= clean);
}
void Cache::shutdown(void)
diff -Nrup a/storage/falcon/IO.cpp b/storage/falcon/IO.cpp
--- a/storage/falcon/IO.cpp 2007-10-23 16:50:14 -04:00
+++ b/storage/falcon/IO.cpp 2007-10-29 11:39:58 -04:00
@@ -32,10 +32,9 @@
#define LSEEK _lseeki64
#define SEEK_OFFSET int64
#define MKDIR(dir) mkdir(dir)
-#define O_SYNC 0
+#define WRITE_MODE 0
#else
#include <sys/types.h>
-#include <aio.h>
#include <unistd.h>
#include <signal.h>
@@ -43,6 +42,10 @@
#include "config.h"
#endif
+#ifndef WRITE_MODE
+#define WRITE_MODE O_DIRECT
+#endif
+
#ifdef TARGET_OS_LINUX
#include <linux/unistd.h>
#else
@@ -54,7 +57,7 @@
#include <sys/file.h>
#define O_BINARY 0
#define O_RANDOM 0
-#define MKDIR(dir) mkdir (dir, S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IXUSR | S_IXGRP)
+#define MKDIR(dir) mkdir(dir, S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IXUSR | S_IXGRP)
#endif
#ifndef LSEEK
@@ -117,7 +120,7 @@ IO::~IO()
bool IO::openFile(const char * name, bool readOnly)
{
fileName = name;
- fileId = ::open (fileName, (readOnly) ? O_RDONLY | O_BINARY : O_SYNC | O_RDWR | O_BINARY);
+ fileId = ::open (fileName, (readOnly) ? O_RDONLY | O_BINARY : WRITE_MODE | O_RDWR | O_BINARY);
if (fileId < 0)
throw SQLEXCEPTION (CONNECTION_ERROR, "can't open file \"%s\": %s (%d)",
@@ -146,7 +149,7 @@ bool IO::createFile(const char *name, ui
fileName = name;
fileId = ::open (fileName,
- O_SYNC | O_CREAT | O_RDWR | O_RANDOM | O_TRUNC | O_BINARY,
+ WRITE_MODE | O_CREAT | O_RDWR | O_RANDOM | O_TRUNC | O_BINARY,
S_IREAD | S_IWRITE | S_IRGRP | S_IWGRP);
if (fileId < 0)
@@ -503,38 +506,7 @@ void IO::sync(void)
}
#else
-#ifdef _POSIX_SYNCHRONIZED_IO_XXX
- aiocb ocb;
- bzero(&ocb, sizeof(ocb));
- ocb.aio_fildes = fileId;
- ocb.aio_sigevent.sigev_notify = SIGEV_NONE;
- int ret = aio_fsync(O_DSYNC, &ocb);
-
- if (ret == -1)
- {
- declareFatalError();
- FATAL ("aio_fsync error on \"%s\": %s (%d)",
- (const char*) fileName, strerror (errno), errno);
- }
-
- int iterations = 0;
-
- while ( (ret = aio_error(&ocb)) == EINPROGRESS)
- ++iterations;
-
- if ( (ret = aio_return(&ocb)) )
- {
- int error = aio_error(&ocb);
- declareFatalError();
- FATAL ("aio_fsync final error on \"%s\": %s (%d)",
- (const char*) fileName, strerror(error), error);
- }
-
-#else
- //Sync sync (&syncObject, "IO::sync");
- //sync.lock(Exclusive);
fsync(fileId);
-#endif
#endif
writesSinceSync = 0;
diff -Nrup a/storage/falcon/SerialLogFile.cpp b/storage/falcon/SerialLogFile.cpp
--- a/storage/falcon/SerialLogFile.cpp 2007-09-20 11:42:35 -04:00
+++ b/storage/falcon/SerialLogFile.cpp 2007-10-29 11:39:58 -04:00
@@ -22,7 +22,13 @@
#ifdef _WIN32
#include <windows.h>
#include <io.h>
+#define WRITE_MODE 0
#else
+
+#ifdef STORAGE_ENGINE
+#include "config.h"
+#endif
+
#include <unistd.h>
#endif
@@ -40,14 +46,14 @@
#include "Sync.h"
#include "SQLError.h"
-#ifndef O_SYNC
-#define O_SYNC 0
-#endif
#ifndef O_BINARY
#define O_BINARY 0
#endif
+#ifndef WRITE_MODE
+#define WRITE_MODE O_DIRECT
+#endif
#ifdef _DEBUG
#undef THIS_FILE
@@ -110,16 +116,16 @@ void SerialLogFile::open(JString filenam
#else
if (create)
- handle = ::open(filename, O_SYNC | O_RDWR | O_BINARY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+ handle = ::open(filename, WRITE_MODE | O_RDWR | O_BINARY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
else
- handle = ::open(filename, O_SYNC | O_RDWR | O_BINARY);
+ handle = ::open(filename, WRITE_MODE | O_RDWR | O_BINARY);
if (handle <= 0)
throw SQLEXCEPTION (IO_ERROR, "can't open file \"%s\": %s (%d)",
(const char*) filename, strerror (errno), errno);
fileName = filename;
- sectorSize = 512;
+ sectorSize = 4096;
#endif
if (create)
@@ -145,17 +151,16 @@ void SerialLogFile::close()
void SerialLogFile::write(int64 position, uint32 length, const SerialLogBlock *data)
{
- Sync sync(&syncObject, "SerialLogFile::write");
- sync.lock(Exclusive);
- //ASSERT(position == writePoint || position == 0 || writePoint == 0);
-
+ uint32 effectiveLength = ROUNDUP(length, sectorSize);
+
if (!(position == writePoint || position == 0 || writePoint == 0))
throw SQLError(IO_ERROR, "serial log left in inconsistent state");
- uint32 effectiveLength = ROUNDUP(length, sectorSize);
-
#ifdef _WIN32
+ Sync sync(&syncObject, "SerialLogFile::write");
+ sync.lock(Exclusive);
+
if (position != offset)
{
LARGE_INTEGER pos;
@@ -172,6 +177,15 @@ void SerialLogFile::write(int64 position
#else
+#if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD)
+ uint32 n = ::pwrite (handle, buffer, length, offset);
+#else
+ Sync sync (&syncObject, "IO::pwrite");
+ sync.lock (Exclusive);
+
+ longSeek(offset);
+ ret = (int) ::write (fileId, buffer, length);
+
if (position != offset)
{
off_t loc = lseek(handle, position, SEEK_SET);
@@ -183,6 +197,7 @@ void SerialLogFile::write(int64 position
}
uint32 n = ::write(handle, data, effectiveLength);
+#endif
if (n != effectiveLength)
throw SQLEXCEPTION (IO_ERROR, "serial write error on \"%s\": %s (%d)",
@@ -196,13 +211,12 @@ void SerialLogFile::write(int64 position
uint32 SerialLogFile::read(int64 position, uint32 length, UCHAR *data)
{
- Sync sync(&syncObject, "SerialLogFile::read");
- sync.lock(Exclusive);
- ASSERT(position < writePoint || writePoint == 0);
uint32 effectiveLength = ROUNDUP(length, sectorSize);
#ifdef _WIN32
-
+ Sync sync(&syncObject, "SerialLogFile::read");
+ sync.lock(Exclusive);
+ ASSERT(position < writePoint || writePoint == 0);
LARGE_INTEGER pos;
pos.QuadPart = position;
@@ -220,6 +234,12 @@ uint32 SerialLogFile::read(int64 positio
return ret;
#else
+#if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD)
+ int n = ::pread (handle, data, effectiveLength, position);
+#else
+ Sync sync(&syncObject, "SerialLogFile::read");
+ sync.lock(Exclusive);
+ ASSERT(position < writePoint || writePoint == 0);
off_t loc = lseek(handle, position, SEEK_SET);
if (loc != position)
@@ -227,6 +247,7 @@ uint32 SerialLogFile::read(int64 positio
(const char*) fileName, strerror (errno), errno);
int n = ::read(handle, data, effectiveLength);
+#endif
if (n < 0)
throw SQLEXCEPTION (IO_ERROR, "serial read error on \"%s\": %s (%d)",
| Thread |
|---|
| • bk commit into 6.0 tree (jas:1.2657) | U-ROWVWADEjas | 29 Oct |