diff options
author | Luke Chen <luke.chen@mongodb.com> | 2017-11-24 15:14:51 +1100 |
---|---|---|
committer | Luke Chen <luke.chen@mongodb.com> | 2017-11-24 15:14:51 +1100 |
commit | 8a03a74df0e124061f374984201e5faebc2350c7 (patch) | |
tree | 02c2113766d120dbe00349a32963ac5459fd396c /src/third_party/wiredtiger/src/include | |
parent | 4c00395b84400df45bcce4413b6ea895ead7eff4 (diff) | |
download | mongo-8a03a74df0e124061f374984201e5faebc2350c7.tar.gz |
Import wiredtiger: bc0337ed0085ea2d7b00f73deb2f726b4ffbee1b from branch mongodb-3.8
ref: d1027489d8..bc0337ed00
for: 3.7.1
WT-3607 Compact skips all in-cache blocks with associated disk images
WT-3658 Fixed-sized strings can be stored without a trailing NUL
WT-3761 Review when cursor operations force evict pages
WT-3762 Allow the oldest_timestamp to be moved backwards.
Diffstat (limited to 'src/third_party/wiredtiger/src/include')
-rw-r--r-- | src/third_party/wiredtiger/src/include/btree.i | 22 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/extern.h | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/misc.i | 14 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/packing.i | 19 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/wiredtiger.in | 3 |
5 files changed, 43 insertions, 17 deletions
diff --git a/src/third_party/wiredtiger/src/include/btree.i b/src/third_party/wiredtiger/src/include/btree.i index 35cb868ac26..19b300908b1 100644 --- a/src/third_party/wiredtiger/src/include/btree.i +++ b/src/third_party/wiredtiger/src/include/btree.i @@ -1425,15 +1425,19 @@ __wt_page_release(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags) * tree, then perform a general check if eviction will be possible. */ page = ref->page; - if (!WT_READGEN_EVICT_SOON(page->read_gen) || - LF_ISSET(WT_READ_NO_SPLIT) || - btree->evict_disabled > 0 || - !__wt_page_can_evict(session, ref, &inmem_split) || - (F_ISSET(session, WT_SESSION_NO_RECONCILE) && !inmem_split)) - return (__wt_hazard_clear(session, ref)); - - WT_RET_BUSY_OK(__wt_page_release_evict(session, ref)); - return (0); + if (WT_READGEN_EVICT_SOON(page->read_gen) && + btree->evict_disabled == 0 && + __wt_page_can_evict(session, ref, &inmem_split)) { + if ((LF_ISSET(WT_READ_NO_SPLIT) || (!inmem_split && + F_ISSET(session, WT_SESSION_NO_RECONCILE)))) + __wt_page_evict_urgent(session, ref); + else { + WT_RET_BUSY_OK(__wt_page_release_evict(session, ref)); + return (0); + } + } + + return (__wt_hazard_clear(session, ref)); } /* diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h index 17267861717..ce9e1e57a47 100644 --- a/src/third_party/wiredtiger/src/include/extern.h +++ b/src/third_party/wiredtiger/src/include/extern.h @@ -824,7 +824,7 @@ extern int __wt_timestamp_to_hex_string( WT_SESSION_IMPL *session, char *hex_tim extern void __wt_verbose_timestamp(WT_SESSION_IMPL *session, const wt_timestamp_t *ts, const char *msg); extern int __wt_txn_parse_timestamp(WT_SESSION_IMPL *session, const char *name, wt_timestamp_t *timestamp, WT_CONFIG_ITEM *cval) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_txn_global_query_timestamp( WT_SESSION_IMPL *session, char *hex_timestamp, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_txn_update_pinned_timestamp(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_txn_update_pinned_timestamp(WT_SESSION_IMPL *session, bool force) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_txn_global_set_timestamp(WT_SESSION_IMPL *session, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_timestamp_validate(WT_SESSION_IMPL *session, const char *name, wt_timestamp_t *ts, WT_CONFIG_ITEM *cval, bool cmp_oldest, bool cmp_stable, bool cmp_commit) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_txn_set_timestamp(WT_SESSION_IMPL *session, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); diff --git a/src/third_party/wiredtiger/src/include/misc.i b/src/third_party/wiredtiger/src/include/misc.i index dbb921f0946..bedd3121037 100644 --- a/src/third_party/wiredtiger/src/include/misc.i +++ b/src/third_party/wiredtiger/src/include/misc.i @@ -41,6 +41,20 @@ __wt_strdup(WT_SESSION_IMPL *session, const char *str, void *retp) } /* + * __wt_strnlen -- + * Determine the length of a fixed-size string + */ +static inline size_t +__wt_strnlen(const char *s, size_t maxlen) +{ + size_t i; + + for (i = 0; i < maxlen && *s != '\0'; i++, s++) + ; + return (i); +} + +/* * __wt_snprintf -- * snprintf convenience function, ignoring the returned size. */ diff --git a/src/third_party/wiredtiger/src/include/packing.i b/src/third_party/wiredtiger/src/include/packing.i index e1cf158c660..d5181738fbd 100644 --- a/src/third_party/wiredtiger/src/include/packing.i +++ b/src/third_party/wiredtiger/src/include/packing.i @@ -342,15 +342,20 @@ __pack_write( *pp += pv->size; break; case 'S': - s = strlen(pv->u.s); + /* + * When preceded by a size, that indicates the maximum number + * of bytes the string can store, this does not include the + * terminating NUL character. In a string with characters + * less than the specified size, the remaining bytes are + * NULL padded. + */ if (pv->havesize) { - if (pv->size < s) { - s = pv->size; - pad = 0; - } else - pad = pv->size - s; - } else + s = __wt_strnlen(pv->u.s, pv->size); + pad = (s < pv->size) ? pv->size - s : 0; + } else { + s = strlen(pv->u.s); pad = 1; + } WT_SIZE_CHECK_PACK(s + pad, maxlen); if (s > 0) memcpy(*pp, pv->u.s, s); diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in index c24cffe2371..d4c1fa956c3 100644 --- a/src/third_party/wiredtiger/src/include/wiredtiger.in +++ b/src/third_party/wiredtiger/src/include/wiredtiger.in @@ -2341,6 +2341,9 @@ struct __wt_connection { * supplied value should not be older than the current oldest and stable * timestamps. See @ref transaction_timestamps., a string; default * empty.} + * @config{force, set timestamps even if they violate normal ordering + * requirements. For example allow the \c oldest_timestamp to move + * backwards., a boolean flag; default \c false.} * @config{oldest_timestamp, future commits and queries will be no * earlier than the specified timestamp. Supplied values must be * monotonically increasing\, any attempt to set the value to older than |