summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2016-03-27 10:50:14 -0400
committerKeith Bostic <keith@wiredtiger.com>2016-03-27 10:50:14 -0400
commit69b26f1f8338eee18fe0abdba43264e4cbfd443f (patch)
treead52bfc50da95c91f1cf79755272637185a7075a /src
parent5ea3ffb90fbd27f65e632e8f496f1da569b06434 (diff)
downloadmongo-69b26f1f8338eee18fe0abdba43264e4cbfd443f.tar.gz
WT-2330: in-memory configurations should not create on-disk collection files
Remove HAVE_SYNC_FILE_RANGE #ifdef from the block manager and support ENOTSUP returns up the stack from any underlying asynchronous flush call. General reworking of block manager's sync code to ignore further calls whenever ENOTSUP is returned on a handle.
Diffstat (limited to 'src')
-rw-r--r--src/block/block_mgr.c14
-rw-r--r--src/block/block_open.c3
-rw-r--r--src/block/block_write.c11
-rw-r--r--src/include/block.h3
-rw-r--r--src/os_posix/os_inmemory.c8
-rw-r--r--src/os_posix/os_posix.c6
-rw-r--r--src/os_win/os_win.c9
7 files changed, 43 insertions, 11 deletions
diff --git a/src/block/block_mgr.c b/src/block/block_mgr.c
index f842fd4d98e..f20bb991ff7 100644
--- a/src/block/block_mgr.c
+++ b/src/block/block_mgr.c
@@ -413,7 +413,19 @@ __bm_stat(WT_BM *bm, WT_SESSION_IMPL *session, WT_DSRC_STATS *stats)
static int
__bm_sync(WT_BM *bm, WT_SESSION_IMPL *session, bool block)
{
- return (__wt_fsync(session, bm->block->fh, block));
+ WT_DECL_RET;
+
+ if (!block && !bm->block->nowait_sync_available)
+ return (0);
+
+ if ((ret = __wt_fsync(session, bm->block->fh, block)) == 0)
+ return (0);
+
+ /* Ignore ENOTSUP, but don't try again. */
+ if (ret != ENOTSUP)
+ return (ret);
+ bm->block->nowait_sync_available = false;
+ return (0);
}
/*
diff --git a/src/block/block_open.c b/src/block/block_open.c
index 0fef6ad0e66..777fb1e8cd9 100644
--- a/src/block/block_open.c
+++ b/src/block/block_open.c
@@ -210,7 +210,8 @@ __wt_block_open(WT_SESSION_IMPL *session,
/* Set the file extension information. */
block->extend_len = conn->data_extend_len;
- /* Set the preload availability. */
+ /* Set the asynchronous flush, preload availability. */
+ block->nowait_sync_available = true;
block->preload_available = true;
/* Initialize the live checkpoint's lock. */
diff --git a/src/block/block_write.c b/src/block/block_write.c
index d6599d81a8e..771b0d34193 100644
--- a/src/block/block_write.c
+++ b/src/block/block_write.c
@@ -337,7 +337,6 @@ __wt_block_write_off(WT_SESSION_IMPL *session, WT_BLOCK *block,
WT_RET(ret);
}
-#ifdef HAVE_SYNC_FILE_RANGE
/*
* Optionally schedule writes for dirty pages in the system buffer
* cache, but only if the current session can wait.
@@ -346,9 +345,15 @@ __wt_block_write_off(WT_SESSION_IMPL *session, WT_BLOCK *block,
(block->os_cache_dirty += align_size) > block->os_cache_dirty_max &&
__wt_session_can_wait(session)) {
block->os_cache_dirty = 0;
- WT_RET(__wt_fsync(session, fh, false));
+ if ((ret = __wt_fsync(session, fh, false)) != 0) {
+ /*
+ * Ignore ENOTSUP, but don't try again.
+ */
+ if (ret != ENOTSUP)
+ return (ret);
+ block->os_cache_dirty_max = 0;
+ }
}
-#endif
/* Optionally discard blocks from the buffer cache. */
WT_RET(__wt_block_discard(session, block, align_size));
diff --git a/src/include/block.h b/src/include/block.h
index ebdaa91d33e..d1ea04572e7 100644
--- a/src/include/block.h
+++ b/src/include/block.h
@@ -223,7 +223,8 @@ struct __wt_block {
wt_off_t size; /* File size */
wt_off_t extend_size; /* File extended size */
wt_off_t extend_len; /* File extend chunk size */
- bool preload_available; /* File pages can be preloaded. */
+ bool nowait_sync_available; /* File can flush asynchronously */
+ bool preload_available; /* File pages can be preloaded */
/* Configuration information, set when the file is opened. */
uint32_t allocfirst; /* Allocation is first-fit */
diff --git a/src/os_posix/os_inmemory.c b/src/os_posix/os_inmemory.c
index 4d5b35e1499..e79054e56ed 100644
--- a/src/os_posix/os_inmemory.c
+++ b/src/os_posix/os_inmemory.c
@@ -320,8 +320,12 @@ __im_handle_sync(WT_SESSION_IMPL *session, WT_FH *fh, bool block)
{
WT_UNUSED(session);
WT_UNUSED(fh);
- WT_UNUSED(block);
- return (0);
+
+ /*
+ * Callers attempting asynchronous flush handle ENOTSUP returns, and
+ * won't make further attempts.
+ */
+ return (block ? 0 : ENOTSUP);
}
/*
diff --git a/src/os_posix/os_posix.c b/src/os_posix/os_posix.c
index a89cf13a760..ccae0554a92 100644
--- a/src/os_posix/os_posix.c
+++ b/src/os_posix/os_posix.c
@@ -27,8 +27,12 @@ __posix_sync(WT_SESSION_IMPL *session,
WT_RET_MSG(session, ret, "%s: %s: sync_file_range", name, func);
}
#else
+ /*
+ * Callers attempting asynchronous flush handle ENOTSUP returns, and
+ * won't make further attempts.
+ */
if (!block)
- return (0);
+ return (ENOTSUP);
#endif
#if defined(F_FULLFSYNC)
diff --git a/src/os_win/os_win.c b/src/os_win/os_win.c
index 3d7a71deb03..647f795aa36 100644
--- a/src/os_win/os_win.c
+++ b/src/os_win/os_win.c
@@ -376,9 +376,14 @@ __win_handle_sync(WT_SESSION_IMPL *session, WT_FH *fh, bool block)
{
WT_DECL_RET;
- WT_UNUSED(block);
-
if (fh->fp == NULL) {
+ /*
+ * Callers attempting asynchronous flush handle ENOTSUP returns,
+ * and won't make further attempts.
+ */
+ if (!block)
+ return (ENOTSUP);
+
if ((ret = FlushFileBuffers(fh->filehandle)) == FALSE)
WT_RET_MSG(session, __wt_win32_errno(),
"%s handle-sync: FlushFileBuffers error", fh->name);