diff options
author | Keith Bostic <keith@wiredtiger.com> | 2015-04-01 07:29:43 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2015-04-01 07:29:43 -0400 |
commit | 27a7df31be161b1c76ea2b066db2b8c1a7cb8a56 (patch) | |
tree | 193ef9f3c98d2282a7f10df8a76e5542de8eafb8 | |
parent | a74bec0a7dc993f074b3263bf3c37dee16bc287e (diff) | |
parent | 76cba586685828fc3a8598b48e70c7614818859c (diff) | |
download | mongo-27a7df31be161b1c76ea2b066db2b8c1a7cb8a56.tar.gz |
Merge branch 'develop' into vectorize-search
87 files changed, 704 insertions, 824 deletions
diff --git a/bench/wtperf/config.c b/bench/wtperf/config.c index e27b4861bed..82d4800e25f 100644 --- a/bench/wtperf/config.c +++ b/bench/wtperf/config.c @@ -613,26 +613,26 @@ config_print(CONFIG *cfg) u_int i; printf("Workload configuration:\n"); - printf("\tHome: %s\n", cfg->home); - printf("\tTable name: %s\n", cfg->table_name); - printf("\tConnection configuration: %s\n", cfg->conn_config); + printf("\t" "Home: %s\n", cfg->home); + printf("\t" "Table name: %s\n", cfg->table_name); + printf("\t" "Connection configuration: %s\n", cfg->conn_config); if (cfg->sess_config != NULL) - printf("\tSession configuration: %s\n", cfg->sess_config); + printf("\t" "Session configuration: %s\n", cfg->sess_config); printf("\t%s table: %s\n", cfg->create ? "Creating new" : "Using existing", cfg->table_config); - printf("\tKey size: %" PRIu32 ", value size: %" PRIu32 "\n", + printf("\t" "Key size: %" PRIu32 ", value size: %" PRIu32 "\n", cfg->key_sz, cfg->value_sz); if (cfg->create) - printf("\tPopulate threads: %" PRIu32 ", inserting %" PRIu32 + printf("\t" "Populate threads: %" PRIu32 ", inserting %" PRIu32 " rows\n", cfg->populate_threads, cfg->icount); - printf("\tWorkload seconds, operations: %" PRIu32 ", %" PRIu32 "\n", + printf("\t" "Workload seconds, operations: %" PRIu32 ", %" PRIu32 "\n", cfg->run_time, cfg->run_ops); if (cfg->workload != NULL) { - printf("\tWorkload configuration(s):\n"); + printf("\t" "Workload configuration(s):\n"); for (i = 0, workp = cfg->workload; i < cfg->workload_cnt; ++i, ++workp) printf("\t\t%" PRId64 " threads (inserts=%" PRId64 @@ -641,12 +641,12 @@ config_print(CONFIG *cfg) workp->insert, workp->read, workp->update); } - printf("\tCheckpoint threads, interval: %" PRIu32 ", %" PRIu32 "\n", + printf("\t" "Checkpoint threads, interval: %" PRIu32 ", %" PRIu32 "\n", cfg->checkpoint_threads, cfg->checkpoint_interval); - printf("\tReporting interval: %" PRIu32 "\n", cfg->report_interval); - printf("\tSampling interval: %" PRIu32 "\n", cfg->sample_interval); + printf("\t" "Reporting interval: %" PRIu32 "\n", cfg->report_interval); + printf("\t" "Sampling interval: %" PRIu32 "\n", cfg->sample_interval); - printf("\tVerbosity: %" PRIu32 "\n", cfg->verbose); + printf("\t" "Verbosity: %" PRIu32 "\n", cfg->verbose); } /* diff --git a/bench/wtperf/wtperf.c b/bench/wtperf/wtperf.c index 8780d270664..5b506437dca 100644 --- a/bench/wtperf/wtperf.c +++ b/bench/wtperf/wtperf.c @@ -229,7 +229,7 @@ track_operation(TRACK *trk, uint64_t usecs) ++trk->us[v]; /* - * Second buckets: millseconds from 1ms to 1000ms, at 1ms each. + * Second buckets: milliseconds from 1ms to 1000ms, at 1ms each. */ else if (v < ms_to_us(1000)) ++trk->ms[us_to_ms(v)]; @@ -2026,7 +2026,7 @@ main(int argc, char *argv[]) cfg->async_threads = 2; if (cfg->async_threads > 0) { /* - * The maximum number of async threasd is two digits, so just + * The maximum number of async threads is two digits, so just * use that to compute the space we need. Assume the default * of 1024 for the max ops. Although we could bump that up * to 4096 if needed. diff --git a/bench/wtperf/wtperf.h b/bench/wtperf/wtperf.h index 201623c7859..f176f62320e 100644 --- a/bench/wtperf/wtperf.h +++ b/bench/wtperf/wtperf.h @@ -102,7 +102,7 @@ typedef struct { * NOTE: If you add any fields to this structure here, you must also add * an initialization in wtperf.c in the default_cfg. */ -struct __config { /* Configuration struction */ +struct __config { /* Configuration structure */ const char *home; /* WiredTiger home */ const char *monitor_dir; /* Monitor output dir */ char *base_uri; /* Object URI */ diff --git a/dist/s_string b/dist/s_string index 89ba5b130d0..2e226b21094 100644 --- a/dist/s_string +++ b/dist/s_string @@ -15,6 +15,16 @@ type aspell > /dev/null 2>&1 || { exit 0 } +# replace: +# Create a replacement list of spelling words. +replace() { + aspell --mode=ccpp --lang=en list < ../$1 | + sort -u | + comm -12 /dev/stdin s_string.ok +} + +# check: +# Check the spelling of an individual file. check() { aspell --mode=ccpp --lang=en list < ../$1 | sort -u | @@ -27,9 +37,28 @@ check() { # List of files to spellchk. l=`(cd .. && - find examples ext src test -name '*.[chisy]' && + find bench examples ext src test -name '*.[chisy]' && find src -name '*.in')` +usage() +{ + echo 'usage: s_string [-r]' >&2 + exit 1 +} +while : + do case "$1" in + -r) # -r builds replacement list of OK words + for f in $l; do + replace $f + done | sort -u > $t + cp $t s_string.ok + shift;; + *) + test "$#" -eq 0 || usage + break;; + esac +done + for f in $l; do check $f done diff --git a/dist/s_string.ok b/dist/s_string.ok index e2c6380660d..ed17236924d 100644 --- a/dist/s_string.ok +++ b/dist/s_string.ok @@ -6,7 +6,6 @@ AAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA ABCDEFGHIJKLMNOPQRSTUVWXYZ ADDR -AIX AJ API APIs @@ -20,7 +19,6 @@ Alloc Async Athanassoulis Athlon -BASHOLEVELDB BBBBB BBBBBB BBBBBBBBBB @@ -33,11 +31,7 @@ BIGENDIAN BOOL BSR BTREE -BUF -BUFs -BUILTIN BZ -BZIP Barack Bitfield Bitwise @@ -49,13 +43,8 @@ CELL's CELLs CHECKKEY CKPT -CLMPRSTdehikrsuv -CLR -CMP -COL's CONCAT CONFIG -CPUID CPUs CRC CURSORs @@ -68,24 +57,19 @@ CloseHandle Comparator Config CreateFileMapping -CreateThread Crummey CustomersPhone -DATAITEMs DECL DECR DESC DHANDLE -DLFCN DNE DOI -DSRC DUPLICATEV DbCursor DbEnv Decrement EAGAIN -EB EBUSY EINTR EINVAL @@ -93,36 +77,23 @@ EMSG EMail ENOENT ENOMEM -ENOSYS ENOTSUP -ENV EOF ERET ESET ETIME ETIMEDOUT -EXLOG EXTLIST Enqueue -Env Eron -FADVISE -FALLOCATE FALLTHROUGH -FCNTL -FDATASYNC FH FLD FLS FNV FORALL FOREACH -FREAD -FREELIST -FTRUNCATE FULLFSYNC -Fasttrack -Filesystems FindFirstFile Fk FlushFileBuffers @@ -130,13 +101,8 @@ Fprintf FreeBSD FreeBSD's FreeLibrary -Freelist -Fsync -Ftruncate Fuerst GCC -GETTIME -GETTIMEOFDAY GIDs Gcc Geoff @@ -146,30 +112,20 @@ GetFileSizeEx GetLastError GetModuleHandleEx GetProcAddress -Givargis Google HFS HHHH HHHHLL HHHLL -HYPERLEVELDB -HyperLevelDB IEC IEEE -IFF IKEY IMPL -IMPL's INCR -INDX INIT INITIALIZER INMEM -INODE -INSERT's INTL -INUSE -ISSET ITEMs Inline Intra @@ -184,17 +140,9 @@ KVS Kanowski's Kounavis LANGID -LEX LF -LIBBZ -LIBDL -LIBPTHREAD -LIBRT -LIBSNAPPY -LIBZ LLLLLL LLLLLLL -LNO LOGREC LOGSCAN LRU @@ -203,26 +151,20 @@ LSB LSM LSN LSNs +LTE LZ LZO LeafGreen -LevelDB Levyx Llqr Llqrt -LoadLoad LockFile Lookup -MADVISE MALLOC -MAXID -MBUF MEM -MEMALIGN MERCHANTABILITY MSVC MUTEX -MVCC Manos MapViewOfFile Marsaglia's @@ -232,10 +174,8 @@ Mewhort Mitzenmacher MongoDB MoveFile -Multi Multithreaded Mutex -Mutexes NEEDKEY NEEDVALUE NOLL @@ -243,29 +183,20 @@ NONINFRINGEMENT NOTFOUND NOTREACHED NOVALUE -NOWRITE -NRECS NUL -NULLs NetBSD NoAddr Noll Nul -ONPAGE OPTYPE OUTBUFF OVFL Obama -PADDR -PAGE's PARAM POSIX PRIu -PRIu64 -PSIZE PTHREAD PTR -Pagesize Pandis Phong PlatformSDK @@ -274,43 +205,29 @@ Pre Prepend Qsort RCS -READONLY -RECNO REF's REFs -REQ RET RHEL RLE +RLEs RNG -ROCKSDB RPC RUNDIR -RVv Radu -Recno -Recurse RedHat Redistributions -Relock Resize -RocksDB -SCHED SIMD SLIST SLVG -SML SOURCE's -SPARC SPINLOCK SQL -SSD SSHH SSq STAILQ -STRTOUQ STRUCT -SYS Scalability Scalable Seigh @@ -325,18 +242,11 @@ Spinlock Spinlocks Split's Stoica -StoreLoad -Strsep -Subtree -Subtrees TAILQ TODO -TOOSMALL TORTIOUS -TRK TXN TXNC -TXNID Timespec Timestamp TryCV @@ -346,9 +256,6 @@ UID UIDs UINT ULINE -UNISTD -UPD -UPDATEs URI URIs UTF @@ -356,11 +263,9 @@ UnixLib Unmap UnmapViewOfFile Unmarshall -Unregister VARCHAR VLDB VMSG -Vanishingly Vc Vfprintf Vixie @@ -368,7 +273,6 @@ Vo Vv VxWorks WIREDTIGER -WaitForSingleObject WakeAllConditionVariable Wconditional WeakHashLen @@ -378,26 +282,18 @@ WinNT WiredTiger WiredTiger's WiredTigerCheckpoint -WiredTigerHome WiredTigerInit WiredTigerLog WiredTigerPreplog -WiredTigerStat WiredTigerTmplog WiredTigerTxn WithSeeds -Wmissing Wuninitialized XP -ZLIB -Zlib -__wt_epoch abcdef abcdefghijklmnopqrstuvwxyz -addfrag addl addr -addrs af agc alfred @@ -408,18 +304,15 @@ allocfile allocsize amd ao -ap api -apip arg argc args argv async asyncopp -autockpt +asyncops autocommit -autoheader bInheritHandle basecfg bdb @@ -429,31 +322,26 @@ bitcnt bitfield bitfields bitpos -bitstr bitstring bitwise +blk bm bnd bool boolean br breakpoint -bsearch bt btcur -btdsk btmem btree btrees buf -buflen -bufs bufsz builtin builtins bytelock bytestring -bz bzCompressEnd bzCompressInit bzDecompress @@ -464,13 +352,11 @@ bzfree bzip calloc catfmt -cb cd centric cfg cfkos change's -checkfrag checkpointed checkpointer checkpointing @@ -479,12 +365,10 @@ checksums chk chongo cip -cityhash ckpt ckptfrag ckptlist cksum -clr clsm cmd cmp @@ -510,11 +394,8 @@ copyout cp cpuid crc -cref ctime -ctype curbackup -curbtree curbulk curconfig curdump @@ -546,9 +427,7 @@ decrementing deflateCopy deflateEnd deflateInit -defno del -delfmt dequeue dequeued der @@ -560,42 +439,34 @@ dhandle dhandles dir dirlist -dl dlclose -dlfcn dlh dll dlopen dlsym dmsg +doxgen +doxygen ds dsk dsrc dst dstlen dsync -dt -dtype -dumpable dumpcmp -dumpfile dup eg emp encodings endian -endif english enqueue enqueued -enum's env eof -eop equalp errhandler errno -errv errx esc eventv @@ -606,20 +477,16 @@ exe execop extern extlist -extlists fadvise fallocate fblocks fclose fcntl -fdatasync -feof ffc fflush ffs fgetln fh -fileID filefrag fileid filename @@ -632,37 +499,26 @@ filesystems fillms firstfit fixup -flcs floatnum fmt fmterr fnv foc fopen -fotxn fp fprintf -fread free'd -freelist -fs -fsm fstat fsync fsyncs ftruncate func -funcs gcc gdb getenv -getfiles -getid getline getone -getoneraw getones -getonesn getopt getraw gettime @@ -677,8 +533,6 @@ hashval havesize hdr highjack -hin -hrow html huffman hval @@ -689,33 +543,26 @@ ibackup icount idx ifdef's -ifndef ikey -imref incr incrementing -incrv indices indirects indx infeasible -inflateEnd inflateInit init initn initsize +initval inline -inlined inmem -inode insertK insertV instantiation intl intnum intpack -ints -inttypes inuse io ip @@ -725,22 +572,15 @@ jnr jrx json kb -kcell keycmp -keygen -keyname keyv kv kvraw kvs kvsbdb lang -latencies lbrace lbracket -lbz -ld -ldl len lenp level's @@ -751,31 +591,26 @@ lfence libdatasource libs libwiredtiger -lld llll llu -lno loadtext localtime -lockdown logf logmgr lognum -logput logread logrec logsize logtest lookup lookups -lpthread -lr -lrt +lossy lru lseek lsm lsn lsnappy +lt lu lz lzo @@ -784,65 +619,48 @@ majorp malloc marshall marshalled -maxid -maxintlitem -maxintlpage -maxleafitem -maxleafpage -mb mem memalign -memalloc membar memcpy -memfree memmove memset memsize -mergeable metaconf metadata metafile mfence minorp -minprefix mkdir mmap mnt msecs msg -msgv msvc -mtx multi multiblock multicore multiprocess multisocket -multithread multithreaded munmap mutex mutexes -myfile mytable mytxn namespace namespaces nbits -nbsp nchunks nclr nd negint newbar newfile -newname newuri nextprev nfilename nhex -nl nlpo nocase nonliteral @@ -850,43 +668,34 @@ noop nop noraw notfound -notset notsup -notyet -nowrite -np -nr nset -nthread nul nuls numSymbols numbare -oc offpage -oindex ok -oldname ondisk onint onpage oo opendir openfile -opsq optype os ovfl ownp packv parens +pareto parserp patchp pathname pathnames -perf pfx poptable +popthreads pos posint posix @@ -904,7 +713,6 @@ printlog priv progname ps -pse psp pthread pushms @@ -912,10 +720,8 @@ putK putV pv py -qSS qdown qrrSS -qs qsort quartile qup @@ -923,14 +729,9 @@ rS rb rbrace rbracket -rdlock rduppo readlock -readnear -readnext readonly -readprev -readserver readunlock realloc recno @@ -938,43 +739,27 @@ recnos reconfig reconfiguring recsize -rectype recurse refp reinitialization -req -rescan resize resizing -resultp ret retp rf rle +rmw rng rpc -rref run's -runlength runtime rwlock -rwlocks -rwunlock -rx sH sHQ -savepoints -sb -scanp sched -schemas -schematab scr sd -searchable sed -seqno -serializable sessionp setstr setv @@ -985,7 +770,6 @@ sizep sizev skiplist skiplists -sl slotsp slvg snaplen @@ -996,35 +780,22 @@ spinlocks sprintf src srch -srvr -sset ssize startup statlog -stbar -stdarg stderr stdin -stdint -stdlib stdout -stepinit -stepkv -stepnext stepp -steprec str strcmp strdup strerror strftime -strget -stringin strlen -strncmp strncpy strndup -strsep +strtok strtoll strtouq struct @@ -1035,79 +806,39 @@ subgets subinit sublicense subtree -subtrees sunique superset sw sys -syserr -sz t's tV tablename -tbackup -tblock -tcopyright -tcreate -tcursors -tdatabase -tdisplay -tdrop -tdump -tdumpfile -tempty th -thazard tid timestamp -tinsert -tlist -tload tmp -toffpage tokenizer toklen tokname tokstart toktype -toverflow -tparent -tprintlog +totalsec transactional transactionally trecno -treeconfig -trename -trepeat -treplacement trk trk's -troot -trun trunc trylock -trywrlock -tsalvage -tsplit -tstat -tstate -tt -ttracking tupdate -tupgrade tvalue -tverbose -tverify -twiredtiger -twrite txn txnc txnid -txnidp txnmin typedef uB -uid +uS uint uintmax unbare @@ -1118,9 +849,6 @@ unesc unescaped uninstantiated unistd -unix -unjams -unlinked unmap unmarshall unmarshalled @@ -1137,6 +865,7 @@ update's upg uri uri's +uris usecs usedp usercfg @@ -1149,22 +878,17 @@ valuep valuev vanishingly variable's -vcell -verrx versa vfprintf -vlcs -vmsg vpack vprintf vrfy vsize -vslot vsnprintf vtype vunpack -vupdate walk's +warmup wb wiredtiger workFactor diff --git a/dist/stat.py b/dist/stat.py index 53cbf30cf16..2a87d4425e6 100644 --- a/dist/stat.py +++ b/dist/stat.py @@ -123,7 +123,13 @@ __wt_stat_refresh_''' + name + '''_stats(void *stats_arg) f.write('}\n') # Aggregation is only interesting for data-source statistics. + # Complain if any aggregation flags are set. if name == 'connection': + for l in sorted(list): + if 'no_aggregate' in l.flags or 'max_aggregate' in l.flags: + print >>sys.stdout,\ + "Aggregation configuration for " +\ + name + "." + l.name + " statistics not supported" return; f.write(''' diff --git a/dist/stat_data.py b/dist/stat_data.py index f133ab899ea..ba6e7ec2459 100644 --- a/dist/stat_data.py +++ b/dist/stat_data.py @@ -9,9 +9,12 @@ # # Optional configuration flags: # no_clear Value not cleared when statistics cleared +# no_scale Don't scale value per second in the logging tool script +# +# Data-source statistics are normally aggregated across the set of underlying +# objects. Additional optionaly configuration flags are available: # no_aggregate Ignore the value when aggregating statistics # max_aggregate Take the maximum value when aggregating statistics -# no_scale Don't scale value per second in the logging tool script from operator import attrgetter import sys @@ -121,7 +124,7 @@ connection_stats = [ AsyncStat('async_full', 'number of times operation allocation failed'), AsyncStat('async_cur_queue', 'current work queue length'), AsyncStat('async_max_queue', - 'maximum work queue length', 'max_aggregate,no_scale'), + 'maximum work queue length', 'no_clear,no_scale'), AsyncStat('async_nowork', 'number of times worker found no work'), AsyncStat('async_op_alloc', 'total allocations'), AsyncStat('async_op_compact', 'total compact calls'), @@ -178,7 +181,7 @@ connection_stats = [ CacheStat('cache_eviction_hazard', 'hazard pointer blocked page eviction'), CacheStat('cache_eviction_internal', 'internal pages evicted'), CacheStat('cache_eviction_maximum_page_size', - 'maximum page size at eviction', 'max_aggregate,no_scale'), + 'maximum page size at eviction', 'no_clear,no_scale'), CacheStat('cache_eviction_queue_empty', 'eviction server candidate queue empty when topping up'), CacheStat('cache_eviction_queue_not_empty', @@ -269,26 +272,20 @@ connection_stats = [ TxnStat('txn_checkpoint_generation', 'transaction checkpoint generation', 'no_clear,no_scale'), TxnStat('txn_checkpoint_time_max', - 'transaction checkpoint max time (msecs)', - 'no_aggregate,no_clear,no_scale'), + 'transaction checkpoint max time (msecs)', 'no_clear,no_scale'), TxnStat('txn_checkpoint_time_min', - 'transaction checkpoint min time (msecs)', - 'max_aggregate,no_clear,no_scale'), + 'transaction checkpoint min time (msecs)', 'no_clear,no_scale'), TxnStat('txn_checkpoint_time_recent', - 'transaction checkpoint most recent time (msecs)', - 'no_aggregate,no_clear,no_scale'), + 'transaction checkpoint most recent time (msecs)', 'no_clear,no_scale'), TxnStat('txn_checkpoint_time_total', - 'transaction checkpoint total time (msecs)', - 'no_aggregate,no_clear,no_scale'), + 'transaction checkpoint total time (msecs)', 'no_clear,no_scale'), TxnStat('txn_checkpoint_running', - 'transaction checkpoint currently running', - 'no_aggregate,no_clear,no_scale'), + 'transaction checkpoint currently running', 'no_clear,no_scale'), TxnStat('txn_pinned_checkpoint_range', 'transaction range of IDs currently pinned by a checkpoint', - 'no_aggregate,no_clear,no_scale'), + 'no_clear,no_scale'), TxnStat('txn_pinned_range', - 'transaction range of IDs currently pinned', - 'no_aggregate,no_clear,no_scale'), + 'transaction range of IDs currently pinned', 'no_clear,no_scale'), TxnStat('txn_commit', 'transactions committed'), TxnStat('txn_fail_cache', 'transaction failures due to cache overflow'), TxnStat('txn_rollback', 'transactions rolled back'), @@ -391,15 +388,15 @@ dsrc_stats = [ BtreeStat('btree_maximum_depth', 'maximum tree depth', 'max_aggregate,no_scale'), BtreeStat('btree_maxintlkey', - 'maximum internal page key size', 'no_aggregate,no_scale'), + 'maximum internal page key size', 'max_aggregate,no_scale'), BtreeStat('btree_maxintlpage', - 'maximum internal page size', 'no_aggregate,no_scale'), + 'maximum internal page size', 'max_aggregate,no_scale'), BtreeStat('btree_maxleafkey', - 'maximum leaf page key size', 'no_aggregate,no_scale'), + 'maximum leaf page key size', 'max_aggregate,no_scale'), BtreeStat('btree_maxleafpage', - 'maximum leaf page size', 'no_aggregate,no_scale'), + 'maximum leaf page size', 'max_aggregate,no_scale'), BtreeStat('btree_maxleafvalue', - 'maximum leaf page value size', 'no_aggregate,no_scale'), + 'maximum leaf page value size', 'max_aggregate,no_scale'), BtreeStat('btree_overflow', 'overflow pages', 'no_scale'), BtreeStat('btree_row_internal', 'row-store internal pages', 'no_scale'), BtreeStat('btree_row_leaf', 'row-store leaf pages', 'no_scale'), @@ -415,8 +412,7 @@ dsrc_stats = [ LSMStat('bloom_page_read', 'bloom filter pages read into cache'), LSMStat('bloom_size', 'total size of bloom filters', 'no_scale'), LSMStat('lsm_checkpoint_throttle', 'sleep for LSM checkpoint throttle'), - LSMStat('lsm_chunk_count', - 'chunks in the LSM tree', 'no_aggregate,no_scale'), + LSMStat('lsm_chunk_count', 'chunks in the LSM tree', 'no_scale'), LSMStat('lsm_generation_max', 'highest merge generation in the LSM tree', 'max_aggregate,no_scale'), LSMStat('lsm_lookup_no_bloom', diff --git a/lang/python/wiredtiger.i b/lang/python/wiredtiger.i index d35d7d5c456..c46fd6d24a6 100644 --- a/lang/python/wiredtiger.i +++ b/lang/python/wiredtiger.i @@ -358,12 +358,12 @@ retry: $action if (result != 0 && result != EBUSY) SWIG_ERROR_IF_NOT_SET(result); - else if (result == EBUSY) { + else if (result == EBUSY) { SWIG_PYTHON_THREAD_BEGIN_ALLOW; - __wt_sleep(0, 10000); + __wt_sleep(0, 10000); SWIG_PYTHON_THREAD_END_ALLOW; - goto retry; - } + goto retry; + } } %enddef @@ -745,8 +745,8 @@ typedef int int_void; } else { ret = $self->equals($self, other, &cmp); - if (ret == 0) - ret = cmp; + if (ret == 0) + ret = cmp; } return (ret); } @@ -842,12 +842,25 @@ typedef int int_void; self._iterable = IterableCursor(self) return self._iterable + def __delitem__(self, key): + '''Python convenience for removing''' + self.set_key(key) + if self.remove() != 0: + raise KeyError + def __getitem__(self, key): '''Python convenience for searching''' self.set_key(key) if self.search() != 0: raise KeyError return self.get_value() + + def __setitem__(self, key, value): + '''Python convenience for inserting''' + self.set_key(key) + self.set_value(value) + if self.insert() != 0: + raise KeyError %} }; @@ -870,17 +883,17 @@ typedef int int_void; %{ int diagnostic_build() { #ifdef HAVE_DIAGNOSTIC - return 1; + return 1; #else - return 0; + return 0; #endif } int verbose_build() { #ifdef HAVE_VERBOSE - return 1; + return 1; #else - return 0; + return 0; #endif } %} @@ -1127,8 +1140,8 @@ pythonAsyncCallback(WT_ASYNC_CALLBACK *cb, WT_ASYNC_OP *asyncop, int opret, int ret, t_ret; PY_CALLBACK *pcb; PyObject *arglist, *notify_method, *pyresult; - WT_ASYNC_OP_IMPL *op; - WT_SESSION_IMPL *session; + WT_ASYNC_OP_IMPL *op; + WT_SESSION_IMPL *session; /* * Ensure the global interpreter lock is held since we'll be @@ -1136,8 +1149,8 @@ pythonAsyncCallback(WT_ASYNC_CALLBACK *cb, WT_ASYNC_OP *asyncop, int opret, */ SWIG_PYTHON_THREAD_BEGIN_BLOCK; - op = (WT_ASYNC_OP_IMPL *)asyncop; - session = O2S(op); + op = (WT_ASYNC_OP_IMPL *)asyncop; + session = O2S(op); pcb = (PY_CALLBACK *)asyncop->c.lang_private; asyncop->c.lang_private = NULL; ret = 0; @@ -1172,10 +1185,10 @@ err: __wt_err(session, ret, "python async callback error"); } __wt_free(session, pcb); - if (ret == 0 && (opret == 0 || opret == WT_NOTFOUND)) - return (0); - else - return (1); + if (ret == 0 && (opret == 0 || opret == WT_NOTFOUND)) + return (0); + else + return (1); } static WT_ASYNC_CALLBACK pyApiAsyncCallback = { pythonAsyncCallback }; diff --git a/src/btree/bt_curnext.c b/src/btree/bt_curnext.c index d80a5f4740d..ffb5cbcedd6 100644 --- a/src/btree/bt_curnext.c +++ b/src/btree/bt_curnext.c @@ -165,14 +165,18 @@ __cursor_var_next(WT_CURSOR_BTREE *cbt, int newpage) WT_CELL_UNPACK unpack; WT_COL *cip; WT_ITEM *val; + WT_INSERT *ins; WT_PAGE *page; WT_SESSION_IMPL *session; WT_UPDATE *upd; + uint64_t rle, rle_start; session = (WT_SESSION_IMPL *)cbt->iface.session; page = cbt->ref->page; val = &cbt->iface.value; + rle_start = 0; /* -Werror=maybe-uninitialized */ + /* Initialize for each new page. */ if (newpage) { cbt->last_standard_recno = __col_var_last_recno(page); @@ -189,7 +193,8 @@ __cursor_var_next(WT_CURSOR_BTREE *cbt, int newpage) __cursor_set_recno(cbt, cbt->recno + 1); new_page: /* Find the matching WT_COL slot. */ - if ((cip = __col_var_search(page, cbt->recno)) == NULL) + if ((cip = + __col_var_search(page, cbt->recno, &rle_start)) == NULL) return (WT_NOTFOUND); cbt->slot = WT_COL_SLOT(page, cip); @@ -220,8 +225,41 @@ new_page: /* Find the matching WT_COL slot. */ if ((cell = WT_COL_PTR(page, cip)) == NULL) continue; __wt_cell_unpack(cell, &unpack); - if (unpack.type == WT_CELL_DEL) + if (unpack.type == WT_CELL_DEL) { + if ((rle = __wt_cell_rle(&unpack)) == 1) + continue; + + /* + * There can be huge gaps in the variable-length + * column-store name space appearing as deleted + * records. If more than one deleted record, do + * the work of finding the next record to return + * instead of looping through the records. + * + * First, find the smallest record in the update + * list that's larger than the current record. + */ + ins = __col_insert_search_gt( + cbt->ins_head, cbt->recno); + + /* + * Second, for records with RLEs greater than 1, + * the above call to __col_var_search located + * this record in the page's list of repeating + * records, and returned the starting record. + * The starting record plus the RLE is the + * record to which we could skip, if there was + * no smaller record in the update list. + */ + cbt->recno = rle_start + rle; + if (ins != NULL && + WT_INSERT_RECNO(ins) < cbt->recno) + cbt->recno = WT_INSERT_RECNO(ins); + + /* Adjust for the outer loop increment. */ + --cbt->recno; continue; + } WT_RET(__wt_page_cell_data_ref( session, page, &unpack, &cbt->tmp)); diff --git a/src/btree/bt_curprev.c b/src/btree/bt_curprev.c index f1ca81ee145..eeb69433a1f 100644 --- a/src/btree/bt_curprev.c +++ b/src/btree/bt_curprev.c @@ -301,15 +301,19 @@ __cursor_var_prev(WT_CURSOR_BTREE *cbt, int newpage) WT_CELL *cell; WT_CELL_UNPACK unpack; WT_COL *cip; + WT_INSERT *ins; WT_ITEM *val; WT_PAGE *page; WT_SESSION_IMPL *session; WT_UPDATE *upd; + uint64_t rle_start; session = (WT_SESSION_IMPL *)cbt->iface.session; page = cbt->ref->page; val = &cbt->iface.value; + rle_start = 0; /* -Werror=maybe-uninitialized */ + /* Initialize for each new page. */ if (newpage) { cbt->last_standard_recno = __col_var_last_recno(page); @@ -327,7 +331,8 @@ new_page: if (cbt->recno < page->pg_var_recno) return (WT_NOTFOUND); /* Find the matching WT_COL slot. */ - if ((cip = __col_var_search(page, cbt->recno)) == NULL) + if ((cip = + __col_var_search(page, cbt->recno, &rle_start)) == NULL) return (WT_NOTFOUND); cbt->slot = WT_COL_SLOT(page, cip); @@ -358,8 +363,40 @@ new_page: if (cbt->recno < page->pg_var_recno) if ((cell = WT_COL_PTR(page, cip)) == NULL) continue; __wt_cell_unpack(cell, &unpack); - if (unpack.type == WT_CELL_DEL) + if (unpack.type == WT_CELL_DEL) { + if (__wt_cell_rle(&unpack) == 1) + continue; + /* + * There can be huge gaps in the variable-length + * column-store name space appearing as deleted + * records. If more than one deleted record, do + * the work of finding the next record to return + * instead of looping through the records. + * + * First, find the largest record in the update + * list that's smaller than the current record. + */ + ins = __col_insert_search_lt( + cbt->ins_head, cbt->recno); + + /* + * Second, for records with RLEs greater than 1, + * the above call to __col_var_search located + * this record in the page's list of repeating + * records, and returned the starting record. + * The starting record - 1 is the record to + * which we could skip, if there was no larger + * record in the update list. + */ + cbt->recno = rle_start - 1; + if (ins != NULL && + WT_INSERT_RECNO(ins) > cbt->recno) + cbt->recno = WT_INSERT_RECNO(ins); + + /* Adjust for the outer loop decrement. */ + ++cbt->recno; continue; + } WT_RET(__wt_page_cell_data_ref( session, page, &unpack, &cbt->tmp)); diff --git a/src/btree/bt_debug.c b/src/btree/bt_debug.c index fa7cff35e5f..6da5d9ecd16 100644 --- a/src/btree/bt_debug.c +++ b/src/btree/bt_debug.c @@ -546,8 +546,7 @@ __debug_page(WT_DBG *ds, WT_PAGE *page, uint32_t flags) session = ds->session; /* Dump the page metadata. */ - WT_WITH_PAGE_INDEX(session, - ret = __debug_page_metadata(ds, page)); + WT_WITH_PAGE_INDEX(session, ret = __debug_page_metadata(ds, page)); WT_RET(ret); /* Dump the page. */ @@ -600,7 +599,7 @@ __debug_page_metadata(WT_DBG *ds, WT_PAGE *page) switch (page->type) { case WT_PAGE_COL_INT: __dmsg(ds, " recno %" PRIu64, page->pg_intl_recno); - pindex = WT_INTL_INDEX_COPY(page); + WT_INTL_INDEX_GET(session, page, pindex); entries = pindex->entries; break; case WT_PAGE_COL_FIX: @@ -612,7 +611,7 @@ __debug_page_metadata(WT_DBG *ds, WT_PAGE *page) entries = page->pg_var_entries; break; case WT_PAGE_ROW_INT: - pindex = WT_INTL_INDEX_COPY(page); + WT_INTL_INDEX_GET(session, page, pindex); entries = pindex->entries; break; case WT_PAGE_ROW_LEAF: diff --git a/src/btree/bt_discard.c b/src/btree/bt_discard.c index 05a54ad643e..f43e936eeda 100644 --- a/src/btree/bt_discard.c +++ b/src/btree/bt_discard.c @@ -209,7 +209,7 @@ __free_page_modify(WT_SESSION_IMPL *session, WT_PAGE *page) static void __free_page_int(WT_SESSION_IMPL *session, WT_PAGE *page) { - __wt_free_ref_index(session, page, WT_INTL_INDEX_COPY(page), 0); + __wt_free_ref_index(session, page, WT_INTL_INDEX_GET_SAFE(page), 0); } /* diff --git a/src/btree/bt_handle.c b/src/btree/bt_handle.c index 1e0f95d3131..1930d6650a8 100644 --- a/src/btree/bt_handle.c +++ b/src/btree/bt_handle.c @@ -422,7 +422,7 @@ __btree_tree_open_empty(WT_SESSION_IMPL *session, int creation) __wt_page_alloc(session, WT_PAGE_COL_INT, 1, 1, 1, &root)); root->pg_intl_parent_ref = &btree->root; - pindex = WT_INTL_INDEX_COPY(root); + pindex = WT_INTL_INDEX_GET_SAFE(root); ref = pindex->index[0]; ref->home = root; ref->page = NULL; @@ -435,7 +435,7 @@ __btree_tree_open_empty(WT_SESSION_IMPL *session, int creation) __wt_page_alloc(session, WT_PAGE_ROW_INT, 0, 1, 1, &root)); root->pg_intl_parent_ref = &btree->root; - pindex = WT_INTL_INDEX_COPY(root); + pindex = WT_INTL_INDEX_GET_SAFE(root); ref = pindex->index[0]; ref->home = root; ref->page = NULL; diff --git a/src/btree/bt_page.c b/src/btree/bt_page.c index 0b93cc981d7..dd7a29347df 100644 --- a/src/btree/bt_page.c +++ b/src/btree/bt_page.c @@ -269,7 +269,7 @@ __wt_page_alloc(WT_SESSION_IMPL *session, uint8_t type, size += sizeof(WT_REF); } if (0) { -err: if ((pindex = WT_INTL_INDEX_COPY(page)) != NULL) { +err: if ((pindex = WT_INTL_INDEX_GET_SAFE(page)) != NULL) { for (i = 0; i < pindex->entries; ++i) __wt_free(session, pindex->index[i]); __wt_free(session, pindex); @@ -456,7 +456,7 @@ __inmem_col_int(WT_SESSION_IMPL *session, WT_PAGE *page) * Walk the page, building references: the page contains value items. * The value items are on-page items (WT_CELL_VALUE). */ - pindex = WT_INTL_INDEX_COPY(page); + pindex = WT_INTL_INDEX_GET_SAFE(page); refp = pindex->index; WT_CELL_FOREACH(btree, dsk, cell, unpack, i) { ref = *refp++; @@ -591,7 +591,7 @@ __inmem_row_int(WT_SESSION_IMPL *session, WT_PAGE *page, size_t *sizep) * location cookie pairs. Keys are on-page/overflow items and location * cookies are WT_CELL_ADDR_XXX items. */ - pindex = WT_INTL_INDEX_COPY(page); + pindex = WT_INTL_INDEX_GET_SAFE(page); refp = pindex->index; WT_CELL_FOREACH(btree, dsk, cell, unpack, i) { ref = *refp; diff --git a/src/btree/bt_slvg.c b/src/btree/bt_slvg.c index ba1802116d0..896ab23f1c2 100644 --- a/src/btree/bt_slvg.c +++ b/src/btree/bt_slvg.c @@ -1175,7 +1175,7 @@ __slvg_col_build_internal( __wt_page_alloc(session, WT_PAGE_COL_INT, 1, leaf_cnt, 1, &page)); WT_ERR(__slvg_modify_init(session, page)); - pindex = WT_INTL_INDEX_COPY(page); + pindex = WT_INTL_INDEX_GET_SAFE(page); for (refp = pindex->index, i = 0; i < ss->pages_next; ++i) { if ((trk = ss->pages[i]) == NULL) continue; @@ -1820,7 +1820,7 @@ __slvg_row_build_internal( __wt_page_alloc(session, WT_PAGE_ROW_INT, 0, leaf_cnt, 1, &page)); WT_ERR(__slvg_modify_init(session, page)); - pindex = WT_INTL_INDEX_COPY(page); + pindex = WT_INTL_INDEX_GET_SAFE(page); for (refp = pindex->index, i = 0; i < ss->pages_next; ++i) { if ((trk = ss->pages[i]) == NULL) continue; diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c index 9fc567f02c1..1ffc6d25b53 100644 --- a/src/btree/bt_split.c +++ b/src/btree/bt_split.c @@ -147,6 +147,9 @@ static int __split_safe_free(WT_SESSION_IMPL *session, uint64_t split_gen, int exclusive, void *p, size_t s) { + /* We should only call safe free if we aren't pinning the memory. */ + WT_ASSERT(session, session->split_gen != split_gen); + /* * We have swapped something in a page: if we don't have exclusive * access, check whether there are other threads in the same tree. @@ -178,7 +181,13 @@ __split_should_deepen( btree = S2BT(session); page = ref->page; - pindex = WT_INTL_INDEX_COPY(page); + + /* + * Our caller is holding the parent page locked to single-thread splits, + * which means we can safely look at the page's index without setting a + * split generation. + */ + pindex = WT_INTL_INDEX_GET_SAFE(page); /* * Deepen the tree if the page's memory footprint is larger than the @@ -338,7 +347,7 @@ __split_verify_intl_key_order(WT_SESSION_IMPL *session, WT_PAGE *page) switch (page->type) { case WT_PAGE_COL_INT: recno = 0; - WT_INTL_FOREACH_BEGIN_SAFE(session, page, ref) { + WT_INTL_FOREACH_BEGIN(session, page, ref) { WT_ASSERT(session, ref->key.recno > recno); recno = ref->key.recno; } WT_INTL_FOREACH_END; @@ -350,7 +359,7 @@ __split_verify_intl_key_order(WT_SESSION_IMPL *session, WT_PAGE *page) WT_CLEAR(_last); first = 1; - WT_INTL_FOREACH_BEGIN_SAFE(session, page, ref) { + WT_INTL_FOREACH_BEGIN(session, page, ref) { __wt_ref_key(page, ref, &next->data, &next->size); if (last->size == 0) { if (first) @@ -393,7 +402,12 @@ __split_deepen(WT_SESSION_IMPL *session, WT_PAGE *parent, uint32_t children) parent_incr = parent_decr = 0; panic = 0; - pindex = WT_INTL_INDEX_COPY(parent); + /* + * Our caller is holding the parent page locked to single-thread splits, + * which means we can safely look at the page's index without setting a + * split generation. + */ + pindex = WT_INTL_INDEX_GET_SAFE(parent); WT_STAT_FAST_CONN_INCR(session, cache_eviction_deepen); WT_STAT_FAST_DATA_INCR(session, cache_eviction_deepen); @@ -491,7 +505,7 @@ __split_deepen(WT_SESSION_IMPL *session, WT_PAGE *parent, uint32_t children) * to change. */ child_incr = 0; - child_pindex = WT_INTL_INDEX_COPY(child); + child_pindex = WT_INTL_INDEX_GET_SAFE(child); for (child_refp = child_pindex->index, j = 0; j < slots; ++j) { WT_ERR(__split_ref_deepen_move(session, parent, *parent_refp, &parent_decr, &child_incr)); @@ -505,11 +519,11 @@ __split_deepen(WT_SESSION_IMPL *session, WT_PAGE *parent, uint32_t children) parent_refp - pindex->index == pindex->entries - SPLIT_CORRECT_1); /* - * Update the parent's index; this is the update which splits the page, - * making the change visible to threads descending the tree. From now - * on, we're committed to the split. If any subsequent work fails, we - * have to panic because we potentially have threads of control using - * the new page index we just swapped in. + * Confirm the parent page's index hasn't moved, then update it, which + * makes the split visible to threads descending the tree. From this + * point on, we're committed to the split. If subsequent work fails, + * we have to panic because we may have threads of control using the + * new page index we swap in. * * A note on error handling: until this point, there's no problem with * unwinding on error. We allocated a new page index, a new set of @@ -518,13 +532,14 @@ __split_deepen(WT_SESSION_IMPL *session, WT_PAGE *parent, uint32_t children) * footprint. From now on we've modified the parent page, attention * needs to be paid. */ - WT_ASSERT(session, WT_INTL_INDEX_COPY(parent) == pindex); + WT_ASSERT(session, WT_INTL_INDEX_GET_SAFE(parent) == pindex); WT_INTL_INDEX_SET(parent, alloc_index); split_gen = WT_ATOMIC_ADD8(S2C(session)->split_gen, 1); panic = 1; #ifdef HAVE_DIAGNOSTIC - __split_verify_intl_key_order(session, parent); + WT_WITH_PAGE_INDEX(session, + __split_verify_intl_key_order(session, parent)); #endif /* @@ -555,9 +570,16 @@ __split_deepen(WT_SESSION_IMPL *session, WT_PAGE *parent, uint32_t children) if (!WT_PAGE_IS_INTERNAL(child)) continue; #ifdef HAVE_DIAGNOSTIC - __split_verify_intl_key_order(session, child); + WT_WITH_PAGE_INDEX(session, + __split_verify_intl_key_order(session, child)); #endif - WT_INTL_FOREACH_BEGIN_SAFE(session, child, child_ref) { + /* + * We have the parent locked, but there's nothing to prevent + * this child from splitting beneath us; ensure that reading + * the child's page index structure is safe. + */ + WT_ENTER_PAGE_INDEX(session); + WT_INTL_FOREACH_BEGIN(session, child, child_ref) { /* * The page's parent reference may not be wrong, as we * opened up access from the top of the tree already, @@ -570,6 +592,7 @@ __split_deepen(WT_SESSION_IMPL *session, WT_PAGE *parent, uint32_t children) child_ref->ref_hint = 0; } } WT_INTL_FOREACH_END; + WT_LEAVE_PAGE_INDEX(session); } /* @@ -731,9 +754,8 @@ __wt_multi_to_ref(WT_SESSION_IMPL *session, addr = NULL; incr = 0; - /* In some cases, the underlying WT_REF has not yet been allocated. */ - if (*refp == NULL) - WT_RET(__wt_calloc_one(session, refp)); + /* Allocate an underlying WT_REF. */ + WT_RET(__wt_calloc_one(session, refp)); ref = *refp; incr += sizeof(WT_REF); @@ -848,7 +870,11 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref, hazard = 1; } - pindex = WT_INTL_INDEX_COPY(parent); + /* + * We've locked the parent above, which means it cannot split (which is + * the only reason to worry about split generation values). + */ + pindex = WT_INTL_INDEX_GET_SAFE(parent); parent_entries = pindex->entries; /* @@ -904,16 +930,17 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref, } /* - * Update the parent page's index: this update makes the split visible - * to threads descending the tree. + * Confirm the parent page's index hasn't moved then update it, which + * makes the split visible to threads descending the tree. */ - WT_ASSERT(session, WT_INTL_INDEX_COPY(parent) == pindex); + WT_ASSERT(session, WT_INTL_INDEX_GET_SAFE(parent) == pindex); WT_INTL_INDEX_SET(parent, alloc_index); split_gen = WT_ATOMIC_ADD8(S2C(session)->split_gen, 1); alloc_index = NULL; #ifdef HAVE_DIAGNOSTIC - __split_verify_intl_key_order(session, parent); + WT_WITH_PAGE_INDEX(session, + __split_verify_intl_key_order(session, parent)); #endif /* diff --git a/src/btree/bt_walk.c b/src/btree/bt_walk.c index 98411ce548d..fd25efec97e 100644 --- a/src/btree/bt_walk.c +++ b/src/btree/bt_walk.c @@ -272,7 +272,7 @@ descend: couple = ref; page = ref->page; if (page->type == WT_PAGE_ROW_INT || page->type == WT_PAGE_COL_INT) { - pindex = WT_INTL_INDEX_COPY(page); + WT_INTL_INDEX_GET(session, page, pindex); slot = prev ? pindex->entries - 1 : 0; } else { *refp = ref; diff --git a/src/btree/col_srch.c b/src/btree/col_srch.c index db1b565b439..df31748e569 100644 --- a/src/btree/col_srch.c +++ b/src/btree/col_srch.c @@ -49,8 +49,7 @@ restart: page = current->page; WT_ASSERT(session, current->key.recno == page->pg_intl_recno); - WT_ASSERT(session, session->split_gen != 0); - pindex = WT_INTL_INDEX_COPY(page); + WT_INTL_INDEX_GET(session, page, pindex); base = pindex->entries; descent = pindex->index[base - 1]; @@ -134,7 +133,7 @@ leaf_only: } else ins_head = WT_COL_UPDATE_SINGLE(page); } else - if ((cip = __col_var_search(page, recno)) == NULL) { + if ((cip = __col_var_search(page, recno, NULL)) == NULL) { cbt->recno = __col_var_last_recno(page); goto past_end; } else { diff --git a/src/btree/row_srch.c b/src/btree/row_srch.c index 9967c5ecb0c..d6179d08b55 100644 --- a/src/btree/row_srch.c +++ b/src/btree/row_srch.c @@ -195,8 +195,7 @@ restart: page = current->page; if (page->type != WT_PAGE_ROW_INT) break; - WT_ASSERT(session, session->split_gen != 0); - pindex = WT_INTL_INDEX_COPY(page); + WT_INTL_INDEX_GET(session, page, pindex); /* * Fast-path internal pages with one child, a common case for @@ -488,8 +487,7 @@ restart: if (page->type != WT_PAGE_ROW_INT) break; - WT_ASSERT(session, session->split_gen != 0); - pindex = WT_INTL_INDEX_COPY(page); + WT_INTL_INDEX_GET(session, page, pindex); descent = pindex->index[ __wt_random(session->rnd) % pindex->entries]; @@ -523,8 +521,7 @@ restart: */ cbt->ref = current; cbt->compare = 0; - WT_ASSERT(session, session->split_gen != 0); - pindex = WT_INTL_INDEX_COPY(btree->root.page); + WT_INTL_INDEX_GET(session, btree->root.page, pindex); cbt->slot = pindex->entries < 2 ? __wt_random(session->rnd) % page->pg_row_entries : 0; diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c index b41cad25914..dcb769dba4c 100644 --- a/src/conn/conn_api.c +++ b/src/conn/conn_api.c @@ -1803,7 +1803,7 @@ err: /* Discard the configuration strings. */ __wt_buf_free(session, &i2); __wt_buf_free(session, &i3); - if (ret != 0 && conn != NULL) + if (ret != 0) WT_TRET(__wt_connection_close(conn)); return (ret); diff --git a/src/include/btmem.h b/src/include/btmem.h index cda672bc7b4..e9b6b5a1d6e 100644 --- a/src/include/btmem.h +++ b/src/include/btmem.h @@ -412,8 +412,17 @@ struct __wt_page { /* * Macros to copy/set the index because the name is obscured to ensure * the field isn't read multiple times. + * + * There are two versions of WT_INTL_INDEX_GET because the session split + * generation is usually set, but it's not always required: for example, + * if a page is locked for splitting, or being created or destroyed. */ -#define WT_INTL_INDEX_COPY(page) ((page)->u.intl.__index) +#define WT_INTL_INDEX_GET_SAFE(page) \ + ((page)->u.intl.__index) +#define WT_INTL_INDEX_GET(session, page, pindex) do { \ + WT_ASSERT(session, session->split_gen != 0); \ + (pindex) = WT_INTL_INDEX_GET_SAFE(page); \ +} while (0) #define WT_INTL_INDEX_SET(page, v) do { \ WT_WRITE_BARRIER(); \ ((page)->u.intl.__index) = (v); \ @@ -421,21 +430,15 @@ struct __wt_page { /* * Macro to walk the list of references in an internal page. - * Two flavors: by default, check that we have a split_gen, but - * provide a "SAFE" version for code that can safely read the - * page index without a split_gen. */ -#define WT_INTL_FOREACH_BEGIN_SAFE(session, page, ref) do { \ +#define WT_INTL_FOREACH_BEGIN(session, page, ref) do { \ WT_PAGE_INDEX *__pindex; \ WT_REF **__refp; \ uint32_t __entries; \ - for (__pindex = WT_INTL_INDEX_COPY(page), \ - __refp = __pindex->index, \ + WT_INTL_INDEX_GET(session, page, __pindex); \ + for (__refp = __pindex->index, \ __entries = __pindex->entries; __entries > 0; --__entries) {\ (ref) = *__refp++; -#define WT_INTL_FOREACH_BEGIN(session, page, ref) \ - WT_ASSERT(session, session->split_gen != 0); \ - WT_INTL_FOREACH_BEGIN_SAFE(session, page, ref) #define WT_INTL_FOREACH_END \ } \ } while (0) diff --git a/src/include/btree.i b/src/include/btree.i index c0f3ae4dd1e..b238786b3e6 100644 --- a/src/include/btree.i +++ b/src/include/btree.i @@ -279,13 +279,11 @@ __wt_page_refp(WT_SESSION_IMPL *session, WT_PAGE_INDEX *pindex; uint32_t i; - WT_ASSERT(session, session->split_gen != 0); - /* * 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: pindex = WT_INTL_INDEX_COPY(ref->home); +retry: WT_INTL_INDEX_GET(session, ref->home, pindex); /* * Use the page's reference hint: it should be correct unless the page @@ -1229,13 +1227,13 @@ __wt_skip_choose_depth(WT_SESSION_IMPL *session) } /* - * __wt_btree_size_overflow -- - * Check if the size of an in-memory tree with a single leaf page is over + * __wt_btree_lsm_size -- + * Return if the size of an in-memory tree with a single leaf page is over * a specified maximum. If called on anything other than a simple tree with a - * single leaf page, returns true so the calling code will switch to a new tree. + * single leaf page, returns true so our LSM caller will switch to a new tree. */ static inline int -__wt_btree_size_overflow(WT_SESSION_IMPL *session, uint64_t maxsize) +__wt_btree_lsm_size(WT_SESSION_IMPL *session, uint64_t maxsize) { WT_BTREE *btree; WT_PAGE *child, *root; @@ -1254,7 +1252,7 @@ __wt_btree_size_overflow(WT_SESSION_IMPL *session, uint64_t maxsize) return (1); /* Check for a tree with a single leaf page. */ - pindex = WT_INTL_INDEX_COPY(root); + WT_INTL_INDEX_GET(session, root, pindex); if (pindex->entries != 1) /* > 1 child page, switch */ return (1); diff --git a/src/include/column.i b/src/include/column.i index bf12a48a3e4..fc1f372b2a9 100644 --- a/src/include/column.i +++ b/src/include/column.i @@ -7,8 +7,92 @@ */ /* + * __col_insert_search_gt -- + * Search a column-store insert list for the next larger record. + */ +static inline WT_INSERT * +__col_insert_search_gt(WT_INSERT_HEAD *inshead, uint64_t recno) +{ + WT_INSERT *ins, **insp; + int i; + + /* If there's no insert chain to search, we're done. */ + if ((ins = WT_SKIP_LAST(inshead)) == NULL) + return (NULL); + + /* Fast path check for targets past the end of the skiplist. */ + if (recno >= WT_INSERT_RECNO(ins)) + return (NULL); + + /* + * The insert list is a skip list: start at the highest skip level, then + * go as far as possible at each level before stepping down to the next. + */ + ins = NULL; + for (i = WT_SKIP_MAXDEPTH - 1, insp = &inshead->head[i]; i >= 0;) + if (*insp != NULL && recno >= WT_INSERT_RECNO(*insp)) { + ins = *insp; /* GTE: keep going at this level */ + insp = &(*insp)->next[i]; + } else { + --i; /* LT: drop down a level */ + --insp; + } + + /* + * If we didn't find any records smaller than the target, we never set + * the return value, set it to the first record in the list. Otherwise, + * it references a record less-than-or-equal to the target, move to a + * later record, that is, a subsequent record greater than the target. + * Because inserts happen concurrently, additional records might be + * inserted after the searched-for record that are still smaller than + * the target, continue to move forward until reaching a record larger + * than the target. There isn't any safety testing because we confirmed + * such a record exists before searching. + */ + if (ins == NULL) + ins = WT_SKIP_FIRST(inshead); + while (recno >= WT_INSERT_RECNO(ins)) + ins = WT_SKIP_NEXT(ins); + return (ins); +} + +/* + * __col_insert_search_lt -- + * Search a column-store insert list for the next smaller record. + */ +static inline WT_INSERT * +__col_insert_search_lt(WT_INSERT_HEAD *inshead, uint64_t recno) +{ + WT_INSERT *ins, **insp; + int i; + + /* If there's no insert chain to search, we're done. */ + if ((ins = WT_SKIP_FIRST(inshead)) == NULL) + return (NULL); + + /* Fast path check for targets before the skiplist. */ + if (recno <= WT_INSERT_RECNO(ins)) + return (NULL); + + /* + * The insert list is a skip list: start at the highest skip level, then + * go as far as possible at each level before stepping down to the next. + */ + for (i = WT_SKIP_MAXDEPTH - 1, insp = &inshead->head[i]; i >= 0;) + if (*insp != NULL && recno > WT_INSERT_RECNO(*insp)) { + ins = *insp; /* GT: keep going at this level */ + insp = &(*insp)->next[i]; + } else { + --i; /* LTE: drop down a level */ + --insp; + } + + return (ins); +} + +/* * __col_insert_search_match -- - * Search an column-store insert list for an exact match. + * Search a column-store insert list for an exact match. */ static inline WT_INSERT * __col_insert_search_match(WT_INSERT_HEAD *inshead, uint64_t recno) @@ -154,7 +238,7 @@ __col_fix_last_recno(WT_PAGE *page) * Search a variable-length column-store page for a record. */ static inline WT_COL * -__col_var_search(WT_PAGE *page, uint64_t recno) +__col_var_search(WT_PAGE *page, uint64_t recno, uint64_t *start_recnop) { WT_COL_RLE *repeat; uint64_t start_recno; @@ -174,8 +258,11 @@ __col_var_search(WT_PAGE *page, uint64_t recno) repeat = page->pg_var_repeats + indx; if (recno >= repeat->recno && - recno < repeat->recno + repeat->rle) + recno < repeat->recno + repeat->rle) { + if (start_recnop != NULL) + *start_recnop = repeat->recno; return (page->pg_var_d + repeat->indx); + } if (recno < repeat->recno) continue; base = indx + 1; diff --git a/src/lsm/lsm_cursor.c b/src/lsm/lsm_cursor.c index a18269baa28..a9825b45d7a 100644 --- a/src/lsm/lsm_cursor.c +++ b/src/lsm/lsm_cursor.c @@ -97,10 +97,11 @@ __clsm_enter_update(WT_CURSOR_LSM *clsm) hard_limit = F_ISSET(lsm_tree, WT_LSM_TREE_NEED_SWITCH) ? 1 : 0; if (have_primary) { + WT_ENTER_PAGE_INDEX(session); WT_WITH_BTREE(session, ((WT_CURSOR_BTREE *)primary)->btree, - ovfl = __wt_btree_size_overflow( - session, hard_limit ? + ovfl = __wt_btree_lsm_size(session, hard_limit ? 2 * lsm_tree->chunk_size : lsm_tree->chunk_size)); + WT_LEAVE_PAGE_INDEX(session); /* If there was no overflow, we're done. */ if (!ovfl) diff --git a/src/reconcile/rec_write.c b/src/reconcile/rec_write.c index 33d79e6d4ce..0ce220e486e 100644 --- a/src/reconcile/rec_write.c +++ b/src/reconcile/rec_write.c @@ -499,17 +499,16 @@ __rec_root_write(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t flags) switch (page->type) { case WT_PAGE_COL_INT: WT_RET(__wt_page_alloc(session, - WT_PAGE_COL_INT, 1, mod->mod_multi_entries, 1, &next)); + WT_PAGE_COL_INT, 1, mod->mod_multi_entries, 0, &next)); break; case WT_PAGE_ROW_INT: WT_RET(__wt_page_alloc(session, - WT_PAGE_ROW_INT, 0, mod->mod_multi_entries, 1, &next)); + WT_PAGE_ROW_INT, 0, mod->mod_multi_entries, 0, &next)); break; WT_ILLEGAL_VALUE(session); } - WT_ASSERT(session, session->split_gen != 0); - pindex = WT_INTL_INDEX_COPY(next); + WT_INTL_INDEX_GET(session, next, pindex); for (i = 0; i < mod->mod_multi_entries; ++i) { WT_ERR(__wt_multi_to_ref(session, next, &mod->mod_multi[i], &pindex->index[i], NULL)); @@ -2931,8 +2930,11 @@ __wt_bulk_init(WT_SESSION_IMPL *session, WT_CURSOR_BULK *cbulk) WT_RET_MSG(session, EINVAL, "bulk-load is only possible for newly created trees"); - /* Get a reference to the empty leaf page. */ - pindex = WT_INTL_INDEX_COPY(btree->root.page); + /* + * Get a reference to the empty leaf page; we have exclusive access so + * we can take a copy of the page, confident the parent won't split. + */ + pindex = WT_INTL_INDEX_GET_SAFE(btree->root.page); cbulk->ref = pindex->index[0]; cbulk->leaf = cbulk->ref->page; @@ -3598,7 +3600,7 @@ __rec_col_var(WT_SESSION_IMPL *session, WT_INSERT *ins; WT_ITEM *last; WT_UPDATE *upd; - uint64_t n, nrepeat, repeat_count, rle, src_recno; + uint64_t n, nrepeat, repeat_count, rle, skip, src_recno; uint32_t i, size; int deleted, last_deleted, orig_deleted, update_no_copy; const void *data; @@ -3913,11 +3915,26 @@ compare: /* for (n = WT_INSERT_RECNO(ins); src_recno <= n; ++src_recno) { /* * The application may have inserted records which left - * gaps in the name space. + * gaps in the name space, and these gaps can be huge. + * If we're in a set of deleted records, skip the boring + * part. */ - if (src_recno < n) + if (src_recno < n) { deleted = 1; - else { + if (last_deleted) { + /* + * The record adjustment is decremented + * by one so we can naturally fall into + * the RLE accounting below, where we + * increment rle by one, then continue + * in the outer loop, where we increment + * src_recno by one. + */ + skip = (n - src_recno) - 1; + rle += skip; + src_recno += skip; + } + } else { deleted = WT_UPDATE_DELETED_ISSET(upd); if (!deleted) { data = WT_UPDATE_DATA(upd); diff --git a/src/support/stat.c b/src/support/stat.c index 824914bf8bf..aa30126ca91 100644 --- a/src/support/stat.c +++ b/src/support/stat.c @@ -253,6 +253,16 @@ __wt_stat_aggregate_dsrc_stats(const void *child, const void *parent) p->btree_column_internal.v += c->btree_column_internal.v; p->btree_column_deleted.v += c->btree_column_deleted.v; p->btree_column_variable.v += c->btree_column_variable.v; + if (c->btree_maxintlkey.v > p->btree_maxintlkey.v) + p->btree_maxintlkey.v = c->btree_maxintlkey.v; + if (c->btree_maxintlpage.v > p->btree_maxintlpage.v) + p->btree_maxintlpage.v = c->btree_maxintlpage.v; + if (c->btree_maxleafkey.v > p->btree_maxleafkey.v) + p->btree_maxleafkey.v = c->btree_maxleafkey.v; + if (c->btree_maxleafpage.v > p->btree_maxleafpage.v) + p->btree_maxleafpage.v = c->btree_maxleafpage.v; + if (c->btree_maxleafvalue.v > p->btree_maxleafvalue.v) + p->btree_maxleafvalue.v = c->btree_maxleafvalue.v; if (c->btree_maximum_depth.v > p->btree_maximum_depth.v) p->btree_maximum_depth.v = c->btree_maximum_depth.v; p->btree_entries.v += c->btree_entries.v; @@ -301,6 +311,7 @@ __wt_stat_aggregate_dsrc_stats(const void *child, const void *parent) p->bloom_page_evict.v += c->bloom_page_evict.v; p->bloom_page_read.v += c->bloom_page_read.v; p->bloom_count.v += c->bloom_count.v; + p->lsm_chunk_count.v += c->lsm_chunk_count.v; if (c->lsm_generation_max.v > p->lsm_generation_max.v) p->lsm_generation_max.v = c->lsm_generation_max.v; p->lsm_lookup_no_bloom.v += c->lsm_lookup_no_bloom.v; @@ -550,7 +561,6 @@ __wt_stat_refresh_connection_stats(void *stats_arg) stats = (WT_CONNECTION_STATS *)stats_arg; stats->async_cur_queue.v = 0; - stats->async_max_queue.v = 0; stats->async_alloc_race.v = 0; stats->async_flush.v = 0; stats->async_alloc_view.v = 0; @@ -582,7 +592,6 @@ __wt_stat_refresh_connection_stats(void *stats_arg) stats->cache_eviction_hazard.v = 0; stats->cache_inmem_split.v = 0; stats->cache_eviction_internal.v = 0; - stats->cache_eviction_maximum_page_size.v = 0; stats->cache_eviction_dirty.v = 0; stats->cache_eviction_deepen.v = 0; stats->cache_eviction_force.v = 0; diff --git a/test/salvage/salvage.c b/test/salvage/salvage.c index 1c4d54df9e9..c78eb916426 100644 --- a/test/salvage/salvage.c +++ b/test/salvage/salvage.c @@ -38,6 +38,13 @@ #define PSIZE (2 * 1024) #define OSIZE (PSIZE / 20) +#define CHECK(x) do { \ + if (!(x)) { \ + fprintf(stderr, "%s: failed\n", #x); \ + assert(0); \ + } \ +} while (0) + void build(int, int, int); void copy(u_int, u_int); void empty(int); @@ -161,8 +168,8 @@ run(int r) printf("\t%s: run %d\n", __wt_page_type_string(page_type), r); - assert(system("rm -f WiredTiger* __slvg.* __schema.*") == 0); - assert((res_fp = fopen(RSLT, "w")) != NULL); + CHECK(system("rm -f WiredTiger* __slvg.* __schema.*") == 0); + CHECK((res_fp = fopen(RSLT, "w")) != NULL); /* * Each run builds the LOAD file, and then appends the first page of @@ -434,7 +441,7 @@ run(int r) exit(EXIT_FAILURE); } - assert(fclose(res_fp) == 0); + CHECK(fclose(res_fp) == 0); process(); @@ -476,10 +483,10 @@ build(int ikey, int ivalue, int cnt) * Disable logging: we're modifying files directly, we don't want to * run recovery. */ - assert(wiredtiger_open( + CHECK(wiredtiger_open( NULL, NULL, "create,log=(enabled=false)", &conn) == 0); - assert(conn->open_session(conn, NULL, NULL, &session) == 0); - assert(session->drop(session, "file:" LOAD, "force") == 0); + CHECK(conn->open_session(conn, NULL, NULL, &session) == 0); + CHECK(session->drop(session, "file:" LOAD, "force") == 0); switch (page_type) { case WT_PAGE_COL_FIX: @@ -509,8 +516,8 @@ build(int ikey, int ivalue, int cnt) default: assert(0); } - assert(session->create(session, "file:" LOAD, config) == 0); - assert(session->open_cursor( + CHECK(session->create(session, "file:" LOAD, config) == 0); + CHECK(session->open_cursor( session, "file:" LOAD, NULL, "bulk", &cursor) == 0); for (; cnt > 0; --cnt, ++ikey, ++ivalue) { switch (page_type) { /* Build the key. */ @@ -537,7 +544,7 @@ build(int ikey, int ivalue, int cnt) value.size = 20; cursor->set_value(cursor, &value); } - assert(cursor->insert(cursor) == 0); + CHECK(cursor->insert(cursor) == 0); } /* @@ -547,10 +554,10 @@ build(int ikey, int ivalue, int cnt) */ new_slvg = !file_exists(SLVG); if (new_slvg) { - assert(session->drop(session, "file:" SLVG, "force") == 0); - assert(session->create(session, "file:" SLVG, config) == 0); + CHECK(session->drop(session, "file:" SLVG, "force") == 0); + CHECK(session->create(session, "file:" SLVG, config) == 0); } - assert(conn->close(conn, 0) == 0); + CHECK(conn->close(conn, 0) == 0); if (new_slvg) (void)remove(SLVG); } @@ -567,7 +574,7 @@ copy(u_int gen, u_int recno) WT_BLOCK_HEADER *blk; char buf[PSIZE]; - assert((ifp = fopen(LOAD, "r")) != NULL); + CHECK((ifp = fopen(LOAD, "r")) != NULL); /* * If the salvage file doesn't exist, then we're creating it: @@ -575,19 +582,19 @@ copy(u_int gen, u_int recno) * Otherwise, we are appending to an existing file. */ if (file_exists(SLVG)) - assert((ofp = fopen(SLVG, "a")) != NULL); + CHECK((ofp = fopen(SLVG, "a")) != NULL); else { - assert((ofp = fopen(SLVG, "w")) != NULL); - assert(fread(buf, 1, PSIZE, ifp) == PSIZE); - assert(fwrite(buf, 1, PSIZE, ofp) == PSIZE); + CHECK((ofp = fopen(SLVG, "w")) != NULL); + CHECK(fread(buf, 1, PSIZE, ifp) == PSIZE); + CHECK(fwrite(buf, 1, PSIZE, ofp) == PSIZE); } /* * If there's data, copy/update the first formatted page. */ if (gen != 0) { - assert(fseek(ifp, (long)PSIZE, SEEK_SET) == 0); - assert(fread(buf, 1, PSIZE, ifp) == PSIZE); + CHECK(fseek(ifp, (long)PSIZE, SEEK_SET) == 0); + CHECK(fread(buf, 1, PSIZE, ifp) == PSIZE); dsk = (void *)buf; if (page_type != WT_PAGE_ROW_LEAF) dsk->recno = recno; @@ -595,11 +602,11 @@ copy(u_int gen, u_int recno) blk = WT_BLOCK_HEADER_REF(buf); blk->cksum = 0; blk->cksum = __wt_cksum(dsk, PSIZE); - assert(fwrite(buf, 1, PSIZE, ofp) == PSIZE); + CHECK(fwrite(buf, 1, PSIZE, ofp) == PSIZE); } - assert(fclose(ifp) == 0); - assert(fclose(ofp) == 0); + CHECK(fclose(ifp) == 0); + CHECK(fclose(ofp) == 0); } /* @@ -624,35 +631,35 @@ process(void) progname); strcat(config, "log=(enabled=false),"); - assert(wiredtiger_open(NULL, NULL, config, &conn) == 0); - assert(conn->open_session(conn, NULL, NULL, &session) == 0); - assert(session->salvage(session, "file:" SLVG, 0) == 0); - assert(conn->close(conn, 0) == 0); + CHECK(wiredtiger_open(NULL, NULL, config, &conn) == 0); + CHECK(conn->open_session(conn, NULL, NULL, &session) == 0); + CHECK(session->salvage(session, "file:" SLVG, 0) == 0); + CHECK(conn->close(conn, 0) == 0); /* Verify. */ - assert(wiredtiger_open(NULL, NULL, config, &conn) == 0); - assert(conn->open_session(conn, NULL, NULL, &session) == 0); - assert(session->verify(session, "file:" SLVG, 0) == 0); - assert(conn->close(conn, 0) == 0); + CHECK(wiredtiger_open(NULL, NULL, config, &conn) == 0); + CHECK(conn->open_session(conn, NULL, NULL, &session) == 0); + CHECK(session->verify(session, "file:" SLVG, 0) == 0); + CHECK(conn->close(conn, 0) == 0); /* Dump. */ - assert((fp = fopen(DUMP, "w")) != NULL); - assert(wiredtiger_open(NULL, NULL, config, &conn) == 0); - assert(conn->open_session(conn, NULL, NULL, &session) == 0); - assert(session->open_cursor( + CHECK((fp = fopen(DUMP, "w")) != NULL); + CHECK(wiredtiger_open(NULL, NULL, config, &conn) == 0); + CHECK(conn->open_session(conn, NULL, NULL, &session) == 0); + CHECK(session->open_cursor( session, "file:" SLVG, NULL, "dump=print", &cursor) == 0); while (cursor->next(cursor) == 0) { if (page_type == WT_PAGE_ROW_LEAF) { - assert(cursor->get_key(cursor, &key) == 0); - assert(fputs(key, fp) >= 0); - assert(fputc('\n', fp) >= 0); + CHECK(cursor->get_key(cursor, &key) == 0); + CHECK(fputs(key, fp) >= 0); + CHECK(fputc('\n', fp) >= 0); } - assert(cursor->get_value(cursor, &value) == 0); - assert(fputs(value, fp) >= 0); - assert(fputc('\n', fp) >= 0); + CHECK(cursor->get_value(cursor, &value) == 0); + CHECK(fputs(value, fp) >= 0); + CHECK(fputc('\n', fp) >= 0); } - assert(conn->close(conn, 0) == 0); - assert(fclose(fp) == 0); + CHECK(conn->close(conn, 0) == 0); + CHECK(fclose(fp) == 0); } /* diff --git a/test/suite/helper.py b/test/suite/helper.py index f130170ca5b..23c12a29abd 100644 --- a/test/suite/helper.py +++ b/test/suite/helper.py @@ -134,9 +134,7 @@ def simple_populate(self, uri, config, rows): self.session.create(uri, 'value_format=S,' + config) cursor = self.session.open_cursor(uri, None) for i in range(1, rows + 1): - cursor.set_key(key_populate(cursor, i)) - cursor.set_value(value_populate(cursor, i)) - cursor.insert() + cursor[key_populate(cursor, i)] = value_populate(cursor, i) cursor.close() def simple_populate_check_cursor(self, cursor, rows): @@ -206,10 +204,8 @@ def complex_populate_type(self, uri, config, rows, type): indxname + ':indx6', 'columns=(column3,column5,column4)' + ',' + type) cursor = self.session.open_cursor(uri, None) for i in range(1, rows + 1): - cursor.set_key(key_populate(cursor, i)) v = complex_value_populate(cursor, i) - cursor.set_value(v[0], v[1], v[2], v[3]) - cursor.insert() + cursor[key_populate(cursor, i)] = (v[0], v[1], v[2], v[3]) cursor.close() def complex_populate_colgroup_name(self, uri): diff --git a/test/suite/test_backup04.py b/test/suite/test_backup04.py index 03e1e30d8a2..5aa605fac15 100644 --- a/test/suite/test_backup04.py +++ b/test/suite/test_backup04.py @@ -71,20 +71,14 @@ class test_backup_target(wttest.WiredTigerTestCase, suite_subprocess): self.pr('populate: ' + uri + ' with ' + str(rows) + ' rows') cursor = self.session.open_cursor(uri, None) for i in range(1, rows + 1): - cursor.set_key(key_populate(cursor, i)) - my_data = str(i) + ':' + 'a' * dsize - cursor.set_value(my_data) - cursor.insert() + cursor[key_populate(cursor, i)] = str(i) + ':' + 'a' * dsize cursor.close() def update(self, uri, dsize, upd, rows): self.pr('update: ' + uri + ' with ' + str(rows) + ' rows') cursor = self.session.open_cursor(uri, None) for i in range(1, rows + 1): - cursor.set_key(key_populate(cursor, i)) - my_data = str(i) + ':' + upd * dsize - cursor.set_value(my_data) - cursor.insert() + cursor[key_populate(cursor, i)] = str(i) + ':' + upd * dsize cursor.close() # Compare the original and backed-up files using the wt dump command. diff --git a/test/suite/test_base03.py b/test/suite/test_base03.py index 3335518dd16..6a9a53112b9 100644 --- a/test/suite/test_base03.py +++ b/test/suite/test_base03.py @@ -66,9 +66,7 @@ class test_base03(wttest.WiredTigerTestCase): self.pr('creating cursor') cursor = self.session.open_cursor('table:' + self.table_name1, None, None) for i in range(0, self.nentries): - cursor.set_key('key' + str(i)) - cursor.set_value('value' + str(i)) - cursor.insert() + cursor['key' + str(i)] = 'value' + str(i) i = 0 cursor.reset() @@ -89,9 +87,7 @@ class test_base03(wttest.WiredTigerTestCase): self.pr('creating cursor') cursor = self.session.open_cursor('table:' + self.table_name2, None, None) for i in range(0, self.nentries): - cursor.set_key('key' + str(i)) - cursor.set_value(i) - cursor.insert() + cursor['key' + str(i)] = i i = 0 cursor.reset() @@ -115,9 +111,7 @@ class test_base03(wttest.WiredTigerTestCase): self.pr('creating cursor') cursor = self.session.open_cursor('table:' + self.table_name3, None, None) for i in range(0, self.nentries): - cursor.set_key(i) - cursor.set_value('value' + str(i)) - cursor.insert() + cursor[i] = 'value' + str(i) i = 0 cursor.reset() @@ -141,9 +135,7 @@ class test_base03(wttest.WiredTigerTestCase): self.pr('stepping') for i in range(0, self.nentries): self.pr('put %d -> %d' % (i, i)) - cursor.set_key(i) - cursor.set_value(i) - cursor.insert() + cursor[i] = i i = 0 cursor.reset() diff --git a/test/suite/test_base04.py b/test/suite/test_base04.py index 8aca81294df..feb68bf8a08 100644 --- a/test/suite/test_base04.py +++ b/test/suite/test_base04.py @@ -63,9 +63,7 @@ class test_base04(wttest.WiredTigerTestCase): def insert(self, key, value): self.pr('insert') cursor = self.cursor() - cursor.set_key(key) - cursor.set_value(value) - cursor.insert() + cursor[key] = value cursor.close() if self.reconcile: self.reopen_conn() diff --git a/test/suite/test_base05.py b/test/suite/test_base05.py index 0726653d95f..399cba07164 100644 --- a/test/suite/test_base05.py +++ b/test/suite/test_base05.py @@ -168,9 +168,7 @@ class test_base05(wttest.WiredTigerTestCase): numbers[i] = i key = self.mixed_string(i) value = self.mixed_string(i+1) - cursor.set_key(key) - cursor.set_value(value) - cursor.insert() + cursor[key] = value # quick spot check to make sure searches work for divisor in [3, 5, 7]: @@ -212,9 +210,7 @@ class test_base05(wttest.WiredTigerTestCase): key = val = unicode(strlist[i]) else: key = val = strlist[i] - cursor.set_key(key) - cursor.set_value(val) - cursor.insert() + cursor[key] = val for i in range(0, len(strlist)): if convert: diff --git a/test/suite/test_bug001.py b/test/suite/test_bug001.py index 1e0412443a5..08177369309 100644 --- a/test/suite/test_bug001.py +++ b/test/suite/test_bug001.py @@ -43,13 +43,9 @@ class test_bug001(wttest.WiredTigerTestCase): r = initial for i in range(0, middle): r += 1 - cursor.set_key(r) - cursor.set_value(0xab) - cursor.insert() + cursor[r] = 0xab r += trailing - cursor.set_key(r + 1) - cursor.set_value(0xbb) - cursor.insert() + cursor[r + 1] = 0xbb return (cursor) # Test a bug where cursor movement inside implicit records failed. diff --git a/test/suite/test_bug004.py b/test/suite/test_bug004.py index c5a28539409..5f8d35f2404 100644 --- a/test/suite/test_bug004.py +++ b/test/suite/test_bug004.py @@ -50,9 +50,8 @@ class test_bug004(wttest.WiredTigerTestCase): self.session.create(self.uri, self.config) c1 = self.session.open_cursor(self.uri, None) for i in range(1, self.nentries): - c1.set_key(key_populate(c1, i) + 'abcdef' * 100) - c1.set_value(value_populate(c1, i) + 'abcdef' * 100) - c1.insert() + c1[key_populate(c1, i) + 'abcdef' * 100] = \ + value_populate(c1, i) + 'abcdef' * 100 c1.close() # Verify the object, force it to disk, and verify the on-disk version. diff --git a/test/suite/test_bug005.py b/test/suite/test_bug005.py index 1e8d3328236..961bb551b69 100644 --- a/test/suite/test_bug005.py +++ b/test/suite/test_bug005.py @@ -43,9 +43,7 @@ class test_bug005(wttest.WiredTigerTestCase): self.session.create(self.uri, 'value_format=S,key_format=S') cursor = self.session.open_cursor(self.uri, None) for i in range(1, 1000): - cursor.set_key(key_populate(cursor, i)) - cursor.set_value(value_populate(cursor, i)) - cursor.insert() + cursor[key_populate(cursor, i)] = value_populate(cursor, i) cursor.close() # Verify the object, force it to disk, and verify the on-disk version. diff --git a/test/suite/test_bug006.py b/test/suite/test_bug006.py index 401c292c0e4..fbf83b84e7f 100644 --- a/test/suite/test_bug006.py +++ b/test/suite/test_bug006.py @@ -47,9 +47,7 @@ class test_bug006(wttest.WiredTigerTestCase): self.session.create(uri, 'value_format=S,key_format=S') cursor = self.session.open_cursor(uri, None) for i in range(1, 1000): - cursor.set_key(key_populate(cursor, i)) - cursor.set_value(value_populate(cursor, i)) - cursor.insert() + cursor[key_populate(cursor, i)] = value_populate(cursor, i) # Table operations should fail, the cursor is open. self.assertRaises( diff --git a/test/suite/test_bug008.py b/test/suite/test_bug008.py index 6a14201c8dd..0102cbd63f4 100644 --- a/test/suite/test_bug008.py +++ b/test/suite/test_bug008.py @@ -55,9 +55,7 @@ class test_bug008(wttest.WiredTigerTestCase): self.session.begin_transaction() cursor = self.session.open_cursor(uri, None) for i in range(100, 140): - cursor.set_key(key_populate(cursor, i)) - cursor.set_value(value_populate(cursor, i)) - cursor.insert() + cursor[key_populate(cursor, i)] = value_populate(cursor, i) # Open a separate session and cursor. s = self.conn.open_session() @@ -113,18 +111,14 @@ class test_bug008(wttest.WiredTigerTestCase): # Add some additional visible records. cursor = self.session.open_cursor(uri, None) for i in range(100, 120): - cursor.set_key(key_populate(cursor, i)) - cursor.set_value(value_populate(cursor, i)) - cursor.insert() + cursor[key_populate(cursor, i)] = value_populate(cursor, i) cursor.close() # Begin a transaction, and add some additional records. self.session.begin_transaction() cursor = self.session.open_cursor(uri, None) for i in range(120, 140): - cursor.set_key(key_populate(cursor, i)) - cursor.set_value(value_populate(cursor, i)) - cursor.insert() + cursor[key_populate(cursor, i)] = value_populate(cursor, i) # Open a separate session and cursor. s = self.conn.open_session() diff --git a/test/suite/test_bug009.py b/test/suite/test_bug009.py index 9074d45bafd..d2b9ffa4f62 100644 --- a/test/suite/test_bug009.py +++ b/test/suite/test_bug009.py @@ -55,13 +55,8 @@ class test_bug009(wttest.WiredTigerTestCase): # Insert two items with keys that will be prefix compressed and data # items sized so that the compression size difference tips the # size over a page boundary. - cursor.set_key('fill_2__b_27') - cursor.set_value(2294 * '0') - cursor.insert() - - cursor.set_key('fill_2__b_28') - cursor.set_value(3022 * '0') - cursor.insert() + cursor['fill_2__b_27'] = '0' * 2294 + cursor['fill_2__b_28'] = '0' * 3022 if __name__ == '__main__': wttest.run() diff --git a/test/suite/test_bug010.py b/test/suite/test_bug010.py index 4b7f0bc67a0..0266cb82446 100644 --- a/test/suite/test_bug010.py +++ b/test/suite/test_bug010.py @@ -59,9 +59,7 @@ class test_bug010(wttest.WiredTigerTestCase): self.session.create(self.uri + str(i), 'key_format=S,value_format=i') c = self.session.open_cursor(self.uri + str(i), None) - c.set_key('a') - c.set_value(0) - c.insert() + c['a'] = 0 c.close() self.session.checkpoint() @@ -79,9 +77,7 @@ class test_bug010(wttest.WiredTigerTestCase): expected_val += 1 for i in range(0, self.num_tables): c = self.session.open_cursor(self.uri + str(i), None) - c.set_key('a') - c.set_value(expected_val) - c.insert() + c['a'] = expected_val c.close() finally: done.set() diff --git a/test/suite/test_bulk01.py b/test/suite/test_bulk01.py index cab1112cff0..4c8747033d2 100644 --- a/test/suite/test_bulk01.py +++ b/test/suite/test_bulk01.py @@ -61,9 +61,7 @@ class test_bulk_load(wttest.WiredTigerTestCase): 'key_format=' + self.keyfmt + ',value_format=' + self.valfmt) cursor = self.session.open_cursor(uri, None, "bulk") for i in range(1, 100): - cursor.set_key(key_populate(cursor, i)) - cursor.set_value(value_populate(cursor, i)) - cursor.insert() + cursor[key_populate(cursor, i)] = value_populate(cursor, i) cursor.close() @@ -81,9 +79,8 @@ class test_bulk_load_row_order(wttest.WiredTigerTestCase): uri = self.type + self.name self.session.create(uri, 'key_format=S,value_format=S') cursor = self.session.open_cursor(uri, None, "bulk") - cursor.set_key(key_populate(cursor, 10)) - cursor.set_value(value_populate(cursor, 10)) - cursor.insert() + cursor[key_populate(cursor, 10)] = value_populate(cursor, 10) + cursor.set_key(key_populate(cursor, 1)) cursor.set_value(value_populate(cursor, 1)) msg = '/compares smaller than previously inserted key/' @@ -94,12 +91,8 @@ class test_bulk_load_row_order(wttest.WiredTigerTestCase): uri = self.type + self.name self.session.create(uri, 'key_format=S,value_format=S') cursor = self.session.open_cursor(uri, None, "bulk,skip_sort_check") - cursor.set_key(key_populate(cursor, 10)) - cursor.set_value(value_populate(cursor, 10)) - cursor.insert() - cursor.set_key(key_populate(cursor, 1)) - cursor.set_value(value_populate(cursor, 1)) - cursor.insert() + cursor[key_populate(cursor, 10)] = value_populate(cursor, 10) + cursor[key_populate(cursor, 1)] = value_populate(cursor, 1) if not wiredtiger.diagnostic_build(): self.skipTest('requires a diagnostic build') @@ -123,9 +116,7 @@ class test_bulk_load_not_empty(wttest.WiredTigerTestCase): uri = self.type + self.name self.session.create(uri, 'key_format=S,value_format=S') cursor = self.session.open_cursor(uri, None) - cursor.set_key(key_populate(cursor, 1)) - cursor.set_value(value_populate(cursor, 1)) - cursor.insert() + cursor[key_populate(cursor, 1)] = value_populate(cursor, 1) # Close the insert cursor, else we'll get EBUSY. cursor.close() msg = '/bulk-load is only supported on newly created objects/' @@ -136,9 +127,7 @@ class test_bulk_load_not_empty(wttest.WiredTigerTestCase): uri = self.type + self.name self.session.create(uri, 'key_format=S,value_format=S') cursor = self.session.open_cursor(uri, None) - cursor.set_key(key_populate(cursor, 1)) - cursor.set_value(value_populate(cursor, 1)) - cursor.insert() + cursor[key_populate(cursor, 1)] = value_populate(cursor, 1) # Don't close the insert cursor, we want EBUSY. self.assertRaises(wiredtiger.WiredTigerError, lambda: self.session.open_cursor(uri, None, "bulk")) diff --git a/test/suite/test_bulk02.py b/test/suite/test_bulk02.py index 9f7a63f78b2..4af1314c0d8 100644 --- a/test/suite/test_bulk02.py +++ b/test/suite/test_bulk02.py @@ -57,9 +57,7 @@ class test_bulkload_checkpoint(wttest.WiredTigerTestCase, suite_subprocess): self.session.create(self.uri, 'key_format=S,value_format=S') cursor = self.session.open_cursor(self.uri, None, 'bulk') for i in range(1, 10): - cursor.set_key(key_populate(cursor, i)) - cursor.set_value(value_populate(cursor, i)) - cursor.insert() + cursor[key_populate(cursor, i)] = value_populate(cursor, i) # Checkpoint a few times (to test the drop code). for i in range(1, 5): @@ -117,9 +115,7 @@ class test_bulkload_backup(wttest.WiredTigerTestCase, suite_subprocess): self.session.create(self.uri, 'key_format=S,value_format=S') cursor = self.session.open_cursor(self.uri, None, 'bulk') for i in range(1, 10): - cursor.set_key(key_populate(cursor, i)) - cursor.set_value(value_populate(cursor, i)) - cursor.insert() + cursor[key_populate(cursor, i)] = value_populate(cursor, i) # Test without a checkpoint, with an unnamed checkpoint, with a named # checkpoint. diff --git a/test/suite/test_checkpoint01.py b/test/suite/test_checkpoint01.py index c9799700001..aacc8f1f055 100644 --- a/test/suite/test_checkpoint01.py +++ b/test/suite/test_checkpoint01.py @@ -59,9 +59,7 @@ class test_checkpoint(wttest.WiredTigerTestCase): cursor = self.session.open_cursor(self.uri, None, "overwrite") start, stop = self.checkpoints[name][0] for i in range(start, stop+1): - cursor.set_key("%010d KEY------" % i) - cursor.set_value("%010d VALUE "% i + name) - self.assertEqual(cursor.insert(), 0) + cursor["%010d KEY------" % i] = ("%010d VALUE " % i) + name cursor.close() self.checkpoints[name] = (self.checkpoints[name][0], 1) @@ -214,9 +212,7 @@ class test_checkpoint_target(wttest.WiredTigerTestCase): def update(self, uri, value): cursor = self.session.open_cursor(uri, None, "overwrite") - cursor.set_key(key_populate(cursor, 10)) - cursor.set_value(value) - cursor.insert() + cursor[key_populate(cursor, 10)] = value cursor.close() def check(self, uri, value): @@ -293,9 +289,7 @@ class test_checkpoint_last(wttest.WiredTigerTestCase): for value in ('FIRST', 'SECOND', 'THIRD', 'FOURTH', 'FIFTH'): # Update the object. cursor = self.session.open_cursor(uri, None, "overwrite") - cursor.set_key(key_populate(cursor, 10)) - cursor.set_value(value) - cursor.insert() + cursor[key_populate(cursor, 10)] = value cursor.close() # Checkpoint the object. @@ -397,9 +391,7 @@ class test_checkpoint_empty(wttest.WiredTigerTestCase): cursor.close() cursor = self.session.open_cursor(self.uri, None) - cursor.set_key("key") - cursor.set_value("value") - cursor.insert() + cursor["key"] = "value" self.session.checkpoint() cursor = self.session.open_cursor(self.uri, None, "checkpoint=ckpt") @@ -414,9 +406,7 @@ class test_checkpoint_empty(wttest.WiredTigerTestCase): cursor.close() cursor = self.session.open_cursor(self.uri, None) - cursor.set_key("key") - cursor.set_value("value") - cursor.insert() + cursor["key"] = "value" self.session.checkpoint('name=ckpt') cursor = self.session.open_cursor( diff --git a/test/suite/test_colgap.py b/test/suite/test_colgap.py new file mode 100644 index 00000000000..4192f14c5e6 --- /dev/null +++ b/test/suite/test_colgap.py @@ -0,0 +1,123 @@ +#!usr/bin/env python +# +# Public Domain 2014-2015 MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +import wiredtiger, wttest +from helper import simple_populate, key_populate, value_populate + +# test_colgap.py +# Test variable-length column-store gap performance. +class test_column_store_gap(wttest.WiredTigerTestCase): + nentries = 13 + + # Cursor forward + def forward(self, cursor, expected): + cursor.reset() + i = 0 + while True: + if cursor.next() != 0: + break + self.assertEqual(cursor.get_key(), expected[i]) + i += 1 + self.assertEqual(i, self.nentries) + + # Cursor backward + def backward(self, cursor, expected): + cursor.reset() + i = 0 + while True: + if cursor.prev() != 0: + break + self.assertEqual(cursor.get_key(), expected[i]) + i += 1 + self.assertEqual(i, self.nentries) + + # Create a variable-length column-store table with really big gaps in the + # namespace. If this runs in less-than-glacial time, it's working. + def test_column_store_gap(self): + uri = 'table:gap' + simple_populate(self, uri, 'key_format=r,value_format=S', 0) + cursor = self.session.open_cursor(uri, None, None) + self.nentries = 0 + + # Create a column-store table with large gaps in the name-space. + v = [ 1000, 2000000000000, 30000000000000 ] + for i in v: + cursor[key_populate(cursor, i)] = value_populate(cursor, i) + self.nentries += 1 + + # In-memory cursor forward, backward. + self.forward(cursor, v) + self.backward(cursor, list(reversed(v))) + + self.reopen_conn() + cursor = self.session.open_cursor(uri, None, None) + + # Disk page cursor forward, backward. + self.forward(cursor, v) + self.backward(cursor, list(reversed(v))) + + def test_column_store_gap_traverse(self): + uri = 'table:gap' + simple_populate(self, uri, 'key_format=r,value_format=S', 0) + cursor = self.session.open_cursor(uri, None, None) + self.nentries = 0 + + # Create a column store with key gaps. The particular values aren't + # important, we just want some gaps. + v = [ 1000, 1001, 2000, 2001] + for i in v: + cursor[key_populate(cursor, i)] = value_populate(cursor, i) + self.nentries += 1 + + # In-memory cursor forward, backward. + self.forward(cursor, v) + self.backward(cursor, list(reversed(v))) + + self.reopen_conn() + cursor = self.session.open_cursor(uri, None, None) + + # Disk page cursor forward, backward. + self.forward(cursor, v) + self.backward(cursor, list(reversed(v))) + + # Insert some new records, so there are in-memory updates and an + # on disk image. Put them in the middle of the existing values + # so the traversal walks to them. + v2 = [ 1500, 1501 ] + for i in v2: + cursor[key_populate(cursor, i)] = value_populate(cursor, i) + self.nentries += 1 + + # Tell the validation what to expect. + v = [ 1000, 1001, 1500, 1501, 2000, 2001 ] + self.forward(cursor, v) + self.backward(cursor, list(reversed(v))) + + +if __name__ == '__main__': + wttest.run() diff --git a/test/suite/test_config02.py b/test/suite/test_config02.py index 7e3570a1a37..53c9989eb5d 100644 --- a/test/suite/test_config02.py +++ b/test/suite/test_config02.py @@ -51,9 +51,7 @@ class test_config02(wttest.WiredTigerTestCase): self.session.create("table:" + self.table_name1, create_args) cursor = self.session.open_cursor('table:' + self.table_name1, None, None) for i in range(0, self.nentries): - cursor.set_key(str(1000000 + i)) - cursor.set_value('value' + str(i)) - cursor.insert() + cursor[str(1000000 + i)] = 'value' + str(i) i = 0 cursor.reset() for key, value in cursor: diff --git a/test/suite/test_config04.py b/test/suite/test_config04.py index ceb2da41305..31deced73d0 100644 --- a/test/suite/test_config04.py +++ b/test/suite/test_config04.py @@ -58,9 +58,7 @@ class test_config04(wttest.WiredTigerTestCase): cursor = self.session.open_cursor( 'table:' + self.table_name1, None, None) for i in range(0, self.nentries): - cursor.set_key(str(1000000 + i)) - cursor.set_value('value' + str(i)) - cursor.insert() + cursor[str(1000000 + i)] = 'value' + str(i) i = 0 cursor.reset() for key, value in cursor: diff --git a/test/suite/test_config05.py b/test/suite/test_config05.py index c8c8c79f192..8687552eefe 100644 --- a/test/suite/test_config05.py +++ b/test/suite/test_config05.py @@ -58,9 +58,7 @@ class test_config05(wttest.WiredTigerTestCase): session.create("table:" + self.table_name1, create_args) cursor = session.open_cursor('table:' + self.table_name1, None, None) for i in range(0, self.nentries): - cursor.set_key(str(1000000 + i)) - cursor.set_value('value' + str(i)) - cursor.insert() + cursor[str(1000000 + i)] = 'value' + str(i) cursor.close() def verify_entries(self, session): diff --git a/test/suite/test_cursor01.py b/test/suite/test_cursor01.py index 12b8f113095..507036e85cf 100644 --- a/test/suite/test_cursor01.py +++ b/test/suite/test_cursor01.py @@ -101,9 +101,7 @@ class test_cursor01(wttest.WiredTigerTestCase): self.assertCursorHasNoKeyValue(cursor) for i in range(0, self.nentries): - cursor.set_key(self.genkey(i)) - cursor.set_value(self.genvalue(i)) - cursor.insert() + cursor[self.genkey(i)] = self.genvalue(i) return cursor diff --git a/test/suite/test_cursor04.py b/test/suite/test_cursor04.py index c9bf8140139..50cde0023d8 100644 --- a/test/suite/test_cursor04.py +++ b/test/suite/test_cursor04.py @@ -125,9 +125,7 @@ class test_cursor04(wttest.WiredTigerTestCase): # 0. Populate the key space for i in range(0, self.nentries): - cursor.set_key(self.genkey(i)) - cursor.set_value(self.genvalue(i)) - cursor.insert() + cursor[self.genkey(i)] = self.genvalue(i) # 1. Calling search for a value that exists self.assertEqual(cursor[self.genkey(5)], self.genvalue(5)) diff --git a/test/suite/test_cursor05.py b/test/suite/test_cursor05.py index 14705e8bcb0..c98bcf63fa8 100644 --- a/test/suite/test_cursor05.py +++ b/test/suite/test_cursor05.py @@ -41,9 +41,7 @@ class test_cursor05(wttest.WiredTigerTestCase): """ Populate the given number of entries. """ cursor = self.session.open_cursor('table:main', None, None) for i in range(0, count): - cursor.set_key(i, 'key' + str(i)) - cursor.set_value('val' + str(i), i, 'val' + str(i), i) - cursor.insert() + cursor[(i, 'key' + str(i))] = ('val' + str(i), i, 'val' + str(i), i) cursor.close() def check_iterate_forward(self, cursor, expectcount): diff --git a/test/suite/test_cursor07.py b/test/suite/test_cursor07.py index afce5bef9f2..3ec93aa8a44 100644 --- a/test/suite/test_cursor07.py +++ b/test/suite/test_cursor07.py @@ -75,9 +75,7 @@ class test_cursor07(wttest.WiredTigerTestCase, suite_subprocess): self.session.begin_transaction() for k in range(self.nkeys): - c.set_key(k) - c.set_value(value) - c.insert() + c[k] = value self.session.commit_transaction() c.close() diff --git a/test/suite/test_cursor_random.py b/test/suite/test_cursor_random.py index bcf89d722b1..be08c59210f 100644 --- a/test/suite/test_cursor_random.py +++ b/test/suite/test_cursor_random.py @@ -64,10 +64,8 @@ class test_cursor_random(wttest.WiredTigerTestCase): uri = self.type + 'random' self.session.create(uri, 'key_format=' + self.fmt + ',value_format=S') cursor = self.session.open_cursor(uri, None) - cursor.set_key('AAA') - cursor.set_value('BBB') - cursor.insert() - cursor.close + cursor['AAA'] = 'BBB' + cursor.close() cursor = self.session.open_cursor(uri, None, "next_random=true") for i in range(1,5): cursor.next() @@ -149,9 +147,7 @@ class test_cursor_random_invisible(wttest.WiredTigerTestCase): # Start a transaction. self.session.begin_transaction() for i in range(1, 100): - cursor.set_key(key_populate(cursor, i)) - cursor.set_value(value_populate(cursor, i)) - cursor.insert() + cursor[key_populate(cursor, i)] = value_populate(cursor, i) # Open another session, the updates won't yet be visible, we shouldn't # find anything at all. @@ -165,16 +161,12 @@ class test_cursor_random_invisible(wttest.WiredTigerTestCase): cursor = self.session.open_cursor(uri, None) # Insert a single leading record. - cursor.set_key(key_populate(cursor, 1)) - cursor.set_value(value_populate(cursor, 1)) - cursor.insert() + cursor[key_populate(cursor, 1)] = value_populate(cursor, 1) # Start a transaction. self.session.begin_transaction() for i in range(2, 100): - cursor.set_key(key_populate(cursor, i)) - cursor.set_value(value_populate(cursor, i)) - cursor.insert() + cursor[key_populate(cursor, i)] = value_populate(cursor, i) # Open another session, the updates won't yet be visible, we should # return the only possible record. @@ -189,16 +181,12 @@ class test_cursor_random_invisible(wttest.WiredTigerTestCase): cursor = self.session.open_cursor(uri, None) # Insert a single leading record. - cursor.set_key(key_populate(cursor, 99)) - cursor.set_value(value_populate(cursor, 99)) - cursor.insert() + cursor[key_populate(cursor, 99)] = value_populate(cursor, 99) # Start a transaction. self.session.begin_transaction() for i in range(2, 100): - cursor.set_key(key_populate(cursor, i)) - cursor.set_value(value_populate(cursor, i)) - cursor.insert() + cursor[key_populate(cursor, i)] = value_populate(cursor, i) # Open another session, the updates won't yet be visible, we should # return the only possible record. diff --git a/test/suite/test_cursor_tracker.py b/test/suite/test_cursor_tracker.py index f25def3e1cc..1fa93f3e59b 100644 --- a/test/suite/test_cursor_tracker.py +++ b/test/suite/test_cursor_tracker.py @@ -156,12 +156,8 @@ class TestCursorTracker(wttest.WiredTigerTestCase): for i in range(npairs): wtkey = self.encode_key(i << 32) wtval = self.encode_value(i << 32) - self.traceapi('cursor.set_key(' + str(wtkey) + ')') - cursor.set_key(wtkey) - self.traceapi('cursor.set_value(' + str(wtval) + ')') - cursor.set_value(wtval) - self.traceapi('cursor.insert()') - cursor.insert() + self.traceapi('cursor[' + str(wtkey) + '] = ' + str(wtval)) + cursor[wtkey] = wtval cursor.close() self.pr('reopening the connection') self.conn.close() @@ -316,12 +312,8 @@ class TestCursorTracker(wttest.WiredTigerTestCase): self.setpos(pos, True) wtkey = self.encode_key(bits) wtval = self.encode_value(bits) - self.traceapi('cursor.set_key(' + str(wtkey) + ')') - cursor.set_key(wtkey) - self.traceapi('cursor.set_value(' + str(wtval) + ')') - cursor.set_value(wtval) - self.traceapi('cursor.insert()') - cursor.insert() + self.traceapi('cursor[' + str(wtkey) + '] = ' + str(wtval)) + cursor[wtkey] = wtval def cur_remove_here(self, cursor): # TODO: handle the exception case diff --git a/test/suite/test_drop_create.py b/test/suite/test_drop_create.py index 9566edf9f6f..9cd6a32c9bf 100644 --- a/test/suite/test_drop_create.py +++ b/test/suite/test_drop_create.py @@ -63,9 +63,7 @@ class test_drop_create(wttest.WiredTigerTestCase): # Create a table with the same name, but a different schema self.assertEqual(s.create("table:test", 'key_format=S,value_format=l,columns=(k,v)'), 0) c2 = s2.open_cursor("table:test", None, None) - c2.set_key("Hi") - c2.set_value(1) - c2.insert() + c2["Hi"] = 1 self.assertEqual(s.close(), 0) self.assertEqual(s2.close(), 0) diff --git a/test/suite/test_durability01.py b/test/suite/test_durability01.py index 53529c7e89f..b43ec698eec 100644 --- a/test/suite/test_durability01.py +++ b/test/suite/test_durability01.py @@ -73,9 +73,7 @@ class test_durability01(wttest.WiredTigerTestCase, suite_subprocess): self.session.create(self.uri, self.create_params) for i in range(100): c = self.session.open_cursor(self.uri) - c.set_key(i) - c.set_value(i) - c.insert() + c[i] = i c.close() if i % 5 == 0: self.session.checkpoint() diff --git a/test/suite/test_empty.py b/test/suite/test_empty.py index 4851d6b8317..93ec65e1f94 100644 --- a/test/suite/test_empty.py +++ b/test/suite/test_empty.py @@ -64,10 +64,9 @@ class test_empty(wttest.WiredTigerTestCase): # Add a few records to the object and remove them. cursor = self.session.open_cursor(uri, None, None) for i in range(1,5): - cursor.set_key(key_populate(cursor, i)) - cursor.set_value("XXX") - cursor.insert() - cursor.remove() + key = key_populate(cursor, i) + cursor[key] = "XXX" + del cursor[key] # Perform a checkpoint (we shouldn't write any underlying pages because # of a checkpoint, either). diff --git a/test/suite/test_jsondump02.py b/test/suite/test_jsondump02.py index 3ce6ffd424c..0c6b38db3ef 100644 --- a/test/suite/test_jsondump02.py +++ b/test/suite/test_jsondump02.py @@ -42,18 +42,14 @@ class test_jsondump02(wttest.WiredTigerTestCase): def set_kv(self, uri, key, val): cursor = self.session.open_cursor(uri, None, None) try: - cursor.set_key(key) - cursor.set_value(val) - cursor.insert() + cursor[key] = val finally: cursor.close() def set_kv2(self, uri, key, val1, val2): cursor = self.session.open_cursor(uri, None, None) try: - cursor.set_key(key) - cursor.set_value(val1, val2) - cursor.insert() + cursor[key] = (val1, val2) finally: cursor.close() @@ -61,11 +57,10 @@ class test_jsondump02(wttest.WiredTigerTestCase): def populate_squarecube(self, uri): cursor = self.session.open_cursor(uri, None, None) for i in range(1, 5): - cursor.set_key(i, 'key' + str(i)) square = i * i cube = square * i - cursor.set_value('val' + str(square), square, 'val' + str(cube), cube) - cursor.insert() + cursor[(i, 'key' + str(i))] = \ + ('val' + str(square), square, 'val' + str(cube), cube) cursor.close() # Check the result of using a JSON cursor on the URI. @@ -86,9 +81,7 @@ class test_jsondump02(wttest.WiredTigerTestCase): try: for insert in inserts: #tty_pr('Insert: ' + str(insert)) - cursor.set_key(insert[0]) - cursor.set_value(insert[1]) - cursor.insert() + cursor[insert[0]] = insert[1] finally: cursor.close() diff --git a/test/suite/test_lsm02.py b/test/suite/test_lsm02.py index 00d1e00dc17..afa5c47a77e 100644 --- a/test/suite/test_lsm02.py +++ b/test/suite/test_lsm02.py @@ -36,9 +36,7 @@ class test_lsm02(wttest.WiredTigerTestCase): def add_key(self, uri, key, value): cursor = self.session.open_cursor(uri, None, None) - cursor.set_key(key) - cursor.set_value(value) - cursor.insert() + cursor[key] = value cursor.close() def verify_key_exists(self, uri, key, value): diff --git a/test/suite/test_perf001.py b/test/suite/test_perf001.py index 415756e2255..60633780a32 100644 --- a/test/suite/test_perf001.py +++ b/test/suite/test_perf001.py @@ -51,12 +51,7 @@ class test_perf001(wttest.WiredTigerTestCase): self.pr(`conn`) return conn - def insert_one(self, c, k1, v1, v2): - c.set_key(k1) - c.set_value(v1, v2) - self.assertEqual(c.insert(), 0) - - def test_performance_of_indeces(self): + def test_performance_of_indices(self): uri = 'table:' + self.table_name create_args = 'key_format=i,value_format=ii,columns=(a,c,d),type=' + self.tabletype self.session.create(uri, create_args) @@ -72,7 +67,7 @@ class test_perf001(wttest.WiredTigerTestCase): end_time = clock() self.assertTrue(end_time - start_time < 5) start_time = end_time - self.insert_one(c, i, int(time()), random.randint(1,5)) + c[i] = (int(time()), random.randint(1,5)) c.close() if __name__ == '__main__': diff --git a/test/suite/test_priv01.py b/test/suite/test_priv01.py index f2cd6b1d16d..9b6b494e76e 100644 --- a/test/suite/test_priv01.py +++ b/test/suite/test_priv01.py @@ -67,9 +67,7 @@ class test_priv01(wttest.WiredTigerTestCase): self.session.create("table:" + self.table_name1, create_args) cursor = self.session.open_cursor('table:' + self.table_name1, None, None) for i in range(0, self.nentries): - cursor.set_key(str(1000000 + i)) - cursor.set_value('value' + str(i)) - cursor.insert() + cursor[str(1000000 + i)] = 'value' + str(i) i = 0 cursor.reset() for key, value in cursor: diff --git a/test/suite/test_salvage.py b/test/suite/test_salvage.py index 0a50ab9bd62..d7e11da4925 100644 --- a/test/suite/test_salvage.py +++ b/test/suite/test_salvage.py @@ -50,9 +50,7 @@ class test_salvage(wttest.WiredTigerTestCase, suite_subprocess): val = self.unique + '0' else: val = key + key - cursor.set_key(key) - cursor.set_value(val) - cursor.insert() + cursor[key] = val cursor.close() def check_populate(self, tablename): diff --git a/test/suite/test_schema01.py b/test/suite/test_schema01.py index 9bfc1897ec9..44c4462cdc2 100644 --- a/test/suite/test_schema01.py +++ b/test/suite/test_schema01.py @@ -84,9 +84,7 @@ class test_schema01(wttest.WiredTigerTestCase): c = self.cursor('overwrite') try: for record in pop_data: - c.set_key(record[0]) - c.set_value(*record[1:]) - c.insert() + c[record[0]] = record[1:] finally: c.close() diff --git a/test/suite/test_schema02.py b/test/suite/test_schema02.py index 6d3f444346d..57709591c6e 100644 --- a/test/suite/test_schema02.py +++ b/test/suite/test_schema02.py @@ -167,11 +167,10 @@ class test_schema02(wttest.WiredTigerTestCase): def populate(self): cursor = self.session.open_cursor('table:main', None, None) for i in range(0, self.nentries): - cursor.set_key(i, 'key' + str(i)) square = i * i cube = square * i - cursor.set_value('val' + str(square), square, 'val' + str(cube), cube) - cursor.insert() + cursor[(i, 'key' + str(i))] = \ + ('val' + str(square), square, 'val' + str(cube), cube) cursor.close() def check_entries(self): diff --git a/test/suite/test_shared_cache01.py b/test/suite/test_shared_cache01.py index e6d712e61bc..b5abc047334 100644 --- a/test/suite/test_shared_cache01.py +++ b/test/suite/test_shared_cache01.py @@ -46,9 +46,7 @@ class test_shared_cache01(wttest.WiredTigerTestCase): def add_records(self, session, start, stop): cursor = session.open_cursor(self.uri, None, "overwrite") for i in range(start, stop+1): - cursor.set_key("%010d KEY------" % i) - cursor.set_value("%010d VALUE "% i + self.data_str) - self.assertEqual(cursor.insert(), 0) + cursor["%010d KEY------" % i] = ("%010d VALUE " % i) + self.data_str cursor.close() # Disable default setup/shutdown steps - connections are managed manually. diff --git a/test/suite/test_shared_cache02.py b/test/suite/test_shared_cache02.py index 3806e9d0cda..ffe27360399 100644 --- a/test/suite/test_shared_cache02.py +++ b/test/suite/test_shared_cache02.py @@ -46,9 +46,7 @@ class test_shared_cache02(wttest.WiredTigerTestCase): def add_records(self, session, start, stop): cursor = session.open_cursor(self.uri, None, "overwrite") for i in range(start, stop+1): - cursor.set_key("%010d KEY------" % i) - cursor.set_value("%010d VALUE "% i + self.data_str) - self.assertEqual(cursor.insert(), 0) + cursor["%010d KEY------" % i] = ("%010d VALUE " % i) + self.data_str cursor.close() # Disable default setup/shutdown steps - connections are managed manually. diff --git a/test/suite/test_split.py b/test/suite/test_split.py index d2fa740d0d7..dbed0956c94 100644 --- a/test/suite/test_split.py +++ b/test/suite/test_split.py @@ -52,9 +52,7 @@ class test_split(wttest.WiredTigerTestCase): # Create a 4KB page (more than 3KB): 40 records w / 10 byte keys # and 81 byte values. for i in range(40): - cursor.set_key('%09d' % i) - cursor.set_value(8 * ('%010d' % i)) - cursor.insert() + cursor['%09d' % i] = 8 * ('%010d' % i) # Stabilize self.reopen_conn() @@ -66,9 +64,7 @@ class test_split(wttest.WiredTigerTestCase): # Now append a few records so we're definitely (a little) over 4KB cursor = self.session.open_cursor(self.uri, None) for i in range(50,55): - cursor.set_key('%09d' % i) - cursor.set_value(8 * ('%010d' % i)) - cursor.insert() + cursor['%09d' % i] = 8 * ('%010d' % i) # Stabilize self.reopen_conn() @@ -80,9 +76,7 @@ class test_split(wttest.WiredTigerTestCase): # Now insert some more records in between cursor = self.session.open_cursor(self.uri, None) for i in range(40,45): - cursor.set_key('%09d' % i) - cursor.set_value(8 * ('%010d' % i)) - cursor.insert() + cursor['%09d' % i] = 8 * ('%010d' % i) # Stabilize self.reopen_conn() diff --git a/test/suite/test_stat01.py b/test/suite/test_stat01.py index e5e6bde6b76..8790aed66e9 100644 --- a/test/suite/test_stat01.py +++ b/test/suite/test_stat01.py @@ -117,9 +117,7 @@ class test_stat01(wttest.WiredTigerTestCase): value = "" for i in range(1, self.nentries): value = value + 1000 * "a" - cursor.set_key(key_populate(cursor, i)) - cursor.set_value(value) - cursor.insert() + cursor[key_populate(cursor, i)] = value cursor.close() # Force the object to disk, otherwise we can't check the overflow count. diff --git a/test/suite/test_stat04.py b/test/suite/test_stat04.py index 912967475e9..33e7a925c6a 100644 --- a/test/suite/test_stat04.py +++ b/test/suite/test_stat04.py @@ -95,9 +95,7 @@ class test_stat04(wttest.WiredTigerTestCase, suite_subprocess): for i in range(0, self.nentries): if count % 50 == 0: self.checkcount(uri, count) - cursor.set_key(self.genkey(i)) - cursor.set_value(self.genvalue(i)) - cursor.insert() + cursor[self.genkey(i)] = self.genvalue(i) count += 1 # Remove a number of entries, at each step checking that stats match. for i in range(0, self.nentries / 37): diff --git a/test/suite/test_sweep01.py b/test/suite/test_sweep01.py index 8b5e0c74660..b0a9adcf44e 100644 --- a/test/suite/test_sweep01.py +++ b/test/suite/test_sweep01.py @@ -86,10 +86,8 @@ class test_sweep01(wttest.WiredTigerTestCase, suite_subprocess): # print "Creating %s with config '%s'" % (uri, self.create_params) self.session.create(uri, self.create_params) c = self.session.open_cursor(uri, None) - c.set_value(1) for k in range(self.numkv): - c.set_key(k+1) - c.insert() + c[k+1] = 1 c.close() if f % 20 == 0: time.sleep(1) @@ -123,9 +121,7 @@ class test_sweep01(wttest.WiredTigerTestCase, suite_subprocess): sleep = 0 while sleep < 12: k = k+1 - c.set_key(k) - c.set_value(1) - c.insert() + c[k] = 1 sleep += 2 time.sleep(2) c.close() diff --git a/test/suite/test_truncate01.py b/test/suite/test_truncate01.py index 53735318d0f..dd91a7868ec 100644 --- a/test/suite/test_truncate01.py +++ b/test/suite/test_truncate01.py @@ -346,9 +346,7 @@ class test_truncate_cursor(wttest.WiredTigerTestCase): for i in range(start + 1, stop + 1): k = key_populate(cursor, i) v = value_populate(cursor, i) - cursor.set_key(k) - cursor.set_value(v) - cursor.insert() + cursor[k] = v expected[k] = [v] cursor.close() @@ -370,9 +368,7 @@ class test_truncate_cursor(wttest.WiredTigerTestCase): start += 1 k = key_populate(cursor, start) v = value_populate(cursor, start) - cursor.set_key(k) - cursor.set_value(v) - cursor.insert() + cursor[k] = v expected[k] = [v] # Optionally insert trailing skipped records. @@ -386,9 +382,7 @@ class test_truncate_cursor(wttest.WiredTigerTestCase): stop += 1 k = key_populate(cursor, stop) v = value_populate(cursor, stop) - cursor.set_key(k) - cursor.set_value(v) - cursor.insert() + cursor[k] = v expected[k] = [v] cursor.close() diff --git a/test/suite/test_truncate03.py b/test/suite/test_truncate03.py index a69421b4217..85826841814 100644 --- a/test/suite/test_truncate03.py +++ b/test/suite/test_truncate03.py @@ -113,9 +113,7 @@ class test_truncate_address_deleted(wttest.WiredTigerTestCase): for i in range(3000, 7000, 137): k = key_populate(cursor, i) v = 'changed value: ' + str(i) - cursor.set_key(k) - cursor.set_value(v) - self.assertEqual(cursor.insert(), 0) + cursor[k] = v for i in range(3000, 7000, 137): k = key_populate(cursor, i) v = 'changed value: ' + str(i) diff --git a/test/suite/test_txn01.py b/test/suite/test_txn01.py index 94e65ff0f48..cbb771273a6 100644 --- a/test/suite/test_txn01.py +++ b/test/suite/test_txn01.py @@ -154,14 +154,10 @@ class test_read_committed_default(wttest.WiredTigerTestCase): self.session.create(self.uri, 'key_format=S,value_format=S') cursor = self.session.open_cursor(self.uri, None) self.session.begin_transaction() - cursor.set_key('key: aaa') - cursor.set_value('value: aaa') - cursor.insert() + cursor['key: aaa'] = 'value: aaa' self.session.commit_transaction() self.session.begin_transaction() - cursor.set_key('key: bbb') - cursor.set_value('value: bbb') - cursor.insert() + cursor['key: bbb'] = 'value: bbb' s = self.conn.open_session() cursor = s.open_cursor(self.uri, None) diff --git a/test/suite/test_txn02.py b/test/suite/test_txn02.py index bcba27d9584..5827a892654 100644 --- a/test/suite/test_txn02.py +++ b/test/suite/test_txn02.py @@ -204,15 +204,7 @@ class test_txn02(wttest.WiredTigerTestCase, suite_subprocess): # Set up the table with entries for 1, 2, 10 and 11. # We use the overwrite config so insert can update as needed. c = self.session.open_cursor(self.uri, None, 'overwrite') - c.set_value(1) - c.set_key(1) - c.insert() - c.set_key(2) - c.insert() - c.set_key(10) - c.insert() - c.set_key(11) - c.insert() + c[1] = c[2] = c[10] = c[11] = 1 current = {1:1, 2:1, 10:1, 11:1} committed = current.copy() @@ -238,13 +230,8 @@ class test_txn02(wttest.WiredTigerTestCase, suite_subprocess): k1 = k + 1 # print '%d: %s(%d)[%s]' % (i, ok[0], ok[1], txn) if op == 'insert' or op == 'update': - c.set_value(i + 2) - c.set_key(k) - c.insert() - c.set_key(k1) - c.insert() - current[k] = i + 2 - current[k1] = i + 2 + c[k] = c[k1] = i + 2 + current[k] = current[k1] = i + 2 elif op == 'remove': c.set_key(k) c.remove() diff --git a/test/suite/test_txn03.py b/test/suite/test_txn03.py index 4025dbb1117..41e283a8050 100644 --- a/test/suite/test_txn03.py +++ b/test/suite/test_txn03.py @@ -59,23 +59,17 @@ class test_txn03(wttest.WiredTigerTestCase): # Set up the table with entries for 1 and 10 # We use the overwrite config so insert can update as needed. c = self.session.open_cursor(self.uri1, None, 'overwrite') - c.set_value(self.data_str1) - c.set_key(self.key_str) - c.insert() + c[self.key_str] = self.data_str1 c.close() c = self.session.open_cursor(self.uri2, None, 'overwrite') - c.set_value(self.data_str1) - c.set_key(self.key_str) - c.insert() + c[self.key_str] = self.data_str1 c.close() # Update the first table - this update should be visible in the # new session. self.session.begin_transaction() c = self.session.open_cursor(self.uri1, None, 'overwrite') - c.set_value(self.data_str2) - c.set_key(self.key_str) - c.insert() + c[self.key_str] = self.data_str2 self.session.commit_transaction() c.close() @@ -88,9 +82,7 @@ class test_txn03(wttest.WiredTigerTestCase): # Make an update in the first session. self.session.begin_transaction() c = self.session.open_cursor(self.uri2, None, 'overwrite') - c.set_value(self.data_str2) - c.set_key(self.key_str) - c.insert() + c[self.key_str] = self.data_str2 self.session.commit_transaction() c.close() diff --git a/test/suite/test_txn04.py b/test/suite/test_txn04.py index 1dfe13db961..d0a21f5ec9c 100644 --- a/test/suite/test_txn04.py +++ b/test/suite/test_txn04.py @@ -139,10 +139,8 @@ class test_txn04(wttest.WiredTigerTestCase, suite_subprocess): # We then truncate starting or ending in various places. # We use the overwrite config so insert can update as needed. current = {1:1, 2:1, 3:1, 4:1, 5:1} - c.set_value(1) for k in current: - c.set_key(k) - c.insert() + c[k] = 1 committed = current.copy() ops = (self.op1, ) @@ -163,9 +161,7 @@ class test_txn04(wttest.WiredTigerTestCase, suite_subprocess): # print '%d: %s(%d)[%s]' % (i, ok[0], ok[1], txn) if op == 'insert' or op == 'update': - c.set_value(i + 2) - c.set_key(k) - c.insert() + c[k] = i + 2 current[k] = i + 2 elif op == 'remove': c.set_key(k) diff --git a/test/suite/test_txn05.py b/test/suite/test_txn05.py index 9651a5add74..8a2f36fc910 100644 --- a/test/suite/test_txn05.py +++ b/test/suite/test_txn05.py @@ -170,10 +170,8 @@ class test_txn05(wttest.WiredTigerTestCase, suite_subprocess): # We then truncate starting or ending in various places. c = self.session.open_cursor(self.uri, None) current = {1:1, 2:1, 3:1, 4:1, 5:1} - c.set_value(1) for k in current: - c.set_key(k) - c.insert() + c[k] = 1 committed = current.copy() ops = (self.op1, ) diff --git a/test/suite/test_txn06.py b/test/suite/test_txn06.py index 36457899054..4e3416c2235 100644 --- a/test/suite/test_txn06.py +++ b/test/suite/test_txn06.py @@ -55,9 +55,7 @@ class test_txn06(wttest.WiredTigerTestCase, suite_subprocess): c_src = self.session.open_cursor(self.source_uri) c = self.session.open_cursor(self.uri) for k, v in c_src: - c.set_key(k) - c.set_value(v) - c.insert() + c[k] = v if __name__ == '__main__': wttest.run() diff --git a/test/suite/test_txn07.py b/test/suite/test_txn07.py index 74df555ce5c..8e7119186f5 100644 --- a/test/suite/test_txn07.py +++ b/test/suite/test_txn07.py @@ -160,10 +160,8 @@ class test_txn07(wttest.WiredTigerTestCase, suite_subprocess): # Choose large compressible values for the string cases. value = 'abc' * 1000000 current = {1:value, 2:value, 3:value, 4:value, 5:value} - c.set_value(value) for k in current: - c.set_key(k) - c.insert() + c[k] = value committed = current.copy() ops = (self.op1, ) diff --git a/test/suite/test_txn08.py b/test/suite/test_txn08.py index f8abd52ca47..d35a0c70b3b 100644 --- a/test/suite/test_txn08.py +++ b/test/suite/test_txn08.py @@ -72,9 +72,7 @@ class test_txn08(wttest.WiredTigerTestCase, suite_subprocess): self.session.begin_transaction() for k in range(5): - c.set_key(k) - c.set_value(value) - c.insert() + c[k] = value self.session.commit_transaction() diff --git a/test/suite/test_txn09.py b/test/suite/test_txn09.py index 9ab6718341f..98229c52f2e 100644 --- a/test/suite/test_txn09.py +++ b/test/suite/test_txn09.py @@ -128,15 +128,7 @@ class test_txn09(wttest.WiredTigerTestCase, suite_subprocess): # Set up the table with entries for 1, 2, 10 and 11. # We use the overwrite config so insert can update as needed. c = self.session.open_cursor(self.uri, None, 'overwrite') - c.set_value(1) - c.set_key(1) - c.insert() - c.set_key(2) - c.insert() - c.set_key(10) - c.insert() - c.set_key(11) - c.insert() + c[1] = c[2] = c[10] = c[11] = 1 current = {1:1, 2:1, 10:1, 11:1} committed = current.copy() @@ -160,18 +152,11 @@ class test_txn09(wttest.WiredTigerTestCase, suite_subprocess): k1 = k + 1 # print '%d: %s(%d)[%s]' % (i, ok[0], ok[1], txn) if op == 'insert' or op == 'update': - c.set_value(i + 2) - c.set_key(k) - c.insert() - c.set_key(k1) - c.insert() - current[k] = i + 2 - current[k1] = i + 2 + c[k] = c[k1] = i + 2 + current[k] = current[k1] = i + 2 elif op == 'remove': - c.set_key(k) - c.remove() - c.set_key(k1) - c.remove() + del c[k] + del c[k1] if k in current: del current[k] if k1 in current: diff --git a/test/suite/test_txn10.py b/test/suite/test_txn10.py index a2bcb6686ef..cee25562756 100644 --- a/test/suite/test_txn10.py +++ b/test/suite/test_txn10.py @@ -80,9 +80,7 @@ class test_txn10(wttest.WiredTigerTestCase, suite_subprocess): self.session.create(self.t2, self.create_params) c = self.session.open_cursor(self.t2, None, None) for i in range(10000): - c.set_key(i) - c.set_value(i+1) - c.insert() + c[i] = i + 1 c.close() self.simulate_crash_restart(".", "RESTART") c = self.session.open_cursor(self.t2, None, None) diff --git a/test/suite/test_util01.py b/test/suite/test_util01.py index 62540769f08..0b1e2a35833 100644 --- a/test/suite/test_util01.py +++ b/test/suite/test_util01.py @@ -145,9 +145,7 @@ class test_util01(wttest.WiredTigerTestCase, suite_subprocess): for i in range(0, self.nentries): key = self.get_key(i) value = self.get_value(i) - cursor.set_key(key) - cursor.set_value(value) - cursor.insert() + cursor[key] = value expectout.write(self.dumpstr(key, hexoutput)) expectout.write(self.dumpstr(value, hexoutput)) cursor.close() diff --git a/test/suite/test_util02.py b/test/suite/test_util02.py index 76a35695a5f..f55542e3d3f 100644 --- a/test/suite/test_util02.py +++ b/test/suite/test_util02.py @@ -128,11 +128,7 @@ class test_util02(wttest.WiredTigerTestCase, suite_subprocess): self.session.create('table:' + self.tablename, params) cursor = self.session.open_cursor('table:' + self.tablename, None, None) for i in range(0, self.nentries): - key = self.get_key(i) - value = self.get_value(i) - cursor.set_key(key) - cursor.set_value(value) - cursor.insert() + cursor[self.get_key(i)] = self.get_value(i) cursor.close() dumpargs = ["dump"] diff --git a/test/suite/test_util07.py b/test/suite/test_util07.py index 9a04f0b1363..37de647cae1 100644 --- a/test/suite/test_util07.py +++ b/test/suite/test_util07.py @@ -45,9 +45,7 @@ class test_util07(wttest.WiredTigerTestCase, suite_subprocess): for i in range(0, self.nentries): key = 'KEY' + str(i) val = 'VAL' + str(i) - cursor.set_key(key) - cursor.set_value(val) - cursor.insert() + cursor[key] = val cursor.close() def close_conn(self): diff --git a/test/suite/test_util11.py b/test/suite/test_util11.py index e69530255a4..d9b226b506a 100644 --- a/test/suite/test_util11.py +++ b/test/suite/test_util11.py @@ -41,9 +41,7 @@ class test_util11(wttest.WiredTigerTestCase, suite_subprocess): Insert some simple entries into the table """ cursor = self.session.open_cursor('table:' + tablename, None, None) - cursor.set_key('SOMEKEY') - cursor.set_value('SOMEVALUE') - cursor.insert() + cursor['SOMEKEY'] = 'SOMEVALUE' cursor.close() def test_list_none(self): diff --git a/test/suite/test_verify.py b/test/suite/test_verify.py index 6b9fe06ce89..48a965141f0 100644 --- a/test/suite/test_verify.py +++ b/test/suite/test_verify.py @@ -44,10 +44,7 @@ class test_verify(wttest.WiredTigerTestCase, suite_subprocess): key = '' for i in range(0, self.nentries): key += str(i) - val = key + key - cursor.set_key(key) - cursor.set_value(val) - cursor.insert() + cursor[key] = key + key cursor.close() def check_populate(self, tablename): diff --git a/test/suite/wtthread.py b/test/suite/wtthread.py index c847c877b2d..1e2e4f56380 100644 --- a/test/suite/wtthread.py +++ b/test/suite/wtthread.py @@ -126,9 +126,7 @@ class op_thread(threading.Thread): if op == 'gi': # Group insert a number of tables. sess.begin_transaction() for next_cur in cursors: - next_cur.set_key(key) - next_cur.set_value(value) - next_cur.insert() + next_cur[key] = value sess.commit_transaction() if op == 'gu': # Group update a number of tables. sess.begin_transaction() @@ -139,9 +137,7 @@ class op_thread(threading.Thread): next_cur.reset() sess.commit_transaction() if op == 'i': # Insert an item - c.set_key(key) - c.set_value(value) - c.insert() + c[key] = value elif op == 'b': # Bounce the session handle. c.close() sess.close() @@ -159,9 +155,7 @@ class op_thread(threading.Thread): "key_format=" + self.key_fmt + ",value_format=S") try: c2 = sess.open_cursor(self.uris[0] + str(key), None, None) - c2.set_key(key) - c2.set_value(value) - c2.insert() + c2[key] = value c2.close() except wiredtiger.WiredTigerError as e: # These operations can fail, if the drop in another diff --git a/tools/wtstats/stat_data.py b/tools/wtstats/stat_data.py index a4fc2fcc831..db5b14d6cd6 100644 --- a/tools/wtstats/stat_data.py +++ b/tools/wtstats/stat_data.py @@ -62,8 +62,10 @@ no_scale_per_second_list = [ 'session: open cursor count', ] no_clear_list = [ + 'async: maximum work queue length', 'cache: bytes currently in the cache', 'cache: maximum bytes configured', + 'cache: maximum page size at eviction', 'cache: pages currently held in the cache', 'cache: percentage overhead', 'cache: tracked bytes belonging to internal pages in the cache', |