diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2015-08-18 10:26:20 +1000 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2015-08-18 10:26:20 +1000 |
commit | d4e4b25d8ca52f79781fc1fdd96d28bed08212cc (patch) | |
tree | facbcd6d91f8ba5c62d8f6bef73ff8db36170c92 /src/third_party/wiredtiger | |
parent | 934c760404cdeb693ac72b04373b2efe659b79df (diff) | |
download | mongo-d4e4b25d8ca52f79781fc1fdd96d28bed08212cc.tar.gz |
Import wiredtiger-wiredtiger-2.6.1-514-g7ffa315.tar.gz from wiredtiger branch mongodb-3.2
Diffstat (limited to 'src/third_party/wiredtiger')
42 files changed, 359 insertions, 378 deletions
diff --git a/src/third_party/wiredtiger/SConstruct b/src/third_party/wiredtiger/SConstruct index 49e4417133f..70ed6e0220b 100644 --- a/src/third_party/wiredtiger/SConstruct +++ b/src/third_party/wiredtiger/SConstruct @@ -454,6 +454,7 @@ t = env.Program("wtperf", [ "bench/wtperf/misc.c", "bench/wtperf/track.c", "bench/wtperf/wtperf.c", + "bench/wtperf/wtperf_truncate.c", ], LIBS=[wtlib, shim] + wtlibs) Default(t) diff --git a/src/third_party/wiredtiger/bench/wtperf/config.c b/src/third_party/wiredtiger/bench/wtperf/config.c index 721b41432cb..6b0ce47ef3f 100644 --- a/src/third_party/wiredtiger/bench/wtperf/config.c +++ b/src/third_party/wiredtiger/bench/wtperf/config.c @@ -96,7 +96,7 @@ config_assign(CONFIG *dest, const CONFIG *src) } } - STAILQ_INIT(&dest->stone_head); + TAILQ_INIT(&dest->stone_head); return (0); } diff --git a/src/third_party/wiredtiger/bench/wtperf/wtperf.h b/src/third_party/wiredtiger/bench/wtperf/wtperf.h index 58dc65388ae..e4b9fc00798 100644 --- a/src/third_party/wiredtiger/bench/wtperf/wtperf.h +++ b/src/third_party/wiredtiger/bench/wtperf/wtperf.h @@ -122,7 +122,7 @@ struct __truncate_struct { struct __truncate_queue_entry { char *key; /* Truncation point */ uint64_t diff; /* Number of items to be truncated*/ - STAILQ_ENTRY(__truncate_queue_entry) q; + TAILQ_ENTRY(__truncate_queue_entry) q; }; typedef struct __truncate_queue_entry TRUNCATE_QUEUE_ENTRY; @@ -178,7 +178,7 @@ struct __config { /* Configuration structure */ u_int has_truncate; /* if there is a truncate workload */ /* Queue head for use with the Truncate Logic */ - STAILQ_HEAD(__truncate_qh, __truncate_queue_entry) stone_head; + TAILQ_HEAD(__truncate_qh, __truncate_queue_entry) stone_head; /* Fields changeable on command line are listed in wtperf_opt.i */ #define OPT_DECLARE_STRUCT diff --git a/src/third_party/wiredtiger/bench/wtperf/wtperf_truncate.c b/src/third_party/wiredtiger/bench/wtperf/wtperf_truncate.c index 0d5d1045e1e..581d1987947 100644 --- a/src/third_party/wiredtiger/bench/wtperf/wtperf_truncate.c +++ b/src/third_party/wiredtiger/bench/wtperf/wtperf_truncate.c @@ -112,7 +112,7 @@ setup_truncate(CONFIG *cfg, CONFIG_THREAD *thread, WT_SESSION *session) { truncate_item->key = truncate_key; truncate_item->diff = (trunc_cfg->stone_gap * i) - trunc_cfg->last_key; - STAILQ_INSERT_TAIL( &cfg->stone_head, truncate_item, q); + TAILQ_INSERT_TAIL( &cfg->stone_head, truncate_item, q); trunc_cfg->last_key = trunc_cfg->stone_gap * i; trunc_cfg->num_stones++; } @@ -166,7 +166,7 @@ run_truncate(CONFIG *cfg, CONFIG_THREAD *thread, generate_key(cfg, truncate_key, trunc_cfg->last_key); truncate_item->key = truncate_key; truncate_item->diff = trunc_cfg->stone_gap; - STAILQ_INSERT_TAIL(&cfg->stone_head, truncate_item, q); + TAILQ_INSERT_TAIL(&cfg->stone_head, truncate_item, q); trunc_cfg->num_stones++; } @@ -175,9 +175,9 @@ run_truncate(CONFIG *cfg, CONFIG_THREAD *thread, trunc_cfg->expected_total <= thread->workload->truncate_count) return (0); - truncate_item = STAILQ_FIRST(&cfg->stone_head); + truncate_item = TAILQ_FIRST(&cfg->stone_head); trunc_cfg->num_stones--; - STAILQ_REMOVE_HEAD(&cfg->stone_head, q); + TAILQ_REMOVE(&cfg->stone_head, truncate_item, q); cursor->set_key(cursor,truncate_item->key); if ((ret = cursor->search(cursor)) != 0) { lprintf(cfg, ret, 0, "Truncate search: failed"); @@ -207,9 +207,9 @@ void cleanup_truncate_config(CONFIG *cfg) { TRUNCATE_QUEUE_ENTRY *truncate_item; - while (!STAILQ_EMPTY(&cfg->stone_head)) { - truncate_item = STAILQ_FIRST(&cfg->stone_head); - STAILQ_REMOVE_HEAD(&cfg->stone_head, q); + while (!TAILQ_EMPTY(&cfg->stone_head)) { + truncate_item = TAILQ_FIRST(&cfg->stone_head); + TAILQ_REMOVE(&cfg->stone_head, truncate_item, q); free(truncate_item->key); free(truncate_item); } diff --git a/src/third_party/wiredtiger/dist/s_define b/src/third_party/wiredtiger/dist/s_define index 7809bf14918..77673bdcdf9 100755 --- a/src/third_party/wiredtiger/dist/s_define +++ b/src/third_party/wiredtiger/dist/s_define @@ -4,18 +4,23 @@ t=__wt.$$ trap 'rm -f $t; exit 0' 0 1 2 3 13 15 -# List of files to search. +# List of source files to search. l=`sed -e 's,#.*,,' -e '/^$/d' -e 's,^,../,' filelist` l="$l `echo ../src/include/*.i ../src/utilities/*.c ../test/*/*.c`" +# List of include files for source #defines. +# Ignore the queue.h file, we don't use most of it. +dl="../src/include/*.[hi] ../src/include/*.in" +dl=`echo $dl | sed 's/ [^ ]*queue.h//'` + ( # Copy out the list of #defines we don't use, but it's OK. sed -e '/^$/d' -e '/^#/d' < s_define.list -# Get the list of #defines. -# Ignore the list of configuration objects -# Ignore the list of statistic "keys" generated for applications. -search=`cat ../src/include/*.[hi] ../src/include/*.in | +# Search the list of include files for #defines +# Ignore configuration objects #defines +# Ignore statistic "keys" generated for applications #defines +search=`cat $dl | sed -e '/configuration section: BEGIN/,/configuration section: END/d' \ -e '/Statistics section: BEGIN/,/Statistics section: END/d' | egrep '^#define' | diff --git a/src/third_party/wiredtiger/dist/s_define.list b/src/third_party/wiredtiger/dist/s_define.list index a9ae2a10006..9e64d81bc93 100644 --- a/src/third_party/wiredtiger/dist/s_define.list +++ b/src/third_party/wiredtiger/dist/s_define.list @@ -68,63 +68,3 @@ __WT_ATOMIC_CAS __WT_ATOMIC_FETCH_ADD __WT_ATOMIC_STORE __WT_ATOMIC_SUB - -# List of queue.h #defines that are "unused", but it's OK. -LIST_EMPTY -LIST_ENTRY -LIST_FIRST -LIST_FOREACH -LIST_HEAD -LIST_HEAD_INITIALIZER -LIST_INIT -LIST_INSERT_AFTER -LIST_INSERT_BEFORE -LIST_INSERT_HEAD -LIST_NEXT -LIST_REMOVE -QMD_TRACE_ELEM -QMD_TRACE_HEAD -QUEUE_MACRO_DEBUG -SLIST_EMPTY -SLIST_ENTRY -SLIST_FIRST -SLIST_FOREACH -SLIST_FOREACH_PREVPTR -SLIST_HEAD -SLIST_HEAD_INITIALIZER -SLIST_INIT -SLIST_INSERT_AFTER -SLIST_INSERT_HEAD -SLIST_NEXT -SLIST_REMOVE -SLIST_REMOVE_HEAD -STAILQ_CONCAT -STAILQ_EMPTY -STAILQ_ENTRY -STAILQ_FIRST -STAILQ_FOREACH -STAILQ_HEAD -STAILQ_HEAD_INITIALIZER -STAILQ_INIT -STAILQ_INSERT_AFTER -STAILQ_INSERT_HEAD -STAILQ_INSERT_TAIL -STAILQ_LAST -STAILQ_NEXT -STAILQ_REMOVE -STAILQ_REMOVE_HEAD -STAILQ_REMOVE_HEAD_UNTIL -TAILQ_CONCAT -TAILQ_EMPTY -TAILQ_ENTRY -TAILQ_FOREACH_REVERSE -TAILQ_HEAD -TAILQ_HEAD_INITIALIZER -TAILQ_INSERT_AFTER -TAILQ_INSERT_BEFORE -TAILQ_LAST -TAILQ_NEXT -TAILQ_PREV -TRACEBUF -TRASHIT -_DB_QUEUE_H_ diff --git a/src/third_party/wiredtiger/dist/s_style b/src/third_party/wiredtiger/dist/s_style index e5411748a31..2237b520020 100755 --- a/src/third_party/wiredtiger/dist/s_style +++ b/src/third_party/wiredtiger/dist/s_style @@ -46,6 +46,11 @@ else cat $t fi + if ! expr "$f" : 'src/include/queue\.h' > /dev/null && + egrep 'STAILQ_|SLIST_|\bLIST_' $f ; then + echo "$f: use TAILQ for all lists" + fi + if ! expr "$f" : 'src/os_posix/.*' > /dev/null && ! expr "$f" : 'src/os_win/.*' > /dev/null && ! expr "$f" : 'src/include/extern.h' > /dev/null && diff --git a/src/third_party/wiredtiger/dist/stat_data.py b/src/third_party/wiredtiger/dist/stat_data.py index 77061b36dcb..51152fcc6af 100644 --- a/src/third_party/wiredtiger/dist/stat_data.py +++ b/src/third_party/wiredtiger/dist/stat_data.py @@ -208,6 +208,8 @@ connection_stats = [ ########################################## # Dhandle statistics ########################################## + DhandleStat('dh_conn_handle_count', + 'connection data handles currently active', 'no_clear,no_scale'), DhandleStat('dh_sweep_close', 'connection sweep dhandles closed'), DhandleStat('dh_sweep_remove', 'connection sweep dhandles removed from hash list'), diff --git a/src/third_party/wiredtiger/src/async/async_api.c b/src/third_party/wiredtiger/src/async/async_api.c index 44e492cb0e5..9874d7aab00 100644 --- a/src/third_party/wiredtiger/src/async/async_api.c +++ b/src/third_party/wiredtiger/src/async/async_api.c @@ -43,7 +43,7 @@ __async_get_format(WT_CONNECTION_IMPL *conn, const char *uri, * is a possibility a duplicate entry might be inserted, but * that is not harmful. */ - STAILQ_FOREACH(af, &async->formatqh, q) { + TAILQ_FOREACH(af, &async->formatqh, q) { if (af->uri_hash == uri_hash && af->cfg_hash == cfg_hash) goto setup; } @@ -71,7 +71,7 @@ __async_get_format(WT_CONNECTION_IMPL *conn, const char *uri, WT_ERR(c->close(c)); c = NULL; - STAILQ_INSERT_HEAD(&async->formatqh, af, q); + TAILQ_INSERT_HEAD(&async->formatqh, af, q); __wt_spin_unlock(session, &async->ops_lock); WT_ERR(wt_session->close(wt_session, NULL)); @@ -237,7 +237,7 @@ __async_start(WT_SESSION_IMPL *session) */ WT_RET(__wt_calloc_one(session, &conn->async)); async = conn->async; - STAILQ_INIT(&async->formatqh); + TAILQ_INIT(&async->formatqh); WT_RET(__wt_spin_init(session, &async->ops_lock, "ops")); WT_RET(__wt_cond_alloc(session, "async flush", 0, &async->flush_cond)); WT_RET(__wt_async_op_init(session)); @@ -461,9 +461,9 @@ __wt_async_destroy(WT_SESSION_IMPL *session) } /* Free format resources */ - af = STAILQ_FIRST(&async->formatqh); + af = TAILQ_FIRST(&async->formatqh); while (af != NULL) { - afnext = STAILQ_NEXT(af, q); + afnext = TAILQ_NEXT(af, q); __wt_free(session, af->uri); __wt_free(session, af->config); __wt_free(session, af->key_format); diff --git a/src/third_party/wiredtiger/src/async/async_worker.c b/src/third_party/wiredtiger/src/async/async_worker.c index 4f372d05d19..473e7103832 100644 --- a/src/third_party/wiredtiger/src/async/async_worker.c +++ b/src/third_party/wiredtiger/src/async/async_worker.c @@ -135,7 +135,7 @@ __async_worker_cursor(WT_SESSION_IMPL *session, WT_ASYNC_OP_IMPL *op, if (op->optype == WT_AOP_COMPACT) return (0); WT_ASSERT(session, op->format != NULL); - STAILQ_FOREACH(ac, &worker->cursorqh, q) { + TAILQ_FOREACH(ac, &worker->cursorqh, q) { if (op->format->cfg_hash == ac->cfg_hash && op->format->uri_hash == ac->uri_hash) { /* @@ -156,7 +156,7 @@ __async_worker_cursor(WT_SESSION_IMPL *session, WT_ASYNC_OP_IMPL *op, ac->cfg_hash = op->format->cfg_hash; ac->uri_hash = op->format->uri_hash; ac->c = c; - STAILQ_INSERT_HEAD(&worker->cursorqh, ac, q); + TAILQ_INSERT_HEAD(&worker->cursorqh, ac, q); worker->num_cursors++; *cursorp = c; return (0); @@ -297,7 +297,7 @@ __wt_async_worker(void *arg) async = conn->async; worker.num_cursors = 0; - STAILQ_INIT(&worker.cursorqh); + TAILQ_INIT(&worker.cursorqh); while (F_ISSET(conn, WT_CONN_SERVER_ASYNC) && F_ISSET(session, WT_SESSION_SERVER_ASYNC)) { WT_ERR(__async_op_dequeue(conn, session, &op)); @@ -346,9 +346,9 @@ err: WT_PANIC_MSG(session, ret, "async worker error"); * Worker thread cleanup, close our cached cursors and free all the * WT_ASYNC_CURSOR structures. */ - ac = STAILQ_FIRST(&worker.cursorqh); + ac = TAILQ_FIRST(&worker.cursorqh); while (ac != NULL) { - acnext = STAILQ_NEXT(ac, q); + acnext = TAILQ_NEXT(ac, q); WT_TRET(ac->c->close(ac->c)); __wt_free(session, ac); ac = acnext; diff --git a/src/third_party/wiredtiger/src/block/block_open.c b/src/third_party/wiredtiger/src/block/block_open.c index fd00e0c7deb..c005b226bfc 100644 --- a/src/third_party/wiredtiger/src/block/block_open.c +++ b/src/third_party/wiredtiger/src/block/block_open.c @@ -185,7 +185,7 @@ __wt_block_open(WT_SESSION_IMPL *session, hash = __wt_hash_city64(filename, strlen(filename)); bucket = hash % WT_HASH_ARRAY_SIZE; __wt_spin_lock(session, &conn->block_lock); - SLIST_FOREACH(block, &conn->blockhash[bucket], hashl) { + TAILQ_FOREACH(block, &conn->blockhash[bucket], hashq) { if (strcmp(filename, block->name) == 0) { ++block->ref; *blockp = block; diff --git a/src/third_party/wiredtiger/src/conn/conn_api.c b/src/third_party/wiredtiger/src/conn/conn_api.c index bc96ddd117a..62114ec8b5a 100644 --- a/src/third_party/wiredtiger/src/conn/conn_api.c +++ b/src/third_party/wiredtiger/src/conn/conn_api.c @@ -432,7 +432,7 @@ __wt_encryptor_config(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *cval, "requires connection encryption to be set"); hash = __wt_hash_city64(keyid->str, keyid->len); bucket = hash % WT_HASH_ARRAY_SIZE; - SLIST_FOREACH(kenc, &nenc->keyedhashlh[bucket], l) + TAILQ_FOREACH(kenc, &nenc->keyedhashqh[bucket], q) if (WT_STRING_MATCH(kenc->keyid, keyid->str, keyid->len)) goto out; @@ -450,8 +450,8 @@ __wt_encryptor_config(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *cval, WT_ERR(encryptor->sizing(encryptor, &session->iface, &kenc->size_const)); kenc->encryptor = encryptor; - SLIST_INSERT_HEAD(&nenc->keyedlh, kenc, l); - SLIST_INSERT_HEAD(&nenc->keyedhashlh[bucket], kenc, hashl); + TAILQ_INSERT_HEAD(&nenc->keyedqh, kenc, q); + TAILQ_INSERT_HEAD(&nenc->keyedhashqh[bucket], kenc, hashq); out: __wt_spin_unlock(session, &conn->encryptor_lock); *kencryptorp = kenc; @@ -506,9 +506,9 @@ __conn_add_encryptor(WT_CONNECTION *wt_conn, WT_ERR(__wt_calloc_one(session, &nenc)); WT_ERR(__wt_strdup(session, name, &nenc->name)); nenc->encryptor = encryptor; - SLIST_INIT(&nenc->keyedlh); + TAILQ_INIT(&nenc->keyedqh); for (i = 0; i < WT_HASH_ARRAY_SIZE; i++) - SLIST_INIT(&nenc->keyedhashlh[i]); + TAILQ_INIT(&nenc->keyedhashqh[i]); TAILQ_INSERT_TAIL(&conn->encryptqh, nenc, q); nenc = NULL; @@ -537,15 +537,14 @@ __wt_conn_remove_encryptor(WT_SESSION_IMPL *session) conn = S2C(session); while ((nenc = TAILQ_FIRST(&conn->encryptqh)) != NULL) { - while ((kenc = SLIST_FIRST(&nenc->keyedlh)) != NULL) { + while ((kenc = TAILQ_FIRST(&nenc->keyedqh)) != NULL) { /* Call any termination method. */ if (kenc->owned && kenc->encryptor->terminate != NULL) WT_TRET(kenc->encryptor->terminate( kenc->encryptor, (WT_SESSION *)session)); /* Remove from the connection's list, free memory. */ - SLIST_REMOVE( - &nenc->keyedlh, kenc, __wt_keyed_encryptor, l); + TAILQ_REMOVE(&nenc->keyedqh, kenc, q); __wt_free(session, kenc->keyid); __wt_free(session, kenc); } diff --git a/src/third_party/wiredtiger/src/conn/conn_dhandle.c b/src/third_party/wiredtiger/src/conn/conn_dhandle.c index 1ea609f6578..f1e67e2882b 100644 --- a/src/third_party/wiredtiger/src/conn/conn_dhandle.c +++ b/src/third_party/wiredtiger/src/conn/conn_dhandle.c @@ -81,7 +81,7 @@ __wt_conn_dhandle_find( bucket = __wt_hash_city64(uri, strlen(uri)) % WT_HASH_ARRAY_SIZE; if (checkpoint == NULL) { - SLIST_FOREACH(dhandle, &conn->dhhash[bucket], hashl) { + TAILQ_FOREACH(dhandle, &conn->dhhash[bucket], hashq) { if (F_ISSET(dhandle, WT_DHANDLE_DEAD)) continue; if (dhandle->checkpoint == NULL && @@ -91,7 +91,7 @@ __wt_conn_dhandle_find( } } } else - SLIST_FOREACH(dhandle, &conn->dhhash[bucket], hashl) { + TAILQ_FOREACH(dhandle, &conn->dhhash[bucket], hashq) { if (F_ISSET(dhandle, WT_DHANDLE_DEAD)) continue; if (dhandle->checkpoint != NULL && @@ -399,7 +399,7 @@ __wt_conn_btree_apply(WT_SESSION_IMPL *session, if (uri != NULL) { bucket = __wt_hash_city64(uri, strlen(uri)) % WT_HASH_ARRAY_SIZE; - SLIST_FOREACH(dhandle, &conn->dhhash[bucket], hashl) + TAILQ_FOREACH(dhandle, &conn->dhhash[bucket], hashq) if (F_ISSET(dhandle, WT_DHANDLE_OPEN) && !F_ISSET(dhandle, WT_DHANDLE_DEAD) && strcmp(uri, dhandle->name) == 0 && @@ -407,7 +407,7 @@ __wt_conn_btree_apply(WT_SESSION_IMPL *session, WT_RET(__conn_btree_apply_internal( session, dhandle, func, cfg)); } else { - SLIST_FOREACH(dhandle, &conn->dhlh, l) + TAILQ_FOREACH(dhandle, &conn->dhqh, q) if (F_ISSET(dhandle, WT_DHANDLE_OPEN) && !F_ISSET(dhandle, WT_DHANDLE_DEAD) && (apply_checkpoints || @@ -484,7 +484,7 @@ __wt_conn_btree_apply_single(WT_SESSION_IMPL *session, hash = __wt_hash_city64(uri, strlen(uri)); bucket = hash % WT_HASH_ARRAY_SIZE; - SLIST_FOREACH(dhandle, &conn->dhhash[bucket], hashl) + TAILQ_FOREACH(dhandle, &conn->dhhash[bucket], hashq) if (F_ISSET(dhandle, WT_DHANDLE_OPEN) && !F_ISSET(dhandle, WT_DHANDLE_DEAD) && (hash == dhandle->name_hash && @@ -533,7 +533,7 @@ __wt_conn_dhandle_close_all( WT_ASSERT(session, session->dhandle == NULL); bucket = __wt_hash_city64(uri, strlen(uri)) % WT_HASH_ARRAY_SIZE; - SLIST_FOREACH(dhandle, &conn->dhhash[bucket], hashl) { + TAILQ_FOREACH(dhandle, &conn->dhhash[bucket], hashq) { if (strcmp(dhandle->name, uri) != 0 || F_ISSET(dhandle, WT_DHANDLE_DEAD)) continue; @@ -671,7 +671,7 @@ __wt_conn_dhandle_discard(WT_SESSION_IMPL *session) * the list, so we do it the hard way. */ restart: - SLIST_FOREACH(dhandle, &conn->dhlh, l) { + TAILQ_FOREACH(dhandle, &conn->dhqh, q) { if (WT_IS_METADATA(dhandle)) continue; @@ -690,7 +690,7 @@ restart: F_SET(session, WT_SESSION_NO_DATA_HANDLES); /* Close the metadata file handle. */ - while ((dhandle = SLIST_FIRST(&conn->dhlh)) != NULL) + while ((dhandle = TAILQ_FIRST(&conn->dhqh)) != NULL) WT_WITH_DHANDLE(session, dhandle, WT_TRET(__wt_conn_dhandle_discard_single(session, 1, 0))); diff --git a/src/third_party/wiredtiger/src/conn/conn_handle.c b/src/third_party/wiredtiger/src/conn/conn_handle.c index 94e69897c1d..c02f145a09a 100644 --- a/src/third_party/wiredtiger/src/conn/conn_handle.c +++ b/src/third_party/wiredtiger/src/conn/conn_handle.c @@ -21,14 +21,14 @@ __wt_connection_init(WT_CONNECTION_IMPL *conn) session = conn->default_session; for (i = 0; i < WT_HASH_ARRAY_SIZE; i++) { - SLIST_INIT(&conn->dhhash[i]); /* Data handle hash lists */ - SLIST_INIT(&conn->fhhash[i]); /* File handle hash lists */ + TAILQ_INIT(&conn->dhhash[i]); /* Data handle hash lists */ + TAILQ_INIT(&conn->fhhash[i]); /* File handle hash lists */ } - SLIST_INIT(&conn->dhlh); /* Data handle list */ + TAILQ_INIT(&conn->dhqh); /* Data handle list */ TAILQ_INIT(&conn->dlhqh); /* Library list */ TAILQ_INIT(&conn->dsrcqh); /* Data source list */ - SLIST_INIT(&conn->fhlh); /* File list */ + TAILQ_INIT(&conn->fhqh); /* File list */ TAILQ_INIT(&conn->collqh); /* Collator list */ TAILQ_INIT(&conn->compqh); /* Compressor list */ TAILQ_INIT(&conn->encryptqh); /* Encryptor list */ @@ -91,8 +91,8 @@ __wt_connection_init(WT_CONNECTION_IMPL *conn) */ WT_RET(__wt_spin_init(session, &conn->block_lock, "block manager")); for (i = 0; i < WT_HASH_ARRAY_SIZE; i++) - SLIST_INIT(&conn->blockhash[i]);/* Block handle hash lists */ - SLIST_INIT(&conn->blocklh); /* Block manager list */ + TAILQ_INIT(&conn->blockhash[i]);/* Block handle hash lists */ + TAILQ_INIT(&conn->blockqh); /* Block manager list */ return (0); } diff --git a/src/third_party/wiredtiger/src/conn/conn_open.c b/src/third_party/wiredtiger/src/conn/conn_open.c index 3f3808579a9..51e42cc0aa4 100644 --- a/src/third_party/wiredtiger/src/conn/conn_open.c +++ b/src/third_party/wiredtiger/src/conn/conn_open.c @@ -146,14 +146,14 @@ __wt_connection_close(WT_CONNECTION_IMPL *conn) * Complain if files weren't closed, ignoring the lock file, we'll * close it in a minute. */ - SLIST_FOREACH(fh, &conn->fhlh, l) { + TAILQ_FOREACH(fh, &conn->fhqh, q) { if (fh == conn->lock_fh) continue; __wt_errx(session, "Connection has open file handles: %s", fh->name); WT_TRET(__wt_close(session, &fh)); - fh = SLIST_FIRST(&conn->fhlh); + fh = TAILQ_FIRST(&conn->fhqh); } /* Disconnect from shared cache - must be before cache destroy. */ diff --git a/src/third_party/wiredtiger/src/conn/conn_stat.c b/src/third_party/wiredtiger/src/conn/conn_stat.c index 9c438c01cd2..be842378cec 100644 --- a/src/third_party/wiredtiger/src/conn/conn_stat.c +++ b/src/third_party/wiredtiger/src/conn/conn_stat.c @@ -46,6 +46,8 @@ __wt_conn_stat_init(WT_SESSION_IMPL *session) __wt_cache_stats_update(session); __wt_txn_stats_update(session); + WT_CONN_STAT(session, dh_conn_handle_count) = + S2C(session)->dhandle_count; WT_CONN_STAT(session, file_open) = S2C(session)->open_file_count; } diff --git a/src/third_party/wiredtiger/src/conn/conn_sweep.c b/src/third_party/wiredtiger/src/conn/conn_sweep.c index 492b89bb8a8..3de9347f38f 100644 --- a/src/third_party/wiredtiger/src/conn/conn_sweep.c +++ b/src/third_party/wiredtiger/src/conn/conn_sweep.c @@ -8,6 +8,10 @@ #include "wt_internal.h" +#define WT_DHANDLE_CAN_DISCARD(dhandle) \ + (!F_ISSET(dhandle, WT_DHANDLE_EXCLUSIVE | WT_DHANDLE_OPEN) && \ + dhandle->session_inuse == 0 && dhandle->session_ref == 0) + /* * __sweep_mark -- * Mark idle handles with a time of death, and note if we see dead @@ -21,7 +25,7 @@ __sweep_mark(WT_SESSION_IMPL *session, time_t now) conn = S2C(session); - SLIST_FOREACH(dhandle, &conn->dhlh, l) { + TAILQ_FOREACH(dhandle, &conn->dhqh, q) { if (WT_IS_METADATA(dhandle)) continue; @@ -34,8 +38,12 @@ __sweep_mark(WT_SESSION_IMPL *session, time_t now) if (dhandle->session_inuse > 1) dhandle->timeofdeath = 0; - if (F_ISSET(dhandle, WT_DHANDLE_DEAD) || - dhandle->session_inuse != 0 || + /* + * If the handle is open exclusive or currently in use, or the + * time of death is already set, move on. + */ + if (F_ISSET(dhandle, WT_DHANDLE_EXCLUSIVE) || + dhandle->session_inuse > 0 || dhandle->timeofdeath != 0) continue; @@ -116,7 +124,7 @@ __sweep_expire(WT_SESSION_IMPL *session, time_t now) conn = S2C(session); - SLIST_FOREACH(dhandle, &conn->dhlh, l) { + TAILQ_FOREACH(dhandle, &conn->dhqh, q) { /* * Ignore open files once the btree file count is below the * minimum number of handles. @@ -125,7 +133,7 @@ __sweep_expire(WT_SESSION_IMPL *session, time_t now) break; if (WT_IS_METADATA(dhandle) || - F_ISSET(dhandle, WT_DHANDLE_DEAD) || + !F_ISSET(dhandle, WT_DHANDLE_OPEN) || dhandle->session_inuse != 0 || dhandle->timeofdeath == 0 || now <= dhandle->timeofdeath + conn->sweep_idle_time) @@ -144,8 +152,7 @@ __sweep_expire(WT_SESSION_IMPL *session, time_t now) * Discard pages from dead trees. */ static int -__sweep_discard_trees( - WT_SESSION_IMPL *session, time_t now, u_int *dead_handlesp) +__sweep_discard_trees(WT_SESSION_IMPL *session, u_int *dead_handlesp) { WT_CONNECTION_IMPL *conn; WT_DATA_HANDLE *dhandle; @@ -155,10 +162,8 @@ __sweep_discard_trees( *dead_handlesp = 0; - SLIST_FOREACH(dhandle, &conn->dhlh, l) { - if (!F_ISSET(dhandle, WT_DHANDLE_OPEN | WT_DHANDLE_EXCLUSIVE) && - (dhandle->timeofdiscard == 0 || - now <= dhandle->timeofdiscard + conn->sweep_idle_time)) + TAILQ_FOREACH(dhandle, &conn->dhqh, q) { + if (WT_DHANDLE_CAN_DISCARD(dhandle)) ++*dead_handlesp; if (!F_ISSET(dhandle, WT_DHANDLE_OPEN) || @@ -198,8 +203,7 @@ __sweep_remove_one(WT_SESSION_IMPL *session, WT_DATA_HANDLE *dhandle) * If there are no longer any references to the handle in any * sessions, attempt to discard it. */ - if (F_ISSET(dhandle, WT_DHANDLE_EXCLUSIVE | WT_DHANDLE_OPEN) || - dhandle->session_inuse != 0 || dhandle->session_ref != 0) + if (!WT_DHANDLE_CAN_DISCARD(dhandle)) WT_ERR(EBUSY); WT_WITH_DHANDLE(session, dhandle, @@ -221,7 +225,7 @@ err: WT_TRET(__wt_writeunlock(session, dhandle->rwlock)); * Remove closed handles from the connection list. */ static int -__sweep_remove_handles(WT_SESSION_IMPL *session, time_t now) +__sweep_remove_handles(WT_SESSION_IMPL *session) { WT_CONNECTION_IMPL *conn; WT_DATA_HANDLE *dhandle, *dhandle_next; @@ -229,28 +233,21 @@ __sweep_remove_handles(WT_SESSION_IMPL *session, time_t now) conn = S2C(session); - for (dhandle = SLIST_FIRST(&conn->dhlh); + for (dhandle = TAILQ_FIRST(&conn->dhqh); dhandle != NULL; dhandle = dhandle_next) { - dhandle_next = SLIST_NEXT(dhandle, l); + dhandle_next = TAILQ_NEXT(dhandle, q); if (WT_IS_METADATA(dhandle)) continue; - if (F_ISSET(dhandle, WT_DHANDLE_EXCLUSIVE | WT_DHANDLE_OPEN) || - dhandle->session_inuse != 0 || dhandle->session_ref != 0) - continue; - if (dhandle->timeofdiscard != 0 && - now <= dhandle->timeofdiscard + conn->sweep_idle_time) + if (!WT_DHANDLE_CAN_DISCARD(dhandle)) continue; WT_WITH_HANDLE_LIST_LOCK(session, ret = __sweep_remove_one(session, dhandle)); if (ret == 0) - WT_STAT_FAST_CONN_INCR( - session, dh_sweep_remove); - else { + WT_STAT_FAST_CONN_INCR(session, dh_sweep_remove); + else WT_STAT_FAST_CONN_INCR(session, dh_sweep_ref); - dhandle->timeofdiscard = now; - } WT_RET_BUSY_OK(ret); } @@ -301,10 +298,10 @@ __sweep_server(void *arg) conn->open_btree_count >= conn->sweep_handles_min) WT_ERR(__sweep_expire(session, now)); - WT_ERR(__sweep_discard_trees(session, now, &dead_handles)); + WT_ERR(__sweep_discard_trees(session, &dead_handles)); if (dead_handles > 0) - WT_ERR(__sweep_remove_handles(session, now)); + WT_ERR(__sweep_remove_handles(session)); } if (0) { diff --git a/src/third_party/wiredtiger/src/cursor/cur_stat.c b/src/third_party/wiredtiger/src/cursor/cur_stat.c index 82568401319..da9838292d6 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_stat.c +++ b/src/third_party/wiredtiger/src/cursor/cur_stat.c @@ -113,12 +113,12 @@ __curstat_get_value(WT_CURSOR *cursor, ...) if (F_ISSET(cursor, WT_CURSTD_RAW)) { WT_ERR(__wt_struct_size(session, &size, cursor->value_format, - cst->stats_first[WT_STAT_KEY_OFFSET(cst)].desc, + cst->stats[WT_STAT_KEY_OFFSET(cst)].desc, cst->pv.data, cst->v)); WT_ERR(__wt_buf_initsize(session, &cursor->value, size)); WT_ERR(__wt_struct_pack(session, cursor->value.mem, size, cursor->value_format, - cst->stats_first[WT_STAT_KEY_OFFSET(cst)].desc, + cst->stats[WT_STAT_KEY_OFFSET(cst)].desc, cst->pv.data, cst->v)); item = va_arg(ap, WT_ITEM *); @@ -130,7 +130,7 @@ __curstat_get_value(WT_CURSOR *cursor, ...) * pointer support isn't documented, but it's a cheap test. */ if ((p = va_arg(ap, const char **)) != NULL) - *p = cst->stats_first[WT_STAT_KEY_OFFSET(cst)].desc; + *p = cst->stats[WT_STAT_KEY_OFFSET(cst)].desc; if ((p = va_arg(ap, const char **)) != NULL) *p = cst->pv.data; if ((v = va_arg(ap, uint64_t *)) != NULL) @@ -215,7 +215,7 @@ __curstat_next(WT_CURSOR *cursor) F_CLR(cursor, WT_CURSTD_KEY_SET | WT_CURSTD_VALUE_SET); WT_ERR(WT_NOTFOUND); } - cst->v = cst->stats_first[WT_STAT_KEY_OFFSET(cst)].v; + cst->v = cst->stats[WT_STAT_KEY_OFFSET(cst)].v; WT_ERR(__curstat_print_value(session, cst->v, &cst->pv)); F_SET(cursor, WT_CURSTD_KEY_INT | WT_CURSTD_VALUE_INT); @@ -254,7 +254,7 @@ __curstat_prev(WT_CURSOR *cursor) WT_ERR(WT_NOTFOUND); } - cst->v = cst->stats_first[WT_STAT_KEY_OFFSET(cst)].v; + cst->v = cst->stats[WT_STAT_KEY_OFFSET(cst)].v; WT_ERR(__curstat_print_value(session, cst->v, &cst->pv)); F_SET(cursor, WT_CURSTD_KEY_INT | WT_CURSTD_VALUE_INT); @@ -308,7 +308,7 @@ __curstat_search(WT_CURSOR *cursor) if (cst->key < WT_STAT_KEY_MIN(cst) || cst->key > WT_STAT_KEY_MAX(cst)) WT_ERR(WT_NOTFOUND); - cst->v = cst->stats_first[WT_STAT_KEY_OFFSET(cst)].v; + cst->v = cst->stats[WT_STAT_KEY_OFFSET(cst)].v; WT_ERR(__curstat_print_value(session, cst->v, &cst->pv)); F_SET(cursor, WT_CURSTD_KEY_INT | WT_CURSTD_VALUE_INT); @@ -358,7 +358,7 @@ __curstat_conn_init(WT_SESSION_IMPL *session, WT_CURSOR_STAT *cst) if (F_ISSET(cst, WT_CONN_STAT_CLEAR)) __wt_stat_refresh_connection_stats(&conn->stats); - cst->stats_first = cst->stats = (WT_STATS *)&cst->u.conn_stats; + cst->stats = (WT_STATS *)&cst->u.conn_stats; cst->stats_base = WT_CONNECTION_STATS_BASE; cst->stats_count = sizeof(WT_CONNECTION_STATS) / sizeof(WT_STATS); } @@ -418,7 +418,7 @@ void __wt_curstat_dsrc_final(WT_CURSOR_STAT *cst) { - cst->stats_first = cst->stats = (WT_STATS *)&cst->u.dsrc_stats; + cst->stats = (WT_STATS *)&cst->u.dsrc_stats; cst->stats_base = WT_DSRC_STATS_BASE; cst->stats_count = sizeof(WT_DSRC_STATS) / sizeof(WT_STATS); } diff --git a/src/third_party/wiredtiger/src/evict/evict_lru.c b/src/third_party/wiredtiger/src/evict/evict_lru.c index a03d8b9147d..ced592cf9f4 100644 --- a/src/third_party/wiredtiger/src/evict/evict_lru.c +++ b/src/third_party/wiredtiger/src/evict/evict_lru.c @@ -632,7 +632,7 @@ __evict_clear_all_walks(WT_SESSION_IMPL *session) conn = S2C(session); - SLIST_FOREACH(dhandle, &conn->dhlh, l) + TAILQ_FOREACH(dhandle, &conn->dhqh, q) if (WT_PREFIX_MATCH(dhandle->name, "file:")) WT_WITH_DHANDLE(session, dhandle, WT_TRET(__evict_clear_walk(session))); @@ -968,14 +968,14 @@ retry: while (slot < max_entries && ret == 0) { if ((dhandle = cache->evict_file_next) != NULL) cache->evict_file_next = NULL; else - dhandle = SLIST_FIRST(&conn->dhlh); + dhandle = TAILQ_FIRST(&conn->dhqh); } else { if (incr) { WT_ASSERT(session, dhandle->session_inuse > 0); (void)WT_ATOMIC_SUB4(dhandle->session_inuse, 1); incr = 0; } - dhandle = SLIST_NEXT(dhandle, l); + dhandle = TAILQ_NEXT(dhandle, q); } /* If we reach the end of the list, we're done. */ @@ -1557,7 +1557,7 @@ __wt_cache_dump(WT_SESSION_IMPL *session) conn = S2C(session); total_bytes = 0; - SLIST_FOREACH(dhandle, &conn->dhlh, l) { + TAILQ_FOREACH(dhandle, &conn->dhqh, q) { if (!WT_PREFIX_MATCH(dhandle->name, "file:") || !F_ISSET(dhandle, WT_DHANDLE_OPEN)) continue; diff --git a/src/third_party/wiredtiger/src/include/async.h b/src/third_party/wiredtiger/src/include/async.h index 88ecad6eb2c..c8d9fa5aa91 100644 --- a/src/third_party/wiredtiger/src/include/async.h +++ b/src/third_party/wiredtiger/src/include/async.h @@ -31,7 +31,7 @@ typedef enum { * The URI/config/format cache. */ struct __wt_async_format { - STAILQ_ENTRY(__wt_async_format) q; + TAILQ_ENTRY(__wt_async_format) q; const char *config; uint64_t cfg_hash; /* Config hash */ const char *uri; @@ -88,7 +88,7 @@ struct __wt_async { uint64_t alloc_tail; /* Next slot to dequeue */ uint64_t tail_slot; /* Worker slot consumed */ - STAILQ_HEAD(__wt_async_format_qh, __wt_async_format) formatqh; + TAILQ_HEAD(__wt_async_format_qh, __wt_async_format) formatqh; int cur_queue; /* Currently enqueued */ int max_queue; /* Maximum enqueued */ WT_ASYNC_FLUSH_STATE flush_state; /* Queue flush state */ @@ -112,7 +112,7 @@ struct __wt_async { * has a cache of async cursors to reuse for operations. */ struct __wt_async_cursor { - STAILQ_ENTRY(__wt_async_cursor) q; /* Worker cache */ + TAILQ_ENTRY(__wt_async_cursor) q; /* Worker cache */ uint64_t cfg_hash; /* Config hash */ uint64_t uri_hash; /* URI hash */ WT_CURSOR *c; /* WT cursor */ @@ -124,6 +124,6 @@ struct __wt_async_cursor { */ struct __wt_async_worker_state { uint32_t id; - STAILQ_HEAD(__wt_cursor_qh, __wt_async_cursor) cursorqh; + TAILQ_HEAD(__wt_cursor_qh, __wt_async_cursor) cursorqh; uint32_t num_cursors; }; diff --git a/src/third_party/wiredtiger/src/include/block.h b/src/third_party/wiredtiger/src/include/block.h index 795d646db1e..ce33b331e76 100644 --- a/src/third_party/wiredtiger/src/include/block.h +++ b/src/third_party/wiredtiger/src/include/block.h @@ -215,8 +215,8 @@ struct __wt_block { /* A list of block manager handles, sharing a file descriptor. */ uint32_t ref; /* References */ WT_FH *fh; /* Backing file handle */ - SLIST_ENTRY(__wt_block) l; /* Linked list of handles */ - SLIST_ENTRY(__wt_block) hashl; /* Hashed list of handles */ + TAILQ_ENTRY(__wt_block) q; /* Linked list of handles */ + TAILQ_ENTRY(__wt_block) hashq; /* Hashed list of handles */ /* Configuration information, set when the file is opened. */ uint32_t allocfirst; /* Allocation is first-fit */ diff --git a/src/third_party/wiredtiger/src/include/connection.h b/src/third_party/wiredtiger/src/include/connection.h index 06a020b80e8..b3c69c68964 100644 --- a/src/third_party/wiredtiger/src/include/connection.h +++ b/src/third_party/wiredtiger/src/include/connection.h @@ -38,8 +38,8 @@ struct __wt_keyed_encryptor { size_t size_const; /* The result of the sizing callback */ WT_ENCRYPTOR *encryptor; /* User supplied callbacks */ /* Linked list of encryptors */ - SLIST_ENTRY(__wt_keyed_encryptor) hashl; - SLIST_ENTRY(__wt_keyed_encryptor) l; + TAILQ_ENTRY(__wt_keyed_encryptor) hashq; + TAILQ_ENTRY(__wt_keyed_encryptor) q; }; /* @@ -82,9 +82,9 @@ struct __wt_named_encryptor { const char *name; /* Name of encryptor */ WT_ENCRYPTOR *encryptor; /* User supplied callbacks */ /* Locked: list of encryptors by key */ - SLIST_HEAD(__wt_keyedhash, __wt_keyed_encryptor) - keyedhashlh[WT_HASH_ARRAY_SIZE]; - SLIST_HEAD(__wt_keyed_lh, __wt_keyed_encryptor) keyedlh; + TAILQ_HEAD(__wt_keyedhash, __wt_keyed_encryptor) + keyedhashqh[WT_HASH_ARRAY_SIZE]; + TAILQ_HEAD(__wt_keyed_qh, __wt_keyed_encryptor) keyedqh; /* Linked list of encryptors */ TAILQ_ENTRY(__wt_named_encryptor) q; }; @@ -119,14 +119,15 @@ struct __wt_named_extractor { * main queue and the hashed queue. */ #define WT_CONN_DHANDLE_INSERT(conn, dhandle, bucket) do { \ - SLIST_INSERT_HEAD(&(conn)->dhlh, dhandle, l); \ - SLIST_INSERT_HEAD(&(conn)->dhhash[bucket], dhandle, hashl); \ + TAILQ_INSERT_HEAD(&(conn)->dhqh, dhandle, q); \ + TAILQ_INSERT_HEAD(&(conn)->dhhash[bucket], dhandle, hashq); \ + ++conn->dhandle_count; \ } while (0) #define WT_CONN_DHANDLE_REMOVE(conn, dhandle, bucket) do { \ - SLIST_REMOVE(&(conn)->dhlh, dhandle, __wt_data_handle, l); \ - SLIST_REMOVE(&(conn)->dhhash[bucket], \ - dhandle, __wt_data_handle, hashl); \ + TAILQ_REMOVE(&(conn)->dhqh, dhandle, q); \ + TAILQ_REMOVE(&(conn)->dhhash[bucket], dhandle, hashq); \ + --conn->dhandle_count; \ } while (0) /* @@ -134,14 +135,13 @@ struct __wt_named_extractor { * main queue and the hashed queue. */ #define WT_CONN_BLOCK_INSERT(conn, block, bucket) do { \ - SLIST_INSERT_HEAD(&(conn)->blocklh, block, l); \ - SLIST_INSERT_HEAD(&(conn)->blockhash[bucket], block, hashl); \ + TAILQ_INSERT_HEAD(&(conn)->blockqh, block, q); \ + TAILQ_INSERT_HEAD(&(conn)->blockhash[bucket], block, hashq); \ } while (0) #define WT_CONN_BLOCK_REMOVE(conn, block, bucket) do { \ - SLIST_REMOVE(&(conn)->blocklh, block, __wt_block, l); \ - SLIST_REMOVE( \ - &(conn)->blockhash[bucket], block, __wt_block, hashl); \ + TAILQ_REMOVE(&(conn)->blockqh, block, q); \ + TAILQ_REMOVE(&(conn)->blockhash[bucket], block, hashq); \ } while (0) /* @@ -149,13 +149,13 @@ struct __wt_named_extractor { * main queue and the hashed queue. */ #define WT_CONN_FILE_INSERT(conn, fh, bucket) do { \ - SLIST_INSERT_HEAD(&(conn)->fhlh, fh, l); \ - SLIST_INSERT_HEAD(&(conn)->fhhash[bucket], fh, hashl); \ + TAILQ_INSERT_HEAD(&(conn)->fhqh, fh, q); \ + TAILQ_INSERT_HEAD(&(conn)->fhhash[bucket], fh, hashq); \ } while (0) #define WT_CONN_FILE_REMOVE(conn, fh, bucket) do { \ - SLIST_REMOVE(&(conn)->fhlh, fh, __wt_fh, l); \ - SLIST_REMOVE(&(conn)->fhhash[bucket], fh, __wt_fh, hashl); \ + TAILQ_REMOVE(&(conn)->fhqh, fh, q); \ + TAILQ_REMOVE(&(conn)->fhhash[bucket], fh, hashq); \ } while (0) /* @@ -219,21 +219,22 @@ struct __wt_connection_impl { * URI. */ /* Locked: data handle hash array */ - SLIST_HEAD(__wt_dhhash, __wt_data_handle) dhhash[WT_HASH_ARRAY_SIZE]; + TAILQ_HEAD(__wt_dhhash, __wt_data_handle) dhhash[WT_HASH_ARRAY_SIZE]; /* Locked: data handle list */ - SLIST_HEAD(__wt_dhandle_lh, __wt_data_handle) dhlh; + TAILQ_HEAD(__wt_dhandle_qh, __wt_data_handle) dhqh; /* Locked: LSM handle list. */ TAILQ_HEAD(__wt_lsm_qh, __wt_lsm_tree) lsmqh; /* Locked: file list */ - SLIST_HEAD(__wt_fhhash, __wt_fh) fhhash[WT_HASH_ARRAY_SIZE]; - SLIST_HEAD(__wt_fh_lh, __wt_fh) fhlh; + TAILQ_HEAD(__wt_fhhash, __wt_fh) fhhash[WT_HASH_ARRAY_SIZE]; + TAILQ_HEAD(__wt_fh_qh, __wt_fh) fhqh; /* Locked: library list */ TAILQ_HEAD(__wt_dlh_qh, __wt_dlh) dlhqh; WT_SPINLOCK block_lock; /* Locked: block manager list */ - SLIST_HEAD(__wt_blockhash, __wt_block) blockhash[WT_HASH_ARRAY_SIZE]; - SLIST_HEAD(__wt_block_lh, __wt_block) blocklh; + TAILQ_HEAD(__wt_blockhash, __wt_block) blockhash[WT_HASH_ARRAY_SIZE]; + TAILQ_HEAD(__wt_block_qh, __wt_block) blockqh; + u_int dhandle_count; /* Locked: handles in the queue */ u_int open_btree_count; /* Locked: open writable btree count */ uint32_t next_file_id; /* Locked: file ID counter */ uint32_t open_file_count; /* Atomic: open file handle count */ diff --git a/src/third_party/wiredtiger/src/include/cursor.h b/src/third_party/wiredtiger/src/include/cursor.h index 36f36f2c46c..c53c5d762d5 100644 --- a/src/third_party/wiredtiger/src/include/cursor.h +++ b/src/third_party/wiredtiger/src/include/cursor.h @@ -304,7 +304,6 @@ struct __wt_cursor_stat { int notpositioned; /* Cursor not positioned */ WT_STATS *stats; /* Stats owned by the cursor */ - WT_STATS *stats_first; /* First stats reference */ int stats_base; /* Base statistics value */ int stats_count; /* Count of stats elements */ @@ -325,12 +324,10 @@ struct __wt_cursor_stat { /* * WT_CURSOR_STATS -- - * Return a reference to a statistic cursor's stats structures; use the - * WT_CURSOR.stats_first field instead of WT_CURSOR.stats because the latter - * is NULL when non-cursor memory is used to hold the statistics. + * Return a reference to a statistic cursor's stats structures. */ #define WT_CURSOR_STATS(cursor) \ - (((WT_CURSOR_STAT *)cursor)->stats_first) + (((WT_CURSOR_STAT *)cursor)->stats) struct __wt_cursor_table { WT_CURSOR iface; diff --git a/src/third_party/wiredtiger/src/include/dhandle.h b/src/third_party/wiredtiger/src/include/dhandle.h index 8bb649513c7..3eb117b3341 100644 --- a/src/third_party/wiredtiger/src/include/dhandle.h +++ b/src/third_party/wiredtiger/src/include/dhandle.h @@ -28,14 +28,19 @@ */ #define WT_SAVE_DHANDLE(s, e) WT_WITH_DHANDLE(s, (s)->dhandle, e) +/* Check if a handle is inactive. */ +#define WT_DHANDLE_INACTIVE(dhandle) \ + (F_ISSET(dhandle, WT_DHANDLE_DEAD) || \ + !F_ISSET(dhandle, WT_DHANDLE_EXCLUSIVE | WT_DHANDLE_OPEN)) + /* * WT_DATA_HANDLE -- * A handle for a generic named data source. */ struct __wt_data_handle { WT_RWLOCK *rwlock; /* Lock for shared/exclusive ops */ - SLIST_ENTRY(__wt_data_handle) l; - SLIST_ENTRY(__wt_data_handle) hashl; + TAILQ_ENTRY(__wt_data_handle) q; + TAILQ_ENTRY(__wt_data_handle) hashq; /* * Sessions caching a connection's data handle will have a non-zero @@ -45,7 +50,6 @@ struct __wt_data_handle { uint32_t session_ref; /* Sessions referencing this handle */ int32_t session_inuse; /* Sessions using this handle */ time_t timeofdeath; /* Use count went to 0 */ - time_t timeofdiscard; /* Time of last failed discard */ uint64_t name_hash; /* Hash of name */ const char *name; /* Object name as a URI */ diff --git a/src/third_party/wiredtiger/src/include/os.h b/src/third_party/wiredtiger/src/include/os.h index edb59b0f521..518b124f547 100644 --- a/src/third_party/wiredtiger/src/include/os.h +++ b/src/third_party/wiredtiger/src/include/os.h @@ -77,8 +77,8 @@ typedef enum { struct __wt_fh { char *name; /* File name */ uint64_t name_hash; /* Hash of name */ - SLIST_ENTRY(__wt_fh) l; /* List of open handles */ - SLIST_ENTRY(__wt_fh) hashl; /* Hashed list of handles */ + TAILQ_ENTRY(__wt_fh) q; /* List of open handles */ + TAILQ_ENTRY(__wt_fh) hashq; /* Hashed list of handles */ u_int ref; /* Reference count */ diff --git a/src/third_party/wiredtiger/src/include/schema.h b/src/third_party/wiredtiger/src/include/schema.h index 8f4884281cd..0664af5adba 100644 --- a/src/third_party/wiredtiger/src/include/schema.h +++ b/src/third_party/wiredtiger/src/include/schema.h @@ -62,8 +62,8 @@ struct __wt_table { WT_INDEX **indices; size_t idx_alloc; - SLIST_ENTRY(__wt_table) l; - SLIST_ENTRY(__wt_table) hashl; + TAILQ_ENTRY(__wt_table) q; + TAILQ_ENTRY(__wt_table) hashq; int cg_complete, idx_complete, is_simple; u_int ncolgroups, nindices, nkey_columns; diff --git a/src/third_party/wiredtiger/src/include/session.h b/src/third_party/wiredtiger/src/include/session.h index f32da177bf9..c6c246954f7 100644 --- a/src/third_party/wiredtiger/src/include/session.h +++ b/src/third_party/wiredtiger/src/include/session.h @@ -14,8 +14,8 @@ struct __wt_data_handle_cache { WT_DATA_HANDLE *dhandle; - SLIST_ENTRY(__wt_data_handle_cache) l; - SLIST_ENTRY(__wt_data_handle_cache) hashl; + TAILQ_ENTRY(__wt_data_handle_cache) q; + TAILQ_ENTRY(__wt_data_handle_cache) hashq; }; /* @@ -66,7 +66,7 @@ struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_session_impl { * across session close - so it is declared further down. */ /* Session handle reference list */ - SLIST_HEAD(__dhandles, __wt_data_handle_cache) dhandles; + TAILQ_HEAD(__dhandles, __wt_data_handle_cache) dhandles; time_t last_sweep; /* Last sweep for dead handles */ WT_CURSOR *cursor; /* Current cursor */ @@ -90,7 +90,7 @@ struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_session_impl { * table of lists. The hash table list is kept in allocated memory * that lives across session close - so it is declared further down. */ - SLIST_HEAD(__tables, __wt_table) tables; + TAILQ_HEAD(__tables, __wt_table) tables; WT_ITEM **scratch; /* Temporary memory for any function */ u_int scratch_alloc; /* Currently allocated */ @@ -151,9 +151,9 @@ struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_session_impl { WT_RAND_STATE rnd; /* Random number generation state */ /* Hashed handle reference list array */ - SLIST_HEAD(__dhandles_hash, __wt_data_handle_cache) *dhhash; + TAILQ_HEAD(__dhandles_hash, __wt_data_handle_cache) *dhhash; /* Hashed table reference list array */ - SLIST_HEAD(__tables_hash, __wt_table) *tablehash; + TAILQ_HEAD(__tables_hash, __wt_table) *tablehash; /* * Splits can "free" memory that may still be in use, and we use a diff --git a/src/third_party/wiredtiger/src/include/stat.h b/src/third_party/wiredtiger/src/include/stat.h index d99d70b6d23..82df9a1a784 100644 --- a/src/third_party/wiredtiger/src/include/stat.h +++ b/src/third_party/wiredtiger/src/include/stat.h @@ -196,6 +196,7 @@ struct __wt_connection_stats { WT_STATS cursor_search; WT_STATS cursor_search_near; WT_STATS cursor_update; + WT_STATS dh_conn_handle_count; WT_STATS dh_session_handles; WT_STATS dh_session_sweeps; WT_STATS dh_sweep_close; diff --git a/src/third_party/wiredtiger/src/include/txn.h b/src/third_party/wiredtiger/src/include/txn.h index 7a67f713244..0e7be1be6bc 100644 --- a/src/third_party/wiredtiger/src/include/txn.h +++ b/src/third_party/wiredtiger/src/include/txn.h @@ -31,7 +31,7 @@ struct __wt_named_snapshot { const char *name; - STAILQ_ENTRY(__wt_named_snapshot) q; + TAILQ_ENTRY(__wt_named_snapshot) q; uint64_t snap_min, snap_max; uint64_t *snapshot; @@ -72,7 +72,7 @@ struct __wt_txn_global { /* Named snapshot state. */ WT_RWLOCK *nsnap_rwlock; volatile uint64_t nsnap_oldest_id; - STAILQ_HEAD(__wt_nsnap_qh, __wt_named_snapshot) nsnaph; + TAILQ_HEAD(__wt_nsnap_qh, __wt_named_snapshot) nsnaph; WT_TXN_STATE *states; /* Per-session transaction states */ }; diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in index 80e7d0fcacc..a538bb211fc 100644 --- a/src/third_party/wiredtiger/src/include/wiredtiger.in +++ b/src/third_party/wiredtiger/src/include/wiredtiger.in @@ -3670,164 +3670,166 @@ extern int wiredtiger_extension_terminate(WT_CONNECTION *connection); #define WT_STAT_CONN_CURSOR_SEARCH_NEAR 1062 /*! cursor: cursor update calls */ #define WT_STAT_CONN_CURSOR_UPDATE 1063 +/*! data-handle: connection data handles currently active */ +#define WT_STAT_CONN_DH_CONN_HANDLE_COUNT 1064 /*! data-handle: session dhandles swept */ -#define WT_STAT_CONN_DH_SESSION_HANDLES 1064 +#define WT_STAT_CONN_DH_SESSION_HANDLES 1065 /*! data-handle: session sweep attempts */ -#define WT_STAT_CONN_DH_SESSION_SWEEPS 1065 +#define WT_STAT_CONN_DH_SESSION_SWEEPS 1066 /*! data-handle: connection sweep dhandles closed */ -#define WT_STAT_CONN_DH_SWEEP_CLOSE 1066 +#define WT_STAT_CONN_DH_SWEEP_CLOSE 1067 /*! data-handle: connection sweep candidate became referenced */ -#define WT_STAT_CONN_DH_SWEEP_REF 1067 +#define WT_STAT_CONN_DH_SWEEP_REF 1068 /*! data-handle: connection sweep dhandles removed from hash list */ -#define WT_STAT_CONN_DH_SWEEP_REMOVE 1068 +#define WT_STAT_CONN_DH_SWEEP_REMOVE 1069 /*! data-handle: connection sweep time-of-death sets */ -#define WT_STAT_CONN_DH_SWEEP_TOD 1069 +#define WT_STAT_CONN_DH_SWEEP_TOD 1070 /*! data-handle: connection sweeps */ -#define WT_STAT_CONN_DH_SWEEPS 1070 +#define WT_STAT_CONN_DH_SWEEPS 1071 /*! connection: files currently open */ -#define WT_STAT_CONN_FILE_OPEN 1071 +#define WT_STAT_CONN_FILE_OPEN 1072 /*! log: total log buffer size */ -#define WT_STAT_CONN_LOG_BUFFER_SIZE 1072 +#define WT_STAT_CONN_LOG_BUFFER_SIZE 1073 /*! log: log bytes of payload data */ -#define WT_STAT_CONN_LOG_BYTES_PAYLOAD 1073 +#define WT_STAT_CONN_LOG_BYTES_PAYLOAD 1074 /*! log: log bytes written */ -#define WT_STAT_CONN_LOG_BYTES_WRITTEN 1074 +#define WT_STAT_CONN_LOG_BYTES_WRITTEN 1075 /*! log: yields waiting for previous log file close */ -#define WT_STAT_CONN_LOG_CLOSE_YIELDS 1075 +#define WT_STAT_CONN_LOG_CLOSE_YIELDS 1076 /*! log: total size of compressed records */ -#define WT_STAT_CONN_LOG_COMPRESS_LEN 1076 +#define WT_STAT_CONN_LOG_COMPRESS_LEN 1077 /*! log: total in-memory size of compressed records */ -#define WT_STAT_CONN_LOG_COMPRESS_MEM 1077 +#define WT_STAT_CONN_LOG_COMPRESS_MEM 1078 /*! log: log records too small to compress */ -#define WT_STAT_CONN_LOG_COMPRESS_SMALL 1078 +#define WT_STAT_CONN_LOG_COMPRESS_SMALL 1079 /*! log: log records not compressed */ -#define WT_STAT_CONN_LOG_COMPRESS_WRITE_FAILS 1079 +#define WT_STAT_CONN_LOG_COMPRESS_WRITE_FAILS 1080 /*! log: log records compressed */ -#define WT_STAT_CONN_LOG_COMPRESS_WRITES 1080 +#define WT_STAT_CONN_LOG_COMPRESS_WRITES 1081 /*! log: maximum log file size */ -#define WT_STAT_CONN_LOG_MAX_FILESIZE 1081 +#define WT_STAT_CONN_LOG_MAX_FILESIZE 1082 /*! log: pre-allocated log files prepared */ -#define WT_STAT_CONN_LOG_PREALLOC_FILES 1082 +#define WT_STAT_CONN_LOG_PREALLOC_FILES 1083 /*! log: number of pre-allocated log files to create */ -#define WT_STAT_CONN_LOG_PREALLOC_MAX 1083 +#define WT_STAT_CONN_LOG_PREALLOC_MAX 1084 /*! log: pre-allocated log files used */ -#define WT_STAT_CONN_LOG_PREALLOC_USED 1084 +#define WT_STAT_CONN_LOG_PREALLOC_USED 1085 /*! log: log release advances write LSN */ -#define WT_STAT_CONN_LOG_RELEASE_WRITE_LSN 1085 +#define WT_STAT_CONN_LOG_RELEASE_WRITE_LSN 1086 /*! log: records processed by log scan */ -#define WT_STAT_CONN_LOG_SCAN_RECORDS 1086 +#define WT_STAT_CONN_LOG_SCAN_RECORDS 1087 /*! log: log scan records requiring two reads */ -#define WT_STAT_CONN_LOG_SCAN_REREADS 1087 +#define WT_STAT_CONN_LOG_SCAN_REREADS 1088 /*! log: log scan operations */ -#define WT_STAT_CONN_LOG_SCANS 1088 +#define WT_STAT_CONN_LOG_SCANS 1089 /*! log: consolidated slot closures */ -#define WT_STAT_CONN_LOG_SLOT_CLOSES 1089 +#define WT_STAT_CONN_LOG_SLOT_CLOSES 1090 /*! log: written slots coalesced */ -#define WT_STAT_CONN_LOG_SLOT_COALESCED 1090 +#define WT_STAT_CONN_LOG_SLOT_COALESCED 1091 /*! log: logging bytes consolidated */ -#define WT_STAT_CONN_LOG_SLOT_CONSOLIDATED 1091 +#define WT_STAT_CONN_LOG_SLOT_CONSOLIDATED 1092 /*! log: consolidated slot joins */ -#define WT_STAT_CONN_LOG_SLOT_JOINS 1092 +#define WT_STAT_CONN_LOG_SLOT_JOINS 1093 /*! log: consolidated slot join races */ -#define WT_STAT_CONN_LOG_SLOT_RACES 1093 +#define WT_STAT_CONN_LOG_SLOT_RACES 1094 /*! log: record size exceeded maximum */ -#define WT_STAT_CONN_LOG_SLOT_TOOBIG 1094 +#define WT_STAT_CONN_LOG_SLOT_TOOBIG 1095 /*! log: failed to find a slot large enough for record */ -#define WT_STAT_CONN_LOG_SLOT_TOOSMALL 1095 +#define WT_STAT_CONN_LOG_SLOT_TOOSMALL 1096 /*! log: consolidated slot join transitions */ -#define WT_STAT_CONN_LOG_SLOT_TRANSITIONS 1096 +#define WT_STAT_CONN_LOG_SLOT_TRANSITIONS 1097 /*! log: log sync operations */ -#define WT_STAT_CONN_LOG_SYNC 1097 +#define WT_STAT_CONN_LOG_SYNC 1098 /*! log: log sync_dir operations */ -#define WT_STAT_CONN_LOG_SYNC_DIR 1098 +#define WT_STAT_CONN_LOG_SYNC_DIR 1099 /*! log: log server thread advances write LSN */ -#define WT_STAT_CONN_LOG_WRITE_LSN 1099 +#define WT_STAT_CONN_LOG_WRITE_LSN 1100 /*! log: log write operations */ -#define WT_STAT_CONN_LOG_WRITES 1100 +#define WT_STAT_CONN_LOG_WRITES 1101 /*! LSM: sleep for LSM checkpoint throttle */ -#define WT_STAT_CONN_LSM_CHECKPOINT_THROTTLE 1101 +#define WT_STAT_CONN_LSM_CHECKPOINT_THROTTLE 1102 /*! LSM: sleep for LSM merge throttle */ -#define WT_STAT_CONN_LSM_MERGE_THROTTLE 1102 +#define WT_STAT_CONN_LSM_MERGE_THROTTLE 1103 /*! LSM: rows merged in an LSM tree */ -#define WT_STAT_CONN_LSM_ROWS_MERGED 1103 +#define WT_STAT_CONN_LSM_ROWS_MERGED 1104 /*! LSM: application work units currently queued */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_APP 1104 +#define WT_STAT_CONN_LSM_WORK_QUEUE_APP 1105 /*! LSM: merge work units currently queued */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_MANAGER 1105 +#define WT_STAT_CONN_LSM_WORK_QUEUE_MANAGER 1106 /*! LSM: tree queue hit maximum */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_MAX 1106 +#define WT_STAT_CONN_LSM_WORK_QUEUE_MAX 1107 /*! LSM: switch work units currently queued */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_SWITCH 1107 +#define WT_STAT_CONN_LSM_WORK_QUEUE_SWITCH 1108 /*! LSM: tree maintenance operations scheduled */ -#define WT_STAT_CONN_LSM_WORK_UNITS_CREATED 1108 +#define WT_STAT_CONN_LSM_WORK_UNITS_CREATED 1109 /*! LSM: tree maintenance operations discarded */ -#define WT_STAT_CONN_LSM_WORK_UNITS_DISCARDED 1109 +#define WT_STAT_CONN_LSM_WORK_UNITS_DISCARDED 1110 /*! LSM: tree maintenance operations executed */ -#define WT_STAT_CONN_LSM_WORK_UNITS_DONE 1110 +#define WT_STAT_CONN_LSM_WORK_UNITS_DONE 1111 /*! connection: memory allocations */ -#define WT_STAT_CONN_MEMORY_ALLOCATION 1111 +#define WT_STAT_CONN_MEMORY_ALLOCATION 1112 /*! connection: memory frees */ -#define WT_STAT_CONN_MEMORY_FREE 1112 +#define WT_STAT_CONN_MEMORY_FREE 1113 /*! connection: memory re-allocations */ -#define WT_STAT_CONN_MEMORY_GROW 1113 +#define WT_STAT_CONN_MEMORY_GROW 1114 /*! thread-yield: page acquire busy blocked */ -#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1114 +#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1115 /*! thread-yield: page acquire eviction blocked */ -#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1115 +#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1116 /*! thread-yield: page acquire locked blocked */ -#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1116 +#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1117 /*! thread-yield: page acquire read blocked */ -#define WT_STAT_CONN_PAGE_READ_BLOCKED 1117 +#define WT_STAT_CONN_PAGE_READ_BLOCKED 1118 /*! thread-yield: page acquire time sleeping (usecs) */ -#define WT_STAT_CONN_PAGE_SLEEP 1118 +#define WT_STAT_CONN_PAGE_SLEEP 1119 /*! connection: total read I/Os */ -#define WT_STAT_CONN_READ_IO 1119 +#define WT_STAT_CONN_READ_IO 1120 /*! reconciliation: page reconciliation calls */ -#define WT_STAT_CONN_REC_PAGES 1120 +#define WT_STAT_CONN_REC_PAGES 1121 /*! reconciliation: page reconciliation calls for eviction */ -#define WT_STAT_CONN_REC_PAGES_EVICTION 1121 +#define WT_STAT_CONN_REC_PAGES_EVICTION 1122 /*! reconciliation: split bytes currently awaiting free */ -#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES 1122 +#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES 1123 /*! reconciliation: split objects currently awaiting free */ -#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS 1123 +#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS 1124 /*! connection: pthread mutex shared lock read-lock calls */ -#define WT_STAT_CONN_RWLOCK_READ 1124 +#define WT_STAT_CONN_RWLOCK_READ 1125 /*! connection: pthread mutex shared lock write-lock calls */ -#define WT_STAT_CONN_RWLOCK_WRITE 1125 +#define WT_STAT_CONN_RWLOCK_WRITE 1126 /*! session: open cursor count */ -#define WT_STAT_CONN_SESSION_CURSOR_OPEN 1126 +#define WT_STAT_CONN_SESSION_CURSOR_OPEN 1127 /*! session: open session count */ -#define WT_STAT_CONN_SESSION_OPEN 1127 +#define WT_STAT_CONN_SESSION_OPEN 1128 /*! transaction: transaction begins */ -#define WT_STAT_CONN_TXN_BEGIN 1128 +#define WT_STAT_CONN_TXN_BEGIN 1129 /*! transaction: transaction checkpoints */ -#define WT_STAT_CONN_TXN_CHECKPOINT 1129 +#define WT_STAT_CONN_TXN_CHECKPOINT 1130 /*! transaction: transaction checkpoint generation */ -#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1130 +#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1131 /*! transaction: transaction checkpoint currently running */ -#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1131 +#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1132 /*! transaction: transaction checkpoint max time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1132 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1133 /*! transaction: transaction checkpoint min time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1133 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1134 /*! transaction: transaction checkpoint most recent time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1134 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1135 /*! transaction: transaction checkpoint total time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1135 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1136 /*! transaction: transactions committed */ -#define WT_STAT_CONN_TXN_COMMIT 1136 +#define WT_STAT_CONN_TXN_COMMIT 1137 /*! transaction: transaction failures due to cache overflow */ -#define WT_STAT_CONN_TXN_FAIL_CACHE 1137 +#define WT_STAT_CONN_TXN_FAIL_CACHE 1138 /*! transaction: transaction range of IDs currently pinned by a checkpoint */ -#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1138 +#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1139 /*! transaction: transaction range of IDs currently pinned */ -#define WT_STAT_CONN_TXN_PINNED_RANGE 1139 +#define WT_STAT_CONN_TXN_PINNED_RANGE 1140 /*! transaction: transactions rolled back */ -#define WT_STAT_CONN_TXN_ROLLBACK 1140 +#define WT_STAT_CONN_TXN_ROLLBACK 1141 /*! transaction: transaction sync calls */ -#define WT_STAT_CONN_TXN_SYNC 1141 +#define WT_STAT_CONN_TXN_SYNC 1142 /*! connection: total write I/Os */ -#define WT_STAT_CONN_WRITE_IO 1142 +#define WT_STAT_CONN_WRITE_IO 1143 /*! * @} diff --git a/src/third_party/wiredtiger/src/lsm/lsm_manager.c b/src/third_party/wiredtiger/src/lsm/lsm_manager.c index cb078d991d8..e2f7ebb45dd 100644 --- a/src/third_party/wiredtiger/src/lsm/lsm_manager.c +++ b/src/third_party/wiredtiger/src/lsm/lsm_manager.c @@ -273,7 +273,7 @@ __wt_lsm_manager_destroy(WT_SESSION_IMPL *session) WT_CONNECTION_IMPL *conn; WT_DECL_RET; WT_LSM_MANAGER *manager; - WT_LSM_WORK_UNIT *current, *next; + WT_LSM_WORK_UNIT *current; WT_SESSION *wt_session; uint32_t i; uint64_t removed; @@ -297,23 +297,17 @@ __wt_lsm_manager_destroy(WT_SESSION_IMPL *session) manager->lsm_worker_cookies[0].tid = 0; /* Release memory from any operations left on the queue. */ - for (current = TAILQ_FIRST(&manager->switchqh); - current != NULL; current = next) { - next = TAILQ_NEXT(current, q); + while ((current = TAILQ_FIRST(&manager->switchqh)) != NULL) { TAILQ_REMOVE(&manager->switchqh, current, q); ++removed; __wt_lsm_manager_free_work_unit(session, current); } - for (current = TAILQ_FIRST(&manager->appqh); - current != NULL; current = next) { - next = TAILQ_NEXT(current, q); + while ((current = TAILQ_FIRST(&manager->appqh)) != NULL) { TAILQ_REMOVE(&manager->appqh, current, q); ++removed; __wt_lsm_manager_free_work_unit(session, current); } - for (current = TAILQ_FIRST(&manager->managerqh); - current != NULL; current = next) { - next = TAILQ_NEXT(current, q); + while ((current = TAILQ_FIRST(&manager->managerqh)) != NULL) { TAILQ_REMOVE(&manager->managerqh, current, q); ++removed; __wt_lsm_manager_free_work_unit(session, current); diff --git a/src/third_party/wiredtiger/src/os_posix/os_open.c b/src/third_party/wiredtiger/src/os_posix/os_open.c index 7a4f5fdb38d..619a4afe4b6 100644 --- a/src/third_party/wiredtiger/src/os_posix/os_open.c +++ b/src/third_party/wiredtiger/src/os_posix/os_open.c @@ -53,7 +53,7 @@ __wt_open(WT_SESSION_IMPL *session, hash = __wt_hash_city64(name, strlen(name)); bucket = hash % WT_HASH_ARRAY_SIZE; __wt_spin_lock(session, &conn->fh_lock); - SLIST_FOREACH(tfh, &conn->fhhash[bucket], hashl) { + TAILQ_FOREACH(tfh, &conn->fhhash[bucket], hashq) { if (strcmp(name, tfh->name) == 0) { ++tfh->ref; *fhp = tfh; @@ -167,7 +167,7 @@ setupfh: */ matched = 0; __wt_spin_lock(session, &conn->fh_lock); - SLIST_FOREACH(tfh, &conn->fhhash[bucket], hashl) { + TAILQ_FOREACH(tfh, &conn->fhhash[bucket], hashq) { if (strcmp(name, tfh->name) == 0) { ++tfh->ref; *fhp = tfh; diff --git a/src/third_party/wiredtiger/src/os_posix/os_remove.c b/src/third_party/wiredtiger/src/os_posix/os_remove.c index 3fc692d8755..96bbba9bab2 100644 --- a/src/third_party/wiredtiger/src/os_posix/os_remove.c +++ b/src/third_party/wiredtiger/src/os_posix/os_remove.c @@ -29,7 +29,7 @@ __remove_file_check(WT_SESSION_IMPL *session, const char *name) * level should have closed it before removing. */ __wt_spin_lock(session, &conn->fh_lock); - SLIST_FOREACH(fh, &conn->fhhash[bucket], hashl) + TAILQ_FOREACH(fh, &conn->fhhash[bucket], hashq) if (strcmp(name, fh->name) == 0) break; __wt_spin_unlock(session, &conn->fh_lock); diff --git a/src/third_party/wiredtiger/src/os_win/os_open.c b/src/third_party/wiredtiger/src/os_win/os_open.c index a77bef63b9d..1c6f5636501 100644 --- a/src/third_party/wiredtiger/src/os_win/os_open.c +++ b/src/third_party/wiredtiger/src/os_win/os_open.c @@ -39,7 +39,7 @@ __wt_open(WT_SESSION_IMPL *session, /* Increment the reference count if we already have the file open. */ matched = 0; __wt_spin_lock(session, &conn->fh_lock); - SLIST_FOREACH(tfh, &conn->fhhash[bucket], hashl) + TAILQ_FOREACH(tfh, &conn->fhhash[bucket], hashq) if (strcmp(name, tfh->name) == 0) { ++tfh->ref; *fhp = tfh; @@ -160,7 +160,7 @@ setupfh: */ matched = 0; __wt_spin_lock(session, &conn->fh_lock); - SLIST_FOREACH(tfh, &conn->fhhash[bucket], hashl) + TAILQ_FOREACH(tfh, &conn->fhhash[bucket], hashq) if (strcmp(name, tfh->name) == 0) { ++tfh->ref; *fhp = tfh; diff --git a/src/third_party/wiredtiger/src/os_win/os_remove.c b/src/third_party/wiredtiger/src/os_win/os_remove.c index 0c6396c775f..55b50030064 100644 --- a/src/third_party/wiredtiger/src/os_win/os_remove.c +++ b/src/third_party/wiredtiger/src/os_win/os_remove.c @@ -29,7 +29,7 @@ __remove_file_check(WT_SESSION_IMPL *session, const char *name) * level should have closed it before removing. */ __wt_spin_lock(session, &conn->fh_lock); - SLIST_FOREACH(fh, &conn->fhhash[bucket], hashl) + TAILQ_FOREACH(fh, &conn->fhhash[bucket], hashq) if (strcmp(name, fh->name) == 0) break; __wt_spin_unlock(session, &conn->fh_lock); diff --git a/src/third_party/wiredtiger/src/schema/schema_list.c b/src/third_party/wiredtiger/src/schema/schema_list.c index a36fd696079..d091a5d94da 100644 --- a/src/third_party/wiredtiger/src/schema/schema_list.c +++ b/src/third_party/wiredtiger/src/schema/schema_list.c @@ -29,8 +29,8 @@ __schema_add_table(WT_SESSION_IMPL *session, WT_RET(ret); bucket = table->name_hash % WT_HASH_ARRAY_SIZE; - SLIST_INSERT_HEAD(&session->tables, table, l); - SLIST_INSERT_HEAD(&session->tablehash[bucket], table, hashl); + TAILQ_INSERT_HEAD(&session->tables, table, q); + TAILQ_INSERT_HEAD(&session->tablehash[bucket], table, hashq); *tablep = table; return (0); @@ -51,7 +51,7 @@ __schema_find_table(WT_SESSION_IMPL *session, bucket = __wt_hash_city64(name, namelen) % WT_HASH_ARRAY_SIZE; restart: - SLIST_FOREACH(table, &session->tablehash[bucket], hashl) { + TAILQ_FOREACH(table, &session->tablehash[bucket], hashq) { tablename = table->name; (void)WT_PREFIX_SKIP(tablename, "table:"); if (WT_STRING_MATCH(tablename, name, namelen)) { @@ -228,8 +228,8 @@ __wt_schema_remove_table(WT_SESSION_IMPL *session, WT_TABLE *table) WT_ASSERT(session, table->refcnt <= 1); bucket = table->name_hash % WT_HASH_ARRAY_SIZE; - SLIST_REMOVE(&session->tables, table, __wt_table, l); - SLIST_REMOVE(&session->tablehash[bucket], table, __wt_table, hashl); + TAILQ_REMOVE(&session->tables, table, q); + TAILQ_REMOVE(&session->tablehash[bucket], table, hashq); return (__wt_schema_destroy_table(session, &table)); } @@ -243,7 +243,7 @@ __wt_schema_close_tables(WT_SESSION_IMPL *session) WT_DECL_RET; WT_TABLE *table; - while ((table = SLIST_FIRST(&session->tables)) != NULL) + while ((table = TAILQ_FIRST(&session->tables)) != NULL) WT_TRET(__wt_schema_remove_table(session, table)); return (ret); } diff --git a/src/third_party/wiredtiger/src/session/session_api.c b/src/third_party/wiredtiger/src/session/session_api.c index 1103dba7409..06786db2f6d 100644 --- a/src/third_party/wiredtiger/src/session/session_api.c +++ b/src/third_party/wiredtiger/src/session/session_api.c @@ -1190,7 +1190,7 @@ __wt_open_session(WT_CONNECTION_IMPL *conn, event_handler == NULL ? session->event_handler : event_handler); TAILQ_INIT(&session_ret->cursors); - SLIST_INIT(&session_ret->dhandles); + TAILQ_INIT(&session_ret->dhandles); /* * If we don't have one, allocate the dhandle hash array. * Allocate the table hash array as well. @@ -1202,8 +1202,8 @@ __wt_open_session(WT_CONNECTION_IMPL *conn, WT_ERR(__wt_calloc(session_ret, WT_HASH_ARRAY_SIZE, sizeof(struct __tables_hash), &session_ret->tablehash)); for (i = 0; i < WT_HASH_ARRAY_SIZE; i++) { - SLIST_INIT(&session_ret->dhhash[i]); - SLIST_INIT(&session_ret->tablehash[i]); + TAILQ_INIT(&session_ret->dhhash[i]); + TAILQ_INIT(&session_ret->tablehash[i]); } /* Initialize transaction support: default to read-committed. */ diff --git a/src/third_party/wiredtiger/src/session/session_dhandle.c b/src/third_party/wiredtiger/src/session/session_dhandle.c index 9d3173de04f..9fc9fd1d81d 100644 --- a/src/third_party/wiredtiger/src/session/session_dhandle.c +++ b/src/third_party/wiredtiger/src/session/session_dhandle.c @@ -25,8 +25,8 @@ __session_add_dhandle( dhandle_cache->dhandle = session->dhandle; bucket = dhandle_cache->dhandle->name_hash % WT_HASH_ARRAY_SIZE; - SLIST_INSERT_HEAD(&session->dhandles, dhandle_cache, l); - SLIST_INSERT_HEAD(&session->dhhash[bucket], dhandle_cache, hashl); + TAILQ_INSERT_HEAD(&session->dhandles, dhandle_cache, q); + TAILQ_INSERT_HEAD(&session->dhhash[bucket], dhandle_cache, hashq); if (dhandle_cachep != NULL) *dhandle_cachep = dhandle_cache; @@ -36,6 +36,61 @@ __session_add_dhandle( } /* + * __session_discard_dhandle -- + * Remove a data handle from the session cache. + */ +static void +__session_discard_dhandle( + WT_SESSION_IMPL *session, WT_DATA_HANDLE_CACHE *dhandle_cache) +{ + uint64_t bucket; + + bucket = dhandle_cache->dhandle->name_hash % WT_HASH_ARRAY_SIZE; + TAILQ_REMOVE(&session->dhandles, dhandle_cache, q); + TAILQ_REMOVE(&session->dhhash[bucket], dhandle_cache, hashq); + + (void)WT_ATOMIC_SUB4(dhandle_cache->dhandle->session_ref, 1); + + __wt_overwrite_and_free(session, dhandle_cache); +} + +/* + * __session_find_dhandle -- + * Search for a data handle in the session cache. + */ +static void +__session_find_dhandle(WT_SESSION_IMPL *session, + const char *uri, const char *checkpoint, + WT_DATA_HANDLE_CACHE **dhandle_cachep) +{ + WT_DATA_HANDLE *dhandle; + WT_DATA_HANDLE_CACHE *dhandle_cache; + uint64_t bucket; + + dhandle = NULL; + + bucket = __wt_hash_city64(uri, strlen(uri)) % WT_HASH_ARRAY_SIZE; +retry: TAILQ_FOREACH(dhandle_cache, &session->dhhash[bucket], hashq) { + dhandle = dhandle_cache->dhandle; + if (WT_DHANDLE_INACTIVE(dhandle) && !WT_IS_METADATA(dhandle)) { + __session_discard_dhandle(session, dhandle_cache); + /* We deleted our entry, retry from the start. */ + goto retry; + } + + if (strcmp(uri, dhandle->name) != 0) + continue; + if (checkpoint == NULL && dhandle->checkpoint == NULL) + break; + if (checkpoint != NULL && dhandle->checkpoint != NULL && + strcmp(checkpoint, dhandle->checkpoint) == 0) + break; + } + + *dhandle_cachep = dhandle_cache; +} + +/* * __wt_session_lock_dhandle -- * Return when the current data handle is either (a) open with the * requested lock mode; or (b) closed and write locked. If exclusive @@ -173,6 +228,7 @@ __wt_session_release_btree(WT_SESSION_IMPL *session) { WT_BTREE *btree; WT_DATA_HANDLE *dhandle; + WT_DATA_HANDLE_CACHE *dhandle_cache; WT_DECL_RET; int write_locked; @@ -184,6 +240,13 @@ __wt_session_release_btree(WT_SESSION_IMPL *session) * If we had special flags set, close the handle so that future access * can get a handle without special flags. */ + if (F_ISSET(dhandle, WT_DHANDLE_DISCARD | WT_DHANDLE_DISCARD_FORCE)) { + __session_find_dhandle(session, + dhandle->name, dhandle->checkpoint, &dhandle_cache); + if (dhandle_cache != NULL) + __session_discard_dhandle(session, dhandle_cache); + } + if (F_ISSET(dhandle, WT_DHANDLE_DISCARD_FORCE)) { ret = __wt_conn_btree_sync_and_close(session, 0, 1); F_CLR(dhandle, WT_DHANDLE_DISCARD_FORCE); @@ -263,26 +326,6 @@ retry: WT_RET(__wt_meta_checkpoint_last_name( } /* - * __session_discard_btree -- - * Discard our reference to the btree. - */ -static void -__session_discard_btree( - WT_SESSION_IMPL *session, WT_DATA_HANDLE_CACHE *dhandle_cache) -{ - uint64_t bucket; - - bucket = dhandle_cache->dhandle->name_hash % WT_HASH_ARRAY_SIZE; - SLIST_REMOVE( - &session->dhandles, dhandle_cache, __wt_data_handle_cache, l); - SLIST_REMOVE(&session->dhhash[bucket], - dhandle_cache, __wt_data_handle_cache, hashl); - - (void)WT_ATOMIC_SUB4(dhandle_cache->dhandle->session_ref, 1); - __wt_overwrite_and_free(session, dhandle_cache); -} - -/* * __wt_session_close_cache -- * Close any cached handles in a session. */ @@ -291,8 +334,8 @@ __wt_session_close_cache(WT_SESSION_IMPL *session) { WT_DATA_HANDLE_CACHE *dhandle_cache; - while ((dhandle_cache = SLIST_FIRST(&session->dhandles)) != NULL) - __session_discard_btree(session, dhandle_cache); + while ((dhandle_cache = TAILQ_FIRST(&session->dhandles)) != NULL) + __session_discard_dhandle(session, dhandle_cache); } /* @@ -320,18 +363,18 @@ __session_dhandle_sweep(WT_SESSION_IMPL *session) WT_STAT_FAST_CONN_INCR(session, dh_session_sweeps); - dhandle_cache = SLIST_FIRST(&session->dhandles); + dhandle_cache = TAILQ_FIRST(&session->dhandles); while (dhandle_cache != NULL) { - dhandle_cache_next = SLIST_NEXT(dhandle_cache, l); + dhandle_cache_next = TAILQ_NEXT(dhandle_cache, q); dhandle = dhandle_cache->dhandle; if (dhandle != session->dhandle && dhandle->session_inuse == 0 && - (F_ISSET(dhandle, WT_DHANDLE_DEAD) || + (WT_DHANDLE_INACTIVE(dhandle) || (dhandle->timeofdeath != 0 && now - dhandle->timeofdeath > conn->sweep_idle_time))) { WT_STAT_FAST_CONN_INCR(session, dh_session_handles); WT_ASSERT(session, !WT_IS_METADATA(dhandle)); - __session_discard_btree(session, dhandle_cache); + __session_discard_dhandle(session, dhandle_cache); } dhandle_cache = dhandle_cache_next; } @@ -339,51 +382,37 @@ __session_dhandle_sweep(WT_SESSION_IMPL *session) } /* - * __session_dhandle_find_shared -- + * __session_find_shared_dhandle -- * Search for a data handle in the connection and add it to a session's * cache. Since the data handle isn't locked, this must be called holding * the handle list lock, and we must increment the handle's reference * count before releasing it. */ static int -__session_dhandle_find_shared( +__session_find_shared_dhandle( WT_SESSION_IMPL *session, const char *uri, const char *checkpoint) { WT_RET(__wt_conn_dhandle_find(session, uri, checkpoint)); (void)WT_ATOMIC_ADD4(session->dhandle->session_ref, 1); return (0); } + /* - * __session_dhandle_find -- + * __session_get_dhandle -- * Search for a data handle, first in the session cache, then in the * connection. */ static int -__session_dhandle_find( +__session_get_dhandle( WT_SESSION_IMPL *session, const char *uri, const char *checkpoint) { - WT_DATA_HANDLE *dhandle; WT_DATA_HANDLE_CACHE *dhandle_cache; WT_DECL_RET; - uint64_t bucket; - bucket = __wt_hash_city64(uri, strlen(uri)) % WT_HASH_ARRAY_SIZE; -retry: SLIST_FOREACH(dhandle_cache, &session->dhhash[bucket], hashl) { - dhandle = dhandle_cache->dhandle; - if (F_ISSET(dhandle, WT_DHANDLE_DEAD)) { - WT_ASSERT(session, !WT_IS_METADATA(dhandle)); - __session_discard_btree(session, dhandle_cache); - /* We deleted our entry, retry from the start. */ - goto retry; - } - if (strcmp(uri, dhandle->name) != 0) - continue; - if ((checkpoint == NULL && dhandle->checkpoint == NULL) || - (checkpoint != NULL && dhandle->checkpoint != NULL && - strcmp(checkpoint, dhandle->checkpoint) == 0)) { - session->dhandle = dhandle; - return (0); - } + __session_find_dhandle(session, uri, checkpoint, &dhandle_cache); + if (dhandle_cache != NULL) { + session->dhandle = dhandle_cache->dhandle; + return (0); } /* @@ -391,7 +420,7 @@ retry: SLIST_FOREACH(dhandle_cache, &session->dhhash[bucket], hashl) { * handle list and cache the handle we find. */ WT_WITH_HANDLE_LIST_LOCK(session, ret = - __session_dhandle_find_shared(session, uri, checkpoint)); + __session_find_shared_dhandle(session, uri, checkpoint)); if (ret == 0) ret = __session_add_dhandle(session, NULL); @@ -413,7 +442,7 @@ __wt_session_get_btree(WT_SESSION_IMPL *session, WT_ASSERT(session, !F_ISSET(session, WT_SESSION_NO_DATA_HANDLES)); for (;;) { - WT_RET(__session_dhandle_find(session, uri, checkpoint)); + WT_RET(__session_get_dhandle(session, uri, checkpoint)); dhandle = session->dhandle; /* Try to lock the handle. */ diff --git a/src/third_party/wiredtiger/src/support/stat.c b/src/third_party/wiredtiger/src/support/stat.c index b706263d1ce..2f638790060 100644 --- a/src/third_party/wiredtiger/src/support/stat.c +++ b/src/third_party/wiredtiger/src/support/stat.c @@ -444,6 +444,8 @@ __wt_stat_init_connection_stats(WT_CONNECTION_STATS *stats) stats->cursor_search.desc = "cursor: cursor search calls"; stats->cursor_search_near.desc = "cursor: cursor search near calls"; stats->cursor_update.desc = "cursor: cursor update calls"; + stats->dh_conn_handle_count.desc = + "data-handle: connection data handles currently active"; stats->dh_sweep_ref.desc = "data-handle: connection sweep candidate became referenced"; stats->dh_sweep_close.desc = diff --git a/src/third_party/wiredtiger/src/txn/txn.c b/src/third_party/wiredtiger/src/txn/txn.c index 210c5dde5d0..43bafbfe9f0 100644 --- a/src/third_party/wiredtiger/src/txn/txn.c +++ b/src/third_party/wiredtiger/src/txn/txn.c @@ -715,7 +715,7 @@ __wt_txn_global_init(WT_SESSION_IMPL *session, const char *cfg[]) WT_RET(__wt_rwlock_alloc(session, &txn_global->nsnap_rwlock, "named snapshot lock")); txn_global->nsnap_oldest_id = WT_TXN_NONE; - STAILQ_INIT(&txn_global->nsnaph); + TAILQ_INIT(&txn_global->nsnaph); WT_RET(__wt_calloc_def( session, conn->session_size, &txn_global->states)); diff --git a/src/third_party/wiredtiger/src/txn/txn_nsnap.c b/src/third_party/wiredtiger/src/txn/txn_nsnap.c index bd352c2237e..be736cc1c98 100644 --- a/src/third_party/wiredtiger/src/txn/txn_nsnap.c +++ b/src/third_party/wiredtiger/src/txn/txn_nsnap.c @@ -34,7 +34,7 @@ __nsnap_drop_one(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *name) txn_global = &S2C(session)->txn_global; - STAILQ_FOREACH(found, &txn_global->nsnaph, q) + TAILQ_FOREACH(found, &txn_global->nsnaph, q) if (WT_STRING_MATCH(found->name, name->str, name->len)) break; @@ -42,10 +42,10 @@ __nsnap_drop_one(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *name) return (WT_NOTFOUND); /* Bump the global ID if we are removing the first entry */ - if (found == STAILQ_FIRST(&txn_global->nsnaph)) - txn_global->nsnap_oldest_id = (STAILQ_NEXT(found, q) != NULL) ? - STAILQ_NEXT(found, q)->snap_min : WT_TXN_NONE; - STAILQ_REMOVE(&txn_global->nsnaph, found, __wt_named_snapshot, q); + if (found == TAILQ_FIRST(&txn_global->nsnaph)) + txn_global->nsnap_oldest_id = (TAILQ_NEXT(found, q) != NULL) ? + TAILQ_NEXT(found, q)->snap_min : WT_TXN_NONE; + TAILQ_REMOVE(&txn_global->nsnaph, found, q); __nsnap_destroy(session, found); return (ret); @@ -67,7 +67,7 @@ __nsnap_drop_to(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *name, int inclusive) last = nsnap = prev = NULL; txn_global = &S2C(session)->txn_global; - if (STAILQ_EMPTY(&txn_global->nsnaph)) { + if (TAILQ_EMPTY(&txn_global->nsnaph)) { if (name == NULL) return (0); /* @@ -85,7 +85,7 @@ __nsnap_drop_to(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *name, int inclusive) */ new_nsnap_oldest = WT_TXN_NONE; if (name != NULL) { - STAILQ_FOREACH(last, &txn_global->nsnaph, q) { + TAILQ_FOREACH(last, &txn_global->nsnaph, q) { if (WT_STRING_MATCH(last->name, name->str, name->len)) break; prev = last; @@ -102,17 +102,17 @@ __nsnap_drop_to(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *name, int inclusive) last = prev; } - if (STAILQ_NEXT(last, q) != NULL) - new_nsnap_oldest = STAILQ_NEXT(last, q)->snap_min; + if (TAILQ_NEXT(last, q) != NULL) + new_nsnap_oldest = TAILQ_NEXT(last, q)->snap_min; } do { - nsnap = STAILQ_FIRST(&txn_global->nsnaph); + nsnap = TAILQ_FIRST(&txn_global->nsnaph); WT_ASSERT(session, nsnap != NULL); - STAILQ_REMOVE_HEAD(&txn_global->nsnaph, q); + TAILQ_REMOVE(&txn_global->nsnaph, nsnap, q); __nsnap_destroy(session, nsnap); /* Last will be NULL in the all case so it will never match */ - } while (nsnap != last && !STAILQ_EMPTY(&txn_global->nsnaph)); + } while (nsnap != last && !TAILQ_EMPTY(&txn_global->nsnaph)); /* Now that the queue of named snapshots is updated, update the ID */ txn_global->nsnap_oldest_id = new_nsnap_oldest; @@ -173,9 +173,9 @@ __wt_txn_named_snapshot_begin(WT_SESSION_IMPL *session, const char *cfg[]) */ WT_ERR_NOTFOUND_OK(__nsnap_drop_one(session, &cval)); - if (STAILQ_EMPTY(&txn_global->nsnaph)) + if (TAILQ_EMPTY(&txn_global->nsnaph)) txn_global->nsnap_oldest_id = nsnap_new->snap_min; - STAILQ_INSERT_TAIL(&txn_global->nsnaph, nsnap_new, q); + TAILQ_INSERT_TAIL(&txn_global->nsnaph, nsnap_new, q); nsnap_new = NULL; err: if (started_txn) @@ -254,7 +254,7 @@ __wt_txn_named_snapshot_get(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *nameval) WT_RET(__wt_session_copy_values(session)); WT_RET(__wt_readlock(session, txn_global->nsnap_rwlock)); - STAILQ_FOREACH(nsnap, &txn_global->nsnaph, q) + TAILQ_FOREACH(nsnap, &txn_global->nsnaph, q) if (WT_STRING_MATCH(nsnap->name, nameval->str, nameval->len)) { txn->snap_min = txn_state->snap_min = nsnap->snap_min; txn->snap_max = nsnap->snap_max; @@ -358,10 +358,8 @@ __wt_txn_named_snapshot_destroy(WT_SESSION_IMPL *session) txn_global = &S2C(session)->txn_global; txn_global->nsnap_oldest_id = WT_TXN_NONE; - while (!STAILQ_EMPTY(&txn_global->nsnaph)) { - nsnap = STAILQ_FIRST(&txn_global->nsnaph); - WT_ASSERT(session, nsnap != NULL); - STAILQ_REMOVE_HEAD(&txn_global->nsnaph, q); + while ((nsnap = TAILQ_FIRST(&txn_global->nsnaph)) != NULL) { + TAILQ_REMOVE(&txn_global->nsnaph, nsnap, q); __nsnap_destroy(session, nsnap); } diff --git a/src/third_party/wiredtiger/tools/wtstats/stat_data.py b/src/third_party/wiredtiger/tools/wtstats/stat_data.py index db5b14d6cd6..3fbc634385a 100644 --- a/src/third_party/wiredtiger/tools/wtstats/stat_data.py +++ b/src/third_party/wiredtiger/tools/wtstats/stat_data.py @@ -13,6 +13,7 @@ no_scale_per_second_list = [ 'cache: tracked dirty bytes in the cache', 'cache: tracked dirty pages in the cache', 'connection: files currently open', + 'data-handle: connection data handles currently active', 'log: maximum log file size', 'log: number of pre-allocated log files to create', 'log: total log buffer size', @@ -74,6 +75,7 @@ no_clear_list = [ 'cache: tracked dirty bytes in the cache', 'cache: tracked dirty pages in the cache', 'connection: files currently open', + 'data-handle: connection data handles currently active', 'log: maximum log file size', 'log: number of pre-allocated log files to create', 'log: total log buffer size', |