Compare commits

...

74 Commits

Author SHA1 Message Date
Alex Gorrod
8d23249433 Merge branch 'develop' into mongodb-3.6 2016-12-19 15:08:21 +11:00
David Hows
8ae0338420 WT-3075 Document and enforce that WiredTiger now depends on Python 2.7 (#3196) 2016-12-19 11:24:26 +11:00
Keith Bostic
ea8b8b7688 WT-3084 Fix Coverity resource leak complaint. (#3205)
* The returned value after calling __wt_turtle_read() should only be set
if ret is non-zero, but Coverity is convinced otherwise. The code path
is used enough that Coverity complains a lot, add an error check to get
some peace and quiet.
2016-12-16 10:38:55 -05:00
Keith Bostic
4873051264 WT-2402 Misaligned structure accesses lead to undefined behavior (#3203)
* Don't specify -std=c11 with Solaris/gcc, it's a strict build and so
we're missing lots of standard function prototypes, like posix_memalign,
strdup and strcasecmp.

Try and reorder the autoconf compiler flag code to do important flags
first (-pthreads, -D GNU_SOURCE), before less-important flags
(--enable-strict and other options flags). I'm assuming -D GNU_SOURCE
would reasonably be needed during options testing.

Don't use uname and look for SunOS, instead, use $host_os and look for
solaris.

* "access" is a C library call, don't use the same name.

Don't hard-code a buffer size.

The "ret" value was never used.
2016-12-16 08:12:57 -05:00
Alex Gorrod
c404af8b32 WT-3068 Have Jenkins include specific files for copy rather than exclude (#3202) 2016-12-16 09:10:51 +11:00
sueloverso
876a85fbc5 Fix data source examples to include alter. (#3200) 2016-12-15 14:40:09 -05:00
sueloverso
e8d8fd8110 WT-283 Add WT_SESSION::alter method (#3177)
* 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.
2016-12-15 13:06:31 -05:00
Michael Cahill
2142d32fd6 WT-2402 Pad structures to avoid cache line sharing. (#3191)
* WT-2402 Pad structures to avoid cache line sharing.

We previously used compiler alignment to avoid cache line sharing, which
is problematic because we don't allocate memory with the necessary
alignment, so some behavior is undefined.  Instead, this change merely
pads structs to ensure they won't share a cache line when allocated in
an array.

* Add some #if barriers around the new union's

* Change where CACHE_LINE_PAD defines live and rename _START to _BEGIN

* Add ax_check_compile_flag to aclocal

* Lint

* Allocate the TINFO structures separately to minimize false sharing.

* Comment cleanup to make spell happy.

* Pad the read-write locks to avoid false sharing.

* Add a comment as to why we're adding -std=c11 to the compile.

* whitespace

* Add asserts that we're padding the structures we intended to pad.

Minor cleanup, don't use #defines outside of the WiredTiger namespace.
2016-12-15 07:15:42 -05:00
Keith Bostic
18fb0f8da4 SERVER-26545 Remove fixed-size limitation on WiredTiger hazard pointers (#3187)
* Default to an initial 250 hazard slots and grow from there.

* Make hazard_max undocumented, add an internal limit of 1000 eviction walks.

* If we grow the hazard pointer array, schedule the original to be freed when the database is closed.

* Update test_bug011 back to stress eviction with the hard-coded limit of 1000 active trees.  Only run during "long" tests.
2016-12-15 16:01:12 +11:00
Keith Bostic
a026912444 WT-3078 test reconfiguration hang in the statlog server. (#3198)
Flush the caller's flags before reading the condition information, we may not write anything before joining the exiting thread, and a write-barrier() would not necessarily have any effect.
2016-12-15 15:42:38 +11:00
Michael Cahill
baa2780154 WT-3070 Fix search_near on indexes. (#3195)
* WT-3070 Fix search_near on indexes.

Since WT-2773, the sign of the `exact` result was flipped and
WT_NOTFOUND was returned for search_near calls with a key past the end
of the index.
2016-12-14 19:43:48 -05:00
Keith Bostic
ff4c7e6010 WT-3069 Fix LevelDB APIs build failures. (#3193) 2016-12-14 11:32:31 +11:00
Alex Gorrod
356d96eea0 WT-3068 Copy artifacts of test runs in wtperf_run script. (#3190) 2016-12-14 11:28:11 +11:00
Don Anderson
a0724e6004 WT-3071 Fixed sign-conversion compiler errors in Java and Python SWIG code (#3194)
Modified SWIG compilation for python to turn off sign conversion checks.
There are a dozen or so sign conversion complaints in boiler-plate
SWIG-Python utility functions that we can't do anything about.
Since we'd like to build a tree with python enabled and sign conversions
checks on everywhere else, this appears to be the best we can do.
2016-12-14 09:22:35 +11:00
David Hows
52dc47647e WT-3061 Syscall testing should support pwrite64 on Linux
* WT-3061 Ensure checkpoint sync's are run as part of syscall testing

* Change pwrite to pwrite64

* Add a regex to treat all pwrite64's as pwrites

* Fix a missing pwrite64 to pwrite regex

* Change how we remove the WIREDTIGER_CONFIG environment variable

* Remove the over-ride of WIREDTIGER_CONFIG, we will alter that per-job
2016-12-13 10:01:10 +11:00
Don Anderson
467a63fd4d WT-3056 Allow projected table and join cursors to use primary keys (#3186)
Add cursor projection tests that include the primary key, for table, index and join cursors.
2016-12-12 14:24:41 +11:00
Keith Bostic
493bbf750c WT-3066 lint (#3189) 2016-12-12 14:01:19 +11:00
Alex Gorrod
1b6c815a3f Merge branch 'develop' into mongodb-3.6 2016-12-12 01:05:55 +00:00
Keith Bostic
1b812c0aa2 WT-3064 minor tree cleanups: .gitignore, NEWS misspelling (#3185) 2016-12-08 09:42:31 -05:00
Keith Bostic
a5c91bce5f WT-3057 WiredTiger hazard pointers should use the WT_REF, not the WT_PAGE. (#3181) 2016-12-08 14:05:26 +11:00
Michael Cahill
124eed30a0 WT-2336 Fix a "noreturn" warning in a new test. (#3183) 2016-12-07 16:31:06 +11:00
David Hows
5ebe8b7531 Bump release version on develop to 2.9.1 2016-12-07 16:07:22 +11:00
David Hows
fb1801585d Merge branch 'master' into develop 2016-12-07 15:53:27 +11:00
Don Anderson
587be3ea72 WT-2336 Add a test validating schema operations via file system call monitoring (#3059)
Take advantage of the above to create a maintainable .run file that works
on systems without ftruncate. Use macros to avoid using so many #ifdefs.

When output differences are detected, report the output's line number (or
range of lines numbers we tried to match) to make it easier to diagnose
differences.

Add O_NOATIME to list of predefines to check.  The probe needs to be
compiled -D_GNU_SOURCE on Linux.  Use all probed variables in the symbol
table when looking at strace/dtruss output, as strace uses symbolic flag names.
2016-12-07 14:29:11 +11:00
Michael Cahill
e4ee4d91f2 WT-3052 Improve search if index hint is wrong (#3166)
* After a split, child references in an internal page can end up in a different location in the index array.  WiredTiger maintains a hint of the expected offset, and searches if the expected reference is not found at the location of the hint.  We now search in both directions starting at the hint: the old hint can be wrong in either direction but usually not by much.

* Mark the index hint volatile: it would be incorrect if the compiler read it multiple times rather than using a single copy.
2016-12-07 14:07:09 +11:00
Keith Bostic
1adda6a0a5 WT-2960 Reduce likelihood of using the lookaside file, especially when inserting multi-megabyte values (#3171)
Don't configure the lookaside table as soon as eviction is stuck, only
configure the lookaside table if update/restore reconciliation fails and
there's reason to believe the lookaside table will be effective, based
on the updates that were skipped during the update/restore reconciliation.

The evaluation of whether an update/restore reconciliation would make
progress was a check for a single block rewrite with no updates to
restore or at least one update chain without a skipped entry. Check
more deeply, if there's any block without updates to be restored or at
least 10% of the update chains didn't have skipped entries, assume we're
making progress.
2016-12-07 13:52:34 +11:00
Don Anderson
c68e35c4c8 WT-3055 When an AsyncOp is created, cache the whether the cursor is "raw". (#3182)
Later, when an application is fetching keys/values from the AsyncOp,
the JAVA_CALLBACK object may be detached from the (java) AsyncOp, which makes
finding out information about the cursor impossible.
2016-12-07 11:26:03 +11:00
Michael Cahill
00c60c5e79 WT-3053 Make Python use internal memory allocation again. (#3179)
Since we aren't going to make allocation functions hidden, revert
changes to the Python API in WT-3014 so it uses internal memory
allocation functions, matching the Java API.
2016-12-06 14:12:41 +11:00
Keith Bostic
f1152ba768 WT-2969 Possible snapshot corruption during compaction (#3160)
* Change compaction to use database-wide checkpoints: rather than processing each file separately and checkpointing after each time we compact a file, do a compaction pass over all of the files then database-wide checkpoints.

* Save/restore the WT_SESSION_CAN_WAIT, WT_SESSION_NO_EVICTION flags set during checkpoint, the session handle may be used for other tasks in the future.

* There's no need to hold the checkpoint lock while opening the metadata cursor.

* When adc1cfb went in (WT-2394, gather handles for compaction first, before doing the actual compaction), we broke data-source support for compaction. Add back in data-source support and simplify the __wt_schema_worker() code, it no longer needs to know about LSM or data-source compaction.

* Disallow LSM compaction in an existing transaction (LSM didn't check, but there's no reason to special case LSM compaction so it can run in an existing transaction, and it's potentially confusing, or fragile if LSM compaction some day requires checkpoints).

* Do a checkpoint after removing the key/value pairs, otherwise we might not find anything to work with in our compaction pass.

* Replace WT_SESSION_LOCK_NO_WAIT with per-lock operation flags. If we set WT_SESSION_LOCK_NO_WAIT and the lock is acquired, then the underlying operation eventually needs to acquire its own locks, having the WT_SESSION_LOCK_NO_WAIT flag set in the session may not be correct.
2016-12-06 14:06:19 +11:00
Don Anderson
6b7d879a27 WT-3054 Make a PackOutputStream constructor that is compatible with the (#3175)
previous interface, allowing old tests to work without changes.
2016-12-06 12:48:47 +11:00
Alex Gorrod
1435e0c114 WT-3053 Revert: Python and Java support use internal WiredTiger functions (#3178) 2016-12-06 10:03:13 +11:00
Keith Bostic
f514d647ce WT-3053 Python and Java support use internal WiredTiger functions (#3174)
* WT-3053 Python and Java support use internal WiredTiger functions

Remove calls to internal WiredTiger functions from the Java and Python
APIs, meaning we no longer need to expose a few more internal WiredTiger
functions.

* Try using SWIGWIN instead of _MSC_VER for the swig windows #ifdef.

* Another try at a Windows #ifdef in the SWIG code.
2016-12-05 14:55:11 -05:00
sueloverso
853430ea86 WT-2670 Add access_pattern_hint configuration for tables (#3155) 2016-12-05 15:22:58 +11:00
Keith Bostic
d2dfe81c95 WT-3014 Add GCC/clang support for ELF symbol visibility. (#3138)
* 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.
2016-12-05 14:21:45 +11:00
Michael Cahill
873bda74e4 WT-3030 Fix a race between scans and splits reading the index hint. (#3173) 2016-12-05 11:52:22 +11:00
Keith Bostic
a9104cf7b4 WT-3051 Remove external __wt_hex symbol. (#3172) 2016-12-05 11:51:38 +11:00
Michael Cahill
2f18a859ce WT-3034 Add support for named snapshots including updates. (#3161)
This supports a model where one session performs updates in a transaction after creating a named snapshot and other sessions can use that snapshot and read the updates.  In other words, they see exactly what the updating session sees.
2016-12-05 11:49:34 +11:00
Keith Bostic
2573977de1 WT-3030 Test failure indicating invalid key order during traversal (#3157)
* WT-3030 Test failure indicating invalid key order during traversal

When dumping internal pages, print out the WT_REF pointer, not the
WT_PAGE pointer, that's what I need to dump the page.

* Assert there's no disk image when splitting root pages.
2016-12-02 07:02:58 -05:00
Don Anderson
938f6252f3 WT-3021 fixes for java log example, raw mode in java, and raw mode in log cursors (#3150)
* log cursors performing search must internally get keys; raw mode must be turned off temporarily to accomplish that. Use this same technique to clean up how keys/values are set.

* In java, when a raw mode cursor is created, allow setting key/value only via byte array.

* Synchronize java log example with the C version, including changing LSN from long to int and adding a count check to the simple log walk. Fix an error with how LSN file/offset was saved for a later search. The 'copy' table can now use S formats, since there is a way to insert them as raw records obtained from the log.
2016-12-02 17:46:36 +11:00
Keith Bostic
1f8860ea54 WT-3048 WiredTiger maximum size warning uses the wrong format. (#3164)
Also force the type of WT_BTREE_MAX_OBJECT_SIZE, there's no guarantee all
systems will consistently declare UINT32_MAX.
2016-12-02 09:25:55 +11:00
sueloverso
13215e81fc WT-3037 Clean up some log slot comments. (#3163) 2016-11-30 14:06:39 -05:00
Michael Cahill
6338c682ec WT-3028 Don't check for blocked eviction with in-memory workloads. (#3159)
* Don't check for blocked eviction with in-memory workloads.  The cache can become full of clean pages so eviction can't make progress, but application threads are not blocked.  We shouldn't fail in this case.

* Directly track if reconciliation makes progress.  Give up on page rewrites that don't use any updates.
2016-11-29 16:58:14 +11:00
Michael Cahill
49813035a9 WT-3028 Count eviction of dirty pages as progress. (#3158) 2016-11-25 16:41:42 +11:00
sueloverso
3519767074 WT-3025 Fix error path in log_force_sync. (#3154) 2016-11-17 12:04:57 +11:00
Michael Cahill
ca6eee06ff Merge branch 'develop' into mongodb-3.4 2016-11-16 21:09:45 +11:00
Michael Cahill
85121cf51f Merge branch 'develop' into mongodb-3.4 2016-11-15 17:03:37 +11:00
Michael Cahill
85ec028f36 Merge branch 'develop' into mongodb-3.4 2016-11-15 17:02:07 +11:00
Michael Cahill
038fc36723 Merge branch 'develop' into mongodb-3.4 2016-11-14 17:00:41 +11:00
Michael Cahill
74430da40c Merge branch 'develop' into mongodb-3.4 2016-11-07 16:41:41 +11:00
Michael Cahill
432ede0442 Merge branch 'develop' into mongodb-3.4 2016-11-04 21:05:26 +11:00
Alex Gorrod
ef9a7983ea Merge branch 'develop' into mongodb-3.4 2016-10-24 14:28:49 +11:00
Alex Gorrod
6a31c2118c Merge branch 'develop' into mongodb-3.4 2016-10-07 15:28:01 +11:00
Alex Gorrod
fc0e7abe82 Merge branch 'develop' into mongodb-3.4 2016-09-26 17:05:01 +10:00
Alex Gorrod
5bc03723a7 Merge branch 'develop' into mongodb-3.4 2016-09-16 06:21:24 +00:00
Michael Cahill
deeb0f589a Merge branch 'develop' into mongodb-3.4 2016-09-12 17:58:04 +10:00
Alex Gorrod
569c70d13a Merge branch 'develop' into mongodb-3.4 2016-09-09 15:46:16 +10:00
Alex Gorrod
65986fbb1d Merge branch 'develop' into mongodb-3.4 2016-09-08 17:35:12 +10:00
Michael Cahill
7d3c0f9f50 Merge branch 'develop' into mongodb-3.4 2016-08-29 22:22:24 +10:00
Alex Gorrod
2566118fc6 Merge branch 'develop' into mongodb-3.4 2016-08-26 07:35:09 +00:00
Michael Cahill
34182adadb Merge branch 'develop' into mongodb-3.4 2016-08-05 17:10:03 +10:00
Alex Gorrod
a9e96961ab Merge branch 'develop' into mongodb-3.4 2016-08-04 16:07:16 +10:00
David Hows
d8fb874fc4 Merge branch 'develop' of github.com:wiredtiger/wiredtiger into mongodb-3.4 2016-06-24 17:05:13 +10:00
Michael Cahill
fb1663e6fc Merge branch 'develop' into mongodb-3.4 2016-06-03 15:18:38 +10:00
Alex Gorrod
ff108d7c70 Merge branch 'develop' into mongodb-3.4 2016-06-01 12:38:19 +10:00
Alex Gorrod
6f9a7a41f2 Merge branch 'develop' into mongodb-3.4 2016-05-27 15:50:49 +10:00
Michael Cahill
636a7b25ef Merge branch 'develop' into mongodb-3.4 2016-05-05 15:38:12 +10:00
Michael Cahill
eaa7b5f0fc Merge pull request #2670 from wiredtiger/wt-2566
WT-2566 Lock/unlock operations should imply memory barriers.
(cherry picked from commit 05cfbc26c2)
2016-04-20 17:14:06 +10:00
Alex Gorrod
7bcf6fc668 Merge branch 'develop' into mongodb-3.4 2016-04-08 16:40:27 +10:00
Michael Cahill
94c171dbcd Merge branch 'develop' into mongodb-3.4 2016-04-07 17:10:40 +10:00
Alex Gorrod
5047aab626 Merge branch 'develop' into mongodb-3.4 2016-04-05 14:13:26 +10:00
Alex Gorrod
9cf8eb2f15 Merge branch 'develop' into mongodb-3.4 2016-03-22 14:49:51 +11:00
Alex Gorrod
444981a456 Merge branch 'develop' into mongodb-3.4 2016-03-03 08:56:19 +11:00
Alex Gorrod
4531b92b50 Merge branch 'develop' into mongodb-3.4 2016-02-29 16:09:13 +11:00
Michael Cahill
4f3828797f Merge pull request #2505 from wiredtiger/wt-2411
WT-2411 Drop the checkpoint lock when LSM is draining its queue.
(cherry picked from commit 2b78ad8a6b)
2016-02-19 15:35:48 +11:00
173 changed files with 4710 additions and 2026 deletions

1
.gitignore vendored
View File

@@ -122,4 +122,5 @@ _wiredtiger.pyd
**/test/recovery/random-abort
**/test/recovery/truncated-log
**/test/salvage/t
**/test/syscall/test_wt2336_base
**/test/thread/t

2
NEWS
View File

@@ -201,7 +201,7 @@ Other noteworthy changes since the previous release:
* WT-2769 Update documentation to reflect correct limits of memory_page_max
* WT-2770 Add statistics tracking schema operations
* WT-2772 Adjust log.wtperf config. Remove unneeded config entries
* WT-2773 Ensure that search_near in an index find's exact matches
* WT-2773 Ensure that search_near in an index finds exact matches
* WT-2774 Minor cleanups/improvements
* WT-2778 Enhance output formatting when running Python test suite
* WT-2779 Fix large pages getting generated with raw compression

6
README
View File

@@ -1,6 +1,6 @@
WiredTiger 2.9.0: (December 7, 2016)
WiredTiger 2.9.1: (December 7, 2016)
This is version 2.9.0 of WiredTiger.
This is version 2.9.1 of WiredTiger.
WiredTiger release packages and documentation can be found at:
@@ -8,7 +8,7 @@ WiredTiger release packages and documentation can be found at:
The documentation for this specific release can be found at:
http://source.wiredtiger.com/2.9.0/index.html
http://source.wiredtiger.com/2.9.1/index.html
The WiredTiger source code can be found at:

View File

@@ -1,6 +1,6 @@
WIREDTIGER_VERSION_MAJOR=2
WIREDTIGER_VERSION_MINOR=9
WIREDTIGER_VERSION_PATCH=0
WIREDTIGER_VERSION_PATCH=1
WIREDTIGER_VERSION="$WIREDTIGER_VERSION_MAJOR.$WIREDTIGER_VERSION_MINOR.$WIREDTIGER_VERSION_PATCH"
WIREDTIGER_RELEASE_DATE=`date "+%B %e, %Y"`

View File

@@ -294,6 +294,7 @@ env.Depends(wtdll, [filelistfile, version_file])
Default(wtlib, wtdll)
wtbin = env.Program("wt", [
"src/utilities/util_alter.c",
"src/utilities/util_backup.c",
"src/utilities/util_cpyright.c",
"src/utilities/util_compact.c",

View File

@@ -19,16 +19,19 @@
// under the License.
//
// -------------------------------------------------------------------
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <errno.h>
#include <limits.h>
#include <memory.h>
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <syslog.h>
#include <memory.h>
#include <errno.h>
#ifndef STORAGE_LEVELDB_INCLUDE_PERF_COUNT_H_
#include "perf_count.h"
@@ -36,8 +39,6 @@
#include "util/coding.h"
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#ifdef OS_SOLARIS
# include <atomic.h>

View File

@@ -27,6 +27,7 @@
#include "leveldb_wt.h"
#include <errno.h>
#include <stdlib.h>
#include <sstream>
#include <sys/param.h>
#include <sys/stat.h>
@@ -143,7 +144,14 @@ class ReplayIteratorImpl : public ReplayIterator {
}
private:
void SeekTo(WT_LSN *lsn);
/*
* A log sequence number, representing a position in the transaction log.
*/
typedef struct {
uint32_t file; /* Log file number */
unsigned long long offset; /* Log file offset */
} LSN;
void SeekTo(LSN *lsn);
// No copying allowed
ReplayIteratorImpl(const ReplayIterator&) { }
void operator=(const ReplayIterator&) { }
@@ -151,7 +159,7 @@ class ReplayIteratorImpl : public ReplayIterator {
Status status_;
WT_CURSOR *cursor_;
WT_ITEM key_, value_;
WT_LSN lsn_;
LSN lsn_;
bool valid_;
uint64_t txnid;
uint32_t fileid, opcount, optype, rectype;
@@ -201,7 +209,7 @@ ReplayIteratorImpl::Next() {
void
ReplayIteratorImpl::SeekToLast() {
int ret = 0;
WT_LSN last_lsn;
LSN last_lsn;
last_lsn.file = 0;
if (cursor_ != NULL) {
@@ -235,7 +243,7 @@ ReplayIteratorImpl::SeekToLast() {
void
ReplayIteratorImpl::SeekTo(const std::string& timestamp) {
WT_LSN target_lsn;
LSN target_lsn;
int ret = 0;
if (timestamp == "all") {
@@ -260,7 +268,7 @@ ReplayIteratorImpl::SeekTo(const std::string& timestamp) {
// Set the cursor on the first modification record at or after the
// given LSN.
void
ReplayIteratorImpl::SeekTo(WT_LSN *target_lsn) {
ReplayIteratorImpl::SeekTo(LSN *target_lsn) {
int ret = 0;
valid_ = false;

View File

@@ -43,6 +43,7 @@
#include "basho/perf_count.h"
#endif
#include <pthread.h>
#include "wiredtiger.h"
#define WT_URI "table:data"

View File

@@ -99,6 +99,11 @@ while test "$run" -le "$runmax"; do
if test "$?" -ne "0"; then
exit 1
fi
# Copy the artifacts from the run
backup_dir=${home}_$(basename $wttest)_${run}_$(date +"%s")
rsync -r -m --include="*Stat*" --include="CONFIG.wtperf" --include="*monitor" --include="latency*" --include="test.stat" --exclude="*" $home/ $backup_dir
# Load is always using floating point, so handle separately
l=`grep "^Load time:" ./WT_TEST/test.stat`
if test "$?" -eq "0"; then

View File

@@ -17,6 +17,7 @@ endif
bin_PROGRAMS = wt
wt_SOURCES =\
src/utilities/util_alter.c \
src/utilities/util_backup.c \
src/utilities/util_cpyright.c \
src/utilities/util_compact.c \

View File

@@ -40,6 +40,7 @@ test/packing
test/readonly
test/recovery
test/salvage
test/syscall
test/thread
# Benchmark programs.

View File

@@ -0,0 +1,74 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
# Check whether the given FLAG works with the current language's compiler
# or gives an error. (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the current language's default
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 4
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
AS_VAR_IF(CACHEVAR,yes,
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_COMPILE_FLAGS

View File

@@ -2,8 +2,8 @@ dnl build by dist/s_version
VERSION_MAJOR=2
VERSION_MINOR=9
VERSION_PATCH=0
VERSION_STRING='"WiredTiger 2.9.0: (December 7, 2016)"'
VERSION_PATCH=1
VERSION_STRING='"WiredTiger 2.9.1: (December 7, 2016)"'
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)

View File

@@ -1,2 +1,2 @@
dnl WiredTiger product version for AC_INIT. Maintained by dist/s_version
2.9.0
2.9.1

View File

@@ -22,33 +22,12 @@ AC_PROG_CC(cc gcc)
AC_PROG_CXX(c++ g++)
AM_PROG_AS(as gas)
# Configure options.
AM_OPTIONS
define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
LT_PREREQ(2.2.6)
LT_INIT([pic-only])
AC_SUBST([LIBTOOL_DEPS])
# If enable-strict is configured, turn on as much error checking as we can for
# this compiler. Intended for developers, and only works for gcc/clang, but it
# fills a need.
if test "$wt_cv_enable_strict" = "yes"; then
wt_cv_cc_version="`$CC --version | sed -eq`"
case "$wt_cv_cc_version" in
*clang*)
AM_CLANG_WARNINGS($wt_cv_cc_version);;
*cc*|*CC*) # cc, CC, gcc, GCC
AM_GCC_WARNINGS($wt_cv_cc_version);;
*)
AC_MSG_ERROR(
[--enable-strict does not support "$wt_cv_cc_version".]);;
esac
AM_CFLAGS="$AM_CFLAGS $wt_cv_strict_warnings"
fi
AM_CONDITIONAL([POSIX_HOST], [true])
AM_CONDITIONAL([WINDOWS_HOST], [false])
@@ -69,6 +48,7 @@ AS_CASE([$host_cpu],
[aarch64*], [wt_cv_arm64="yes"],
[wt_cv_arm64="no"])
AM_CONDITIONAL([ARM64_HOST], [test "$wt_cv_arm64" = "yes"])
AS_CASE([$host_os], [*solaris*], [wt_cv_solaris="yes"], [wt_cv_solaris="no"])
# This is a workaround as part of WT-2459. Currently, clang (v3.7) does not
# support compiling the ASM code we have to perform the CRC checks on PowerPC.
@@ -82,9 +62,17 @@ if test "$wt_cv_powerpc" = "yes" -a "$CC" != "$CCAS"; then
fi
AC_SUBST(AM_LIBTOOLFLAGS)
# WiredTiger uses anonymous unions to pad structures. It's part of C11, but
# some compilers require -std=c11 to support them. Turn on that flag for any
# compiler that supports it, except for Solaris, where gcc -std=c11 makes
# some none-C11 prototypes unavailable.
if test "$wt_cv_solaris" = "no"; then
AX_CHECK_COMPILE_FLAG([-std=c11], [AM_CFLAGS="$AM_CFLAGS -std=c11"])
fi
if test "$GCC" = "yes"; then
# The Solaris gcc compiler gets the additional -pthreads flag.
if test "`uname -s`" = "SunOS"; then
if test "$wt_cv_solaris" = "yes"; then
AM_CFLAGS="$AM_CFLAGS -pthreads"
fi
@@ -95,11 +83,35 @@ if test "$GCC" = "yes"; then
fi
else
# The Solaris native compiler gets the additional -mt flag.
if test "`uname -s`" = "SunOS"; then
if test "$wt_cv_solaris" = "yes"; then
AM_CFLAGS="$AM_CFLAGS -mt"
fi
fi
# Linux requires _GNU_SOURCE to be defined
AS_CASE([$host_os], [linux*], [AM_CFLAGS="$AM_CFLAGS -D_GNU_SOURCE"])
# If enable-strict is configured, turn on as much error checking as we can for
# this compiler. Intended for developers, and only works for gcc/clang, but it
# fills a need.
if test "$wt_cv_enable_strict" = "yes"; then
wt_cv_cc_version="`$CC --version | sed -eq`"
case "$wt_cv_cc_version" in
*clang*)
AM_CLANG_WARNINGS($wt_cv_cc_version);;
*cc*|*CC*) # cc, CC, gcc, GCC
AM_GCC_WARNINGS($wt_cv_cc_version);;
*)
AC_MSG_ERROR(
[--enable-strict does not support "$wt_cv_cc_version".]);;
esac
AM_CFLAGS="$AM_CFLAGS $wt_cv_strict_warnings"
fi
# Configure options.
AM_OPTIONS
# Java and Python APIs
if test "$wt_cv_enable_java" = "yes" -o "$wt_cv_enable_python" = "yes"; then
# Only a warning, we need to build release packages without SWIG.
@@ -121,7 +133,7 @@ if test "$wt_cv_enable_java" = "yes"; then
fi
if test "$wt_cv_enable_python" = "yes"; then
AM_PATH_PYTHON([2.6])
AM_PATH_PYTHON([2.7])
if test -n "$with_python_prefix" ; then
PYTHON_INSTALL_ARG="-d $with_python_prefix"
fi
@@ -159,11 +171,6 @@ if test "$ac_cv_sizeof_void_p" != "8" ; then
fi
AC_MSG_RESULT(yes)
# Linux requires _GNU_SOURCE to be defined
case "$host_os" in
linux*) AM_CFLAGS="$AM_CFLAGS -D_GNU_SOURCE" ;;
esac
# Linux requires buffers aligned to 4KB boundaries for O_DIRECT to work.
BUFFER_ALIGNMENT=0
if test "$ax_cv_func_posix_memalign_works" = "yes" ; then

3
dist/api_config.py vendored
View File

@@ -198,7 +198,8 @@ def get_default(c):
return 'false'
elif c.default == 'true':
return 'true'
elif t == 'string' and c.default == 'none':
elif t == 'string' and c.default == 'none' and \
not c.flags.get('choices', []):
return ''
elif t == 'category':
return '(%s)' % (','.join('%s=%s' % (subc.name, get_default(subc))

36
dist/api_data.py vendored
View File

@@ -118,8 +118,23 @@ lsm_config = [
]),
]
file_runtime_config = [
Config('access_pattern_hint', 'none', r'''
It is recommended that workloads that consist primarily of
updates and/or point queries specify \c random. Workloads that
do many cursor scans through large ranges of data specify
\c sequential and other workloads specify \c none. The
option leads to an advisory call to an appropriate operating
system API where available''',
choices=['none', 'random', 'sequential']),
Config('cache_resident', 'false', r'''
do not ever evict the object's pages from cache. Not compatible with
LSM tables; see @ref tuning_cache_resident for more information''',
type='boolean'),
]
# Per-file configuration
file_config = format_meta + [
file_config = format_meta + file_runtime_config + [
Config('block_allocation', 'best', r'''
configure block allocation. Permitted values are \c "first" or
\c "best"; the \c "first" configuration uses a first-available
@@ -138,10 +153,6 @@ file_config = format_meta + [
WT_CONNECTION::add_compressor. If WiredTiger has builtin support for
\c "lz4", \c "snappy", \c "zlib" or \c "zstd" compression, these names
are also available. See @ref compression for more information'''),
Config('cache_resident', 'false', r'''
do not ever evict the object's pages from cache. Not compatible with
LSM tables; see @ref tuning_cache_resident for more information''',
type='boolean'),
Config('checksum', 'uncompressed', r'''
configure block checksums; permitted values are <code>on</code>
(checksum all blocks), <code>off</code> (checksum no blocks) and
@@ -719,7 +730,7 @@ wiredtiger_open_common =\
Config('hazard_max', '1000', r'''
maximum number of simultaneous hazard pointers per session
handle''',
min='15'),
min=15, undoc=True),
Config('mmap', 'true', r'''
Use memory mapping to access files when possible''',
type='boolean'),
@@ -826,6 +837,8 @@ methods = {
'WT_CURSOR.reconfigure' : Method(cursor_runtime_config),
'WT_SESSION.alter' : Method(file_runtime_config),
'WT_SESSION.close' : Method([]),
'WT_SESSION.compact' : Method([
@@ -847,9 +860,10 @@ methods = {
'WT_SESSION.drop' : Method([
Config('checkpoint_wait', 'true', r'''
wait for the checkpoint lock, if \c checkpoint_wait=false, perform
the drop operation without taking a lock, returning EBUSY if the
operation conflicts with a running checkpoint''',
wait for concurrent checkpoints to complete before attempting the drop
operation. If \c checkpoint_wait=false, attempt the drop operation
without waiting, returning EBUSY if the operation conflicts with a
running checkpoint''',
type='boolean', undoc=True),
Config('force', 'false', r'''
return success if the object does not exist''',
@@ -1119,6 +1133,10 @@ methods = {
Config('to', '', r'''
drop all snapshots up to and including the specified name'''),
]),
Config('include_updates', 'false', r'''
make updates from the current transaction visible to users of the
named snapshot. Transactions started with such a named snapshot are
restricted to being read-only''', type='boolean'),
Config('name', '', r'''specify a name for the snapshot'''),
]),

1
dist/filelist vendored
View File

@@ -159,6 +159,7 @@ src/packing/pack_impl.c
src/packing/pack_stream.c
src/reconcile/rec_track.c
src/reconcile/rec_write.c
src/schema/schema_alter.c
src/schema/schema_create.c
src/schema/schema_drop.c
src/schema/schema_list.c

2
dist/flags.py vendored
View File

@@ -114,8 +114,6 @@ flags = {
'session' : [
'SESSION_CAN_WAIT',
'SESSION_INTERNAL',
'SESSION_IN_SPLIT',
'SESSION_LOCK_NO_WAIT',
'SESSION_LOCKED_CHECKPOINT',
'SESSION_LOCKED_HANDLE_LIST',
'SESSION_LOCKED_METADATA',

View File

@@ -1,5 +1,5 @@
Name: wiredtiger
Version: 2.9.0
Version: 2.9.1
Release: 1%{?dist}
Summary: WiredTiger data storage engine

10
dist/s_define.list vendored
View File

@@ -1,5 +1,4 @@
# List of WiredTiger #defines that are "unused", but it's OK.
ALIGN_CHECK
API_CALL
API_CALL_NOCONF
API_SESSION_INIT
@@ -8,17 +7,18 @@ JOINABLE_CURSOR_CALL_CHECK
LF_MASK
LLONG_MAX
LLONG_MIN
SIZE_CHECK
TXN_API_CALL
TXN_API_CALL_NOCONF
TXN_API_END
WIN32_LEAN_AND_MEAN
WT_ALIGN_CHECK
WT_ATOMIC_CAS
WT_ATOMIC_FUNC
WT_BLOCK_DESC_SIZE
WT_BLOCK_HEADER_SIZE
WT_CACHE_LINE_ALIGNMENT
WT_COMPILER_TYPE_ALIGN
WT_CACHE_LINE_PAD_BEGIN
WT_CACHE_LINE_PAD_END
WT_CONN_CHECK_PANIC
WT_DEADLOCK
WT_DEBUG_BYTE
@@ -35,10 +35,12 @@ WT_LOG_SLOT_MAXBITS
WT_LOG_SLOT_UNBUFFERED_ISSET
WT_PACKED_STRUCT_BEGIN
WT_PACKED_STRUCT_END
WT_PADDING_CHECK
WT_READ_BARRIER
WT_REF_SIZE
WT_SESSION_LOCKED_CHECKPOINT
WT_SESSION_LOCKED_TURTLE
WT_SIZE_CHECK
WT_STATS_FIELD_TO_OFFSET
WT_STATS_SLOT_ID
WT_STAT_CONN_DECRV
@@ -54,7 +56,7 @@ WT_STAT_INCRV_BASE
WT_STAT_WRITE
WT_TIMEDIFF_US
WT_TRET_ERROR_OK
WT_WITH_LOCK
WT_WITH_LOCK_NOWAIT
WT_WITH_LOCK_WAIT
__F
__WIREDTIGER_EXT_H_

5
dist/s_prototypes vendored
View File

@@ -39,9 +39,12 @@ proto()
-e H \
-e x \
-e '}' \
-e '# Add the gcc warn_unused_result attribute to any external' \
-e '# Add the warn_unused_result attribute to any external' \
-e '# functions that return an int.' \
-e '/^extern int /s/$/ WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result))/' \
-e '# Add the hidden attribute to any external functions without' \
-e '# an explicit visibility.' \
-e '/visibility/!s/$/ WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")))/' \
-e 's/$/;/' \
-e p < $1
}

4
dist/s_python vendored
View File

@@ -17,10 +17,10 @@ test -s $t && {
echo '[tab] characters appear in Python scripts:'
cat $t
}
# Check Python coding standards: check for trailing semi-colons.
# Check Python coding standards: check for uncommented trailing semi-colons.
# Don't check too widely, there are third-party tools that fail this test as
# well as scripts in this directory that output C code, and so fail the test.
egrep ';$' `find lang test -name '*.py'`> $t
egrep '^[^#]*;$' `find lang test -name '*.py'`> $t
test -s $t && {
echo 'trailing semi-colons in selected Python code:'
cat $t

2
dist/s_string.ok vendored
View File

@@ -159,6 +159,7 @@ HHHHLL
HHHLL
Hendrik
HyperLevelDB
ID's
IEC
IEEE
IKEY
@@ -251,6 +252,7 @@ NONINFRINGEMENT
NOTFOUND
NOTREACHED
NOVALUE
NOWAIT
NUL
NUM
NetBSD

40
dist/s_void vendored
View File

@@ -5,12 +5,14 @@ trap 'rm -f $t' 0 1 2 3 13 15
cd ..
# Turn a C file into a line per function that returns an int.
# Parse a C file, discarding functions that don't return an int, and formatting
# the remaining functions as a single line.
file_parse()
{
sed -n \
-e '/^int$/b loop' \
-e '/^static int$/b loop' \
-e '/^static inline int$/b loop' \
-e 'd' \
-e ': loop' \
-e 'H' \
@@ -34,6 +36,7 @@ func_ok()
-e '/int __compact_uri_analyze$/d' \
-e '/int __config_parser_close$/d' \
-e '/int __curlog_reset$/d' \
-e '/int __cursor_fix_implicit$/d' \
-e '/int __handle_close_default$/d' \
-e '/int __handle_progress_default$/d' \
-e '/int __im_file_close$/d' \
@@ -42,7 +45,7 @@ func_ok()
-e '/int __im_file_sync$/d' \
-e '/int __im_fs_directory_list_free$/d' \
-e '/int __im_fs_exist$/d' \
-e '/int __posix_file_close$/d' \
-e '/int __page_write_gen_wrapped_check$/d' \
-e '/int __posix_terminate$/d' \
-e '/int __rec_destroy_session$/d' \
-e '/int __win_terminate$/d' \
@@ -59,11 +62,14 @@ func_ok()
-e '/int __wt_lsm_manager_pop_entry$/d' \
-e '/int __wt_once$/d' \
-e '/int __wt_posix_directory_list_free$/d' \
-e '/int __wt_spin_init$/d' \
-e '/int __wt_spin_trylock$/d' \
-e '/int __wt_stat_connection_desc$/d' \
-e '/int __wt_stat_dsrc_desc$/d' \
-e '/int __wt_stat_join_desc$/d' \
-e '/int __wt_win_directory_list_free$/d' \
-e '/int bdb_compare_reverse$/d' \
-e '/int copyout_val$/d' \
-e '/int csv_error$/d' \
-e '/int csv_terminate$/d' \
-e '/int demo_file_close$/d' \
@@ -108,13 +114,14 @@ func_ok()
-e '/int zstd_terminate$/d'
}
# Complain about functions which return an "int" but which don't return except
# at the end of the function. This script is a kluge and isn't run by default.
for f in `find bench ext src test -name '*.[ci]'`; do
if expr "$f" : '.*/windows_shim.c' > /dev/null; then
continue
fi
# Complain about functions which return an "int" but which don't return
# except at the end of the function.
#
# Turn each function into a single line, then discard the function's
# final "return" call, then discard any function that still has some
# form of return assignment or call.
@@ -127,6 +134,9 @@ for f in `find bench ext src test -name '*.[ci]'`; do
-e '/WT_ILLEGAL_VALUE[A-Z_]*(/d' \
-e '/WT_PANIC[A-Z_]*(/d' \
-e '/WT_RET[A-Z_]*(/d' \
-e '/WT_SIZE_CHECK_PACK(/d' \
-e '/WT_SIZE_CHECK_UNPACK(/d' \
-e '/WT_SYSCALL(/d' \
-e '/WT_TRET(/d' \
-e '/[^a-z_]ret = /d' \
-e '/[^a-z_]return (/d' \
@@ -141,6 +151,28 @@ for f in `find bench ext src test -name '*.[ci]'`; do
echo "Add false positives to the list in dist/s_void."
echo "=============================================="
}
# Complain about functions which declare a "ret" value but never use it.
file_parse $f |
grep 'WT_DECL_RET' |
sed -e '/ret =/d' \
-e '/API_END_RET/d' \
-e '/WT_CURSOR_NEEDKEY/d' \
-e '/WT_CURSOR_NEEDVALUE/d' \
-e '/WT_ERR/d' \
-e '/WT_ILLEGAL_VALUE_ERR/d' \
-e '/WT_SYSCALL.*ret/d' \
-e '/WT_TRET/d' \
-e 's/^\([^(]*\).*/\1/' \
-e 's/^ *//' > $t
test -s $t && {
echo "=============================================="
echo "$f:"
cat $t | sed 's/^/ /'
echo "Function declares ret without using it."
echo "Add false positives to the list in dist/s_void."
echo "=============================================="
}
done
exit 0

3
dist/stat_data.py vendored
View File

@@ -367,6 +367,9 @@ connection_stats = [
##########################################
SessionStat('session_cursor_open', 'open cursor count', 'no_clear,no_scale'),
SessionStat('session_open', 'open session count', 'no_clear,no_scale'),
SessionStat('session_table_alter_fail', 'table alter failed calls', 'no_clear,no_scale'),
SessionStat('session_table_alter_skip', 'table alter unchanged and skipped', 'no_clear,no_scale'),
SessionStat('session_table_alter_success', 'table alter successful calls', 'no_clear,no_scale'),
SessionStat('session_table_compact_fail', 'table compact failed calls', 'no_clear,no_scale'),
SessionStat('session_table_compact_success', 'table compact successful calls', 'no_clear,no_scale'),
SessionStat('session_table_create_fail', 'table create failed calls', 'no_clear,no_scale'),

View File

@@ -557,6 +557,12 @@ session_ops(WT_SESSION *session)
/*! [Create a column-store table] */
ret = session->create(session,
"table:mytable", "key_format=r,value_format=S");
/*! [Alter a table] */
ret = session->alter(session,
"table:mytable", "access_pattern_hint=random");
/*! [Alter a table] */
/*! [Create a column-store table] */
ret = session->drop(session, "table:mytable", NULL);

View File

@@ -46,6 +46,21 @@ my_data_source_init(WT_CONNECTION *connection)
}
/*! [WT_EXTENSION_API declaration] */
/*! [WT_DATA_SOURCE alter] */
static int
my_alter(WT_DATA_SOURCE *dsrc, WT_SESSION *session,
const char *uri, WT_CONFIG_ARG *config)
/*! [WT_DATA_SOURCE alter] */
{
/* Unused parameters */
(void)dsrc;
(void)session;
(void)uri;
(void)config;
return (0);
}
/*! [WT_DATA_SOURCE create] */
static int
my_create(WT_DATA_SOURCE *dsrc, WT_SESSION *session,
@@ -604,6 +619,7 @@ main(void)
{
/*! [WT_DATA_SOURCE register] */
static WT_DATA_SOURCE my_dsrc = {
my_alter,
my_create,
my_compact,
my_drop,

View File

@@ -29,35 +29,49 @@
* demonstrates how to use the custom file system interface
*/
/*
* Include WiredTiger internal functions: we need architecture portable locking
* in this example, and we use the TAILQ_XXX functions to keep the code simple.
*
* Application-writers SHOULD NOT INCLUDE "wt_internal.h", the public WiredTiger
* include files should be used instead:
*
* #include <wiredtiger.h>
* #include <wiredtiger_ext.h>
*/
#include "wt_internal.h"
#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <queue.h>
#include <stdlib.h>
#include <string.h>
#ifndef _WIN32
#include <pthread.h>
#else
#include "windows_shim.h"
#endif
#include <wiredtiger.h>
#include <wiredtiger_ext.h>
/*
* This example code uses internal WiredTiger functions for portable locking.
* We use #defines to clarify the meaning and ignore errors to simplify the
* code.
*
* Application writers SHOULD NOT COPY THIS LOCKING CODE, it's special-case code
* to make this example portable across platforms.
* This example code uses pthread functions for portable locking, we ignore
* errors for simplicity.
*/
#define ALLOCATE_FILE_SYSTEM_LOCK(demo_fs) \
(void)__wt_spin_init(NULL, &(demo_fs)->lock, "demo file handle lock")
#define DESTROY_FILE_SYSTEM_LOCK(wt_session, demo_fs) \
__wt_spin_destroy((WT_SESSION_IMPL *)(wt_session), &(demo_fs)->lock)
#define LOCK_FILE_SYSTEM(wt_session, demo_fs) \
__wt_spin_lock((WT_SESSION_IMPL *)(wt_session), &(demo_fs)->lock)
#define UNLOCK_FILE_SYSTEM(wt_session, demo_fs) \
__wt_spin_unlock( \
(WT_SESSION_IMPL *)(wt_session), &(demo_fs)->lock)
static void
allocate_file_system_lock(pthread_rwlock_t *lockp)
{
assert(pthread_rwlock_init(lockp, NULL) == 0);
}
static void
destroy_file_system_lock(pthread_rwlock_t *lockp)
{
assert(pthread_rwlock_destroy(lockp) == 0);
}
static void
lock_file_system(pthread_rwlock_t *lockp)
{
assert(pthread_rwlock_wrlock(lockp) == 0);
}
static void
unlock_file_system(pthread_rwlock_t *lockp)
{
assert(pthread_rwlock_unlock(lockp) == 0);
}
/*
* Example file system implementation, using memory buffers to represent files.
@@ -72,7 +86,7 @@ typedef struct {
* might require finer granularity, for example, a single lock for the
* file system handle list and per-handle locks serializing I/O.
*/
WT_SPINLOCK lock; /* Lock */
pthread_rwlock_t lock; /* Lock */
int opened_file_count;
int opened_unique_file_count;
@@ -239,7 +253,7 @@ demo_file_system_create(WT_CONNECTION *conn, WT_CONFIG_ARG *config)
goto err;
}
ALLOCATE_FILE_SYSTEM_LOCK(demo_fs);
allocate_file_system_lock(&demo_fs->lock);
/* Initialize the in-memory jump table. */
file_system->fs_directory_list = demo_fs_directory_list;
@@ -288,7 +302,7 @@ demo_fs_open(WT_FILE_SYSTEM *file_system, WT_SESSION *session,
demo_fh = NULL;
wtext = demo_fs->wtext;
LOCK_FILE_SYSTEM(session, demo_fs);
lock_file_system(&demo_fs->lock);
++demo_fs->opened_file_count;
/*
@@ -308,7 +322,7 @@ demo_fs_open(WT_FILE_SYSTEM *file_system, WT_SESSION *session,
*file_handlep = (WT_FILE_HANDLE *)demo_fh;
UNLOCK_FILE_SYSTEM(session, demo_fs);
unlock_file_system(&demo_fs->lock);
return (0);
}
@@ -366,7 +380,7 @@ err: free(demo_fh->buf);
free(demo_fh);
}
UNLOCK_FILE_SYSTEM(session, demo_fs);
unlock_file_system(&demo_fs->lock);
return (ret);
}
@@ -386,6 +400,8 @@ demo_fs_directory_list(WT_FILE_SYSTEM *file_system,
int ret = 0;
char *name, **entries;
(void)session; /* Unused */
demo_fs = (DEMO_FILE_SYSTEM *)file_system;
*dirlistp = NULL;
@@ -396,7 +412,7 @@ demo_fs_directory_list(WT_FILE_SYSTEM *file_system,
len = strlen(directory);
prefix_len = prefix == NULL ? 0 : strlen(prefix);
LOCK_FILE_SYSTEM(session, demo_fs);
lock_file_system(&demo_fs->lock);
TAILQ_FOREACH(demo_fh, &demo_fs->fileq, q) {
name = demo_fh->iface.name;
if (strncmp(name, directory, len) != 0 ||
@@ -424,7 +440,7 @@ demo_fs_directory_list(WT_FILE_SYSTEM *file_system,
*dirlistp = entries;
*countp = count;
err: UNLOCK_FILE_SYSTEM(session, demo_fs);
err: unlock_file_system(&demo_fs->lock);
if (ret == 0)
return (0);
@@ -466,11 +482,13 @@ demo_fs_exist(WT_FILE_SYSTEM *file_system,
{
DEMO_FILE_SYSTEM *demo_fs;
(void)session; /* Unused */
demo_fs = (DEMO_FILE_SYSTEM *)file_system;
LOCK_FILE_SYSTEM(session, demo_fs);
lock_file_system(&demo_fs->lock);
*existp = demo_handle_search(file_system, name) != NULL;
UNLOCK_FILE_SYSTEM(session, demo_fs);
unlock_file_system(&demo_fs->lock);
return (0);
}
@@ -487,15 +505,16 @@ demo_fs_remove(WT_FILE_SYSTEM *file_system,
DEMO_FILE_HANDLE *demo_fh;
int ret = 0;
(void)flags; /* Unused */
(void)session; /* Unused */
(void)flags; /* Unused */
demo_fs = (DEMO_FILE_SYSTEM *)file_system;
ret = ENOENT;
LOCK_FILE_SYSTEM(session, demo_fs);
lock_file_system(&demo_fs->lock);
if ((demo_fh = demo_handle_search(file_system, name)) != NULL)
ret = demo_handle_remove(session, demo_fh);
UNLOCK_FILE_SYSTEM(session, demo_fs);
unlock_file_system(&demo_fs->lock);
return (ret);
}
@@ -513,11 +532,12 @@ demo_fs_rename(WT_FILE_SYSTEM *file_system,
char *copy;
int ret = 0;
(void)flags; /* Unused */
(void)session; /* Unused */
(void)flags; /* Unused */
demo_fs = (DEMO_FILE_SYSTEM *)file_system;
LOCK_FILE_SYSTEM(session, demo_fs);
lock_file_system(&demo_fs->lock);
if ((demo_fh = demo_handle_search(file_system, from)) == NULL)
ret = ENOENT;
else if ((copy = strdup(to)) == NULL)
@@ -526,7 +546,7 @@ demo_fs_rename(WT_FILE_SYSTEM *file_system,
free(demo_fh->iface.name);
demo_fh->iface.name = copy;
}
UNLOCK_FILE_SYSTEM(session, demo_fs);
unlock_file_system(&demo_fs->lock);
return (ret);
}
@@ -545,10 +565,10 @@ demo_fs_size(WT_FILE_SYSTEM *file_system,
demo_fs = (DEMO_FILE_SYSTEM *)file_system;
ret = ENOENT;
LOCK_FILE_SYSTEM(session, demo_fs);
lock_file_system(&demo_fs->lock);
if ((demo_fh = demo_handle_search(file_system, name)) != NULL)
ret = demo_file_size((WT_FILE_HANDLE *)demo_fh, session, sizep);
UNLOCK_FILE_SYSTEM(session, demo_fs);
unlock_file_system(&demo_fs->lock);
return (ret);
}
@@ -578,7 +598,7 @@ demo_fs_terminate(WT_FILE_SYSTEM *file_system, WT_SESSION *session)
printf("\t%d reads, %d writes\n",
demo_fs->read_ops, demo_fs->write_ops);
DESTROY_FILE_SYSTEM_LOCK(session, demo_fs);
destroy_file_system_lock(&demo_fs->lock);
free(demo_fs);
return (ret);
@@ -594,13 +614,15 @@ demo_file_close(WT_FILE_HANDLE *file_handle, WT_SESSION *session)
DEMO_FILE_HANDLE *demo_fh;
DEMO_FILE_SYSTEM *demo_fs;
(void)session; /* Unused */
demo_fh = (DEMO_FILE_HANDLE *)file_handle;
demo_fs = demo_fh->demo_fs;
LOCK_FILE_SYSTEM(session, demo_fs);
lock_file_system(&demo_fs->lock);
if (--demo_fh->ref == 0)
++demo_fs->closed_file_count;
UNLOCK_FILE_SYSTEM(session, demo_fs);
unlock_file_system(&demo_fs->lock);
return (0);
}
@@ -638,7 +660,7 @@ demo_file_read(WT_FILE_HANDLE *file_handle,
wtext = demo_fs->wtext;
off = (size_t)offset;
LOCK_FILE_SYSTEM(session, demo_fs);
lock_file_system(&demo_fs->lock);
++demo_fs->read_ops;
if (off < demo_fh->size) {
if (len > demo_fh->size - off)
@@ -646,7 +668,7 @@ demo_file_read(WT_FILE_HANDLE *file_handle,
memcpy(buf, (uint8_t *)demo_fh->buf + off, len);
} else
ret = EIO; /* EOF */
UNLOCK_FILE_SYSTEM(session, demo_fs);
unlock_file_system(&demo_fs->lock);
if (ret == 0)
return (0);
@@ -667,12 +689,14 @@ demo_file_size(
DEMO_FILE_HANDLE *demo_fh;
DEMO_FILE_SYSTEM *demo_fs;
(void)session; /* Unused */
demo_fh = (DEMO_FILE_HANDLE *)file_handle;
demo_fs = demo_fh->demo_fs;
LOCK_FILE_SYSTEM(session, demo_fs);
lock_file_system(&demo_fs->lock);
*sizep = (wt_off_t)demo_fh->size;
UNLOCK_FILE_SYSTEM(session, demo_fs);
unlock_file_system(&demo_fs->lock);
return (0);
}
@@ -739,10 +763,10 @@ demo_file_truncate(
demo_fh = (DEMO_FILE_HANDLE *)file_handle;
demo_fs = demo_fh->demo_fs;
LOCK_FILE_SYSTEM(session, demo_fs);
lock_file_system(&demo_fs->lock);
if ((ret = demo_buffer_resize(session, demo_fh, offset)) == 0)
demo_fh->size = (size_t)offset;
UNLOCK_FILE_SYSTEM(session, demo_fs);
unlock_file_system(&demo_fs->lock);
return (ret);
}
@@ -765,7 +789,7 @@ demo_file_write(WT_FILE_HANDLE *file_handle, WT_SESSION *session,
wtext = demo_fs->wtext;
off = (size_t)offset;
LOCK_FILE_SYSTEM(session, demo_fs);
lock_file_system(&demo_fs->lock);
++demo_fs->write_ops;
if ((ret = demo_buffer_resize(session, demo_fh,
offset + (wt_off_t)(len + DEMO_FILE_SIZE_INCREMENT))) == 0) {
@@ -773,7 +797,7 @@ demo_file_write(WT_FILE_HANDLE *file_handle, WT_SESSION *session,
if (off + len > demo_fh->size)
demo_fh->size = off + len;
}
UNLOCK_FILE_SYSTEM(session, demo_fs);
unlock_file_system(&demo_fs->lock);
if (ret == 0)
return (0);

View File

@@ -30,14 +30,13 @@
* table from multiple threads.
*/
#ifndef _WIN32
#include <pthread.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#ifndef _WIN32
#include <pthread.h>
#else
#include "windows_shim.h"
#endif

View File

@@ -35,7 +35,7 @@ import java.util.*;
class Lsn {
int file;
long offset;
int offset;
}
public class ex_log {
@@ -57,7 +57,7 @@ public class ex_log {
conn = wiredtiger.open(home2, CONN_CONFIG);
Session session = conn.open_session(null);
session.create(uri, "key_format=U,value_format=U");
session.create(uri, "key_format=S,value_format=S");
return (session);
}
@@ -72,17 +72,17 @@ public class ex_log {
while ((ret = cursor.next()) == 0) {
ret = curs_copy.next();
byte[] key = cursor.getKeyByteArray();
byte[] value = cursor.getValueByteArray();
byte[] key_copy = curs_copy.getKeyByteArray();
byte[] value_copy = curs_copy.getValueByteArray();
if (!Arrays.equals(key, key_copy) ||
!Arrays.equals(value, value_copy)) {
String key = cursor.getKeyString();
String value = cursor.getValueString();
String key_copy = curs_copy.getKeyString();
String value_copy = curs_copy.getValueString();
if (!key.equals(key_copy) ||
!value.equals(value_copy)) {
System.err.println(
"Mismatched: key " + new String(key) +
", key_copy " + new String(key_copy) +
", value " + new String(value) +
", value_copy " + new String(value_copy));
"Mismatched: key " + key + ", key_copy " + key_copy +
", value " + value + ", value_copy " + value_copy);
ret = cursor.close();
ret = curs_copy.close();
return (1);
}
}
@@ -121,7 +121,7 @@ public class ex_log {
* A simple walk of the log.
*/
static int
simple_walk_log(Session session)
simple_walk_log(Session session, int count_min)
throws WiredTigerException
{
Cursor cursor;
@@ -129,16 +129,18 @@ public class ex_log {
byte[] logrec_key, logrec_value;
long txnid;
int fileid, opcount, optype, rectype;
int ret;
int count, ret;
/*! [log cursor open] */
cursor = session.open_cursor("log:", null, null);
/*! [log cursor open] */
count = 0;
while ((ret = cursor.next()) == 0) {
count++;
/*! [log cursor get_key] */
lsn.file = cursor.getKeyInt();
lsn.offset = cursor.getKeyLong();
lsn.offset = cursor.getKeyInt();
opcount = cursor.getKeyInt();
/*! [log cursor get_key] */
/*! [log cursor get_value] */
@@ -156,6 +158,11 @@ public class ex_log {
if (ret == wiredtiger.WT_NOTFOUND)
ret = 0;
ret = cursor.close();
if (count < count_min) {
System.err.println("Expected minimum " + count_min +
" records, found " + count);
return (1);
}
return (ret);
}
/*! [log cursor walk] */
@@ -185,7 +192,7 @@ public class ex_log {
lsnsave = new Lsn();
while ((ret = cursor.next()) == 0) {
lsn.file = cursor.getKeyInt();
lsn.offset = cursor.getKeyLong();
lsn.offset = cursor.getKeyInt();
opcount = cursor.getKeyInt();
/*
@@ -194,8 +201,10 @@ public class ex_log {
* that LSN to the end (where the multi-step transaction
* was performed). Just choose the record that is MAX_KEYS.
*/
if (++i == MAX_KEYS)
lsnsave = lsn;
if (++i == MAX_KEYS) {
lsnsave.file = lsn.file;
lsnsave.offset = lsn.offset;
}
txnid = cursor.getValueLong();
rectype = cursor.getValueInt();
optype = cursor.getValueInt();
@@ -217,10 +226,10 @@ public class ex_log {
/*
* If the operation is a put, replay it here on the backup
* connection. Note, we cheat by looking only for fileid 1
* in this example. The metadata is fileid 0.
* connection. Note, we cheat by looking at the fileid.
* The metadata is fileid 0, skip its records.
*/
if (fileid == 1 && rectype == wiredtiger.WT_LOGREC_COMMIT &&
if (fileid != 0 && rectype == wiredtiger.WT_LOGREC_COMMIT &&
optype == wiredtiger.WT_LOGOP_ROW_PUT) {
if (!in_txn) {
ret = session2.begin_transaction(null);
@@ -238,15 +247,20 @@ public class ex_log {
/*
* Compare the tables after replay. They should be identical.
*/
if (compare_tables(session, session2) != 0)
System.out.println("compare failed");
if (compare_tables(session, session2) != 0) {
cursor.close();
session2.close(null);
wt_conn2.close(null);
return (ret);
}
ret = session2.close(null);
ret = wt_conn2.close(null);
ret = cursor.reset();
/*! [log cursor set_key] */
cursor.putKeyInt(lsnsave.file);
cursor.putKeyLong(lsnsave.offset);
cursor.putKeyInt(lsnsave.offset);
cursor.putKeyInt(0);
/*! [log cursor set_key] */
/*! [log cursor search] */
ret = cursor.search();
@@ -256,9 +270,9 @@ public class ex_log {
* Walk all records starting with this key.
*/
first = true;
while (ret == 0) { /*TODO: not quite right*/
while (ret == 0) {
lsn.file = cursor.getKeyInt();
lsn.offset = cursor.getKeyLong();
lsn.offset = cursor.getKeyInt();
opcount = cursor.getKeyInt();
if (first) {
first = false;
@@ -293,8 +307,9 @@ public class ex_log {
Connection wt_conn;
Cursor cursor;
Session session;
int i, record_count, ret;
int count_min, i, record_count, ret;
count_min = 0;
try {
String command = "/bin/rm -rf " + home1 + " " + home2;
Process proc = Runtime.getRuntime().exec(command);
@@ -317,6 +332,7 @@ public class ex_log {
session = wt_conn.open_session(null);
ret = session.create(uri, "key_format=S,value_format=S");
count_min++;
cursor = session.open_cursor(uri, null, null);
/*
@@ -328,6 +344,7 @@ public class ex_log {
cursor.putKeyString(k);
cursor.putValueString(v);
ret = cursor.insert();
count_min++;
}
ret = session.begin_transaction(null);
/*
@@ -341,10 +358,12 @@ public class ex_log {
ret = cursor.insert();
}
ret = session.commit_transaction(null);
count_min++;
ret = cursor.close();
/*! [log cursor printf] */
ret = session.log_printf("Wrote " + record_count + " records");
count_min++;
/*! [log cursor printf] */
session.close(null);
@@ -360,7 +379,7 @@ public class ex_log {
}
session = wt_conn.open_session(null);
ret = simple_walk_log(session);
ret = simple_walk_log(session, count_min);
ret = walk_log(session);
ret = session.close(null);
ret = wt_conn.close(null);

View File

@@ -3329,6 +3329,7 @@ wiredtiger_extension_init(WT_CONNECTION *connection, WT_CONFIG_ARG *config)
* compile-time should the structure change underneath us.
*/
static const WT_DATA_SOURCE wtds = {
NULL, /* No session.alter */
helium_session_create, /* session.create */
NULL, /* No session.compaction */
helium_session_drop, /* session.drop */

View File

@@ -1016,9 +1016,10 @@ wiredtiger_extension_init(WT_CONNECTION *connection, WT_CONFIG_ARG *config)
{
/*
* List of the WT_DATA_SOURCE methods -- it's static so it breaks at
* compile-time should the structure changes underneath us.
* compile-time should the structure change underneath us.
*/
static WT_DATA_SOURCE wtds = {
NULL, /* No session.alter */
kvs_session_create, /* session.create */
NULL, /* No session.compaction */
kvs_session_drop, /* session.drop */

View File

@@ -27,6 +27,7 @@ COPYDOC(__wt_async_op, WT_ASYNC_OP, remove)
COPYDOC(__wt_async_op, WT_ASYNC_OP, compact)
COPYDOC(__wt_async_op, WT_ASYNC_OP, get_id)
COPYDOC(__wt_async_op, WT_ASYNC_OP, get_type)
COPYDOC(__wt_session, WT_SESSION, alter)
COPYDOC(__wt_session, WT_SESSION, close)
COPYDOC(__wt_session, WT_SESSION, reconfigure)
COPYDOC(__wt_session, WT_SESSION, open_cursor)

View File

@@ -42,6 +42,7 @@ public class PackOutputStream {
protected PackFormatInputStream format;
protected ByteArrayOutputStream packed;
protected byte[] intBuf;
protected boolean isRaw;
/**
* Constructor.
@@ -50,9 +51,21 @@ public class PackOutputStream {
* defines the layout of this packed value.
*/
public PackOutputStream(String format) {
this.format = new PackFormatInputStream(format, false);
intBuf = new byte[MAX_INT_BYTES];
packed = new ByteArrayOutputStream(100);
this(format, false);
}
/**
* Constructor.
*
* \param format A String that contains the WiredTiger format that
* defines the layout of this packed value.
* \param isRaw The stream is opened raw.
*/
public PackOutputStream(String format, boolean isRaw) {
this.format = new PackFormatInputStream(format, isRaw);
this.intBuf = new byte[MAX_INT_BYTES];
this.packed = new ByteArrayOutputStream(100);
this.isRaw = isRaw;
}
/**
@@ -111,7 +124,9 @@ public class PackOutputStream {
throws WiredTigerPackingException {
int padBytes = 0;
format.checkType('U', false);
if (!isRaw) {
format.checkType('U', false);
}
boolean havesize = format.hasLength();
char type = format.getType();
if (havesize) {

View File

@@ -127,7 +127,7 @@ static void throwWiredTigerException(JNIEnv *jenv, int err) {
%typemap(javain) uint64_t "$javainput"
%typemap(javaout) uint64_t {
return $jnicall;
return ($jnicall);
}
/* Return byte[] from cursor.get_value */
@@ -137,7 +137,7 @@ static void throwWiredTigerException(JNIEnv *jenv, int err) {
%typemap(javain) WT_ITEM, WT_ITEM * "$javainput"
%typemap(javaout) WT_ITEM, WT_ITEM * {
return $jnicall;
return ($jnicall);
}
%typemap(in) WT_ITEM * (WT_ITEM item) %{
@@ -165,7 +165,7 @@ static void throwWiredTigerException(JNIEnv *jenv, int err) {
%typemap(out) int %{
if ($1 != 0 && $1 != WT_NOTFOUND) {
throwWiredTigerException(jenv, $1);
return $null;
return ($null);
}
$result = $1;
%}
@@ -174,7 +174,7 @@ static void throwWiredTigerException(JNIEnv *jenv, int err) {
if (!val) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException,
#name " is null");
return $null;
return ($null);
}
%enddef
@@ -537,7 +537,7 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
k.data = NULL;
if ((ret = $self->get_key($self, &k)) != 0)
throwWiredTigerException(jenv, ret);
return k;
return (k);
}
%javamethodmodifiers get_value_wrap "protected";
@@ -547,40 +547,40 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
v.data = NULL;
if ((ret = $self->get_value($self, &v)) != 0)
throwWiredTigerException(jenv, ret);
return v;
return (v);
}
%javamethodmodifiers insert_wrap "protected";
int insert_wrap(WT_ITEM *k, WT_ITEM *v) {
$self->set_key($self, k);
$self->set_value($self, v);
return $self->insert($self);
return ($self->insert($self));
}
%javamethodmodifiers remove_wrap "protected";
int remove_wrap(WT_ITEM *k) {
$self->set_key($self, k);
return $self->remove($self);
return ($self->remove($self));
}
%javamethodmodifiers search_wrap "protected";
int search_wrap(WT_ITEM *k) {
$self->set_key($self, k);
return $self->search($self);
return ($self->search($self));
}
%javamethodmodifiers update_wrap "protected";
int update_wrap(WT_ITEM *k, WT_ITEM *v) {
$self->set_key($self, k);
$self->set_value($self, v);
return $self->update($self);
return ($self->update($self));
}
%javamethodmodifiers _java_raw "protected";
bool _java_raw(JNIEnv *jenv) {
(void)jenv;
JAVA_CALLBACK *jcb = (JAVA_CALLBACK *)$self->c.lang_private;
return jcb->cursor_raw;
return (jcb->cursor_raw);
}
%javamethodmodifiers _java_init "protected";
@@ -597,6 +597,7 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
%typemap(javabody) struct __wt_async_op %{
private long swigCPtr;
protected boolean swigCMemOwn;
protected boolean javaRaw;
protected String keyFormat;
protected String valueFormat;
protected PackOutputStream keyPacker;
@@ -609,13 +610,14 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
swigCPtr = cPtr;
keyFormat = getKey_format();
valueFormat = getValue_format();
keyPacker = new PackOutputStream(keyFormat);
valuePacker = new PackOutputStream(valueFormat);
javaRaw = _java_raw();
keyPacker = new PackOutputStream(keyFormat, javaRaw);
valuePacker = new PackOutputStream(valueFormat, javaRaw);
wiredtigerJNI.AsyncOp__java_init(swigCPtr, this, this);
}
protected static long getCPtr($javaclassname obj) {
return (obj == null) ? 0 : obj.swigCPtr;
return ((obj == null) ? 0 : obj.swigCPtr);
}
%}
@@ -1098,7 +1100,7 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
if (keyUnpacker == null)
keyUnpacker =
new PackInputStream(keyFormat, get_key_wrap(),
_java_raw());
javaRaw);
return keyUnpacker;
}
@@ -1112,7 +1114,7 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
if (valueUnpacker == null)
valueUnpacker =
new PackInputStream(valueFormat, get_value_wrap(),
_java_raw());
javaRaw);
return valueUnpacker;
}
@@ -1127,7 +1129,7 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
k.data = NULL;
if ((ret = $self->get_key($self, &k)) != 0)
throwWiredTigerException(jenv, ret);
return k;
return (k);
}
%javamethodmodifiers get_value_wrap "protected";
@@ -1137,20 +1139,20 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
v.data = NULL;
if ((ret = $self->get_value($self, &v)) != 0)
throwWiredTigerException(jenv, ret);
return v;
return (v);
}
%javamethodmodifiers insert_wrap "protected";
int insert_wrap(WT_ITEM *k, WT_ITEM *v) {
$self->set_key($self, k);
$self->set_value($self, v);
return $self->insert($self);
return ($self->insert($self));
}
%javamethodmodifiers remove_wrap "protected";
int remove_wrap(WT_ITEM *k) {
$self->set_key($self, k);
return $self->remove($self);
return ($self->remove($self));
}
%javamethodmodifiers reset_wrap "protected";
@@ -1161,7 +1163,7 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
%javamethodmodifiers search_wrap "protected";
int search_wrap(WT_ITEM *k) {
$self->set_key($self, k);
return $self->search($self);
return ($self->search($self));
}
%javamethodmodifiers search_near_wrap "protected";
@@ -1181,7 +1183,7 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
int update_wrap(WT_ITEM *k, WT_ITEM *v) {
$self->set_key($self, k);
$self->set_value($self, v);
return $self->update($self);
return ($self->update($self));
}
%javamethodmodifiers compare_wrap "protected";
@@ -1189,7 +1191,7 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
int cmp, ret = $self->compare($self, other, &cmp);
if (ret != 0)
throwWiredTigerException(jenv, ret);
return cmp;
return (cmp);
}
%javamethodmodifiers equals_wrap "protected";
@@ -1197,14 +1199,14 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
int cmp, ret = $self->equals($self, other, &cmp);
if (ret != 0)
throwWiredTigerException(jenv, ret);
return cmp;
return (cmp);
}
%javamethodmodifiers _java_raw "protected";
bool _java_raw(JNIEnv *jenv) {
(void)jenv;
JAVA_CALLBACK *jcb = (JAVA_CALLBACK *)$self->lang_private;
return jcb->cursor_raw;
return (jcb->cursor_raw);
}
%javamethodmodifiers _java_init "protected";
@@ -1232,8 +1234,8 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
swigCPtr = cPtr;
keyFormat = getKey_format();
valueFormat = getValue_format();
keyPacker = new PackOutputStream(keyFormat);
valuePacker = new PackOutputStream(valueFormat);
keyPacker = new PackOutputStream(keyFormat, _java_raw());
valuePacker = new PackOutputStream(valueFormat, _java_raw());
wiredtigerJNI.Cursor__java_init(swigCPtr, this, this);
}
@@ -1953,7 +1955,7 @@ WT_CONNECTION *wiredtiger_open_wrap(JNIEnv *jenv, const char *home, const char *
err: if (ret != 0)
throwWiredTigerException(jenv, ret);
return conn;
return (conn);
}
}
@@ -1983,7 +1985,7 @@ err: if (ret != 0)
err: if (ret != 0)
throwWiredTigerException(jenv, ret);
return asyncop;
return (asyncop);
}
}
@@ -2007,7 +2009,7 @@ err: if (ret != 0)
err: if (ret != 0)
throwWiredTigerException(jenv, ret);
return session;
return (session);
}
}
@@ -2035,14 +2037,14 @@ err: if (ret != 0)
err: if (ret != 0)
throwWiredTigerException(jenv, ret);
return cursor;
return (cursor);
}
}
%extend __wt_async_op {
long get_id_wrap(JNIEnv *jenv) {
WT_UNUSED(jenv);
return (self->get_id(self));
return ((long)self->get_id(self));
}
}
@@ -2053,6 +2055,6 @@ err: if (ret != 0)
ret = self->transaction_pinned_range(self, &range);
if (ret != 0)
throwWiredTigerException(jenv, ret);
return range;
return ((long)range);
}
}

View File

@@ -35,8 +35,9 @@ from distutils.core import setup, Extension
if not 'ARCHFLAGS' in os.environ:
os.environ['ARCHFLAGS'] = ''
# Suppress warnings building SWIG generated code
extra_cflags = [ '-w', '-I../../src/include']
# Suppress warnings building SWIG generated code. SWIG boiler plate
# functions have sign conversion warnings, so those warnings must be disabled.
extra_cflags = [ '-w', '-I../../src/include', '-Wno-sign-conversion']
dir = os.path.dirname(__file__)

View File

@@ -254,7 +254,6 @@ __wt_async_op_enqueue(WT_SESSION_IMPL *session, WT_ASYNC_OP_IMPL *op)
{
WT_ASYNC *async;
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
uint64_t cur_head, cur_tail, my_alloc, my_slot;
#ifdef HAVE_DIAGNOSTIC
WT_ASYNC_OP_IMPL *my_op;
@@ -307,7 +306,7 @@ __wt_async_op_enqueue(WT_SESSION_IMPL *session, WT_ASYNC_OP_IMPL *op)
WT_ORDERED_READ(cur_head, async->head);
}
WT_PUBLISH(async->head, my_alloc);
return (ret);
return (0);
}
/*

View File

@@ -192,6 +192,7 @@ __wt_block_buffer_to_ckpt(WT_SESSION_IMPL *session,
int
__wt_block_ckpt_decode(WT_SESSION *wt_session,
size_t allocsize, const uint8_t *p, WT_BLOCK_CKPT *ci)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
WT_SESSION_IMPL *session;

View File

@@ -22,6 +22,12 @@ __wt_block_compact_start(WT_SESSION_IMPL *session, WT_BLOCK *block)
/* Switch to first-fit allocation. */
__wt_block_configure_first_fit(block, true);
/* Reset the compaction state information. */
block->compact_pct_tenths = 0;
block->compact_pages_reviewed = 0;
block->compact_pages_skipped = 0;
block->compact_pages_written = 0;
return (0);
}
@@ -55,7 +61,6 @@ __wt_block_compact_end(WT_SESSION_IMPL *session, WT_BLOCK *block)
int
__wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, bool *skipp)
{
WT_DECL_RET;
WT_EXT *ext;
WT_EXTLIST *el;
wt_off_t avail_eighty, avail_ninety, eighty, ninety;
@@ -71,16 +76,6 @@ __wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, bool *skipp)
if (block->size <= WT_MEGABYTE)
return (0);
/*
* Reset the compaction state information. This is done here, not in the
* compaction "start" routine, because this function is called first to
* determine if compaction is useful.
*/
block->compact_pct_tenths = 0;
block->compact_pages_reviewed = 0;
block->compact_pages_skipped = 0;
block->compact_pages_written = 0;
__wt_spin_lock(session, &block->live_lock);
/* Dump the current state of the file. */
@@ -142,7 +137,7 @@ __wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, bool *skipp)
__wt_spin_unlock(session, &block->live_lock);
return (ret);
return (0);
}
/*
@@ -153,7 +148,6 @@ int
__wt_block_compact_page_skip(WT_SESSION_IMPL *session,
WT_BLOCK *block, const uint8_t *addr, size_t addr_size, bool *skipp)
{
WT_DECL_RET;
WT_EXT *ext;
WT_EXTLIST *el;
wt_off_t limit, offset;
@@ -198,7 +192,7 @@ __wt_block_compact_page_skip(WT_SESSION_IMPL *session,
}
#endif
return (ret);
return (0);
}
/*

View File

@@ -201,6 +201,12 @@ __wt_block_open(WT_SESSION_IMPL *session,
* "direct_io=checkpoint" configures direct I/O for readonly data files.
*/
flags = 0;
WT_ERR(__wt_config_gets(session, cfg, "access_pattern_hint", &cval));
if (WT_STRING_MATCH("random", cval.str, cval.len))
LF_SET(WT_FS_OPEN_ACCESS_RAND);
else if (WT_STRING_MATCH("sequential", cval.str, cval.len))
LF_SET(WT_FS_OPEN_ACCESS_SEQ);
if (readonly && FLD_ISSET(conn->direct_io, WT_DIRECT_IO_CHECKPOINT))
LF_SET(WT_FS_OPEN_DIRECTIO);
if (!readonly && FLD_ISSET(conn->direct_io, WT_DIRECT_IO_DATA))

View File

@@ -95,6 +95,7 @@ int
__wt_bloom_create(
WT_SESSION_IMPL *session, const char *uri, const char *config,
uint64_t count, uint32_t factor, uint32_t k, WT_BLOOM **bloomp)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
WT_BLOOM *bloom;
WT_DECL_RET;
@@ -148,6 +149,7 @@ int
__wt_bloom_open(WT_SESSION_IMPL *session,
const char *uri, uint32_t factor, uint32_t k,
WT_CURSOR *owner, WT_BLOOM **bloomp)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
WT_BLOOM *bloom;
WT_CURSOR *c;
@@ -178,6 +180,7 @@ err: WT_TRET(__wt_bloom_close(bloom));
*/
void
__wt_bloom_insert(WT_BLOOM *bloom, WT_ITEM *key)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
uint64_t h1, h2;
uint32_t i;
@@ -195,6 +198,7 @@ __wt_bloom_insert(WT_BLOOM *bloom, WT_ITEM *key)
*/
int
__wt_bloom_finalize(WT_BLOOM *bloom)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
WT_CURSOR *c;
WT_DECL_RET;
@@ -304,6 +308,7 @@ err: /* Don't return WT_NOTFOUND from a failed search. */
*/
int
__wt_bloom_get(WT_BLOOM *bloom, WT_ITEM *key)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
WT_BLOOM_HASH bhash;
@@ -363,6 +368,7 @@ __wt_bloom_intersection(WT_BLOOM *bloom, WT_BLOOM *other)
*/
int
__wt_bloom_close(WT_BLOOM *bloom)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
WT_DECL_RET;
WT_SESSION_IMPL *session;
@@ -385,6 +391,7 @@ __wt_bloom_close(WT_BLOOM *bloom)
*/
int
__wt_bloom_drop(WT_BLOOM *bloom, const char *config)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
WT_DECL_RET;
WT_SESSION *wt_session;

View File

@@ -90,16 +90,15 @@ __compact_rewrite(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp)
* Compact a file.
*/
int
__wt_compact(WT_SESSION_IMPL *session, const char *cfg[])
__wt_compact(WT_SESSION_IMPL *session)
{
WT_BM *bm;
WT_BTREE *btree;
WT_DECL_RET;
WT_REF *ref;
u_int i;
bool skip;
WT_UNUSED(cfg);
btree = S2BT(session);
bm = btree->bm;
ref = NULL;
@@ -129,7 +128,13 @@ __wt_compact(WT_SESSION_IMPL *session, const char *cfg[])
__wt_spin_lock(session, &btree->flush_lock);
/* Walk the tree reviewing pages to see if they should be re-written. */
for (;;) {
for (i = 0;;) {
/* Periodically check if we've run out of time. */
if (++i > 100) {
WT_ERR(__wt_session_compact_check_timeout(session));
i = 0;
}
/*
* Pages read for compaction aren't "useful"; don't update the
* read generation of pages already in memory, and if a page is

View File

@@ -41,7 +41,7 @@ __cursor_size_chk(WT_SESSION_IMPL *session, WT_ITEM *kv)
if (kv->size > WT_BTREE_MAX_OBJECT_SIZE)
WT_RET_MSG(session, EINVAL,
"item size of %" WT_SIZET_FMT " exceeds the maximum "
"supported WiredTiger size of %d",
"supported WiredTiger size of %" PRIu32,
kv->size, WT_BTREE_MAX_OBJECT_SIZE);
/* Check what the block manager can actually write. */

View File

@@ -77,7 +77,7 @@ static inline int
__debug_hex_byte(WT_DBG *ds, uint8_t v)
{
return (ds->f(
ds, "#%c%c", __wt_hex[(v & 0xf0) >> 4], __wt_hex[v & 0x0f]));
ds, "#%c%c", __wt_hex((v & 0xf0) >> 4), __wt_hex(v & 0x0f)));
}
/*
@@ -1003,37 +1003,37 @@ __debug_ref(WT_DBG *ds, WT_REF *ref)
WT_SESSION_IMPL *session;
size_t addr_size;
const uint8_t *addr;
const char *state;
session = ds->session;
WT_RET(ds->f(ds, "\t"));
switch (ref->state) {
case WT_REF_DISK:
WT_RET(ds->f(ds, "disk"));
state = "disk";
break;
case WT_REF_DELETED:
WT_RET(ds->f(ds, "deleted"));
state = "deleted";
break;
case WT_REF_LOCKED:
WT_RET(ds->f(ds, "locked %p", (void *)ref->page));
state = "locked";
break;
case WT_REF_MEM:
WT_RET(ds->f(ds, "memory %p", (void *)ref->page));
state = "memory";
break;
case WT_REF_READING:
WT_RET(ds->f(ds, "reading"));
state = "reading";
break;
case WT_REF_SPLIT:
WT_RET(ds->f(ds, "split"));
state = "split";
break;
default:
WT_RET(ds->f(ds, "INVALID"));
state = "INVALID";
break;
}
__wt_ref_info(ref, &addr, &addr_size, NULL);
return (ds->f(ds, " %s\n",
__wt_addr_string(session, addr, addr_size, ds->tmp)));
return (ds->f(ds, "\t" "%p %s %s\n", (void *)ref,
state, __wt_addr_string(session, addr, addr_size, ds->tmp)));
}
/*
@@ -1104,9 +1104,9 @@ __debug_cell(WT_DBG *ds, const WT_PAGE_HEADER *dsk, WT_CELL_UNPACK *unpack)
case WT_CELL_VALUE_OVFL_RM:
type = "ovfl";
addr: WT_RET(__wt_scr_alloc(session, 128, &buf));
WT_RET(ds->f(ds, ", %s %s", type,
ret = ds->f(ds, ", %s %s", type,
__wt_addr_string(
session, unpack->data, unpack->size, buf)));
session, unpack->data, unpack->size, buf));
__wt_scr_free(session, &buf);
WT_RET(ret);
break;

View File

@@ -27,9 +27,35 @@ __wt_ref_out(WT_SESSION_IMPL *session, WT_REF *ref)
/*
* A version of the page-out function that allows us to make additional
* diagnostic checks.
*
* The WT_REF cannot be the eviction thread's location.
*/
WT_ASSERT(session, S2BT(session)->evict_ref != ref);
#ifdef HAVE_DIAGNOSTIC
{
WT_HAZARD *hp;
int i;
/*
* Make sure no other thread has a hazard pointer on the page we are
* about to discard. This is complicated by the fact that readers
* publish their hazard pointer before re-checking the page state, so
* our check can race with readers without indicating a real problem.
* Wait for up to a second for hazard pointers to be cleared.
*/
for (hp = NULL, i = 0; i < 100; i++) {
if ((hp = __wt_hazard_check(session, ref)) == NULL)
break;
__wt_sleep(0, 10000);
}
if (hp != NULL)
__wt_errx(session,
"discarded page has hazard pointer: (%p: %s, line %d)",
(void *)hp->ref, hp->file, hp->line);
WT_ASSERT(session, hp == NULL);
}
#endif
__wt_page_out(session, &ref->page);
}
@@ -63,30 +89,6 @@ __wt_page_out(WT_SESSION_IMPL *session, WT_PAGE **pagep)
WT_ASSERT(session, !F_ISSET_ATOMIC(page, WT_PAGE_EVICT_LRU));
WT_ASSERT(session, !__wt_rwlock_islocked(session, &page->page_lock));
#ifdef HAVE_DIAGNOSTIC
{
WT_HAZARD *hp;
int i;
/*
* Make sure no other thread has a hazard pointer on the page we are
* about to discard. This is complicated by the fact that readers
* publish their hazard pointer before re-checking the page state, so
* our check can race with readers without indicating a real problem.
* Wait for up to a second for hazard pointers to be cleared.
*/
for (hp = NULL, i = 0; i < 100; i++) {
if ((hp = __wt_page_hazard_check(session, page)) == NULL)
break;
__wt_sleep(0, 10000);
}
if (hp != NULL)
__wt_errx(session,
"discarded page has hazard pointer: (%p: %s, line %d)",
(void *)hp->page, hp->file, hp->line);
WT_ASSERT(session, hp == NULL);
}
#endif
/*
* If a root page split, there may be one or more pages linked from the
* page; walk the list, discarding pages.

View File

@@ -14,6 +14,7 @@
*/
const char *
__wt_page_type_string(u_int type)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
switch (type) {
case WT_PAGE_INVALID:

View File

@@ -324,7 +324,7 @@ __evict_force_check(WT_SESSION_IMPL *session, WT_REF *ref)
* If this session has more than one hazard pointer, eviction will fail
* and there is no point trying.
*/
if (__wt_hazard_count(session, page) > 1)
if (__wt_hazard_count(session, ref) > 1)
return (false);
/* If we can do an in-memory split, do it. */

View File

@@ -1300,7 +1300,7 @@ __slvg_col_build_leaf(WT_SESSION_IMPL *session, WT_TRACK *trk, WT_REF *ref)
/* Write the new version of the leaf page to disk. */
WT_ERR(__slvg_modify_init(session, page));
WT_ERR(__wt_reconcile(session, ref, cookie, WT_VISIBILITY_ERR));
WT_ERR(__wt_reconcile(session, ref, cookie, WT_VISIBILITY_ERR, NULL));
/* Reset the page. */
page->pg_var_d = save_col_var;
@@ -2011,7 +2011,7 @@ __slvg_row_build_leaf(
/* Write the new version of the leaf page to disk. */
WT_ERR(__slvg_modify_init(session, page));
WT_ERR(__wt_reconcile(session, ref, cookie, WT_VISIBILITY_ERR));
WT_ERR(__wt_reconcile(session, ref, cookie, WT_VISIBILITY_ERR, NULL));
/* Reset the page. */
page->pg_row_entries += skip_stop;

View File

@@ -513,7 +513,7 @@ __split_ref_step2(
__split_verify_intl_key_order(session, child));
#endif
WT_ERR(__wt_hazard_clear(session, child));
WT_ERR(__wt_hazard_clear(session, ref));
}
return (0);
@@ -1331,7 +1331,7 @@ __split_internal_unlock(WT_SESSION_IMPL *session, WT_PAGE *parent, bool hazard)
WT_DECL_RET;
if (hazard)
ret = __wt_hazard_clear(session, parent);
ret = __wt_hazard_clear(session, parent->pg_intl_parent_ref);
__wt_writeunlock(session, &parent->page_lock);
return (ret);

View File

@@ -136,8 +136,8 @@ __sync_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop)
__wt_txn_get_snapshot(session);
leaf_bytes += page->memory_footprint;
++leaf_pages;
WT_ERR(__wt_reconcile(
session, walk, NULL, WT_CHECKPOINTING));
WT_ERR(__wt_reconcile(session,
walk, NULL, WT_CHECKPOINTING, NULL));
}
}
break;
@@ -233,7 +233,7 @@ __sync_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop)
++leaf_pages;
}
WT_ERR(__wt_reconcile(
session, walk, NULL, WT_CHECKPOINTING));
session, walk, NULL, WT_CHECKPOINTING, NULL));
}
break;
case WT_SYNC_CLOSE:

View File

@@ -17,54 +17,60 @@ __ref_index_slot(WT_SESSION_IMPL *session,
WT_REF *ref, WT_PAGE_INDEX **pindexp, uint32_t *slotp)
{
WT_PAGE_INDEX *pindex;
uint32_t i;
WT_REF **start, **stop, **p, **t;
uint32_t entries, slot;
/*
* Copy the parent page's index value: the page can split at any time,
* but the index's value is always valid, even if it's not up-to-date.
*/
retry: WT_INTL_INDEX_GET(session, ref->home, pindex);
for (;;) {
/*
* Copy the parent page's index value: the page can split at
* any time, but the index's value is always valid, even if
* it's not up-to-date.
*/
WT_INTL_INDEX_GET(session, ref->home, pindex);
entries = pindex->entries;
/*
* Use the page's reference hint: it should be correct unless the page
* split before our slot. If the page splits after our slot, the hint
* will point earlier in the array than our actual slot, so the first
* loop is from the hint to the end of the list, and the second loop
* is from the start of the list to the end of the list. (The second
* loop overlaps the first, but that only happen in cases where we've
* split the tree and aren't going to find our slot at all, that's not
* worth optimizing.)
*
* It's not an error for the reference hint to be wrong, it just means
* the first retrieval (which sets the hint for subsequent retrievals),
* is slower.
*/
i = ref->pindex_hint;
if (i < pindex->entries && pindex->index[i] == ref) {
*pindexp = pindex;
*slotp = i;
return;
/*
* Use the page's reference hint: it should be correct unless
* there was a split or delete in the parent before our slot.
* If the hint is wrong, it can be either too big or too small,
* but often only by a small amount. Search up and down the
* index starting from the hint.
*
* It's not an error for the reference hint to be wrong, it
* just means the first retrieval (which sets the hint for
* subsequent retrievals), is slower.
*/
slot = ref->pindex_hint;
if (slot >= entries)
slot = entries - 1;
if (pindex->index[slot] == ref)
goto found;
for (start = &pindex->index[0],
stop = &pindex->index[entries - 1],
p = t = &pindex->index[slot];
p > start || t < stop;) {
if (p > start && *--p == ref) {
slot = (uint32_t)(p - start);
goto found;
}
if (t < stop && *++t == ref) {
slot = (uint32_t)(t - start);
goto found;
}
}
/*
* If we don't find our reference, the page split and our home
* pointer references the wrong page. When internal pages
* split, their WT_REF structure home values are updated; yield
* and wait for that to happen.
*/
__wt_yield();
}
while (++i < pindex->entries)
if (pindex->index[i] == ref) {
*pindexp = pindex;
*slotp = ref->pindex_hint = i;
return;
}
for (i = 0; i < pindex->entries; ++i)
if (pindex->index[i] == ref) {
*pindexp = pindex;
*slotp = ref->pindex_hint = i;
return;
}
/*
* If we don't find our reference, the page split and our home pointer
* references the wrong page. When internal pages split, their WT_REF
* structure home values are updated; yield and wait for that to happen.
*/
__wt_yield();
goto retry;
found: WT_ASSERT(session, pindex->index[slot] == ref);
*pindexp = pindex;
*slotp = slot;
}
/*
@@ -431,8 +437,8 @@ restart: /*
/*
* Move to the next slot, and set the reference hint if
* it's wrong (used when we continue the walk). We don't
* update those hints when splitting, so it's common for
* them to be incorrect in some workloads.
* always update the hints when splitting, it's expected
* for them to be incorrect in some workloads.
*/
ref = pindex->index[slot];
if (ref->pindex_hint != slot)

View File

@@ -63,6 +63,7 @@ int
__wt_las_create(WT_SESSION_IMPL *session)
{
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
uint32_t session_flags;
const char *drop_cfg[] = {
WT_CONFIG_BASE(session, WT_SESSION_drop), "force=true", NULL };
@@ -80,7 +81,9 @@ __wt_las_create(WT_SESSION_IMPL *session)
*
* Discard any previous incarnation of the table.
*/
WT_RET(__wt_session_drop(session, WT_LAS_URI, drop_cfg));
WT_WITH_SCHEMA_LOCK(session,
ret = __wt_schema_drop(session, WT_LAS_URI, drop_cfg));
WT_RET(ret);
/* Re-create the table. */
WT_RET(__wt_session_create(session, WT_LAS_URI, WT_LAS_FORMAT));

View File

@@ -1101,6 +1101,7 @@ static const uint32_t g_crc_slicing[8][256] = {
*/
uint32_t
__wt_checksum_sw(const void *chunk, size_t len)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
uint32_t crc, next;
size_t nqwords;

View File

@@ -158,24 +158,25 @@ wiredtiger_config_validate(WT_SESSION *wt_session,
}
/*
* __conn_foc_add --
* __wt_conn_foc_add --
* Add a new entry into the connection's free-on-close list.
*/
static int
__conn_foc_add(WT_SESSION_IMPL *session, const void *p)
void
__wt_conn_foc_add(WT_SESSION_IMPL *session, const void *p)
{
WT_CONNECTION_IMPL *conn;
conn = S2C(session);
/*
* Our caller is expected to be holding any locks we need.
* Callers of this function are expected to be holding the connection's
* api_lock.
*
* All callers of this function currently ignore errors.
*/
WT_RET(__wt_realloc_def(
session, &conn->foc_size, conn->foc_cnt + 1, &conn->foc));
conn->foc[conn->foc_cnt++] = (void *)p;
return (0);
if (__wt_realloc_def(
session, &conn->foc_size, conn->foc_cnt + 1, &conn->foc) == 0)
conn->foc[conn->foc_cnt++] = (void *)p;
}
/*
@@ -328,12 +329,12 @@ __wt_configure_method(WT_SESSION_IMPL *session,
* order to avoid freeing chunks of memory twice. Again, this isn't a
* commonly used API and it shouldn't ever happen, just leak it.
*/
(void)__conn_foc_add(session, entry->base);
(void)__conn_foc_add(session, entry);
(void)__conn_foc_add(session, checks);
(void)__conn_foc_add(session, newcheck->type);
(void)__conn_foc_add(session, newcheck->checks);
(void)__conn_foc_add(session, newcheck_name);
__wt_conn_foc_add(session, entry->base);
__wt_conn_foc_add(session, entry);
__wt_conn_foc_add(session, checks);
__wt_conn_foc_add(session, newcheck->type);
__wt_conn_foc_add(session, newcheck->checks);
__wt_conn_foc_add(session, newcheck_name);
/*
* Instead of using locks to protect configuration information, assume

View File

@@ -372,6 +372,7 @@ __config_merge_cmp(const void *a, const void *b)
int
__wt_config_merge(WT_SESSION_IMPL *session,
const char **cfg, const char *cfg_strip, const char **config_ret)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
WT_CONFIG_MERGE merge;
WT_DECL_RET;

View File

@@ -162,6 +162,14 @@ static const WT_CONFIG_CHECK confchk_WT_CURSOR_reconfigure[] = {
{ NULL, NULL, NULL, NULL, NULL, 0 }
};
static const WT_CONFIG_CHECK confchk_WT_SESSION_alter[] = {
{ "access_pattern_hint", "string",
NULL, "choices=[\"none\",\"random\",\"sequential\"]",
NULL, 0 },
{ "cache_resident", "boolean", NULL, NULL, NULL, 0 },
{ NULL, NULL, NULL, NULL, NULL, 0 }
};
static const WT_CONFIG_CHECK confchk_WT_SESSION_begin_transaction[] = {
{ "isolation", "string",
NULL, "choices=[\"read-uncommitted\",\"read-committed\","
@@ -224,6 +232,9 @@ static const WT_CONFIG_CHECK
};
static const WT_CONFIG_CHECK confchk_WT_SESSION_create[] = {
{ "access_pattern_hint", "string",
NULL, "choices=[\"none\",\"random\",\"sequential\"]",
NULL, 0 },
{ "allocation_size", "int",
NULL, "min=512B,max=128MB",
NULL, 0 },
@@ -371,6 +382,7 @@ static const WT_CONFIG_CHECK confchk_WT_SESSION_snapshot[] = {
{ "drop", "category",
NULL, NULL,
confchk_WT_SESSION_snapshot_drop_subconfigs, 4 },
{ "include_updates", "boolean", NULL, NULL, NULL, 0 },
{ "name", "string", NULL, NULL, NULL, 0 },
{ NULL, NULL, NULL, NULL, NULL, 0 }
};
@@ -400,6 +412,9 @@ static const WT_CONFIG_CHECK confchk_colgroup_meta[] = {
};
static const WT_CONFIG_CHECK confchk_file_config[] = {
{ "access_pattern_hint", "string",
NULL, "choices=[\"none\",\"random\",\"sequential\"]",
NULL, 0 },
{ "allocation_size", "int",
NULL, "min=512B,max=128MB",
NULL, 0 },
@@ -458,6 +473,9 @@ static const WT_CONFIG_CHECK confchk_file_config[] = {
};
static const WT_CONFIG_CHECK confchk_file_meta[] = {
{ "access_pattern_hint", "string",
NULL, "choices=[\"none\",\"random\",\"sequential\"]",
NULL, 0 },
{ "allocation_size", "int",
NULL, "min=512B,max=128MB",
NULL, 0 },
@@ -536,6 +554,9 @@ static const WT_CONFIG_CHECK confchk_index_meta[] = {
};
static const WT_CONFIG_CHECK confchk_lsm_meta[] = {
{ "access_pattern_hint", "string",
NULL, "choices=[\"none\",\"random\",\"sequential\"]",
NULL, 0 },
{ "allocation_size", "int",
NULL, "min=512B,max=128MB",
NULL, 0 },
@@ -1053,6 +1074,10 @@ static const WT_CONFIG_ENTRY config_entries[] = {
"append=false,overwrite=true",
confchk_WT_CURSOR_reconfigure, 2
},
{ "WT_SESSION.alter",
"access_pattern_hint=none,cache_resident=false",
confchk_WT_SESSION_alter, 2
},
{ "WT_SESSION.begin_transaction",
"isolation=,name=,priority=0,snapshot=,sync=",
confchk_WT_SESSION_begin_transaction, 5
@@ -1074,12 +1099,13 @@ static const WT_CONFIG_ENTRY config_entries[] = {
confchk_WT_SESSION_compact, 1
},
{ "WT_SESSION.create",
"allocation_size=4KB,app_metadata=,block_allocation=best,"
"block_compressor=,cache_resident=false,checksum=uncompressed,"
"colgroups=,collator=,columns=,dictionary=0,encryption=(keyid=,"
"name=),exclusive=false,extractor=,format=btree,huffman_key=,"
"huffman_value=,ignore_in_memory_cache_size=false,immutable=false"
",internal_item_max=0,internal_key_max=0,"
"access_pattern_hint=none,allocation_size=4KB,app_metadata=,"
"block_allocation=best,block_compressor=,cache_resident=false,"
"checksum=uncompressed,colgroups=,collator=,columns=,dictionary=0"
",encryption=(keyid=,name=),exclusive=false,extractor=,"
"format=btree,huffman_key=,huffman_value=,"
"ignore_in_memory_cache_size=false,immutable=false,"
"internal_item_max=0,internal_key_max=0,"
"internal_key_truncate=true,internal_page_max=4KB,key_format=u,"
"key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,"
"leaf_value_max=0,log=(enabled=true),lsm=(auto_throttle=true,"
@@ -1089,7 +1115,7 @@ static const WT_CONFIG_ENTRY config_entries[] = {
"os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,"
"prefix_compression_min=4,source=,split_deepen_min_child=0,"
"split_deepen_per_child=0,split_pct=75,type=file,value_format=u",
confchk_WT_SESSION_create, 41
confchk_WT_SESSION_create, 42
},
{ "WT_SESSION.drop",
"checkpoint_wait=true,force=false,lock_wait=true,"
@@ -1142,8 +1168,8 @@ static const WT_CONFIG_ENTRY config_entries[] = {
confchk_WT_SESSION_salvage, 1
},
{ "WT_SESSION.snapshot",
"drop=(all=false,before=,names=,to=),name=",
confchk_WT_SESSION_snapshot, 2
"drop=(all=false,before=,names=,to=),include_updates=false,name=",
confchk_WT_SESSION_snapshot, 3
},
{ "WT_SESSION.strerror",
"",
@@ -1171,10 +1197,26 @@ static const WT_CONFIG_ENTRY config_entries[] = {
confchk_colgroup_meta, 5
},
{ "file.config",
"allocation_size=4KB,app_metadata=,block_allocation=best,"
"block_compressor=,cache_resident=false,checksum=uncompressed,"
"collator=,columns=,dictionary=0,encryption=(keyid=,name=),"
"format=btree,huffman_key=,huffman_value=,"
"access_pattern_hint=none,allocation_size=4KB,app_metadata=,"
"block_allocation=best,block_compressor=,cache_resident=false,"
"checksum=uncompressed,collator=,columns=,dictionary=0,"
"encryption=(keyid=,name=),format=btree,huffman_key=,"
"huffman_value=,ignore_in_memory_cache_size=false,"
"internal_item_max=0,internal_key_max=0,"
"internal_key_truncate=true,internal_page_max=4KB,key_format=u,"
"key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,"
"leaf_value_max=0,log=(enabled=true),memory_page_max=5MB,"
"os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,"
"prefix_compression_min=4,split_deepen_min_child=0,"
"split_deepen_per_child=0,split_pct=75,value_format=u",
confchk_file_config, 35
},
{ "file.meta",
"access_pattern_hint=none,allocation_size=4KB,app_metadata=,"
"block_allocation=best,block_compressor=,cache_resident=false,"
"checkpoint=,checkpoint_lsn=,checksum=uncompressed,collator=,"
"columns=,dictionary=0,encryption=(keyid=,name=),format=btree,"
"huffman_key=,huffman_value=,id=,"
"ignore_in_memory_cache_size=false,internal_item_max=0,"
"internal_key_max=0,internal_key_truncate=true,"
"internal_page_max=4KB,key_format=u,key_gap=10,leaf_item_max=0,"
@@ -1182,24 +1224,8 @@ static const WT_CONFIG_ENTRY config_entries[] = {
"log=(enabled=true),memory_page_max=5MB,os_cache_dirty_max=0,"
"os_cache_max=0,prefix_compression=false,prefix_compression_min=4"
",split_deepen_min_child=0,split_deepen_per_child=0,split_pct=75,"
"value_format=u",
confchk_file_config, 34
},
{ "file.meta",
"allocation_size=4KB,app_metadata=,block_allocation=best,"
"block_compressor=,cache_resident=false,checkpoint=,"
"checkpoint_lsn=,checksum=uncompressed,collator=,columns=,"
"dictionary=0,encryption=(keyid=,name=),format=btree,huffman_key="
",huffman_value=,id=,ignore_in_memory_cache_size=false,"
"internal_item_max=0,internal_key_max=0,"
"internal_key_truncate=true,internal_page_max=4KB,key_format=u,"
"key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,"
"leaf_value_max=0,log=(enabled=true),memory_page_max=5MB,"
"os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,"
"prefix_compression_min=4,split_deepen_min_child=0,"
"split_deepen_per_child=0,split_pct=75,value_format=u,"
"version=(major=0,minor=0)",
confchk_file_meta, 38
"value_format=u,version=(major=0,minor=0)",
confchk_file_meta, 39
},
{ "index.meta",
"app_metadata=,collator=,columns=,extractor=,immutable=false,"
@@ -1207,23 +1233,23 @@ static const WT_CONFIG_ENTRY config_entries[] = {
confchk_index_meta, 10
},
{ "lsm.meta",
"allocation_size=4KB,app_metadata=,block_allocation=best,"
"block_compressor=,cache_resident=false,checksum=uncompressed,"
"chunks=,collator=,columns=,dictionary=0,encryption=(keyid=,"
"name=),format=btree,huffman_key=,huffman_value=,"
"ignore_in_memory_cache_size=false,internal_item_max=0,"
"internal_key_max=0,internal_key_truncate=true,"
"internal_page_max=4KB,key_format=u,key_gap=10,last=,"
"leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,"
"leaf_value_max=0,log=(enabled=true),lsm=(auto_throttle=true,"
"bloom=true,bloom_bit_count=16,bloom_config=,bloom_hash_count=8,"
"bloom_oldest=false,chunk_count_limit=0,chunk_max=5GB,"
"chunk_size=10MB,merge_max=15,merge_min=0),memory_page_max=5MB,"
"old_chunks=,os_cache_dirty_max=0,os_cache_max=0,"
"prefix_compression=false,prefix_compression_min=4,"
"split_deepen_min_child=0,split_deepen_per_child=0,split_pct=75,"
"value_format=u",
confchk_lsm_meta, 38
"access_pattern_hint=none,allocation_size=4KB,app_metadata=,"
"block_allocation=best,block_compressor=,cache_resident=false,"
"checksum=uncompressed,chunks=,collator=,columns=,dictionary=0,"
"encryption=(keyid=,name=),format=btree,huffman_key=,"
"huffman_value=,ignore_in_memory_cache_size=false,"
"internal_item_max=0,internal_key_max=0,"
"internal_key_truncate=true,internal_page_max=4KB,key_format=u,"
"key_gap=10,last=,leaf_item_max=0,leaf_key_max=0,"
"leaf_page_max=32KB,leaf_value_max=0,log=(enabled=true),"
"lsm=(auto_throttle=true,bloom=true,bloom_bit_count=16,"
"bloom_config=,bloom_hash_count=8,bloom_oldest=false,"
"chunk_count_limit=0,chunk_max=5GB,chunk_size=10MB,merge_max=15,"
"merge_min=0),memory_page_max=5MB,old_chunks=,"
"os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,"
"prefix_compression_min=4,split_deepen_min_child=0,"
"split_deepen_per_child=0,split_pct=75,value_format=u",
confchk_lsm_meta, 39
},
{ "table.meta",
"app_metadata=,colgroups=,collator=,columns=,key_format=u,"

View File

@@ -2309,9 +2309,6 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
}
WT_ERR(__wt_verbose_config(session, cfg));
WT_ERR(__wt_config_gets(session, cfg, "hazard_max", &cval));
conn->hazard_max = (uint32_t)cval.val;
WT_ERR(__wt_config_gets(session, cfg, "session_max", &cval));
conn->session_size = (uint32_t)cval.val + WT_EXTRA_INTERNAL_SESSIONS;

View File

@@ -68,7 +68,6 @@ __wt_connection_init(WT_CONNECTION_IMPL *conn)
session, &conn->hot_backup_lock, "hot backup"));
WT_RET(__wt_calloc_def(session, WT_PAGE_LOCKS, &conn->page_lock));
WT_CACHE_LINE_ALIGNMENT_VERIFY(session, conn->page_lock);
for (i = 0; i < WT_PAGE_LOCKS; ++i)
WT_RET(
__wt_spin_init(session, &conn->page_lock[i], "btree page"));

View File

@@ -30,7 +30,6 @@ __wt_connection_open(WT_CONNECTION_IMPL *conn, const char *cfg[])
/* WT_SESSION_IMPL array. */
WT_RET(__wt_calloc(session,
conn->session_size, sizeof(WT_SESSION_IMPL), &conn->sessions));
WT_CACHE_LINE_ALIGNMENT_VERIFY(session, conn->sessions);
/*
* Open the default session. We open this before starting service

View File

@@ -144,8 +144,8 @@ __wt_curbackup_open(WT_SESSION_IMPL *session,
* Start the backup and fill in the cursor's list. Acquire the schema
* lock, we need a consistent view when creating a copy.
*/
WT_WITH_CHECKPOINT_LOCK(session, ret,
WT_WITH_SCHEMA_LOCK(session, ret,
WT_WITH_CHECKPOINT_LOCK(session,
WT_WITH_SCHEMA_LOCK(session,
ret = __backup_start(session, cb, cfg)));
WT_ERR(ret);

View File

@@ -559,7 +559,7 @@ __wt_curfile_open(WT_SESSION_IMPL *session, const char *uri,
* get the handle while holding the checkpoint lock.
*/
if (LF_ISSET(WT_DHANDLE_EXCLUSIVE) && checkpoint_wait)
WT_WITH_CHECKPOINT_LOCK(session, ret,
WT_WITH_CHECKPOINT_LOCK(session,
ret = __wt_session_get_btree_ckpt(
session, uri, cfg, flags));
else

View File

@@ -281,33 +281,38 @@ __curindex_search_near(WT_CURSOR *cursor, int *exact)
* (usually) doesn't contain the primary key, so it is just a prefix of
* any matching index key. That said, if there is an exact match, we
* want to find the first matching index entry and set exact equal to
* zero. Do a search_near, step to the next entry if we land on one
* that is too small, then check that the prefix matches.
* zero.
*
* Do a search_near, and if we find an entry that is too small, step to
* the next one. In the unlikely event of a search past the end of the
* tree, go back to the last key.
*/
__wt_cursor_set_raw_key(child, &cursor->key);
WT_ERR(child->search_near(child, &cmp));
if (cmp < 0)
WT_ERR(child->next(child));
if (cmp < 0) {
if ((ret = child->next(child)) == WT_NOTFOUND)
ret = child->prev(child);
WT_ERR(ret);
}
/*
* We expect partial matches, and want the smallest record with a key
* greater than or equal to the search key.
*
* If the key we find is shorter than the search key, it can't possibly
* match.
* If the found key starts with the search key, we indicate a match by
* setting exact equal to zero.
*
* The only way for the key to be exactly equal is if there is an index
* on the primary key, because otherwise the primary key columns will
* be appended to the index key, but we don't disallow that (odd) case.
* The compare function expects application-supplied keys to come first
* so we flip the sign of the result to match what callers expect.
*/
found_key = child->key;
if (found_key.size < cursor->key.size)
WT_ERR(WT_NOTFOUND);
found_key.size = cursor->key.size;
if (found_key.size > cursor->key.size)
found_key.size = cursor->key.size;
WT_ERR(__wt_compare(
session, cindex->index->collator, &cursor->key, &found_key, exact));
*exact = -*exact;
WT_ERR(__curindex_move(cindex));

View File

@@ -1333,7 +1333,7 @@ __wt_curjoin_open(WT_SESSION_IMPL *session,
WT_ERR(__wt_scr_alloc(session, 0, &tmp));
if (columns != NULL) {
WT_ERR(__wt_struct_reformat(session, table,
columns, strlen(columns), NULL, 1, tmp));
columns, strlen(columns), NULL, false, tmp));
WT_ERR(__wt_strndup(
session, tmp->data, tmp->size, &cursor->value_format));
WT_ERR(__wt_strdup(session, columns, &cjoin->projection));

View File

@@ -270,7 +270,6 @@ __wt_json_alloc_unpack(WT_SESSION_IMPL *session, const void *buffer,
bool iskey, va_list ap)
{
WT_CONFIG_ITEM *names;
WT_DECL_RET;
size_t needed;
char **json_bufp;
@@ -288,7 +287,7 @@ __wt_json_alloc_unpack(WT_SESSION_IMPL *session, const void *buffer,
WT_RET(__json_struct_unpackv(session, buffer, size, fmt,
names, (u_char *)*json_bufp, needed + 1, iskey, ap));
return (ret);
return (0);
}
/*
@@ -315,6 +314,7 @@ __wt_json_close(WT_SESSION_IMPL *session, WT_CURSOR *cursor)
*/
size_t
__wt_json_unpack_char(u_char ch, u_char *buf, size_t bufsz, bool force_unicode)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
u_char abbrev;
@@ -357,8 +357,8 @@ __wt_json_unpack_char(u_char ch, u_char *buf, size_t bufsz, bool force_unicode)
*buf++ = 'u';
*buf++ = '0';
*buf++ = '0';
*buf++ = __wt_hex[(ch & 0xf0) >> 4];
*buf++ = __wt_hex[ch & 0x0f];
*buf++ = __wt_hex((ch & 0xf0) >> 4);
*buf++ = __wt_hex(ch & 0x0f);
}
return (6);
}
@@ -452,6 +452,7 @@ __wt_json_column_init(WT_CURSOR *cursor, const char *keyformat,
int
__wt_json_token(WT_SESSION *wt_session, const char *src, int *toktype,
const char **tokstart, size_t *toklen)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
WT_SESSION_IMPL *session;
int result;
@@ -580,6 +581,7 @@ __wt_json_token(WT_SESSION *wt_session, const char *src, int *toktype,
*/
const char *
__wt_json_tokname(int toktype)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
switch (toktype) {
case 0: return ("<EOF>");
@@ -817,6 +819,7 @@ __wt_json_to_item(WT_SESSION_IMPL *session, const char *jstr,
*/
ssize_t
__wt_json_strlen(const char *src, size_t srclen)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
const char *srcend;
size_t dstlen;
@@ -857,8 +860,9 @@ __wt_json_strlen(const char *src, size_t srclen)
* bytes. If dstlen is greater than the needed size, the result if zero padded.
*/
int
__wt_json_strncpy(WT_SESSION *wt_session, char **pdst, size_t dstlen,
const char *src, size_t srclen)
__wt_json_strncpy(WT_SESSION *wt_session,
char **pdst, size_t dstlen, const char *src, size_t srclen)
WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
WT_SESSION_IMPL *session;
char ch, *dst;

View File

@@ -150,18 +150,22 @@ static int
__curlog_kv(WT_SESSION_IMPL *session, WT_CURSOR *cursor)
{
WT_CURSOR_LOG *cl;
WT_ITEM item;
uint32_t fileid, key_count, opsize, optype;
WT_DECL_RET;
uint32_t fileid, key_count, opsize, optype, raw;
cl = (WT_CURSOR_LOG *)cursor;
/* Temporarily turn off raw so we can do direct cursor operations. */
raw = F_MASK(cursor, WT_CURSTD_RAW);
F_CLR(cursor, WT_CURSTD_RAW);
/*
* If it is a commit and we have stepped over the header, peek to get
* the size and optype and read out any key/value from this operation.
*/
if ((key_count = cl->step_count++) > 0) {
WT_RET(__wt_logop_read(session,
WT_ERR(__wt_logop_read(session,
&cl->stepp, cl->stepp_end, &optype, &opsize));
WT_RET(__curlog_op_read(session, cl, optype, opsize, &fileid));
WT_ERR(__curlog_op_read(session, cl, optype, opsize, &fileid));
/* Position on the beginning of the next record part. */
cl->stepp += opsize;
} else {
@@ -181,39 +185,14 @@ __curlog_kv(WT_SESSION_IMPL *session, WT_CURSOR *cursor)
* The log cursor sets the LSN and step count as the cursor key and
* and log record related data in the value. The data in the value
* contains any operation key/value that was in the log record.
* For the special case that the caller needs the result in raw form,
* we create packed versions of the key/value.
*/
if (FLD_ISSET(cursor->flags, WT_CURSTD_RAW)) {
memset(&item, 0, sizeof(item));
WT_RET(wiredtiger_struct_size((WT_SESSION *)session,
&item.size, WT_LOGC_KEY_FORMAT, cl->cur_lsn->l.file,
cl->cur_lsn->l.offset, key_count));
WT_RET(__wt_realloc(session, NULL, item.size, &cl->packed_key));
item.data = cl->packed_key;
WT_RET(wiredtiger_struct_pack((WT_SESSION *)session,
cl->packed_key, item.size, WT_LOGC_KEY_FORMAT,
cl->cur_lsn->l.file, cl->cur_lsn->l.offset, key_count));
__wt_cursor_set_key(cursor, &item);
__wt_cursor_set_key(cursor, cl->cur_lsn->l.file, cl->cur_lsn->l.offset,
key_count);
__wt_cursor_set_value(cursor, cl->txnid, cl->rectype, optype, fileid,
cl->opkey, cl->opvalue);
WT_RET(wiredtiger_struct_size((WT_SESSION *)session,
&item.size, WT_LOGC_VALUE_FORMAT, cl->txnid, cl->rectype,
optype, fileid, cl->opkey, cl->opvalue));
WT_RET(__wt_realloc(session, NULL, item.size,
&cl->packed_value));
item.data = cl->packed_value;
WT_RET(wiredtiger_struct_pack((WT_SESSION *)session,
cl->packed_value, item.size, WT_LOGC_VALUE_FORMAT,
cl->txnid, cl->rectype, optype, fileid, cl->opkey,
cl->opvalue));
__wt_cursor_set_value(cursor, &item);
} else {
__wt_cursor_set_key(cursor, cl->cur_lsn->l.file,
cl->cur_lsn->l.offset, key_count);
__wt_cursor_set_value(cursor, cl->txnid, cl->rectype, optype,
fileid, cl->opkey, cl->opvalue);
}
return (0);
err: F_SET(cursor, raw);
return (ret);
}
/*
@@ -264,17 +243,19 @@ __curlog_search(WT_CURSOR *cursor)
WT_DECL_RET;
WT_LSN key;
WT_SESSION_IMPL *session;
uint32_t counter, key_file, key_offset;
uint32_t counter, key_file, key_offset, raw;
cl = (WT_CURSOR_LOG *)cursor;
/* Temporarily turn off raw so we can do direct cursor operations. */
raw = F_MASK(cursor, WT_CURSTD_RAW);
F_CLR(cursor, WT_CURSTD_RAW);
CURSOR_API_CALL(cursor, session, search, NULL);
/*
* !!! We are ignoring the counter and only searching based on the LSN.
*/
WT_ERR(__wt_cursor_get_key((WT_CURSOR *)cl,
&key_file, &key_offset, &counter));
WT_ERR(__wt_cursor_get_key(cursor, &key_file, &key_offset, &counter));
WT_SET_LSN(&key, key_file, key_offset);
ret = __wt_log_scan(session, &key, WT_LOGSCAN_ONE,
__curlog_logrec, cl);
@@ -285,7 +266,8 @@ __curlog_search(WT_CURSOR *cursor)
WT_STAT_CONN_INCR(session, cursor_search);
WT_STAT_DATA_INCR(session, cursor_search);
err: API_END_RET(session, ret);
err: F_SET(cursor, raw);
API_END_RET(session, ret);
}
/*

View File

@@ -763,16 +763,13 @@ err: API_END_RET(session, ret);
static int
__curtable_complete(WT_SESSION_IMPL *session, WT_TABLE *table)
{
WT_DECL_RET;
bool complete;
if (table->cg_complete)
return (0);
/* If the table is incomplete, wait on the table lock and recheck. */
complete = false;
WT_WITH_TABLE_LOCK(session, ret, complete = table->cg_complete);
WT_RET(ret);
WT_WITH_TABLE_LOCK(session, complete = table->cg_complete);
if (!complete)
WT_RET_MSG(session, EINVAL,
"'%s' not available until all column groups are created",
@@ -927,7 +924,7 @@ __wt_curtable_open(WT_SESSION_IMPL *session,
WT_ERR(__wt_scr_alloc(session, 0, &tmp));
if (columns != NULL) {
WT_ERR(__wt_struct_reformat(session, table,
columns, strlen(columns), NULL, true, tmp));
columns, strlen(columns), NULL, false, tmp));
WT_ERR(__wt_strndup(
session, tmp->data, tmp->size, &cursor->value_format));

View File

@@ -3,4 +3,4 @@ TOP=$DOCS/..
. $TOP/config.sh
cd python
PYTHONPATH=../../lang/python/src:$THRIFT_HOME/lib/python2.6/site-packages pydoc -w wiredtiger
PYTHONPATH=../../lang/python/src:$THRIFT_HOME/lib/python2.7/site-packages pydoc -w wiredtiger

View File

@@ -36,6 +36,39 @@ the user wants to force recovery on any command, use the \c -R option.
In general, commands that modify the database or tables will run recovery
by default and commands that only read data will not run recovery.
<hr>
@section util_alter wt alter
Alter a table.
@subsection util_alter_synopsis Synopsis
<code>wt [-RVv] [-C config] [-E secretkey ] [-h directory] alter uri configuration ...</code>
The \c uri and \c configuration pairs may be specified to the
\c alter command. These configuration pairs can be used to modify the
configuration values from those passed to the WT_SESSION::create
call.
The \c uri part of the configuration pair should match only one of the
objects being altered, but may be a prefix of the object being matched.
For example, the following two sets of configuration pairs are
equivalent in the case of altering a single table named \c xxx.
@code
table access_pattern_hint=sequential
table:xxx access_pattern_hint=sequential
@endcode
It's an error, however, to specify a matching prefix that matches more
than a single object being altered.
Multiple \c configuration arguments may be specified. For example, the
following two sets of configuration pairs are equivalent:
@code
table:xxx access_pattern_hint=random,cache_resident=false
table:xxx access_pattern_hint=random table:xxx cache_resident=false
@endcode
<hr>
@section util_backup wt backup
Perform a backup of a database or set of data sources.

View File

@@ -27,7 +27,7 @@ The WiredTiger unit test suite includes tests that cover:
The WiredTiger Python test suite is built using the WiredTiger Python
API and the Python unittest functionality (the test suite requires at
least Python version 2.6).
least Python version 2.7).
The WiredTiger test suite automatically runs as part of every commit
into the WiredTiger GitHub source tree.

View File

@@ -1,4 +1,19 @@
/*! @page upgrading Upgrading WiredTiger applications
@section version_291 Upgrading to Version 2.9.1
<dl>
<dt>WiredTiger now requires Python 2.7 at minimum</dt>
<dd>
The minimum version of Python supported by WiredTiger is now 2.7 up from the
previous version of 2.6. This is due to extra unit tests added in this release
that depend on 2.7. This is not due to a change in the Python API.
</dd>
<dt>Changes to hazard pointer configuration</dt>
<dd>
The \c hazard_max parameter to ::wiredtiger_open is now ignored. Memory is
allocated for hazard pointers as required by each session.
</dd>
</dl><hr>
@section version_290 Upgrading to Version 2.9.0
<dl>
@@ -26,6 +41,15 @@ how much work is done at the beginning of a checkpoint to make the critical
section of checkpoints complete more quickly.
</dd>
<dt>Change to default fadvise setting for data files</dt>
<dd>
The default behavior for data files was to advise the file system to optimize
for random access on POSIX and Windows platforms. The default is now to not
advise about access patterns. There is a new \c access_pattern_hint
configuration string available to WT_SESSION::create that can be used
to configure the old default behavior.
</dd>
<dt>Checkpoint server created checkpoint names</dt>
<dd>
The ::wiredtiger_open checkpoint configuration no longer supports the

View File

@@ -57,7 +57,8 @@ __wt_evict_file(WT_SESSION_IMPL *session, WT_CACHE_OP syncop)
* error, retrying later.
*/
if (syncop == WT_SYNC_CLOSE && __wt_page_is_modified(page))
WT_ERR(__wt_reconcile(session, ref, NULL, WT_EVICTING));
WT_ERR(__wt_reconcile(
session, ref, NULL, WT_EVICTING, NULL));
/*
* We can't evict the page just returned to us (it marks our

View File

@@ -271,7 +271,7 @@ __wt_evict_thread_run(WT_SESSION_IMPL *session, WT_THREAD *thread)
* can be closed.
*/
if (thread->id == 0) {
WT_WITH_PASS_LOCK(session, ret,
WT_WITH_PASS_LOCK(session,
ret = __evict_clear_all_walks(session));
WT_ERR(ret);
/*
@@ -351,8 +351,15 @@ __evict_server(WT_SESSION_IMPL *session, bool *did_work)
cache->pages_evicted = cache->pages_evict;
#ifdef HAVE_DIAGNOSTIC
__wt_epoch(session, &cache->stuck_ts);
} else {
/* After being stuck for 5 minutes, give up. */
} else if (!F_ISSET(conn, WT_CONN_IN_MEMORY)) {
/*
* After being stuck for 5 minutes, give up.
*
* We don't do this check for in-memory workloads because
* application threads are not blocked by the cache being full.
* If the cache becomes full of clean pages, we can be
* servicing reads while the cache appears stuck to eviction.
*/
__wt_epoch(session, &now);
if (WT_TIMEDIFF_SEC(now, cache->stuck_ts) > 300) {
ret = ETIMEDOUT;
@@ -767,7 +774,7 @@ __wt_evict_file_exclusive_on(WT_SESSION_IMPL *session)
(void)__wt_atomic_addv32(&cache->pass_intr, 1);
/* Clear any existing LRU eviction walk for the file. */
WT_WITH_PASS_LOCK(session, ret,
WT_WITH_PASS_LOCK(session,
ret = __evict_clear_walk(session, true));
(void)__wt_atomic_subv32(&cache->pass_intr, 1);
WT_ERR(ret);
@@ -1141,9 +1148,17 @@ retry: while (slot < max_entries) {
!__wt_cache_aggressive(session))
continue;
/* Skip files if we have used all available hazard pointers. */
if (btree->evict_ref == NULL && session->nhazard >=
conn->hazard_max - WT_MIN(conn->hazard_max / 2, 10))
/*
* Skip files if we have too many active walks.
*
* This used to be limited by the configured maximum number of
* hazard pointers per session. Even though that ceiling has
* been removed, we need to test eviction with huge numbers of
* active trees before allowing larger numbers of hazard
* pointers in the walk session.
*/
if (btree->evict_ref == NULL &&
session->nhazard > WT_EVICT_MAX_TREES)
continue;
/*

View File

@@ -37,7 +37,7 @@ __evict_exclusive(WT_SESSION_IMPL *session, WT_REF *ref)
* Check for a hazard pointer indicating another thread is using the
* page, meaning the page cannot be evicted.
*/
if (__wt_page_hazard_check(session, ref->page) == NULL)
if (__wt_hazard_check(session, ref) == NULL)
return (0);
WT_STAT_DATA_INCR(session, cache_eviction_hazard);
@@ -66,7 +66,7 @@ __wt_page_release_evict(WT_SESSION_IMPL *session, WT_REF *ref)
* between.
*/
locked = __wt_atomic_casv32(&ref->state, WT_REF_MEM, WT_REF_LOCKED);
if ((ret = __wt_hazard_clear(session, page)) != 0 || !locked) {
if ((ret = __wt_hazard_clear(session, ref)) != 0 || !locked) {
if (locked)
ref->state = WT_REF_MEM;
return (ret == 0 ? EBUSY : ret);
@@ -163,19 +163,8 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
*/
WT_ERR(__evict_page_clean_update(
session, ref, tree_dead || closing));
else {
/*
* The page is not being completely evicted: instead it is
* being split or replaced. In that case, don't increment the
* count of pages evicted, which we use to decide whether
* eviction is making progress. Repeatedly rewriting the same
* page isn't progress.
*/
F_SET(session, WT_SESSION_IN_SPLIT);
ret = __evict_page_dirty_update(session, ref, closing);
F_CLR(session, WT_SESSION_IN_SPLIT);
WT_ERR(ret);
}
else
WT_ERR(__evict_page_dirty_update(session, ref, closing));
if (clean_page) {
WT_STAT_CONN_INCR(session, cache_eviction_clean);
@@ -407,7 +396,7 @@ __evict_review(
WT_DECL_RET;
WT_PAGE *page;
uint32_t flags;
bool modified;
bool lookaside_retry, modified;
flags = WT_EVICTING;
*flagsp = flags;
@@ -506,27 +495,29 @@ __evict_review(
* If we have an exclusive lock (we're discarding the tree), assert
* there are no updates we cannot read.
*
* Don't set any other flags for internal pages: they don't have update
* lists to be saved and restored, nor can we re-create them in memory.
* Don't set any other flags for internal pages: there are no update
* lists to be saved and restored, changes can't be written into the
* lookaside table, nor can we re-create internal pages in memory.
*
* For leaf pages:
*
* If an in-memory configuration or the page is being forcibly evicted,
* set the update-restore flag, so reconciliation will write blocks it
* In-memory pages are a known configuration.
*
* Set the update/restore flag, so reconciliation will write blocks it
* can write and create a list of skipped updates for blocks it cannot
* write, along with disk images. This is how eviction of active, huge
* write, along with disk images. This is how eviction of active, huge
* pages works: we take a big page and reconcile it into blocks, some of
* which we write and discard, the rest of which we re-create as smaller
* in-memory pages, (restoring the updates that stopped us from writing
* the block), and inserting the whole mess into the page's parent.
* the block), and inserting the whole mess into the page's parent. Set
* the flag in all cases because the incremental cost of update/restore
* in reconciliation is minimal, eviction shouldn't have picked a page
* where update/restore is necessary, absent some cache pressure. It's
* possible updates occurred after we selected this page for eviction,
* but it's unlikely and we don't try and manage that risk.
*
* Otherwise, if eviction is getting pressed, configure reconciliation
* to write not-yet-globally-visible updates to the lookaside table,
* allowing the eviction of pages we'd otherwise have to retain in cache
* to support older readers.
*
* Finally, if we don't need to do eviction at the moment, create disk
* images of split pages in order to re-instantiate them.
* Additionally, if we aren't trying to free space in the cache, scrub
* the page and keep it in memory.
*/
cache = S2C(session)->cache;
if (closing)
@@ -535,25 +526,33 @@ __evict_review(
if (F_ISSET(S2C(session), WT_CONN_IN_MEMORY))
LF_SET(WT_EVICT_IN_MEMORY |
WT_EVICT_SCRUB | WT_EVICT_UPDATE_RESTORE);
else if (__wt_cache_stuck(session))
LF_SET(WT_EVICT_LOOKASIDE);
else if (!__wt_txn_visible_all(
session, page->modify->update_txn) ||
page->read_gen == WT_READGEN_OLDEST ||
page->memory_footprint >= S2BT(session)->splitmempage)
else {
LF_SET(WT_EVICT_UPDATE_RESTORE);
/*
* If we aren't trying to free space in the cache, scrub the
* page and keep it around.
*/
if (!LF_ISSET(WT_EVICT_LOOKASIDE) &&
F_ISSET(cache, WT_CACHE_EVICT_SCRUB))
LF_SET(WT_EVICT_SCRUB);
if (F_ISSET(cache, WT_CACHE_EVICT_SCRUB))
LF_SET(WT_EVICT_SCRUB);
}
}
*flagsp = flags;
WT_RET(__wt_reconcile(session, ref, NULL, flags));
/* Reconcile the page. */
ret = __wt_reconcile(session, ref, NULL, flags, &lookaside_retry);
/*
* If reconciliation fails, eviction is stuck and reconciliation reports
* it might succeed if we use the lookaside table (the page didn't have
* uncommitted updates, it was not-yet-globally visible updates causing
* the problem), configure reconciliation to write those updates to the
* lookaside table, allowing the eviction of pages we'd otherwise have
* to retain in cache to support older readers.
*/
if (ret == EBUSY && __wt_cache_stuck(session) && lookaside_retry) {
LF_CLR(WT_EVICT_SCRUB | WT_EVICT_UPDATE_RESTORE);
LF_SET(WT_EVICT_LOOKASIDE);
ret = __wt_reconcile(session, ref, NULL, flags, NULL);
}
*flagsp = flags;
WT_RET(ret);
/*
* Success: assert the page is clean or reconciliation was configured

View File

@@ -444,9 +444,6 @@ struct __wt_page {
/*
* Internal pages (both column- and row-store).
*
* The page record number is only used by column-store, but it's
* simpler having only one kind of internal page.
*
* In-memory internal pages have an array of pointers to child
* structures, maintained in collated order. When a page is
* read into memory, the initial list of children is stored in
@@ -723,7 +720,7 @@ struct __wt_ref {
* up our slot in the page's index structure.
*/
WT_PAGE * volatile home; /* Reference page */
uint32_t pindex_hint; /* Reference page index hint */
volatile uint32_t pindex_hint; /* Reference page index hint */
#define WT_REF_DISK 0 /* Page is on disk */
#define WT_REF_DELETED 1 /* Page is on disk, but deleted */

View File

@@ -44,7 +44,7 @@
* Record numbers are stored in 64-bit unsigned integers, meaning the largest
* record number is "really, really big".
*/
#define WT_BTREE_MAX_OBJECT_SIZE (UINT32_MAX - 1024)
#define WT_BTREE_MAX_OBJECT_SIZE ((uint32_t)(UINT32_MAX - 1024))
/*
* A location in a file is a variable-length cookie, but it has a maximum size

View File

@@ -408,11 +408,7 @@ __wt_cache_page_evict(WT_SESSION_IMPL *session, WT_PAGE *page)
/* Update pages and bytes evicted. */
(void)__wt_atomic_add64(&cache->bytes_evict, page->memory_footprint);
if (F_ISSET(session, WT_SESSION_IN_SPLIT))
(void)__wt_atomic_subv64(&cache->pages_inmem, 1);
else
(void)__wt_atomic_addv64(&cache->pages_evict, 1);
(void)__wt_atomic_addv64(&cache->pages_evict, 1);
}
/*
@@ -1359,7 +1355,7 @@ __wt_page_release(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags)
F_ISSET(session, WT_SESSION_NO_EVICTION) ||
F_ISSET(btree, WT_BTREE_NO_EVICTION) ||
!__wt_page_can_evict(session, ref, NULL))
return (__wt_hazard_clear(session, page));
return (__wt_hazard_clear(session, ref));
WT_RET_BUSY_OK(__wt_page_release_evict(session, ref));
return (0);
@@ -1440,53 +1436,6 @@ __wt_page_swap_func(
return (ret);
}
/*
* __wt_page_hazard_check --
* Return if there's a hazard pointer to the page in the system.
*/
static inline WT_HAZARD *
__wt_page_hazard_check(WT_SESSION_IMPL *session, WT_PAGE *page)
{
WT_CONNECTION_IMPL *conn;
WT_HAZARD *hp;
WT_SESSION_IMPL *s;
uint32_t i, j, hazard_size, max, session_cnt;
conn = S2C(session);
/*
* No lock is required because the session array is fixed size, but it
* may contain inactive entries. We must review any active session
* that might contain a hazard pointer, so insert a barrier before
* reading the active session count. That way, no matter what sessions
* come or go, we'll check the slots for all of the sessions that could
* have been active when we started our check.
*/
WT_STAT_CONN_INCR(session, cache_hazard_checks);
WT_ORDERED_READ(session_cnt, conn->session_cnt);
for (s = conn->sessions, i = 0, j = 0, max = 0;
i < session_cnt; ++s, ++i) {
if (!s->active)
continue;
WT_ORDERED_READ(hazard_size, s->hazard_size);
if (s->hazard_size > max) {
max = s->hazard_size;
WT_STAT_CONN_SET(session,
cache_hazard_max, max);
}
for (hp = s->hazard; hp < s->hazard + hazard_size; ++hp) {
++j;
if (hp->page == page) {
WT_STAT_CONN_INCRV(session,
cache_hazard_walks, j);
return (hp);
}
}
}
WT_STAT_CONN_INCRV(session, cache_hazard_walks, j);
return (NULL);
}
/*
* __wt_skip_choose_depth --
* Randomly choose a depth for a skiplist insert.

View File

@@ -16,6 +16,8 @@
#define WT_EVICT_WALK_BASE 300 /* Pages tracked across file visits */
#define WT_EVICT_WALK_INCR 100 /* Pages added each walk */
#define WT_EVICT_MAX_TREES 1000 /* Maximum walk points */
/*
* WT_EVICT_ENTRY --
* Encapsulation of an eviction candidate.
@@ -185,9 +187,9 @@ struct __wt_cache {
uint32_t flags;
};
#define WT_WITH_PASS_LOCK(session, ret, op) do { \
#define WT_WITH_PASS_LOCK(session, op) do { \
WT_ASSERT(session, !F_ISSET(session, WT_SESSION_LOCKED_PASS)); \
WT_WITH_LOCK(session, ret, \
WT_WITH_LOCK_WAIT(session, \
&cache->evict_pass_lock, WT_SESSION_LOCKED_PASS, op); \
} while (0)

View File

@@ -6,8 +6,10 @@
* See the file LICENSE for redistribution information.
*/
struct __wt_compact {
struct __wt_compact_state {
uint32_t lsm_count; /* Number of LSM trees seen */
uint32_t file_count; /* Number of files seen */
uint64_t max_time; /* Configured timeout */
struct timespec begin; /* Starting time */
};

View File

@@ -62,39 +62,40 @@ struct __wt_config_parser_impl {
#define WT_CONFIG_ENTRY_WT_CONNECTION_set_file_system 10
#define WT_CONFIG_ENTRY_WT_CURSOR_close 11
#define WT_CONFIG_ENTRY_WT_CURSOR_reconfigure 12
#define WT_CONFIG_ENTRY_WT_SESSION_begin_transaction 13
#define WT_CONFIG_ENTRY_WT_SESSION_checkpoint 14
#define WT_CONFIG_ENTRY_WT_SESSION_close 15
#define WT_CONFIG_ENTRY_WT_SESSION_commit_transaction 16
#define WT_CONFIG_ENTRY_WT_SESSION_compact 17
#define WT_CONFIG_ENTRY_WT_SESSION_create 18
#define WT_CONFIG_ENTRY_WT_SESSION_drop 19
#define WT_CONFIG_ENTRY_WT_SESSION_join 20
#define WT_CONFIG_ENTRY_WT_SESSION_log_flush 21
#define WT_CONFIG_ENTRY_WT_SESSION_log_printf 22
#define WT_CONFIG_ENTRY_WT_SESSION_open_cursor 23
#define WT_CONFIG_ENTRY_WT_SESSION_rebalance 24
#define WT_CONFIG_ENTRY_WT_SESSION_reconfigure 25
#define WT_CONFIG_ENTRY_WT_SESSION_rename 26
#define WT_CONFIG_ENTRY_WT_SESSION_reset 27
#define WT_CONFIG_ENTRY_WT_SESSION_rollback_transaction 28
#define WT_CONFIG_ENTRY_WT_SESSION_salvage 29
#define WT_CONFIG_ENTRY_WT_SESSION_snapshot 30
#define WT_CONFIG_ENTRY_WT_SESSION_strerror 31
#define WT_CONFIG_ENTRY_WT_SESSION_transaction_sync 32
#define WT_CONFIG_ENTRY_WT_SESSION_truncate 33
#define WT_CONFIG_ENTRY_WT_SESSION_upgrade 34
#define WT_CONFIG_ENTRY_WT_SESSION_verify 35
#define WT_CONFIG_ENTRY_colgroup_meta 36
#define WT_CONFIG_ENTRY_file_config 37
#define WT_CONFIG_ENTRY_file_meta 38
#define WT_CONFIG_ENTRY_index_meta 39
#define WT_CONFIG_ENTRY_lsm_meta 40
#define WT_CONFIG_ENTRY_table_meta 41
#define WT_CONFIG_ENTRY_wiredtiger_open 42
#define WT_CONFIG_ENTRY_wiredtiger_open_all 43
#define WT_CONFIG_ENTRY_wiredtiger_open_basecfg 44
#define WT_CONFIG_ENTRY_wiredtiger_open_usercfg 45
#define WT_CONFIG_ENTRY_WT_SESSION_alter 13
#define WT_CONFIG_ENTRY_WT_SESSION_begin_transaction 14
#define WT_CONFIG_ENTRY_WT_SESSION_checkpoint 15
#define WT_CONFIG_ENTRY_WT_SESSION_close 16
#define WT_CONFIG_ENTRY_WT_SESSION_commit_transaction 17
#define WT_CONFIG_ENTRY_WT_SESSION_compact 18
#define WT_CONFIG_ENTRY_WT_SESSION_create 19
#define WT_CONFIG_ENTRY_WT_SESSION_drop 20
#define WT_CONFIG_ENTRY_WT_SESSION_join 21
#define WT_CONFIG_ENTRY_WT_SESSION_log_flush 22
#define WT_CONFIG_ENTRY_WT_SESSION_log_printf 23
#define WT_CONFIG_ENTRY_WT_SESSION_open_cursor 24
#define WT_CONFIG_ENTRY_WT_SESSION_rebalance 25
#define WT_CONFIG_ENTRY_WT_SESSION_reconfigure 26
#define WT_CONFIG_ENTRY_WT_SESSION_rename 27
#define WT_CONFIG_ENTRY_WT_SESSION_reset 28
#define WT_CONFIG_ENTRY_WT_SESSION_rollback_transaction 29
#define WT_CONFIG_ENTRY_WT_SESSION_salvage 30
#define WT_CONFIG_ENTRY_WT_SESSION_snapshot 31
#define WT_CONFIG_ENTRY_WT_SESSION_strerror 32
#define WT_CONFIG_ENTRY_WT_SESSION_transaction_sync 33
#define WT_CONFIG_ENTRY_WT_SESSION_truncate 34
#define WT_CONFIG_ENTRY_WT_SESSION_upgrade 35
#define WT_CONFIG_ENTRY_WT_SESSION_verify 36
#define WT_CONFIG_ENTRY_colgroup_meta 37
#define WT_CONFIG_ENTRY_file_config 38
#define WT_CONFIG_ENTRY_file_meta 39
#define WT_CONFIG_ENTRY_index_meta 40
#define WT_CONFIG_ENTRY_lsm_meta 41
#define WT_CONFIG_ENTRY_table_meta 42
#define WT_CONFIG_ENTRY_wiredtiger_open 43
#define WT_CONFIG_ENTRY_wiredtiger_open_all 44
#define WT_CONFIG_ENTRY_wiredtiger_open_basecfg 45
#define WT_CONFIG_ENTRY_wiredtiger_open_usercfg 46
/*
* configuration section: END
* DO NOT EDIT: automatically built by dist/flags.py.

View File

@@ -255,12 +255,6 @@ struct __wt_connection_impl {
size_t session_scratch_max; /* Max scratch memory per session */
/*
* WiredTiger allocates space for a fixed number of hazard pointers
* in each thread of control.
*/
uint32_t hazard_max; /* Hazard array size */
WT_CACHE *cache; /* Page cache */
volatile uint64_t cache_size; /* Cache size (either statically
configured or the current size

View File

@@ -62,6 +62,8 @@ struct __wt_data_handle {
const char *checkpoint; /* Checkpoint name (or NULL) */
const char **cfg; /* Configuration information */
bool compact_skip; /* If the handle failed to compact */
WT_DATA_SOURCE *dsrc; /* Data source for this handle */
void *handle; /* Generic handle */

File diff suppressed because it is too large Load Diff

View File

@@ -1,31 +1,31 @@
/* DO NOT EDIT: automatically built by dist/s_prototypes. */
extern int __wt_posix_directory_list(WT_FILE_SYSTEM *file_system, WT_SESSION *wt_session, const char *directory, const char *prefix, char ***dirlistp, uint32_t *countp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_posix_directory_list_free(WT_FILE_SYSTEM *file_system, WT_SESSION *wt_session, char **dirlist, uint32_t count) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_dlopen(WT_SESSION_IMPL *session, const char *path, WT_DLH **dlhp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_dlsym(WT_SESSION_IMPL *session, WT_DLH *dlh, const char *name, bool fail, void *sym_ret) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_dlclose(WT_SESSION_IMPL *session, WT_DLH *dlh) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_posix_file_extend( WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session, wt_off_t offset) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_os_posix(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_getenv(WT_SESSION_IMPL *session, const char *variable, const char **envp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_posix_map(WT_FILE_HANDLE *fh, WT_SESSION *wt_session, void *mapped_regionp, size_t *lenp, void *mapped_cookiep) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_posix_map_preload(WT_FILE_HANDLE *fh, WT_SESSION *wt_session, const void *map, size_t length, void *mapped_cookie) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_posix_map_discard(WT_FILE_HANDLE *fh, WT_SESSION *wt_session, void *map, size_t length, void *mapped_cookie) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_posix_unmap(WT_FILE_HANDLE *fh, WT_SESSION *wt_session, void *mapped_region, size_t len, void *mapped_cookie) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_cond_alloc(WT_SESSION_IMPL *session, const char *name, bool is_signalled, WT_CONDVAR **condp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern void __wt_cond_wait_signal( WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs, bool *signalled);
extern void __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond);
extern int __wt_cond_destroy(WT_SESSION_IMPL *session, WT_CONDVAR **condp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_once(void (*init_routine)(void)) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_get_vm_pagesize(void) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern bool __wt_absolute_path(const char *path);
extern const char *__wt_path_separator(void);
extern bool __wt_has_priv(void);
extern void __wt_stream_set_line_buffer(FILE *fp);
extern void __wt_stream_set_no_buffer(FILE *fp);
extern void __wt_sleep(uint64_t seconds, uint64_t micro_seconds);
extern int __wt_thread_create(WT_SESSION_IMPL *session, wt_thread_t *tidret, WT_THREAD_CALLBACK(*func)(void *), void *arg) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_thread_join(WT_SESSION_IMPL *session, wt_thread_t tid) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern void __wt_thread_id(char *buf, size_t buflen);
extern void __wt_epoch(WT_SESSION_IMPL *session, struct timespec *tsp);
extern void __wt_yield(void);
extern int __wt_posix_directory_list(WT_FILE_SYSTEM *file_system, WT_SESSION *wt_session, const char *directory, const char *prefix, char ***dirlistp, uint32_t *countp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_posix_directory_list_free(WT_FILE_SYSTEM *file_system, WT_SESSION *wt_session, char **dirlist, uint32_t count) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_dlopen(WT_SESSION_IMPL *session, const char *path, WT_DLH **dlhp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_dlsym(WT_SESSION_IMPL *session, WT_DLH *dlh, const char *name, bool fail, void *sym_ret) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_dlclose(WT_SESSION_IMPL *session, WT_DLH *dlh) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_posix_file_extend( WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session, wt_off_t offset) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_os_posix(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_getenv(WT_SESSION_IMPL *session, const char *variable, const char **envp) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("default"))) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_posix_map(WT_FILE_HANDLE *fh, WT_SESSION *wt_session, void *mapped_regionp, size_t *lenp, void *mapped_cookiep) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_posix_map_preload(WT_FILE_HANDLE *fh, WT_SESSION *wt_session, const void *map, size_t length, void *mapped_cookie) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_posix_map_discard(WT_FILE_HANDLE *fh, WT_SESSION *wt_session, void *map, size_t length, void *mapped_cookie) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_posix_unmap(WT_FILE_HANDLE *fh, WT_SESSION *wt_session, void *mapped_region, size_t len, void *mapped_cookie) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_cond_alloc(WT_SESSION_IMPL *session, const char *name, bool is_signalled, WT_CONDVAR **condp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern void __wt_cond_wait_signal( WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs, bool *signalled) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern void __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_cond_destroy(WT_SESSION_IMPL *session, WT_CONDVAR **condp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_once(void (*init_routine)(void)) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_get_vm_pagesize(void) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern bool __wt_absolute_path(const char *path) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern const char *__wt_path_separator(void) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern bool __wt_has_priv(void) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern void __wt_stream_set_line_buffer(FILE *fp) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("default")));
extern void __wt_stream_set_no_buffer(FILE *fp) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("default")));
extern void __wt_sleep(uint64_t seconds, uint64_t micro_seconds) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("default")));
extern int __wt_thread_create(WT_SESSION_IMPL *session, wt_thread_t *tidret, WT_THREAD_CALLBACK(*func)(void *), void *arg) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_thread_join(WT_SESSION_IMPL *session, wt_thread_t tid) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern void __wt_thread_id(char *buf, size_t buflen) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("default")));
extern void __wt_epoch(WT_SESSION_IMPL *session, struct timespec *tsp) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("default")));
extern void __wt_yield(void) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("default")));

View File

@@ -1,34 +1,34 @@
/* DO NOT EDIT: automatically built by dist/s_prototypes. */
extern int __wt_win_directory_list(WT_FILE_SYSTEM *file_system, WT_SESSION *wt_session, const char *directory, const char *prefix, char ***dirlistp, uint32_t *countp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_win_directory_list_free(WT_FILE_SYSTEM *file_system, WT_SESSION *wt_session, char **dirlist, uint32_t count) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_dlopen(WT_SESSION_IMPL *session, const char *path, WT_DLH **dlhp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_dlsym(WT_SESSION_IMPL *session, WT_DLH *dlh, const char *name, bool fail, void *sym_ret) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_dlclose(WT_SESSION_IMPL *session, WT_DLH *dlh) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_win_fs_size(WT_FILE_SYSTEM *file_system, WT_SESSION *wt_session, const char *name, wt_off_t *sizep) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_os_win(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_getenv(WT_SESSION_IMPL *session, const char *variable, const char **envp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_win_map(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session, void *mapped_regionp, size_t *lenp, void *mapped_cookiep) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_win_unmap(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session, void *mapped_region, size_t length, void *mapped_cookie) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_cond_alloc(WT_SESSION_IMPL *session, const char *name, bool is_signalled, WT_CONDVAR **condp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern void __wt_cond_wait_signal( WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs, bool *signalled);
extern void __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond);
extern int __wt_cond_destroy(WT_SESSION_IMPL *session, WT_CONDVAR **condp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_once(void (*init_routine)(void)) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_get_vm_pagesize(void) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern bool __wt_absolute_path(const char *path);
extern const char *__wt_path_separator(void);
extern bool __wt_has_priv(void);
extern void __wt_stream_set_line_buffer(FILE *fp);
extern void __wt_stream_set_no_buffer(FILE *fp);
extern void __wt_sleep(uint64_t seconds, uint64_t micro_seconds);
extern int __wt_thread_create(WT_SESSION_IMPL *session, wt_thread_t *tidret, WT_THREAD_CALLBACK(*func)(void *), void *arg) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_thread_join(WT_SESSION_IMPL *session, wt_thread_t tid) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern void __wt_thread_id(char *buf, size_t buflen);
extern void __wt_epoch(WT_SESSION_IMPL *session, struct timespec *tsp);
extern int __wt_to_utf16_string( WT_SESSION_IMPL *session, const char*utf8, WT_ITEM **outbuf) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern int __wt_to_utf8_string( WT_SESSION_IMPL *session, const wchar_t*wide, WT_ITEM **outbuf) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern DWORD __wt_getlasterror(void);
extern int __wt_map_windows_error(DWORD windows_error) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result));
extern const char *__wt_formatmessage(WT_SESSION_IMPL *session, DWORD windows_error);
extern void __wt_yield(void);
extern int __wt_win_directory_list(WT_FILE_SYSTEM *file_system, WT_SESSION *wt_session, const char *directory, const char *prefix, char ***dirlistp, uint32_t *countp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_win_directory_list_free(WT_FILE_SYSTEM *file_system, WT_SESSION *wt_session, char **dirlist, uint32_t count) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_dlopen(WT_SESSION_IMPL *session, const char *path, WT_DLH **dlhp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_dlsym(WT_SESSION_IMPL *session, WT_DLH *dlh, const char *name, bool fail, void *sym_ret) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_dlclose(WT_SESSION_IMPL *session, WT_DLH *dlh) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_win_fs_size(WT_FILE_SYSTEM *file_system, WT_SESSION *wt_session, const char *name, wt_off_t *sizep) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_os_win(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_getenv(WT_SESSION_IMPL *session, const char *variable, const char **envp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_win_map(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session, void *mapped_regionp, size_t *lenp, void *mapped_cookiep) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_win_unmap(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session, void *mapped_region, size_t length, void *mapped_cookie) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_cond_alloc(WT_SESSION_IMPL *session, const char *name, bool is_signalled, WT_CONDVAR **condp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern void __wt_cond_wait_signal( WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs, bool *signalled) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern void __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_cond_destroy(WT_SESSION_IMPL *session, WT_CONDVAR **condp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_once(void (*init_routine)(void)) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_get_vm_pagesize(void) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern bool __wt_absolute_path(const char *path) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern const char *__wt_path_separator(void) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern bool __wt_has_priv(void) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern void __wt_stream_set_line_buffer(FILE *fp) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern void __wt_stream_set_no_buffer(FILE *fp) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern void __wt_sleep(uint64_t seconds, uint64_t micro_seconds) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_thread_create(WT_SESSION_IMPL *session, wt_thread_t *tidret, WT_THREAD_CALLBACK(*func)(void *), void *arg) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_thread_join(WT_SESSION_IMPL *session, wt_thread_t tid) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern void __wt_thread_id(char *buf, size_t buflen) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern void __wt_epoch(WT_SESSION_IMPL *session, struct timespec *tsp) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_to_utf16_string( WT_SESSION_IMPL *session, const char*utf8, WT_ITEM **outbuf) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_to_utf8_string( WT_SESSION_IMPL *session, const wchar_t*wide, WT_ITEM **outbuf) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern DWORD __wt_getlasterror(void) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern int __wt_map_windows_error(DWORD windows_error) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern const char *__wt_formatmessage(WT_SESSION_IMPL *session, DWORD windows_error) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));
extern void __wt_yield(void) WT_GCC_FUNC_DECL_ATTRIBUTE((visibility("hidden")));

View File

@@ -52,25 +52,23 @@
#define WT_READ_WONT_NEED 0x00001000
#define WT_SESSION_CAN_WAIT 0x00000001
#define WT_SESSION_INTERNAL 0x00000002
#define WT_SESSION_IN_SPLIT 0x00000004
#define WT_SESSION_LOCKED_CHECKPOINT 0x00000008
#define WT_SESSION_LOCKED_HANDLE_LIST 0x00000010
#define WT_SESSION_LOCKED_METADATA 0x00000020
#define WT_SESSION_LOCKED_PASS 0x00000040
#define WT_SESSION_LOCKED_SCHEMA 0x00000080
#define WT_SESSION_LOCKED_SLOT 0x00000100
#define WT_SESSION_LOCKED_TABLE 0x00000200
#define WT_SESSION_LOCKED_TURTLE 0x00000400
#define WT_SESSION_LOCK_NO_WAIT 0x00000800
#define WT_SESSION_LOGGING_INMEM 0x00001000
#define WT_SESSION_LOOKASIDE_CURSOR 0x00002000
#define WT_SESSION_NO_CACHE 0x00004000
#define WT_SESSION_NO_DATA_HANDLES 0x00008000
#define WT_SESSION_NO_EVICTION 0x00010000
#define WT_SESSION_NO_LOGGING 0x00020000
#define WT_SESSION_NO_SCHEMA_LOCK 0x00040000
#define WT_SESSION_QUIET_CORRUPT_FILE 0x00080000
#define WT_SESSION_SERVER_ASYNC 0x00100000
#define WT_SESSION_LOCKED_CHECKPOINT 0x00000004
#define WT_SESSION_LOCKED_HANDLE_LIST 0x00000008
#define WT_SESSION_LOCKED_METADATA 0x00000010
#define WT_SESSION_LOCKED_PASS 0x00000020
#define WT_SESSION_LOCKED_SCHEMA 0x00000040
#define WT_SESSION_LOCKED_SLOT 0x00000080
#define WT_SESSION_LOCKED_TABLE 0x00000100
#define WT_SESSION_LOCKED_TURTLE 0x00000200
#define WT_SESSION_LOGGING_INMEM 0x00000400
#define WT_SESSION_LOOKASIDE_CURSOR 0x00000800
#define WT_SESSION_NO_CACHE 0x00001000
#define WT_SESSION_NO_DATA_HANDLES 0x00002000
#define WT_SESSION_NO_EVICTION 0x00004000
#define WT_SESSION_NO_LOGGING 0x00008000
#define WT_SESSION_NO_SCHEMA_LOCK 0x00010000
#define WT_SESSION_QUIET_CORRUPT_FILE 0x00020000
#define WT_SESSION_SERVER_ASYNC 0x00040000
#define WT_STAT_CLEAR 0x00000001
#define WT_STAT_JSON 0x00000002
#define WT_STAT_ON_CLOSE 0x00000004

View File

@@ -10,8 +10,6 @@
#define WT_SIZET_FMT "zu" /* size_t format string */
/* Add GCC-specific attributes to types and function declarations. */
#define WT_COMPILER_TYPE_ALIGN(x) __attribute__((aligned(x)))
#define WT_PACKED_STRUCT_BEGIN(name) \
struct __attribute__ ((__packed__)) name {
#define WT_PACKED_STRUCT_END \

View File

@@ -55,7 +55,19 @@
#else
#define WT_CACHE_LINE_ALIGNMENT 64
#endif
#define WT_CACHE_LINE_ALIGNMENT_VERIFY(session, a) \
WT_ASSERT(session, \
WT_PTRDIFF(&(a)[1], &(a)[0]) >= WT_CACHE_LINE_ALIGNMENT && \
WT_PTRDIFF(&(a)[1], &(a)[0]) % WT_CACHE_LINE_ALIGNMENT == 0)
/*
* Pad a structure so an array of structures get separate cache lines.
*
* Note that we avoid compiler structure alignment because that requires
* allocating aligned blocks of memory, and alignment pollutes any other type
* that contains an aligned field. It is possible that a hot field positioned
* before this one will be on the same cache line, but not if it is also
* padded.
*
* This alignment has a small impact on portability as well, as we are using an
* anonymous union here which is supported under C11, earlier versions of
* the GNU standard, and MSVC versions as early as 2003.
*/
#define WT_CACHE_LINE_PAD_BEGIN union { struct {
#define WT_CACHE_LINE_PAD_END }; char __padding[WT_CACHE_LINE_ALIGNMENT]; };

View File

@@ -9,8 +9,6 @@
#define WT_PTRDIFFT_FMT "td" /* ptrdiff_t format string */
#define WT_SIZET_FMT "zu" /* size_t format string */
#define WT_COMPILER_TYPE_ALIGN(x)
#define WT_PACKED_STRUCT_BEGIN(name) \
struct name {
#define WT_PACKED_STRUCT_END \

View File

@@ -159,7 +159,8 @@ union __wt_lsn {
!FLD64_ISSET((uint64_t)(state), WT_LOG_SLOT_CLOSE) && \
WT_LOG_SLOT_JOINED(state) < WT_LOG_SLOT_BUF_MAX)
struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_logslot {
struct __wt_logslot {
WT_CACHE_LINE_PAD_BEGIN
volatile int64_t slot_state; /* Slot state */
int64_t slot_unbuffered; /* Unbuffered data in this slot */
int32_t slot_error; /* Error value */
@@ -176,13 +177,14 @@ struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_logslot {
#define WT_SLOT_SYNC 0x04 /* Needs sync on release */
#define WT_SLOT_SYNC_DIR 0x08 /* Directory sync on release */
uint32_t flags; /* Flags */
WT_CACHE_LINE_PAD_END
};
#define WT_SLOT_INIT_FLAGS 0
#define WT_WITH_SLOT_LOCK(session, log, ret, op) do { \
#define WT_WITH_SLOT_LOCK(session, log, op) do { \
WT_ASSERT(session, !F_ISSET(session, WT_SESSION_LOCKED_SLOT)); \
WT_WITH_LOCK(session, ret, \
WT_WITH_LOCK_WAIT(session, \
&log->log_slot_lock, WT_SESSION_LOCKED_SLOT, op); \
} while (0)

View File

@@ -42,9 +42,9 @@
* WT_WITH_TURTLE_LOCK --
* Acquire the turtle file lock, perform an operation, drop the lock.
*/
#define WT_WITH_TURTLE_LOCK(session, ret, op) do { \
#define WT_WITH_TURTLE_LOCK(session, op) do { \
WT_ASSERT(session, !F_ISSET(session, WT_SESSION_LOCKED_TURTLE));\
WT_WITH_LOCK(session, ret, \
WT_WITH_LOCK_WAIT(session, \
&S2C(session)->turtle_lock, WT_SESSION_LOCKED_TURTLE, op); \
} while (0)

View File

@@ -275,6 +275,3 @@ union __wt_rand_state {
uint32_t w, z;
} x;
};
/* Shared array for converting to hex */
extern const u_char __wt_hex[];

View File

@@ -18,6 +18,16 @@ __wt_cond_wait(WT_SESSION_IMPL *session, WT_CONDVAR *cond, uint64_t usecs)
__wt_cond_wait_signal(session, cond, usecs, &notused);
}
/*
* __wt_hex --
* Convert a byte to a hex character.
*/
static inline u_char
__wt_hex(int c)
{
return ((u_char)"0123456789abcdef"[c]);
}
/*
* __wt_strdup --
* ANSI strdup function.

View File

@@ -19,8 +19,6 @@
/*
* Add MSVC-specific attributes and pragmas to types and function declarations.
*/
#define WT_COMPILER_TYPE_ALIGN(x) __declspec(align(x))
#define WT_PACKED_STRUCT_BEGIN(name) \
__pragma(pack(push,1)) \
struct name {

View File

@@ -53,9 +53,11 @@ typedef union { /* Read/write lock */
* WiredTiger uses read/write locks for shared/exclusive access to resources.
*/
struct __wt_rwlock {
WT_CACHE_LINE_PAD_BEGIN
const char *name; /* Lock name for debugging */
wt_rwlock_t rwlock; /* Read/write lock */
WT_CACHE_LINE_PAD_END
};
/*
@@ -72,7 +74,8 @@ struct __wt_rwlock {
#if SPINLOCK_TYPE == SPINLOCK_GCC
struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_spinlock {
struct __wt_spinlock {
WT_CACHE_LINE_PAD_BEGIN
volatile int lock;
/*
@@ -84,13 +87,15 @@ struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_spinlock {
int16_t stat_count_off; /* acquisitions offset */
int16_t stat_app_usecs_off; /* waiting application threads offset */
int16_t stat_int_usecs_off; /* waiting server threads offset */
WT_CACHE_LINE_PAD_END
};
#elif SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX ||\
SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX_ADAPTIVE ||\
SPINLOCK_TYPE == SPINLOCK_MSVC
struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_spinlock {
struct __wt_spinlock {
WT_CACHE_LINE_PAD_BEGIN
wt_mutex_t lock;
const char *name; /* Mutex name */
@@ -106,6 +111,7 @@ struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_spinlock {
int16_t stat_int_usecs_off; /* waiting server threads offset */
int8_t initialized; /* Lock initialized, for cleanup */
WT_CACHE_LINE_PAD_END
};
#else

View File

@@ -95,29 +95,30 @@ struct __wt_table {
} while (0)
/*
* WT_WITH_LOCK --
* Acquire a lock, perform an operation, drop the lock.
* WT_WITH_LOCK_NOWAIT --
* Acquire a lock if available, perform an operation, drop the lock.
*/
#define WT_WITH_LOCK(session, ret, lock, flag, op) do { \
#define WT_WITH_LOCK_NOWAIT(session, ret, lock, flag, op) do { \
ret = 0; \
if (!F_ISSET(session, (flag)) && \
F_ISSET(session, WT_SESSION_LOCK_NO_WAIT)) { \
if ((ret = __wt_spin_trylock(session, lock)) == 0) { \
F_SET(session, (flag)); \
op; \
F_CLR(session, (flag)); \
__wt_spin_unlock(session, lock); \
} \
} else \
WT_WITH_LOCK_WAIT(session, lock, flag, op); \
if (F_ISSET(session, (flag))) { \
op; \
} else if ((ret = __wt_spin_trylock(session, lock)) == 0) { \
F_SET(session, (flag)); \
op; \
F_CLR(session, (flag)); \
__wt_spin_unlock(session, lock); \
} \
} while (0)
/*
* WT_WITH_CHECKPOINT_LOCK --
* WT_WITH_CHECKPOINT_LOCK, WT_WITH_CHECKPOINT_LOCK_NOWAIT --
* Acquire the checkpoint lock, perform an operation, drop the lock.
*/
#define WT_WITH_CHECKPOINT_LOCK(session, ret, op) \
WT_WITH_LOCK(session, ret, \
#define WT_WITH_CHECKPOINT_LOCK(session, op) \
WT_WITH_LOCK_WAIT(session, \
&S2C(session)->checkpoint_lock, WT_SESSION_LOCKED_CHECKPOINT, op)
#define WT_WITH_CHECKPOINT_LOCK_NOWAIT(session, ret, op) \
WT_WITH_LOCK_NOWAIT(session, ret, \
&S2C(session)->checkpoint_lock, WT_SESSION_LOCKED_CHECKPOINT, op)
/*
@@ -136,34 +137,49 @@ struct __wt_table {
* WT_WITH_METADATA_LOCK --
* Acquire the metadata lock, perform an operation, drop the lock.
*/
#define WT_WITH_METADATA_LOCK(session, ret, op) \
WT_WITH_LOCK(session, ret, \
#define WT_WITH_METADATA_LOCK(session, op) \
WT_WITH_LOCK_WAIT(session, \
&S2C(session)->metadata_lock, WT_SESSION_LOCKED_METADATA, op)
/*
* WT_WITH_SCHEMA_LOCK --
* WT_WITH_SCHEMA_LOCK, WT_WITH_SCHEMA_LOCK_NOWAIT --
* Acquire the schema lock, perform an operation, drop the lock.
* Check that we are not already holding some other lock: the schema lock
* must be taken first.
*/
#define WT_WITH_SCHEMA_LOCK(session, ret, op) do { \
#define WT_WITH_SCHEMA_LOCK(session, op) do { \
WT_ASSERT(session, \
F_ISSET(session, WT_SESSION_LOCKED_SCHEMA) || \
!F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST | \
WT_SESSION_NO_SCHEMA_LOCK | WT_SESSION_LOCKED_TABLE)); \
WT_WITH_LOCK(session, ret, \
WT_WITH_LOCK_WAIT(session, \
&S2C(session)->schema_lock, WT_SESSION_LOCKED_SCHEMA, op); \
} while (0)
#define WT_WITH_SCHEMA_LOCK_NOWAIT(session, ret, op) do { \
WT_ASSERT(session, \
F_ISSET(session, WT_SESSION_LOCKED_SCHEMA) || \
!F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST | \
WT_SESSION_NO_SCHEMA_LOCK | WT_SESSION_LOCKED_TABLE)); \
WT_WITH_LOCK_NOWAIT(session, ret, \
&S2C(session)->schema_lock, WT_SESSION_LOCKED_SCHEMA, op); \
} while (0)
/*
* WT_WITH_TABLE_LOCK --
* WT_WITH_TABLE_LOCK, WT_WITH_TABLE_LOCK_NOWAIT --
* Acquire the table lock, perform an operation, drop the lock.
*/
#define WT_WITH_TABLE_LOCK(session, ret, op) do { \
#define WT_WITH_TABLE_LOCK(session, op) do { \
WT_ASSERT(session, \
F_ISSET(session, WT_SESSION_LOCKED_TABLE) || \
!F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST)); \
WT_WITH_LOCK(session, ret, \
WT_WITH_LOCK_WAIT(session, \
&S2C(session)->table_lock, WT_SESSION_LOCKED_TABLE, op); \
} while (0)
#define WT_WITH_TABLE_LOCK_NOWAIT(session, ret, op) do { \
WT_ASSERT(session, \
F_ISSET(session, WT_SESSION_LOCKED_TABLE) || \
!F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST)); \
WT_WITH_LOCK_NOWAIT(session, ret, \
&S2C(session)->table_lock, WT_SESSION_LOCKED_TABLE, op); \
} while (0)

View File

@@ -23,7 +23,7 @@ struct __wt_data_handle_cache {
* A hazard pointer.
*/
struct __wt_hazard {
WT_PAGE *page; /* Page address */
WT_REF *ref; /* Page reference */
#ifdef HAVE_DIAGNOSTIC
const char *file; /* File/line where hazard acquired */
int line;
@@ -41,7 +41,7 @@ struct __wt_hazard {
* WT_SESSION_IMPL --
* Implementation of WT_SESSION.
*/
struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_session_impl {
struct __wt_session_impl {
WT_SESSION iface;
void *lang_private; /* Language specific private storage */
@@ -75,7 +75,7 @@ struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_session_impl {
WT_CURSOR_BACKUP *bkp_cursor; /* Hot backup cursor */
WT_COMPACT *compact; /* Compaction information */
WT_COMPACT_STATE *compact; /* Compaction information */
enum { WT_COMPACT_NONE=0,
WT_COMPACT_RUNNING, WT_COMPACT_SUCCESS } compact_state;
@@ -200,9 +200,13 @@ struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_session_impl {
#define WT_SESSION_FIRST_USE(s) \
((s)->hazard == NULL)
/* The number of hazard pointers grows dynamically. */
#define WT_HAZARD_INCR 1
uint32_t hazard_size; /* Allocated slots in hazard array. */
/*
* The hazard pointer array grows as necessary, initialize with 250
* slots.
*/
#define WT_SESSION_INITIAL_HAZARD_SLOTS 250
uint32_t hazard_size; /* Hazard pointer array slots */
uint32_t hazard_inuse; /* Hazard pointer array slots in-use */
uint32_t nhazard; /* Count of active hazard pointers */
WT_HAZARD *hazard; /* Hazard pointer array */
};

View File

@@ -445,6 +445,9 @@ struct __wt_connection_stats {
int64_t rec_split_stashed_objects;
int64_t session_cursor_open;
int64_t session_open;
int64_t session_table_alter_fail;
int64_t session_table_alter_success;
int64_t session_table_alter_skip;
int64_t session_table_compact_fail;
int64_t session_table_compact_success;
int64_t session_table_create_fail;

View File

@@ -62,15 +62,17 @@ struct __wt_named_snapshot {
TAILQ_ENTRY(__wt_named_snapshot) q;
uint64_t pinned_id, snap_min, snap_max;
uint64_t id, pinned_id, snap_min, snap_max;
uint64_t *snapshot;
uint32_t snapshot_count;
};
struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_txn_state {
struct __wt_txn_state {
WT_CACHE_LINE_PAD_BEGIN
volatile uint64_t id;
volatile uint64_t pinned_id;
volatile uint64_t metadata_pinned;
WT_CACHE_LINE_PAD_END
};
struct __wt_txn_global {
@@ -103,6 +105,7 @@ struct __wt_txn_global {
* the metadata; and (b) once checkpoint has finished reading a table,
* it won't revisit it.
*/
volatile bool checkpoint_running; /* Checkpoint running */
volatile uint32_t checkpoint_id; /* Checkpoint's session ID */
volatile uint64_t checkpoint_gen; /* Checkpoint generation */
volatile uint64_t checkpoint_pinned; /* Oldest ID for checkpoint */

View File

@@ -62,7 +62,6 @@ __wt_txn_unmodify(WT_SESSION_IMPL *session)
static inline int
__wt_txn_modify(WT_SESSION_IMPL *session, WT_UPDATE *upd)
{
WT_DECL_RET;
WT_TXN_OP *op;
WT_TXN *txn;
@@ -77,7 +76,7 @@ __wt_txn_modify(WT_SESSION_IMPL *session, WT_UPDATE *upd)
WT_TXN_OP_INMEM : WT_TXN_OP_BASIC;
op->u.upd = upd;
upd->txnid = session->txn.id;
return (ret);
return (0);
}
/*

Some files were not shown because too many files have changed in this diff Show More