summaryrefslogtreecommitdiff
path: root/examples/c
Commit message (Collapse)AuthorAgeFilesLines
* WT-3136 bug fix: WiredTiger doesn't check sprintf calls for error return (#3340)Keith Bostic2017-03-245-34/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * WT-3136 bug fix: WiredTiger doesn't check sprintf calls for error return Make a pass through the source base to check sprintf, snprintf, vsprintf and vsnprintf calls for errors. * A WiredTiger key is a uint64_t. Use sizeof(), don't hard-wire buffer sizes into the code. * More (u_int) vs. (uint64_t) fixes. * Use CONFIG_APPEND instead of FORMAT_APPEND, it makes more sense. * revert part of 4475ae9, there's an explicit allocation of the size of the buffer. * MVSC complaints: test\format\config.c(765): warning C4018: '<': signed/unsigned mismatch test\format\config.c(765): warning C4018: '>': signed/unsigned mismatch * Change Windows testing shim to correctly use __wt_snprintf * Change Windows test shim to use the __wt_XXX functions * MSDN's _vscprintf API returns the number of characters excluding the termininating nul byte, return that value.
* WT-3234 Update WiredTiger build for clang 4.0. (#3345)Keith Bostic2017-03-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update WiredTiger build for clang 4.0. ex_all.c:852:7: error: possible misuse of comma operator here [-Werror,-Wcomma] p1++, p2++; ^ ex_all.c:852:3: note: cast expression to void to silence warning p1++, p2++; ^~~~ (void)( ) 1 error generated. * wtperf.c:2670:4: error: code will never be executed [-Werror,-Wunreachable-code] pos += (size_t)snprintf( ^~~ wtperf.c:2669:23: note: silence by adding parentheses to mark code as explicitly dead if (opts->verbose > 1 && strlen(debug_tconfig) != 0) ^ /* DISABLES CODE */ ( ) wtperf.c:2630:4: error: code will never be executed [-Werror,-Wunreachable-code] pos += (size_t)snprintf( ^~~ wtperf.c:2629:23: note: silence by adding parentheses to mark code as explicitly dead if (opts->verbose > 1 && strlen(debug_cconfig) != 0) ^ /* DISABLES CODE */ ( ) 2 errors generated.
* WT-3211 WT_CURSOR.remove cannot always retain its position. (#3321)Keith Bostic2017-03-142-218/+0
|
* WT-3120 Fix ordering problem in connection_close for filesystem loaded in an ↵Keith Bostic2017-01-231-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | extension (#3261) This commit represents fixes for Coverity errors, LeakSanitizer errors, and additional cleanup: * pread/pwrite return value is -1 on error, but the error is in errno. * Convert size_t and off_t to uintmax_t/PRIuMAX, not uint64_t/PRIu64. * Coverity ID 1369085 (#1 of 1): Extra sizeof expression (SIZEOF_MISMATCH) suspicious_pointer_arithmetic: Adding allocated * 8UL /* sizeof (char *) */ to pointer entries of type char ** is suspicious because adding an integral value to this pointer automatically scales that value by the size, 8 bytes, of the pointed-to type, char *. Most likely, the multiplication by sizeof (char *) in this expression is extraneous and should be eliminated. * CID 1369084 (#1 of 1): Resource leak (RESOURCE_LEAK) 9. overwrite_var: Overwriting handle ret in ret = 12 leaks the handle. * CID 1369083 (#1 of 1): Logically dead code (DEADCODE) dead_error_line: Execution cannot reach this statement: while (count > 0U) null: At condition entries != NULL, the value of entries must be NULL. dead_error_condition: The condition entries != NULL cannot be true. * Custom filesystems have to configure early-load, otherwise we'll have already configured a default filesystem by the time the extension is loaded. * Add early-load configuration to the wt3120_filesys test. * Add code to WiredTiger that fails if a custom filesystem is configured after we've already configured a default filesystem.
* WT-283 Add WT_SESSION::alter method (#3177)sueloverso2016-12-152-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * WT-283 Add WT_SESSION:alter method * Add new method to ex_all.c * Typo * Add testing and fixes for LSM, column groups and indexes for alter. * Fix WITH_*_LOCK macro usage. * Whitespace * Change table alter to not walk down into column groups and indexes. * Whitespace * Use base file meta config and compare strings. * Add skip stat * Add alter support to wt command. * Add util_alter.c to SConstruct * Fix subsection in doc. * Add alter thread to test/format * Swap the value we send into alter in test/format. * Add data-source alter support * Only alter access pattern hint in test/format. * Make LSM alter not exclusive. * Whitespace * Use access_pattern_hint in example. * Include base lsm metadata configuration. * Fix text/comment. * Minor changes from review comments. * Unused variable warning.
* WT-3014 Add GCC/clang support for ELF symbol visibility. (#3138)Keith Bostic2016-12-052-58/+81
| | | | | * Rewrite the demo file system example to not require internal WiredTiger functions. * Replace calls to __wt_calloc/__wt_free with C library calloc/free/calls, avoid using internal WiredTiger functions.
* WT-2962 Allow configuration of builtin extensions. (#3137)Michael Cahill2016-11-141-12/+2
| | | While in the area, fix sending "config={values}" to extensions: just the values should be passed in.
* WT-2880 Add Zstandard compression support (#3075)Keith Bostic2016-10-211-0/+33
| | | | | | | | | | | | | | * Fix a bug found by inspection in LZ4 code: we're going to offset the destination buffer by sizeof(LZ4_PREFIX), so we need to offset the destination buffer length by the same amount. * Prettiness pass through the snappy driver so it and the zstd driver look the same, minor cleanup in zlib. * Add the compression_level configuration option to the zstd extension initialization function so it's possible to set the compression level from an application. * Fix a bug in zlib raw compression: the destination buffer size (dst_len), can be smaller than the target page size (page_max), use the smaller of the two values to set the target compression size. * The zlib raw compression function could return without calling deflateEnd on its z_stream structures, potentially leaking memory and scratch buffers. * If the default reserved bytes for zlib raw compression isn't sufficient, we fail on compression of what might be very large blocks. We don't have information on how many bytes need to be reserved in order to know the final deflate() will succeed, and the default value was experimentally derived, for all we know there are workloads where the default will fail a lot. Add a fallback before failing hard, try with 2x the default reserved space.
* WT-2916 Fix and simplify s_whitespace. (#3047)Michael Cahill2016-09-162-4/+4
|
* WT-2900 Add ARM8 build support to WiredTiger and fix ARM CRC assembler tags ↵Keith Bostic2016-09-131-1/+1
| | | | | | (#3028) Add -march=armv8-a+crc to the gcc compile flags for ARM, we need the optional CRC instructions.
* WT-2873 Refactor CRC32 code (#3000)Keith Bostic2016-09-081-3/+3
| | | | | | | | | | | | * Add --enable-crc32-hardware configuration option (configured on by default), which allows CRC32 hardware support to be turned off. * Move the CRC32 implementation in software from the x86-specific code to software/checksum.c, leave the x86-specific code in x86/crc32-x86.c. * Move the pointer to the checksum function from a file static to the WT_PROCESS.cksum field, change the __wt_cksum_init() function to set that field. * WT-2882 Create CRC32 Hardware implementation for ARM8 * Change "cksum" to "checksum" everywhere (hopefully) no semantic changes.
* WT-2820 add gcc warn_unused_result attribute (#2938)Keith Bostic2016-08-121-7/+7
| | | | | | | * Add the gcc "cold" attribute to the verbose, message, and assorted error functions (informs the compiler that the function is unlikely to be executed). * Add the WT_IGNORE_RET() macro that ignores return values in the handfull of places we want to ignore return values. * Replace calls to fprintf() in the utility with calls to util_err(), replace local variable names in error messages with class names.
* WT-2638 Change custom file system API to make truncate support clearer (#2908)Keith Bostic2016-08-091-2/+2
| | | | | | | | | Replace the WT_FILE_HANDLE fh_allocate, fh_allocate_nolock and fh_truncate methods, with fh_extend, fh_extend_nolock, fh_truncate. This simplifies file extension because the WiredTiger layer no longer has to know ftruncate can extend files (if fallocate isn't available), and fall back to that method as needed, nor does WiredTiger have to know ftruncate requires locking.
* WT-2760 Fix a bug in backup related to directory sync. Change the filesystem ↵Keith Bostic2016-07-151-26/+13
| | | | | | | | | | | | | | | | | | | | | | | | | API to make durable the default (#2867) Change the default remove/rename calls to flush the enclosing directory. Simplify the pluggable file system API by replacing the directory-sync method with "durable" boolean argument to the remove, rename and open-file methods. * Add "durable" arguments to relevant functions so that each remove or rename call specifies its durability requirements. * Switch the WT_FILE_SYSTEM::fs_open_file type enum from WT_OPEN_FILE_TYPE, with WT_OPEN_XXX names, to the WT_FS_OPEN_FILE_TYPE, with WT_FS_OPEN_XXX names. Switch the WT_FILE_SYSTEM::fs_open_file flags from WT_OPEN_XXX names to WT_FS_OPEN_XXX names. * Replace the "bool durable" argument to WT_FILE_SYSTEM.fs_remove and WT_FILE_SYSTEM.fs_rename with a "uint32_t flags" argument, and the WT_FS_DURABLE flag. * Remove a stray bracket.
* WT-2711 Change statistics log configuration options (#2834)Keith Bostic2016-07-081-17/+10
| | | | | | | | | No longer support setting the statistics_log path in WT_CONNECTION::reconfigure. No longer support setting a custom name for statistics files, only allow a destination directory. Be more explicit about which logging configuration options are allowed in WT_CONNECTION::reconfigure. The aim of these changes is to avoid situations where applications that embed WiredTiger allow their users to overwrite unexpected files on a file system. This potentially requires an upgrade step for applications that were specifying a non-standard file name component for statistics log file names, it's not backward compatible.
* WT-2408 Windows error translation layer (#2819)Keith Bostic2016-06-231-0/+11
| | | | | | | | | | | | Build a Windows-to-POSIX/ANSI error translation layer. Replace the read-only error mapping to WT_NOTFOUND and WT_PERM_DENIED with EACCES and ENOENT. Windows no longer needs its own version of __wt_strerror(), move the POSIX implementation from os_posix/os_errno.c to os_common/os_errno.c. Rename os_win/os_errno.c to os_win/os_winerr.c to avoid a collision. Windows now has DWORD types in prototypes, split the Windows/POSIX extern.h files. (This actually cleans up some noise, previously we had to sort the OS prototypes to remove duplicates, which wasn't trivial.) Add the WT_EXTENSION_API.map_windows_error method to map Windows system codes to POSIX/ANSI system codes.
* WT-2691 Use wrappers for ctype functions to avoid sign extension errors (#2818)Don Anderson2016-06-211-2/+2
| | | | | | | | | | | | | | * Cast arguments for ctype functions to avoid sign extension errors. Create __wt_* versions of all ctype functions, and use them whenever wt_internal.h is available. Add check to prevent direct use of ctype functions from core source. * Change wrappers to use u_char arguments, and return bool. Remove unused wrappers. * Use u_char in preference to unsigned char. * Examples do not have u_char defined on Windows.
* WT-2692 Fix race in file system example (#2812)Keith Bostic2016-06-202-277/+220
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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).
* WT-2710 WT_FILE_HANDLE_INMEM no longer needs an off field (#2805)Keith Bostic2016-06-171-5/+1
| | | Probably a left-over from when stdio was still part of the pluggable API.
* WT-2682 add option to configure WiredTiger with strict compiler flags (#2773)Keith Bostic2016-06-081-2/+3
| | | | | | Add the --enable-strict option that uses our current best guess at the right flags for strict compilation. While adding the option, expand the set of flags we can compile cleanly with.
* Wt 2661 coverity (#2746)Keith Bostic2016-05-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * WT-2661: Coverity failures: 1356050-1356053 CID 1356050: (NULL_RETURNS) Dereferencing a pointer that might be null "opts->home" when calling "snprintf". CID 1356050: (NULL_RETURNS) Dereferencing a pointer that might be null "opts->uri" when calling "snprintf". * Assigning address of auto variable '_opts' to static (it's an auto variable in main(), so it's safe, but make lint happy). * Coverity appears to be confused by argv handling and eventually passing NULL to snprintf. 2. var_assign_alias: Assigning: opts->progname = argv[0]. Both are now tainted. 47. vararg_transitive: Call to snprintf with tainted argument opts->progname taints NULL. 48. tainted_data_sink_lv_call: Passing tainted variable 0UL to tainted data sink snprintf. NULL is tainted? I'm hoping that using a strlen() call to figure out the string length instead of snprintf() will make this one go away. * test_wt2246_col_append wasn't actually doing any work, set nrecords to a 20 million default. * KNF * Don't use "inline" in example programs, it requires Windows #ifdef's.
* WT-2653: the custom file-system example should show device configuration (#2741)Keith Bostic2016-05-251-32/+118
| | | | | | | Add examples of passing in per-device configuration information to the demo file system initialization function. Use the WiredTiger extension API to handle errors in functions called by WiredTiger. Set the default session's strerror method. If one of the extensions being loaded reports an error via the WT_EXTENSION_API strerror method, but doesn't supply that method a WT_SESSION handle, we'll use the WT_CONNECTION_IMPL's default session and its strerror method.
* WT-2630 Rename pluggable filesystem methods to avoid reserved names. (#2730)Michael Cahill2016-05-241-22/+22
| | | | | * WT-2630 Rename pluggable filesystem methods to avoid reserved names. Use "fstr" consistently as the variable name and prefix for WT_FSTREAM.
* WT-2626 Fix MSVC 2015 snprintf redefinition (#2726)David Hows2016-05-061-1/+1
|
* WT-2624 Fix example program build with MSVC 2013 (#2725)David Hows2016-05-061-0/+4
| | | Since Visual Studio 2013 doesn't have a snprintf symbol.
* WT-2617 Don't use u_int in the example code. It's not Windows native. (#2722)Alex Gorrod2016-05-051-3/+3
|
* WT-2617 Fix a bug in pluggable file system example (#2718)Keith Bostic2016-05-0522-110/+225
| | | | | | | | | | | | | | | | | | | | | | Don't print "home" if it's NULL. Make ex_async work like the rest of the example programs, creating and using WT_HOME. * We need two sizes, the size of the data in the buffer and the size of the buffer itself, split the two apart, otherwise it's possible to read data that's never been written. Remove the assert the file size is never 0, that's a reasonable condition if the file has never been written. Don't bother realloc the buffer when truncating it to a smaller size. * Add a full smoke test, create a table then write it, close and reopen it, and read the values back. * main() should return EXIT_SUCCESS or EXIT_FAILURE, not a return value from the underlying WiredTiger library.
* WT-2586: examples/ex_config is brokenKeith Bostic2016-04-282-93/+0
| | | | Remove the example ex_config.c program entirely.
* WT-2586: examples/ex_config is brokenKeith Bostic2016-04-281-1/+5
| | | | Add verbose output when to expect error messages from WiredTiger.
* WT-2586: examples/ex_config is brokenKeith Bostic2016-04-281-2/+2
| | | | | | | Add a message in the ex_event_handler() output that an error message is expected and it's normal. Always close the database, even if there's been a previous error.
* WT-2586: examples/ex_config is brokenKeith Bostic2016-04-281-2/+3
| | | | | | | | | | | The ex_config example code opens a "config:" URI and then does a WT_CURSOR.next, but "config:" URIs don't support WT_CURSOR.next. In 2010, the file was changed to create "table:access", but the cursor URI wasn't switched to use it, it continued using "config:". The code probably never worked, but when we changed the standard not-supported cursor function to output an error message in WT-2349, the failure became visible.
* WT-2552 Add public API for pluggable filesystems (#2671)Alex Gorrod2016-04-283-0/+872
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * WT-2552 Add public API for pluggable filesystems Not yet compiling. The main parts of this change should be here, but it involved extensive parameter re-organization. There are also a number of layering violations between our existing file system implementations and the WT_FH, that aren't possible with the new structure. There are a number of specific todo comments in the code. One of the main issues is that the in-memory file system had a special close semantic that relied on WiredTiger handle tracking. The in-memory file-system should do it's own tracking of file handles, I've gone part way down that road by adding a queue for closed handles. Need to also add in live handles, and manage the queue as appropriate. I haven't created an example application that uses the new API yet. * WT-2552 Add public API for pluggable filesystems I always forget you have to remove the already-built html files when changing PREDEFINED, add a reminder to the complaint. * WT-2552 Add public API for pluggable filesystems You have to remove the .js files, too. * WT-2552 Add public API for pluggable filesystems Make dist/s_all run cleanly. * WT-2552 Add public API for pluggable filesystems Whitespace. * WT-2552 Add public API for pluggable filesystems Make it compile/build/lint. * WT-2552 Add public API for pluggable filesystems block_write.c: In function '__wt_block_extend': block_write.c:130:71: error: missing terminating ' character [-Werror] * WT-2552 Add public API for pluggable filesystems os_fs_inmemory.c: In function '__im_file_truncate': os_fs_inmemory.c:344:10: error: 'session' is used uninitialized in this function [-Werror=uninitialized] * WT-2552 Add public API for pluggable filesystems os_fs.c: In function '__posix_directory_sync': os_fs.c:92:10: error: 'session' is used uninitialized in this function [-Werror=uninitialized] * WT-2552 Add public API for pluggable filesystems Go back to using bool types in the file-system API, this requires we add <stdbool.h> to the "standard" wiredtiger.h includes. Consistently use wt_session to represent a WT_SESSION, we were using "wtsession" in some places. Make a pass over the Windows code, but I'm sure it doesn't compile yet. * WT-2552 Add public API for pluggable filesystems Fix up another couple of bool types. * WT-2552 Add public API for pluggable filesystems Move the file naming work out of the underlying filesystem functions, the calls to __wt_filename are now in the upper-level code,n os_fs.i; that means the filesystem code is no longer responsible for figuring out paths. This is cleaner, although the directory-sync call is a bit of a kluge, and I've commimtted us to handling NULL filesystem methods. With this set of changes, in-memory runs again. More Windows naming fixes. * WT-2552 Add public API for pluggable filesystems os_fs.c: In function '__posix_directory_sync': os_fs.c:96:3: error: label 'err' used but not defined * WT-2552 Add public API for pluggable filesystems Pull out another call to __wt_filename() from the filesystem-dependent code. * WT-2552 Add public API for pluggable filesystems Consistently check for missing file-system methods when doing file-system calls. Other minor lint & cleanup. * WT-2552 Add public API for pluggable filesystems Change the in-memory code to maintain a complete list of the files it has ever opened, and depend on that list instead of reaching up into the common layer for the WT_FH handle list. This means __wt_handle_search is only used by the common WT_FH handle code, simplify it, and add a __wt_handle_is_open function that can be called for diagnostic purposes (to check for open files that are being renamed or removed, for example). * Fix comiler warning and ignore the file system API in Java * Flesh out the example file system implementation. * Add in some plumbing for set_file_system in wiredtiger_open. * WT-2552 Add public API for pluggable filesystems Whitespace. * WT-2552 Add public API for pluggable filesystems WT_CONFIG_ITEM.val isn't a boolean, don't use boolean types in equal/not-equal comparisons. * WT-2552 Add public API for pluggable filesystems Remove unused #includes. Increment/decrement the DEMO_FILE_SYSTEM.{opened,closed}_file_count. Allocate demo structures, they're larger than the underlying structures. Swap the number/size calloc arguments, number comes first. Fix a couple of statics. * WT-2552 Add public API for pluggable filesystems Use %u instead of casting to %d. * WT-2552 Add public API for pluggable filesystems Add ex_file_system.c to the list of example programs. * WT-2552 Add public API for pluggable filesystems Change ex_file_system.c to not require <wt_internal.h>: strip down a copy of FreeBSD's <queue.h> for local inclusion, rewrite a few other minor pieces of code. * WT-2552 Add public API for pluggable filesystems Update spell check info * WT-2552 Add public API for pluggable filesystems __conn_load_extensions() shouldn't set the "early" boolean to true. * WT-2552 Add public API for pluggable filesystems Don't indirect through a NULL pointer if "local" was set and no path was specified, always set the name to something useful. * WT-2552 Add public API for pluggable filesystems Don't indirect through a NULL pointer if "local" was set and no path was specified, always set the name to something useful. * WT-2552 Add public API for pluggable filesystems wt_off_t vs. size_t conversion lint. * WT-2552 Add public API for pluggable filesystems Add -rdynamic to the load for ex_file_system, the main executable symbols are not exported by default. * WT-2552 Add public API for pluggable filesystems The underlying handle name includes the enclosing directory, compare against the WT_FH.name field instead. * WT-2552 Add public API for pluggable filesystems demo_fs_rename should return 0 if successful, simplify error handling Don't bother casting arguments to free(), it's not necessary. * WT-2552 Add public API for pluggable filesystems General WT_FILE_SYSTEM cleanup. Move OS initialization into the wiredtiger_open() code (the os_common/os_init.c file is no longer needed). Allow early-load extensions to be part of the environment settings, matching the "in-memory" and "readonly" configurations. Syntax check the set of a file-system, remove tests for NULL methods in the file-system structure unless it's legal for them to be NULL. Windows, POSIX and in-memory file systems now set WT_FILE_SYSTEM.terminate, call that function to cleanup when discarding a WT_CONNECTION. Export file-type and open-flags constants for WT_FILE_SYSTEM.open_file, sort the WT_FILE_SYSTEM methods, do an editing pass. Change the WT_FILE_HANDLE type from (const char *) to (char *), it's "owned" by the underlying layer, and it's simpler that way. Minor (untested) cleanup of the Windows WT_FILE_SYSTEM.open-file method. * WT-2552 Add public API for pluggable filesystems Export the advise argument #defines for the WT_FILE_HANDLE.fadvise method. Sort the WT_FILE_HANDLE methods. * WT-2552 Add public API for pluggable filesystems Clean up and simplify WT_FILE_SYSTEM/WT_FILE_HANDLE documentation's description of the handles. * WT-2552 Add public API for pluggable filesystems WT_FILE_HANDLE.close is a required function (at the least, it has to free the memory). WT_FILE_HANDLE.fadvise isn't a required function, if it's not configured, don't call it. * WT-2552 Add public API for pluggable filesystems The WT_FILE_HANDLE.lock function is required. Change the __wt_open() signature to match WT_FILE_SYSTEM.open_file(). * WT-2552 Add public API for pluggable filesystems Rework all of the WT_FILE_HANDLE mapped region methods to be optional. * WT-2552 Add public API for pluggable filesystems The WT_FILE_HANDLE.{read,size} methods are required. The WT_FILE_HANDLE.sync method is not required. Split the WT_FILE_HANDLE.sync method into .sync and .sync_nowait versions, it makes the upper-level code simpler (Windows supports .sync but doesn't support .sync_nowait). * WT-2552 Add public API for pluggable filesystems The WT_FILE_HANDLE.{truncate,write} methods are required IFF the file is not readonly. * WT-2552 Add public API for pluggable filesystems POSIX shouldn't declare a no-sync handle function unless the sync_file_range system call is available. * WT-2552 Add public API for pluggable filesystems Typo, missing semi-colon. * Fix a bug in ex_file_system.c * Fix a memory leak in posix file handle implementation * WT-2552 Use the correct flags when opening backup file. * WT-2552 Add public API for pluggable filesystems Simplify open-file error handling by calling the close function on the handle, that way we won't forget to free all of the applicable memory allocations. * WT-2552 Add public API for pluggable filesystems Simplify the directory-list method, don't pass in an include/exclude file, if prefix is non-NULL, it implies we only want files matching the prefix. * WT-2552 Add public API for pluggable filesystems Replace WT_FILE_HANDLE_POSIX.fallocate_{available,requires_locking} wiht WT_FILE_HANDLE.fallocate and WT_FILE_HANDLE.fallocate_nolock. Example code doesn't need to set WT_FILE_HANDLE methods to NULL, the allocation does that. Free the I/O buffer if open-handle allocation fails in the example code. Remove snippets for WT_FILE_SYSTEM and WT_FILE_HANDLE methods, we're not going to provide example code for them. * WT-2552 Add public API for pluggable filesystems Document we expect either ENOTSUP or EBUSY from optionally supported APIs. Review/cleanups ENOTSUP/EBUSY returns from optionally supported APIs. Make WT_FILE_HANDLE.lock optional. Don't configure or call the POSIX fadvise function on files configured for direct I/O. Rename __wt_filesize_name to __wt_size for consistency. Update the spelling list. * WT-2552 Add public API for pluggable filesystems WT_FILE_HANDLE.truncate requires locking in all known implementations, document it is not called concurrently with other operations. * WT-2552 Add public API for pluggable filesystems Don't terminate the filesystem unless we've actually configured one. * WT-2552 Add public API for pluggable filesystems Remove WT_FILE_SYSTEM and WT_FILE_HANDLE from SWIG so the test suite can pass again. * WT-2552 Add public API for pluggable filesystems Merge __conn_load_early_extensions() and __conn_load_extensions(). Fix a problem where I moved the early extensions load to where it could include the WiredTiger environment variable, but I didn't pass the built cfg into the function. * WT-2552 Add public API for pluggable filesystems Linux build typo. * WT-2552 Add public API for pluggable filesystems Get rid of the "bool silent" argument to WT_FILE_SYSTEM.size by testing for the file's existence before requesting the size (an extra system call, but guaranteed to hit in the buffer cache at least). * WT-2552 Add public API for pluggable filesystems Naming consistency pass over the WT_FILE_SYSTEM functions. * WT-2552 Add public API for pluggable filesystems Fix a spin lock mismatch. * WT-2552 Add public API for pluggable filesystems Another spinlock mismatch. * Update example pluggable file system. Add a directory list implementation to the example, which uncovered an issue with the API. The directory list API allocates memory that is freed by WiredTiger, which I don't think is kosher. * Change file-directory-sync to use reguar fsync. The distinction in os_fs.i doesn't work with the filesystem API. Also add directory_sync application to the example application. * WT-2552 Add public API for pluggable filesystems Whitespace. * WT-2552 Add public API for pluggable filesystems Rewrite __wt_free to not evaluate macro arguments multiple times. * WT-2552 Add public API for pluggable filesystems Simplify the directory-list functions: __wt_realloc_def() already handles scaling the size of the allocations, there's no need to involve a separate constant that increments the allocation size. * WT-2552 Add public API for pluggable filesystems Fix a grouping problem in a realloc call, we need to multiple the size times the previously allocated slots + 10. Fix buffer overrun, if "count" has already been incremented, the memset would skip clearing the first slot and clear one slot past the end of the buffer. Remove a comment, realloc requires clearing allocated memory, it's not paranoia. * WT-2552 Add public API for pluggable filesystems Add the mapping-cookie argument to the map-preload and map-discard functions. Change page-discard to stop reaching down through the block manager, instead, provide a block-manager map-discard function that does the work. * WT-2552 Add public API for pluggable filesystems Require a directory-list function. Implement a directory-list function for the in-memory filesystem. Consistency pass, make all the directory-list functions look the same. * WT-2552 Add public API for pluggable filesystems The WT_FILE_SYSTEM.{directory_sync, remove, rename} methods are not required for read-only systems. * WT-2552 Add public API for pluggable filesystems Change the WT_FILE_SYSTEM.open_file file_type argument from a set of constants to an enum. This requires changing how we store connection direct I/O configuration (the constants used to be flags stored in the WT_CONNECTION_IMPL), and requiring all callers of __wt_open() do their own work to figure out if WT_OPEN_DIRECTIO should be specified. * WT-2552 Add public API for pluggable filesystems Make no guarantees WT_FILE_SYSTEM and WT_FILE_HANDLE methods are not called concurrently (except for WT_FILE_HANDLE::fallocate and WT_FILE_HANDLE::fallocate_nolock). Rewrite the in-memory FS code to lock across all methods (for example, WT_FILE_HANDLE.close), that means including a reference to the enclosing WT_FILE_SYSTEM in the WT_FILE_HANDLE structure so we can find a lock without using the WT_CONNECTION_IMPL structure. * WT-2552 Add public API for pluggable filesystems Remove __wt_directory_sync_fh, it's no longer useful. * WT-2552 Add public API for pluggable filesystems Rename WT_INMEMORY_FILE_SYSTEM to WT_FILE_SYSTEM_INMEM, matching WT_FILE_HANDLE_INMEM. * WT-2552 Add public API for pluggable filesystems Add WT_FILE_SYSTEM.directory_list_free, to free memory allocated by WT_FILE_SYSTEM.direct_list. Fix a memory leak in __log_archive_once (if __wt_readlock failed, we leaked the directory-list memory). * WT-2552 Add public API for pluggable filesystems Typo, check WT_DIRECT_IO_LOG, not WT_DIRECT_IO_CHECKPOINT. * WT-2552 Add public API for pluggable filesystems Typo, unreachable code. * WT-2552 Add public API for pluggable filesystems We don't require WT_FILE_SYSTEM.{remove,rename} if the system is read-only. * Fix Windows build with pluggable file system. Involved removing u_int from the public API. * Fix line wrapping. * Fix Windows terminate function. * Forgot something in my last commit. * Fix Windows munmap bug. * Add new example to Windows build. Extend example to be more complete. * Fix example loading on Windows * Update documentation * Add missing spell words * Remove old comment.
* Merge branch 'develop' into wt-2360-join-disjunctionMichael Cahill2016-04-191-0/+7
|\
| * WT-2103: add incremental backup testing to formatKeith Bostic2016-04-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an example of the code to open a cursor for incremental backup. Wording changes: Remove the requirement that a checkpoint be run between the full backup and the incremental backup; it's not really a requirement and it implies coordination between checkpoints and recovery that could be difficult. Don't mention the backup database becoming "live" as the terminating condition for incrementals, once you run recovery, it's over, you cannot backup to that database copy again. Note the log file grows rather than "changes in size"; it better not shrink in size, applications won't be able to handle that.
* | Merge branch 'develop' into wt-2360-join-disjunctionDon Anderson2016-04-141-1/+1
|\ \ | |/
| * WT-2330: in-memory configurations should not create on-disk collection filesKeith Bostic2016-03-181-1/+1
| | | | | | | | old-style function definition
* | WT-2360 Introduced a more complex join example to show nesting and disjunction.Don Anderson2016-04-141-11/+65
|/
* WT-2473 - Add inttypes.h to ex_config_parseDavid Hows2016-03-141-0/+1
|
* Revert "WT-2473: MSVC doesn't support PRId64"Keith Bostic2016-03-111-1/+1
| | | | This reverts commit 0b2766c1db03e96d5c7bfbb1eae66a9df790e301.
* WT-2473: MSVC doesn't support PRId64Keith Bostic2016-03-111-1/+1
|
* WT-2471: review WiredTiger "int" printf formatsKeith Bostic2016-03-114-21/+30
|
* WT-2431 The schema example now needs statistics enabled for the connection.Don Anderson2016-02-291-1/+2
|
* WT-2431 Add examples for join cursor statistics.Don Anderson2016-02-282-2/+45
|
* WT-2107: Add example code including an event handlerKeith Bostic2016-02-232-16/+19
| | | | | | | | | My last commit introduced a bug, letting the event handler go out of scope before a call that used it. Split out the set of the event handler from the main function, that way we don't have to play games to get the CUSTOM_EVENT_HANDLER declaration next to the code that initializes it. Minor #include cleanup while in the area.
* WT-2107: Add example code including an event handlerKeith Bostic2016-02-231-1/+13
| | | | Add WIREDTIGER_HOME handling so "make check" works, remove unused variable.
* WT-2107: Add example code including an event handlerKeith Bostic2016-02-231-5/+5
| | | | Review, minor wording and style cleanup.
* WT-2107 Shuffle changes for event handler example.Alex Gorrod2016-02-233-71/+121
|
* WT-2107: Add example code including an event handlerKeith Bostic2016-02-211-1/+0
| | | | whitespace
* WT-2107: Add example code including an event handler #2512Keith Bostic2016-02-211-1/+7
| | | | Another compiler fix, add prototypes.
* WT-2107: Add example code including an event handlerKeith Bostic2016-02-211-4/+5
| | | | Fix the error handler function signature.