diff options
author | Ramon Fernandez <ramon@mongodb.com> | 2016-01-29 14:21:53 -0500 |
---|---|---|
committer | Ramon Fernandez <ramon@mongodb.com> | 2016-01-29 14:22:24 -0500 |
commit | 5d6532f3d5227ff76f62c4810c98a4ef4d0c8c56 (patch) | |
tree | 67f6b9581dce0fe7408639c3386e3694d9a8893b /src/third_party/wiredtiger/src/cursor | |
parent | 569041f7df6f62c1b026cc5fefe70c3998092db3 (diff) | |
download | mongo-5d6532f3d5227ff76f62c4810c98a4ef4d0c8c56.tar.gz |
Import wiredtiger-wiredtiger-2.7.0-559-g07966a4.tar.gz from wiredtiger branch mongodb-3.2
ref: 3c2ad56..07966a4
WT-1517 schema format edge cases
WT-1801 Add a directory sync after rollback of a WT_SESSION::rename operation
WT-2060 Simplify aggregation of statistics
WT-2073 metadata cleanups
WT-2099 Seeing memory underflow messages
WT-2113 truncate01 sometimes fails
WT-2142 Connection cleanup in Python tests
WT-2177 Add an optional per-thread seed to random number generator
WT-2198 bulk load and column store appends
WT-2216 simplify row-store search loop slightly
WT-2225 New split code performance impact
WT-2231 pinned page cursor searches could check parent keys
WT-2235 wt printlog option without unicode
WT-2242 WiredTiger treats dead trees the same as other trees in eviction
WT-2244 Trigger in-memory splits sooner
WT-2245 WTPERF Truncate has no ability to catch up when it falls behind
WT-2246 column-store append searches the leaf page; the maximum record number fails CRUD operations
WT-2247 variable-length column-store in-memory page splits
WT-2256 WTPERFs throttle option fires in bursts
WT-2257 wtperf doesn't handle overriding workload config
WT-2258 WiredTiger preloads pages even when direct-IO is configured.
WT-2259 __wt_evict_file_exclusive_on() should clear WT_BTREE_NO_EVICTION on error
WT-2260 Workloads evict internal pages unexpectedly
WT-2262 Random sampling is skewed by tree shape
WT-2265 Wiredtiger related change in ppc64le specific code block in gcc.h
WT-2266 Add wtperf config to set if perf thresholds are fatal
WT-2267 Improve wtperf throttling implementation to provide steady load
WT-2269 wtperf should dump its config everytime it runs
WT-2272 Stress test assertion in the sweep server
WT-2275 broken DB after application crash
WT-2276 tool to decode checkpoint addr
WT-2277 Remove WT check against big-endian systems
WT-2279 Define WT_PAUSE(), WT_FULL_BARRIER(), etc when s390x is defined
WT-2281 wtperf smoke.sh fails on ppc64le
WT-2282 error in wt_txn_update_oldest verbose message test
WT-2283 retry in txn_update_oldest results in a hang
WT-2284 Repeated macro definition
WT-2285 configure should set BUFFER_ALIGNMENT_DEFAULT to 4kb on linux
WT-2287 WT_SESSION.rebalance
WT-2289 failure in fast key check
WT-2290 WT_SESSION.compact could be more effective.
WT-2291 Random cursor walk inefficient in skip list only trees
WT-2295 WT_SESSION.create does a full-scan of the main table
WT-2296 New log algorithm needs improving for sync/flush settings
WT-2297 Fix off-by-one error in Huffman config file parsing
WT-2299 upper-level WiredTiger code is reaching into the block manager
WT-2301 Add reading a range to wtperf
WT-2303 Build warning in wtperf
WT-2304 wtperf crash dumping config
WT-2305 Fix coverity scan issues on 23/12/2015
WT-2307 Internal page splits can corrupt cursor iteration
WT-2308 custom extractor for ref_cursors in join cursor
WT-2311 Support Sparc
WT-2312 re-creating a deleted column-store page can corrupt the in-memory tree
WT-2313 sweep-server: conn_dhandle.c, 610: dhandle != conn->cache->evict_file_next
WT-2314 page-swap error handling is inconsistent
WT-2316 stress test failure: WT_CURSOR.prev out-of-order returns
WT-2320 Only check copyright when cutting releases
WT-2321 WT-2321: race between eviction and worker threads on the eviction queue
WT-2326 Change WTPERF to use new memory allocation functions instead of the standard
WT-2328 schema drop does direct unlink, it should use a block manager interface.
WT-2331 Checking of search() result for reference cursors before join()
WT-2332 Bug in logging write-no-sync mode
WT-2333 Add a flag so drop doesn't block
WT-2335 NULL pointer crash in config_check_search with invalid configuration string
WT-2338 Disable using pre-allocated log files when backup cursor is open
WT-2339 format post-rebalance verify failure (stress run #11586)
WT-2340 Add logging guarantee assertions, whitespace
WT-2342 Enhance wtperf to support background create and drop operations
WT-2344 OS X compiler warning
WT-2347 Java: schema format edge cases
WT-2348 xargs -P isn't portable
WT-2355 Fix minor scratch buffer usage in logging
SERVER-21833 Compact does not release space to the system with WiredTiger
SERVER-21887 $sample takes disproportionately long time on newly created collection
SERVER-22064 Coverity analysis defect 77699: Unchecked return value
SERVER-21944 WiredTiger changes for 3.2.2
Diffstat (limited to 'src/third_party/wiredtiger/src/cursor')
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_backup.c | 25 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_bulk.c | 196 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_config.c | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_ds.c | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_dump.c | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_file.c | 6 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_index.c | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_join.c | 19 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_json.c | 15 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_log.c | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_metadata.c | 10 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_stat.c | 9 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_std.c | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/cursor/cur_table.c | 16 |
14 files changed, 195 insertions, 113 deletions
diff --git a/src/third_party/wiredtiger/src/cursor/cur_backup.c b/src/third_party/wiredtiger/src/cursor/cur_backup.c index 62ac2203b97..6d5d68000ee 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_backup.c +++ b/src/third_party/wiredtiger/src/cursor/cur_backup.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 MongoDB, Inc. + * Copyright (c) 2014-2016 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * @@ -80,13 +80,14 @@ __curbackup_close(WT_CURSOR *cursor) int tret; cb = (WT_CURSOR_BACKUP *)cursor; + CURSOR_API_CALL(cursor, session, close, NULL); WT_TRET(__backup_cleanup_handles(session, cb)); WT_TRET(__wt_cursor_close(cursor)); session->bkp_cursor = NULL; - WT_WITH_SCHEMA_LOCK(session, + WT_WITH_SCHEMA_LOCK(session, tret, tret = __backup_stop(session)); /* Stop the backup. */ WT_TRET(tret); @@ -139,7 +140,8 @@ __wt_curbackup_open(WT_SESSION_IMPL *session, * Start the backup and fill in the cursor's list. Acquire the schema * lock, we need a consistent view when creating a copy. */ - WT_WITH_SCHEMA_LOCK(session, ret = __backup_start(session, cb, cfg)); + WT_WITH_SCHEMA_LOCK(session, ret, + ret = __backup_start(session, cb, cfg)); WT_ERR(ret); /* __wt_cursor_init is last so we don't have to clean up on error. */ @@ -339,11 +341,8 @@ __backup_all(WT_SESSION_IMPL *session, WT_CURSOR_BACKUP *cb) cursor = NULL; - /* - * Open a cursor on the metadata file and copy all of the entries to - * the hot backup file. - */ - WT_ERR(__wt_metadata_cursor(session, NULL, &cursor)); + /* Copy all of the metadata entries to the hot backup file. */ + WT_RET(__wt_metadata_cursor(session, &cursor)); while ((ret = cursor->next(cursor)) == 0) { WT_ERR(cursor->get_key(cursor, &key)); WT_ERR(cursor->get_value(cursor, &value)); @@ -375,13 +374,13 @@ __backup_all(WT_SESSION_IMPL *session, WT_CURSOR_BACKUP *cb) } WT_ERR_NOTFOUND_OK(ret); + WT_ERR(__wt_metadata_cursor_release(session, &cursor)); + /* Build a list of the file objects that need to be copied. */ - WT_WITH_HANDLE_LIST_LOCK(session, - ret = __wt_meta_btree_apply( - session, __backup_list_all_append, NULL)); + WT_WITH_HANDLE_LIST_LOCK(session, ret, ret = + __wt_meta_btree_apply(session, __backup_list_all_append, NULL)); -err: if (cursor != NULL) - WT_TRET(cursor->close(cursor)); +err: WT_TRET(__wt_metadata_cursor_release(session, &cursor)); return (ret); } diff --git a/src/third_party/wiredtiger/src/cursor/cur_bulk.c b/src/third_party/wiredtiger/src/cursor/cur_bulk.c index b996b934464..c013383fa61 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_bulk.c +++ b/src/third_party/wiredtiger/src/cursor/cur_bulk.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 MongoDB, Inc. + * Copyright (c) 2014-2016 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * @@ -9,6 +9,25 @@ #include "wt_internal.h" /* + * __bulk_col_keycmp_err -- + * Error routine when column-store keys inserted out-of-order. + */ +static int +__bulk_col_keycmp_err(WT_CURSOR_BULK *cbulk) +{ + WT_CURSOR *cursor; + WT_SESSION_IMPL *session; + + session = (WT_SESSION_IMPL *)cbulk->cbt.iface.session; + cursor = &cbulk->cbt.iface; + + WT_RET_MSG(session, EINVAL, + "bulk-load presented with out-of-order keys: %" PRIu64 " is less " + "than previously inserted key %" PRIu64, + cursor->recno, cbulk->recno); +} + +/* * __curbulk_insert_fix -- * Fixed-length column-store bulk cursor insert. */ @@ -19,6 +38,7 @@ __curbulk_insert_fix(WT_CURSOR *cursor) WT_CURSOR_BULK *cbulk; WT_DECL_RET; WT_SESSION_IMPL *session; + uint64_t recno; cbulk = (WT_CURSOR_BULK *)cursor; btree = cbulk->cbt.btree; @@ -29,13 +49,63 @@ __curbulk_insert_fix(WT_CURSOR *cursor) * until the bulk cursor is closed. */ CURSOR_API_CALL(cursor, session, insert, btree); + WT_STAT_FAST_DATA_INCR(session, cursor_insert_bulk); - WT_CURSOR_NEEDVALUE(cursor); + /* + * If the "append" flag was configured, the application doesn't have to + * supply a key, else require a key. + */ + if (F_ISSET(cursor, WT_CURSTD_APPEND)) + recno = cbulk->recno + 1; + else { + WT_CURSOR_CHECKKEY(cursor); + if ((recno = cursor->recno) <= cbulk->recno) + WT_ERR(__bulk_col_keycmp_err(cbulk)); + } + WT_CURSOR_CHECKVALUE(cursor); + + /* + * Insert any skipped records as deleted records, update the current + * record count. + */ + for (; recno != cbulk->recno + 1; ++cbulk->recno) + WT_ERR(__wt_bulk_insert_fix(session, cbulk, true)); + cbulk->recno = recno; + + /* Insert the current record. */ + ret = __wt_bulk_insert_fix(session, cbulk, false); + +err: API_END_RET(session, ret); +} + +/* + * __curbulk_insert_fix_bitmap -- + * Fixed-length column-store bulk cursor insert for bitmaps. + */ +static int +__curbulk_insert_fix_bitmap(WT_CURSOR *cursor) +{ + WT_BTREE *btree; + WT_CURSOR_BULK *cbulk; + WT_DECL_RET; + WT_SESSION_IMPL *session; - WT_ERR(__wt_bulk_insert_fix(session, cbulk)); + cbulk = (WT_CURSOR_BULK *)cursor; + btree = cbulk->cbt.btree; + /* + * Bulk cursor inserts are updates, but don't need auto-commit + * transactions because they are single-threaded and not visible + * until the bulk cursor is closed. + */ + CURSOR_API_CALL(cursor, session, insert, btree); WT_STAT_FAST_DATA_INCR(session, cursor_insert_bulk); + WT_CURSOR_CHECKVALUE(cursor); + + /* Insert the current record. */ + ret = __wt_bulk_insert_fix_bitmap(session, cbulk); + err: API_END_RET(session, ret); } @@ -50,7 +120,7 @@ __curbulk_insert_var(WT_CURSOR *cursor) WT_CURSOR_BULK *cbulk; WT_DECL_RET; WT_SESSION_IMPL *session; - bool duplicate; + uint64_t recno; cbulk = (WT_CURSOR_BULK *)cursor; btree = cbulk->cbt.btree; @@ -61,45 +131,63 @@ __curbulk_insert_var(WT_CURSOR *cursor) * until the bulk cursor is closed. */ CURSOR_API_CALL(cursor, session, insert, btree); - - WT_CURSOR_NEEDVALUE(cursor); + WT_STAT_FAST_DATA_INCR(session, cursor_insert_bulk); /* - * If this isn't the first value inserted, compare it against the last - * value and increment the RLE count. - * - * Instead of a "first time" variable, I'm using the RLE count, because - * it is only zero before the first row is inserted. + * If the "append" flag was configured, the application doesn't have to + * supply a key, else require a key. */ - duplicate = false; - if (cbulk->rle != 0) { - if (cbulk->last.size == cursor->value.size && - memcmp(cbulk->last.data, cursor->value.data, - cursor->value.size) == 0) { - ++cbulk->rle; - duplicate = true; - } else - WT_ERR(__wt_bulk_insert_var(session, cbulk)); + if (F_ISSET(cursor, WT_CURSTD_APPEND)) + recno = cbulk->recno + 1; + else { + WT_CURSOR_CHECKKEY(cursor); + if ((recno = cursor->recno) <= cbulk->recno) + WT_ERR(__bulk_col_keycmp_err(cbulk)); } + WT_CURSOR_CHECKVALUE(cursor); + + if (!cbulk->first_insert) { + /* + * If not the first insert and the key space is sequential, + * compare the current value against the last value; if the + * same, just increment the RLE count. + */ + if (recno == cbulk->recno + 1 && + cbulk->last.size == cursor->value.size && + memcmp(cbulk->last.data, + cursor->value.data, cursor->value.size) == 0) { + ++cbulk->rle; + ++cbulk->recno; + goto duplicate; + } + + /* Insert the previous key/value pair. */ + WT_ERR(__wt_bulk_insert_var(session, cbulk, false)); + } else + cbulk->first_insert = false; /* - * Save a copy of the value for the next comparison and reset the RLE - * counter. + * Insert any skipped records as deleted records, update the current + * record count and RLE counter. */ - if (!duplicate) { - WT_ERR(__wt_buf_set(session, - &cbulk->last, cursor->value.data, cursor->value.size)); - cbulk->rle = 1; + if (recno != cbulk->recno + 1) { + cbulk->rle = (recno - cbulk->recno) - 1; + WT_ERR(__wt_bulk_insert_var(session, cbulk, true)); } + cbulk->rle = 1; + cbulk->recno = recno; - WT_STAT_FAST_DATA_INCR(session, cursor_insert_bulk); + /* Save a copy of the value for the next comparison. */ + ret = __wt_buf_set(session, + &cbulk->last, cursor->value.data, cursor->value.size); +duplicate: err: API_END_RET(session, ret); } /* * __bulk_row_keycmp_err -- - * Error routine when keys inserted out-of-order. + * Error routine when row-store keys inserted out-of-order. */ static int __bulk_row_keycmp_err(WT_CURSOR_BULK *cbulk) @@ -116,16 +204,13 @@ __bulk_row_keycmp_err(WT_CURSOR_BULK *cbulk) WT_ERR(__wt_scr_alloc(session, 512, &a)); WT_ERR(__wt_scr_alloc(session, 512, &b)); - WT_ERR(__wt_buf_set_printable( - session, a, cursor->key.data, cursor->key.size)); - WT_ERR(__wt_buf_set_printable( - session, b, cbulk->last.data, cbulk->last.size)); - WT_ERR_MSG(session, EINVAL, - "bulk-load presented with out-of-order keys: %.*s compares smaller " - "than previously inserted key %.*s", - (int)a->size, (const char *)a->data, - (int)b->size, (const char *)b->data); + "bulk-load presented with out-of-order keys: %s compares smaller " + "than previously inserted key %s", + __wt_buf_set_printable( + session, cursor->key.data, cursor->key.size, a), + __wt_buf_set_printable( + session, cbulk->last.data, cbulk->last.size, b)); err: __wt_scr_free(session, &a); __wt_scr_free(session, &b); @@ -154,6 +239,7 @@ __curbulk_insert_row(WT_CURSOR *cursor) * until the bulk cursor is closed. */ CURSOR_API_CALL(cursor, session, insert, btree); + WT_STAT_FAST_DATA_INCR(session, cursor_insert_bulk); WT_CURSOR_CHECKKEY(cursor); WT_CURSOR_CHECKVALUE(cursor); @@ -161,28 +247,20 @@ __curbulk_insert_row(WT_CURSOR *cursor) /* * If this isn't the first key inserted, compare it against the last key * to ensure the application doesn't accidentally corrupt the table. - * - * Instead of a "first time" variable, I'm using the RLE count, because - * it is only zero before the first row is inserted. */ - if (cbulk->rle != 0) { + if (!cbulk->first_insert) { WT_ERR(__wt_compare(session, btree->collator, &cursor->key, &cbulk->last, &cmp)); if (cmp <= 0) WT_ERR(__bulk_row_keycmp_err(cbulk)); - } + } else + cbulk->first_insert = false; - /* - * Save a copy of the key for the next comparison and set the RLE - * counter. - */ + /* Save a copy of the key for the next comparison. */ WT_ERR(__wt_buf_set(session, &cbulk->last, cursor->key.data, cursor->key.size)); - cbulk->rle = 1; - - WT_ERR(__wt_bulk_insert_row(session, cbulk)); - WT_STAT_FAST_DATA_INCR(session, cursor_insert_bulk); + ret = __wt_bulk_insert_row(session, cbulk); err: API_END_RET(session, ret); } @@ -208,13 +286,12 @@ __curbulk_insert_row_skip_check(WT_CURSOR *cursor) * until the bulk cursor is closed. */ CURSOR_API_CALL(cursor, session, insert, btree); + WT_STAT_FAST_DATA_INCR(session, cursor_insert_bulk); - WT_CURSOR_NEEDKEY(cursor); - WT_CURSOR_NEEDVALUE(cursor); - - WT_ERR(__wt_bulk_insert_row(session, cbulk)); + WT_CURSOR_CHECKKEY(cursor); + WT_CURSOR_CHECKVALUE(cursor); - WT_STAT_FAST_DATA_INCR(session, cursor_insert_bulk); + ret = __wt_bulk_insert_row(session, cbulk); err: API_END_RET(session, ret); } @@ -237,18 +314,25 @@ __wt_curbulk_init(WT_SESSION_IMPL *session, __wt_cursor_set_notsup(c); switch (cbt->btree->type) { case BTREE_COL_FIX: - c->insert = __curbulk_insert_fix; + c->insert = bitmap ? + __curbulk_insert_fix_bitmap : __curbulk_insert_fix; break; case BTREE_COL_VAR: c->insert = __curbulk_insert_var; break; case BTREE_ROW: + /* + * Row-store order comparisons are expensive, so we optionally + * skip them when we know the input is correct. + */ c->insert = skip_sort_check ? __curbulk_insert_row_skip_check : __curbulk_insert_row; break; WT_ILLEGAL_VALUE(session); } + cbulk->first_insert = true; + cbulk->recno = 0; cbulk->bitmap = bitmap; if (bitmap) F_SET(c, WT_CURSTD_RAW); diff --git a/src/third_party/wiredtiger/src/cursor/cur_config.c b/src/third_party/wiredtiger/src/cursor/cur_config.c index 348cfbab1dd..1b2fec0eb89 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_config.c +++ b/src/third_party/wiredtiger/src/cursor/cur_config.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 MongoDB, Inc. + * Copyright (c) 2014-2016 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * diff --git a/src/third_party/wiredtiger/src/cursor/cur_ds.c b/src/third_party/wiredtiger/src/cursor/cur_ds.c index ccc19717612..2a598c99523 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_ds.c +++ b/src/third_party/wiredtiger/src/cursor/cur_ds.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 MongoDB, Inc. + * Copyright (c) 2014-2016 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * diff --git a/src/third_party/wiredtiger/src/cursor/cur_dump.c b/src/third_party/wiredtiger/src/cursor/cur_dump.c index e5799fbad05..3324efd96cc 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_dump.c +++ b/src/third_party/wiredtiger/src/cursor/cur_dump.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 MongoDB, Inc. + * Copyright (c) 2014-2016 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * diff --git a/src/third_party/wiredtiger/src/cursor/cur_file.c b/src/third_party/wiredtiger/src/cursor/cur_file.c index b955b292292..8bbe1cc8eda 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_file.c +++ b/src/third_party/wiredtiger/src/cursor/cur_file.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 MongoDB, Inc. + * Copyright (c) 2014-2016 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * @@ -545,8 +545,8 @@ __wt_curfile_open(WT_SESSION_IMPL *session, const char *uri, * failing with EBUSY due to a database-wide checkpoint. */ if (LF_ISSET(WT_DHANDLE_EXCLUSIVE)) - WT_WITH_CHECKPOINT_LOCK(session, ret = - __wt_session_get_btree_ckpt( + WT_WITH_CHECKPOINT_LOCK(session, ret, + ret = __wt_session_get_btree_ckpt( session, uri, cfg, flags)); else ret = __wt_session_get_btree_ckpt( diff --git a/src/third_party/wiredtiger/src/cursor/cur_index.c b/src/third_party/wiredtiger/src/cursor/cur_index.c index a909eaece99..6822055131a 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_index.c +++ b/src/third_party/wiredtiger/src/cursor/cur_index.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 MongoDB, Inc. + * Copyright (c) 2014-2016 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * diff --git a/src/third_party/wiredtiger/src/cursor/cur_join.c b/src/third_party/wiredtiger/src/cursor/cur_join.c index 395da22a80c..2cbefa68c5e 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_join.c +++ b/src/third_party/wiredtiger/src/cursor/cur_join.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 MongoDB, Inc. + * Copyright (c) 2014-2016 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * @@ -383,17 +383,14 @@ __curjoin_endpoint_init_key(WT_SESSION_IMPL *session, allocbuf = NULL; if ((cursor = endpoint->cursor) != NULL) { if (entry->index != NULL) { + /* Extract and save the index's logical key. */ cindex = (WT_CURSOR_INDEX *)endpoint->cursor; - if (cindex->index->extractor == NULL) { - WT_ERR(__wt_struct_repack(session, - cindex->child->key_format, - entry->main->value_format, - &cindex->child->key, &endpoint->key, - &allocbuf)); - if (allocbuf != NULL) - F_SET(endpoint, WT_CURJOIN_END_OWN_KEY); - } else - endpoint->key = cindex->child->key; + WT_ERR(__wt_struct_repack(session, + cindex->child->key_format, + cindex->iface.key_format, + &cindex->child->key, &endpoint->key, &allocbuf)); + if (allocbuf != NULL) + F_SET(endpoint, WT_CURJOIN_END_OWN_KEY); } else { k = &((WT_CURSOR_TABLE *)cursor)->cg_cursors[0]->key; if (WT_CURSOR_RECNO(cursor)) { diff --git a/src/third_party/wiredtiger/src/cursor/cur_json.c b/src/third_party/wiredtiger/src/cursor/cur_json.c index 8f858a5012f..fcb66d3e8b3 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_json.c +++ b/src/third_party/wiredtiger/src/cursor/cur_json.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 MongoDB, Inc. + * Copyright (c) 2014-2016 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * @@ -313,7 +313,6 @@ size_t __wt_json_unpack_char(char ch, u_char *buf, size_t bufsz, bool force_unicode) { char abbrev; - u_char h; if (!force_unicode) { if (isprint(ch) && ch != '\\' && ch != '"') { @@ -354,16 +353,8 @@ __wt_json_unpack_char(char ch, u_char *buf, size_t bufsz, bool force_unicode) *buf++ = 'u'; *buf++ = '0'; *buf++ = '0'; - h = (((u_char)ch) >> 4) & 0xF; - if (h >= 10) - *buf++ = 'A' + (h - 10); - else - *buf++ = '0' + h; - h = ((u_char)ch) & 0xF; - if (h >= 10) - *buf++ = 'A' + (h - 10); - else - *buf++ = '0' + h; + *buf++ = __wt_hex[(ch & 0xf0) >> 4]; + *buf++ = __wt_hex[ch & 0x0f]; } return (6); } diff --git a/src/third_party/wiredtiger/src/cursor/cur_log.c b/src/third_party/wiredtiger/src/cursor/cur_log.c index ade9fd18962..35a2d00e6ec 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_log.c +++ b/src/third_party/wiredtiger/src/cursor/cur_log.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 MongoDB, Inc. + * Copyright (c) 2014-2016 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * diff --git a/src/third_party/wiredtiger/src/cursor/cur_metadata.c b/src/third_party/wiredtiger/src/cursor/cur_metadata.c index 55da93859a6..df66ef34ddd 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_metadata.c +++ b/src/third_party/wiredtiger/src/cursor/cur_metadata.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 MongoDB, Inc. + * Copyright (c) 2014-2016 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * @@ -477,8 +477,12 @@ __wt_curmetadata_open(WT_SESSION_IMPL *session, cursor->key_format = "S"; cursor->value_format = "S"; - /* Open the file cursor for operations on the regular metadata */ - WT_ERR(__wt_metadata_cursor(session, cfg[1], &mdc->file_cursor)); + /* + * Open the file cursor for operations on the regular metadata; don't + * use the existing, cached session metadata cursor, the configuration + * may not be the same. + */ + WT_ERR(__wt_metadata_cursor_open(session, cfg[1], &mdc->file_cursor)); WT_ERR(__wt_cursor_init(cursor, uri, owner, cfg, cursorp)); diff --git a/src/third_party/wiredtiger/src/cursor/cur_stat.c b/src/third_party/wiredtiger/src/cursor/cur_stat.c index e1d5b8eb91a..00a6ade21c6 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_stat.c +++ b/src/third_party/wiredtiger/src/cursor/cur_stat.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 MongoDB, Inc. + * Copyright (c) 2014-2016 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * @@ -384,6 +384,7 @@ __curstat_file_init(WT_SESSION_IMPL *session, { WT_DATA_HANDLE *dhandle; WT_DECL_RET; + wt_off_t size; const char *filename; /* @@ -395,8 +396,8 @@ __curstat_file_init(WT_SESSION_IMPL *session, if (!WT_PREFIX_SKIP(filename, "file:")) return (EINVAL); __wt_stat_dsrc_init_single(&cst->u.dsrc_stats); - WT_RET(__wt_block_manager_size( - session, filename, &cst->u.dsrc_stats)); + WT_RET(__wt_block_manager_named_size(session, filename, &size)); + cst->u.dsrc_stats.block_size = size; __wt_curstat_dsrc_final(cst); return (0); } @@ -662,7 +663,7 @@ __wt_curstat_open(WT_SESSION_IMPL *session, /* * We return the statistics field's offset as the key, and a string - * description, a string value, and a uint64_t value as the value + * description, a string value, and a uint64_t value as the value * columns. */ cursor->key_format = "i"; diff --git a/src/third_party/wiredtiger/src/cursor/cur_std.c b/src/third_party/wiredtiger/src/cursor/cur_std.c index da38988b6c2..051f36c8854 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_std.c +++ b/src/third_party/wiredtiger/src/cursor/cur_std.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 MongoDB, Inc. + * Copyright (c) 2014-2016 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * diff --git a/src/third_party/wiredtiger/src/cursor/cur_table.c b/src/third_party/wiredtiger/src/cursor/cur_table.c index dca72a16ee5..d986577f640 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_table.c +++ b/src/third_party/wiredtiger/src/cursor/cur_table.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015 MongoDB, Inc. + * Copyright (c) 2014-2016 MongoDB, Inc. * Copyright (c) 2008-2014 WiredTiger, Inc. * All rights reserved. * @@ -758,6 +758,7 @@ err: API_END_RET(session, ret); static int __curtable_open_colgroups(WT_CURSOR_TABLE *ctable, const char *cfg_arg[]) { + WT_DECL_RET; WT_SESSION_IMPL *session; WT_TABLE *table; WT_CURSOR **cp; @@ -776,8 +777,10 @@ __curtable_open_colgroups(WT_CURSOR_TABLE *ctable, const char *cfg_arg[]) /* If the table is incomplete, wait on the table lock and recheck. */ complete = table->cg_complete; - if (!complete) - WT_WITH_TABLE_LOCK(session, complete = table->cg_complete); + if (!complete) { + WT_WITH_TABLE_LOCK(session, ret, complete = table->cg_complete); + WT_RET(ret); + } if (!complete) WT_RET_MSG(session, EINVAL, "Can't use '%s' until all column groups are created", @@ -968,8 +971,11 @@ __wt_curtable_open(WT_SESSION_IMPL *session, WT_ERR(__wt_strdup(session, tmp->data, &ctable->cfg[1])); if (0) { -err: WT_TRET(__curtable_close(cursor)); - *cursorp = NULL; +err: if (*cursorp != NULL) { + WT_TRET(__wt_cursor_close(*cursorp)); + *cursorp = NULL; + } + WT_TRET(__curtable_close(cursor)); } __wt_scr_free(session, &tmp); |