summaryrefslogtreecommitdiff
path: root/src/os_common
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2016-06-20 09:33:43 -0400
committerGitHub <noreply@github.com>2016-06-20 09:33:43 -0400
commitac6e79ef569518e01543762692f8dfcfd9f517c8 (patch)
tree0ecfa3ddd9313839f6dbf206e8eabe69846c8c9b /src/os_common
parent73458e6d3b267df9ec8078949ba89ecf8056828e (diff)
downloadmongo-ac6e79ef569518e01543762692f8dfcfd9f517c8.tar.gz
WT-2692 Fix race in file system example (#2812)
* WT-2692 Fix race in file system example Include "wt_internal.h" and add locking by calling the underlying WiredTiger read/write locks. Remove "queue_example.h" file, it's no longer needed because "wt_internal.h" pulls in the WiredTiger queue macros. Minor cleanup of buffer size handling, resizing the buffer shouldn't set the size of the data. Minor cleanup of directory-list functions, free the allocated memory on error. Add counters for read/write operations. Remove sync-nowait function, it's not normally specified if the file doesn't support it, and a no-op function doesn't add anything to the example. * Add/rework some comments. * Switch from read/write locks to spinlocks and remove the hack to find a WT_SESSION handle during startup. It's a simpler locking model, and the hack is ugly. (None of the spinlock initialization functions actually use their session handle argument, I can live with that in a demo program.) * Clarify comment and extend required file handle functions. * Don't require a sync method for read-only files (matches the documentation).
Diffstat (limited to 'src/os_common')
-rw-r--r--src/os_common/os_fhandle.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/os_common/os_fhandle.c b/src/os_common/os_fhandle.c
index 50404c8b354..81e4cc14ccb 100644
--- a/src/os_common/os_fhandle.c
+++ b/src/os_common/os_fhandle.c
@@ -27,14 +27,15 @@ __fhandle_method_finalize(
/* not required: fadvise */
/* not required: fallocate */
/* not required: fallocate_nolock */
- /* not required: lock */
+ WT_HANDLE_METHOD_REQ(fh_lock);
/* not required: map */
/* not required: map_discard */
/* not required: map_preload */
/* not required: map_unmap */
WT_HANDLE_METHOD_REQ(fh_read);
WT_HANDLE_METHOD_REQ(fh_size);
- /* not required: sync */
+ if (!readonly)
+ WT_HANDLE_METHOD_REQ(fh_sync);
/* not required: sync_nowait */
if (!readonly) {
WT_HANDLE_METHOD_REQ(fh_truncate);