diff options
author | Luke Chen <luke.chen@mongodb.com> | 2018-11-14 14:05:56 +1100 |
---|---|---|
committer | Luke Chen <luke.chen@mongodb.com> | 2018-11-14 14:05:56 +1100 |
commit | 33599f740fa241ddaeafa387bf470afbc01c0dbc (patch) | |
tree | 5c81c22dc9ee34152e5685725f68a93b2fe8b9ee /src/third_party | |
parent | fa3279a05f0d634ea0700add272ed8fe454ee8cf (diff) | |
download | mongo-33599f740fa241ddaeafa387bf470afbc01c0dbc.tar.gz |
Import wiredtiger: 2ee0f0f4bbfdc7133ec87986006be17a7494aa08 from branch mongodb-4.0
ref: 231a81ea33..2ee0f0f4bb
for: 4.0.5
WT-4043 Take locks while dumping the cache to avoid crashes
WT-4298 Fix workgen to retry on WT_ROLLBACK and clear ops after warmup
WT-4343 Unlock when sleeping to allow other log threads to make progress
WT-4371 Workgen improvements to create a MongoDB-like workload
WT-4376 Fix a bug where table index open can race
WT-4385 Prepare-conflict during a cursor scan can return the wrong key
WT-4392 A large lint change
WT-4395 Seg fault walking corrupted log with log cursor
WT-4396 When retrying after prepare-conflict, cursor unable to find a valid update
WT-4399 Fix compression for workgen's wtperf emulation
WT-4400 Fix workgen use of PRIxxx macros, needed for old C++ compilers
WT-4401 workgen: wtperf emulation: sample_interval broken with integer values
WT-4402 Add rollback support and monitor JSON output in wtperf
WT-4411 Added connection statistic for current total of cached cursors
WT-4412 wtperf coverity fixes
WT-4418 Don't keep key/value memory buffers allocated for cached cursors
WT-4422 Don't queue clean pages for urgent eviction
Diffstat (limited to 'src/third_party')
65 files changed, 1048 insertions, 599 deletions
diff --git a/src/third_party/wiredtiger/.gitignore b/src/third_party/wiredtiger/.gitignore index a27c74ff155..ff5afdd9d78 100644 --- a/src/third_party/wiredtiger/.gitignore +++ b/src/third_party/wiredtiger/.gitignore @@ -103,6 +103,7 @@ _wiredtiger.pyd **/test/bloom/t **/test/checkpoint/t **/test/csuite/test_random_abort +**/test/csuite/test_random_directio **/test/csuite/test_rwlock **/test/csuite/test_schema_abort **/test/csuite/test_scope @@ -130,6 +131,7 @@ _wiredtiger.pyd **/test/csuite/test_wt4105_large_doc_small_upd **/test/csuite/test_wt4117_checksum **/test/csuite/test_wt4156_metadata_salvage +**/test/csuite/test_wt4333_handle_locks **/test/cursor_order/cursor_order **/test/fops/t **/test/format/s_dumpcmp diff --git a/src/third_party/wiredtiger/bench/workgen/workgen.cxx b/src/third_party/wiredtiger/bench/workgen/workgen.cxx index 39aacb89dc8..4eb2909c819 100644 --- a/src/third_party/wiredtiger/bench/workgen/workgen.cxx +++ b/src/third_party/wiredtiger/bench/workgen/workgen.cxx @@ -27,6 +27,7 @@ */ #define __STDC_LIMIT_MACROS // needed to get UINT64_MAX in C++ +#define __STDC_FORMAT_MACROS // needed to get PRIuXX macros in C++ #include <iomanip> #include <iostream> #include <fstream> @@ -278,6 +279,7 @@ int Monitor::run() { Stats prev_totals; WorkloadOptions *options = &_wrunner._workload->options; uint64_t latency_max = (uint64_t)options->max_latency; + size_t buf_size; bool first; (*_out) << "#time," @@ -300,13 +302,32 @@ int Monitor::run() { first = true; workgen_version(version, sizeof(version)); Stats prev_interval; + + // The whole and fractional part of sample_interval are separated, + // we don't want to sleep longer than a second. + int sample_secs = ms_to_sec(options->sample_interval_ms); + useconds_t sample_usecs = + ms_to_us(options->sample_interval_ms) - sec_to_us(sample_secs); + while (!_stop) { - int waitsecs = (first && options->warmup > 0) ? options->warmup : - options->sample_interval; + int waitsecs; + useconds_t waitusecs; + + if (first && options->warmup > 0) { + waitsecs = options->warmup; + waitusecs = 0; + } else { + waitsecs = sample_secs; + waitusecs = sample_usecs; + } for (int i = 0; i < waitsecs && !_stop; i++) sleep(1); if (_stop) break; + if (waitusecs > 0) + usleep(waitusecs); + if (_stop) + break; workgen_epoch(&t); tm = localtime_r(&t.tv_sec, &_tm); @@ -319,10 +340,10 @@ int Monitor::run() { Stats interval(new_totals); interval.subtract(prev_totals); - int interval_secs = options->sample_interval; - uint64_t cur_reads = interval.read.ops / interval_secs; - uint64_t cur_inserts = interval.insert.ops / interval_secs; - uint64_t cur_updates = interval.update.ops / interval_secs; + double interval_secs = options->sample_interval_ms / 1000.0; + uint64_t cur_reads = (uint64_t)(interval.read.ops / interval_secs); + uint64_t cur_inserts = (uint64_t)(interval.insert.ops / interval_secs); + uint64_t cur_updates = (uint64_t)(interval.update.ops / interval_secs); bool checkpointing = new_totals.checkpoint.ops_in_progress > 0 || interval.checkpoint.ops > 0; @@ -345,9 +366,12 @@ int Monitor::run() { << std::endl; if (_json != NULL) { -#define WORKGEN_TIMESTAMP_JSON "%Y-%m-%dT%H:%M:%S.000Z" - (void)strftime(time_buf, sizeof(time_buf), +#define WORKGEN_TIMESTAMP_JSON "%Y-%m-%dT%H:%M:%S" + buf_size = strftime(time_buf, sizeof(time_buf), WORKGEN_TIMESTAMP_JSON, tm); + ASSERT(buf_size <= sizeof(time_buf)); + snprintf(&time_buf[buf_size], sizeof(time_buf) - buf_size, + ".%3.3" PRIu64 "Z", (uint64_t)ns_to_ms(t.tv_nsec)); // Note: we could allow this to be configurable. int percentiles[4] = {50, 95, 99, 0}; @@ -356,7 +380,9 @@ int Monitor::run() { do { \ int _i; \ (f) << "\"" << (name) << "\":{" << extra \ - << "\"ops per sec\":" << ((t).ops / interval_secs) \ + << "\"ops per sec\":" \ + << (uint64_t)((t).ops / interval_secs) \ + << ",\"rollbacks\":" << ((t).rollbacks) \ << ",\"average latency\":" << (t).average_latency() \ << ",\"min latency\":" << (t).min_latency \ << ",\"max latency\":" << (t).max_latency; \ @@ -440,7 +466,7 @@ int ThreadRunner::create_all(WT_CONNECTION *conn) { ASSERT(_session == NULL); WT_RET(conn->open_session(conn, NULL, NULL, &_session)); _table_usage.clear(); - _stats.track_latency(_workload->options.sample_interval > 0); + _stats.track_latency(_workload->options.sample_interval_ms > 0); WT_RET(workgen_random_alloc(_session, &_rand_state)); _throttle_ops = 0; _throttle_limit = 0; @@ -680,12 +706,13 @@ int ThreadRunner::op_run(Operation *op) { WT_DECL_RET; uint64_t recno; uint64_t range; - bool measure_latency, own_cursor; + bool measure_latency, own_cursor, retry_op; track = NULL; cursor = NULL; recno = 0; own_cursor = false; + retry_op = true; range = op->_table.options.range; if (_throttle != NULL) { if (_throttle_ops >= _throttle_limit && !_in_transaction) { @@ -719,6 +746,7 @@ int ThreadRunner::op_run(Operation *op) { else recno = op_get_key_recno(op, range, tint); break; + case Operation::OP_LOG_FLUSH: case Operation::OP_NONE: case Operation::OP_NOOP: recno = 0; @@ -759,13 +787,8 @@ int ThreadRunner::op_run(Operation *op) { if (track != NULL) track->begin(); - if (op->_transaction != NULL) { - if (_in_transaction) - THROW("nested transactions not supported"); - _session->begin_transaction(_session, - op->_transaction->_begin_config.c_str()); - _in_transaction = true; - } + // Set up the key and value first, outside the transaction which may + // be retried. if (op->is_table_op()) { op->kv_gen(this, true, 100, recno, _keybuf); cursor->set_key(cursor, _keybuf); @@ -775,30 +798,60 @@ int ThreadRunner::op_run(Operation *op) { op->kv_gen(this, false, compressibility, recno, _valuebuf); cursor->set_value(cursor, _valuebuf); } - switch (op->_optype) { - case Operation::OP_INSERT: - WT_ERR(cursor->insert(cursor)); - break; - case Operation::OP_REMOVE: - WT_ERR_NOTFOUND_OK(cursor->remove(cursor)); - break; - case Operation::OP_SEARCH: - ret = cursor->search(cursor); - break; - case Operation::OP_UPDATE: - WT_ERR_NOTFOUND_OK(cursor->update(cursor)); - break; - default: - ASSERT(false); + } + // Retry on rollback until success. + while (retry_op) { + if (op->_transaction != NULL) { + if (_in_transaction) + THROW("nested transactions not supported"); + WT_ERR(_session->begin_transaction(_session, + op->_transaction->_begin_config.c_str())); + _in_transaction = true; } - if (ret != 0) { - ASSERT(ret == WT_NOTFOUND); - track = &_stats.not_found; - ret = 0; // WT_NOTFOUND allowed. + if (op->is_table_op()) { + switch (op->_optype) { + case Operation::OP_INSERT: + ret = cursor->insert(cursor); + break; + case Operation::OP_REMOVE: + ret = cursor->remove(cursor); + if (ret == WT_NOTFOUND) + ret = 0; + break; + case Operation::OP_SEARCH: + ret = cursor->search(cursor); + if (ret == WT_NOTFOUND) { + ret = 0; + track = &_stats.not_found; + } + break; + case Operation::OP_UPDATE: + ret = cursor->update(cursor); + if (ret == WT_NOTFOUND) + ret = 0; + break; + default: + ASSERT(false); + } + // Assume success and no retry unless ROLLBACK. + retry_op = false; + if (ret != 0 && ret != WT_ROLLBACK) + WT_ERR(ret); + if (ret == 0) + cursor->reset(cursor); + else { + retry_op = true; + track->rollbacks++; + WT_ERR(_session->rollback_transaction(_session, NULL)); + _in_transaction = false; + ret = 0; + } + } else { + // Never retry on an internal op. + retry_op = false; + WT_ERR(op->_internal->run(this, _session)); } - cursor->reset(cursor); - } else - WT_ERR(op->_internal->run(this, _session)); + } if (measure_latency) { timespec stop; @@ -819,7 +872,7 @@ err: if (op->_transaction != NULL) { if (ret != 0 || op->_transaction->_rollback) WT_TRET(_session->rollback_transaction(_session, NULL)); - else + else if (_in_transaction) ret = _session->commit_transaction(_session, op->_transaction->_commit_config.c_str()); _in_transaction = false; @@ -1043,6 +1096,9 @@ void Operation::init_internal(OperationInternal *other) { _internal = new TableOperationInternal( *(TableOperationInternal *)other); break; + case OP_LOG_FLUSH: + _internal = new LogFlushOperationInternal(); + break; case OP_NONE: case OP_NOOP: if (other == NULL) @@ -1241,12 +1297,18 @@ void Operation::size_check() const { int CheckpointOperationInternal::run(ThreadRunner *runner, WT_SESSION *session) { + (void)runner; /* not used */ return (session->checkpoint(session, NULL)); } +int LogFlushOperationInternal::run(ThreadRunner *runner, WT_SESSION *session) +{ + (void)runner; /* not used */ + return (session->log_flush(session, NULL)); +} + void SleepOperationInternal::parse_config(const std::string &config) { - int amount = 0; const char *configp; char *endp; @@ -1259,6 +1321,7 @@ void SleepOperationInternal::parse_config(const std::string &config) int SleepOperationInternal::run(ThreadRunner *runner, WT_SESSION *session) { + (void)runner; /* not used */ (void)session; /* not used */ sleep(_sleepvalue); return (0); @@ -1274,14 +1337,15 @@ void TableOperationInternal::parse_config(const std::string &config) } } -Track::Track(bool latency_tracking) : ops_in_progress(0), ops(0), +Track::Track(bool latency_tracking) : ops_in_progress(0), ops(0), rollbacks(0), latency_ops(0), latency(0), bucket_ops(0), min_latency(0), max_latency(0), us(NULL), ms(NULL), sec(NULL) { track_latency(latency_tracking); } Track::Track(const Track &other) : ops_in_progress(other.ops_in_progress), - ops(other.ops), latency_ops(other.latency_ops), latency(other.latency), + ops(other.ops), rollbacks(other.rollbacks), + latency_ops(other.latency_ops), latency(other.latency), bucket_ops(other.bucket_ops), min_latency(other.min_latency), max_latency(other.max_latency), us(NULL), ms(NULL), sec(NULL) { if (other.us != NULL) { @@ -1367,6 +1431,7 @@ void Track::begin() { void Track::clear() { ops_in_progress = 0; ops = 0; + rollbacks = 0; latency_ops = 0; latency = 0; bucket_ops = 0; @@ -1676,8 +1741,8 @@ TableInternal::~TableInternal() {} WorkloadOptions::WorkloadOptions() : max_latency(0), report_file("workload.stat"), report_interval(0), run_time(0), - sample_file("monitor.json"), sample_interval(0), sample_rate(1), warmup(0), - _options() { + sample_file("monitor.json"), sample_interval_ms(0), sample_rate(1), + warmup(0), _options() { _options.add_int("max_latency", max_latency, "prints warning if any latency measured exceeds this number of " "milliseconds. Requires sample_interval to be configured."); @@ -1694,8 +1759,8 @@ WorkloadOptions::WorkloadOptions() : max_latency(0), "enabled by the report_interval option. " "The file name is relative to the connection's home directory. " "When set to the empty string, no JSON is emitted."); - _options.add_int("sample_interval", sample_interval, - "performance logging every interval seconds, 0 to disable"); + _options.add_int("sample_interval_ms", sample_interval_ms, + "performance logging every interval milliseconds, 0 to disable"); _options.add_int("sample_rate", sample_rate, "how often the latency of operations is measured. 1 for every operation, " "2 for every second operation, 3 for every third operation etc."); @@ -1705,7 +1770,7 @@ WorkloadOptions::WorkloadOptions() : max_latency(0), WorkloadOptions::WorkloadOptions(const WorkloadOptions &other) : max_latency(other.max_latency), report_interval(other.report_interval), - run_time(other.run_time), sample_interval(other.sample_interval), + run_time(other.run_time), sample_interval_ms(other.sample_interval_ms), sample_rate(other.sample_rate), _options(other._options) {} WorkloadOptions::~WorkloadOptions() {} @@ -1754,7 +1819,7 @@ int WorkloadRunner::run(WT_CONNECTION *conn) { std::ofstream report_out; _wt_home = conn->get_home(conn); - if (options->sample_interval > 0 && options->sample_rate <= 0) + if (options->sample_interval_ms > 0 && options->sample_rate <= 0) THROW("Workload.options.sample_rate must be positive"); if (!options->report_file.empty()) { open_report_file(report_out, options->report_file.c_str(), @@ -1844,7 +1909,7 @@ void WorkloadRunner::final_report(timespec &totalsecs) { Stats *stats = &_workload->stats; stats->clear(); - stats->track_latency(_workload->options.sample_interval > 0); + stats->track_latency(_workload->options.sample_interval_ms > 0); get_stats(stats); stats->final_report(out, totalsecs); @@ -1869,13 +1934,8 @@ int WorkloadRunner::run_all() { counts.report(out); out << std::endl; - workgen_epoch(&_start); - timespec end = _start + options->run_time; - timespec next_report = _start + - ((options->warmup > 0) ? options->warmup : options->report_interval); - // Start all threads - if (options->sample_interval > 0) { + if (options->sample_interval_ms > 0) { open_report_file(monitor_out, "monitor", "monitor output file"); monitor._out = &monitor_out; @@ -1909,9 +1969,23 @@ int WorkloadRunner::run_all() { return (ret); } thread_handles.push_back(thandle); + } + + // Treat warmup separately from report interval so that if we have a + // warmup period we clear and ignore stats after it ends. + if (options->warmup != 0) + sleep((unsigned int)options->warmup); + + // Clear stats after any warmup period completes. + for (size_t i = 0; i < _trunners.size(); i++) { + ThreadRunner *runner = &_trunners[i]; runner->_stats.clear(); } + workgen_epoch(&_start); + timespec end = _start + options->run_time; + timespec next_report = _start + options->report_interval; + // Let the test run, reporting as needed. Stats curstats(false); timespec now = _start; @@ -1941,7 +2015,7 @@ int WorkloadRunner::run_all() { if (options->run_time != 0) for (size_t i = 0; i < _trunners.size(); i++) _trunners[i]._stop = true; - if (options->sample_interval > 0) + if (options->sample_interval_ms > 0) monitor._stop = true; // wait for all threads @@ -1958,7 +2032,7 @@ int WorkloadRunner::run_all() { } workgen_epoch(&now); - if (options->sample_interval > 0) { + if (options->sample_interval_ms > 0) { WT_TRET(pthread_join(monitor._handle, &status)); if (monitor._errno != 0) std::cerr << "Monitor thread has errno " << monitor._errno diff --git a/src/third_party/wiredtiger/bench/workgen/workgen.h b/src/third_party/wiredtiger/bench/workgen/workgen.h index cc93409b388..ec825e0a193 100644 --- a/src/third_party/wiredtiger/bench/workgen/workgen.h +++ b/src/third_party/wiredtiger/bench/workgen/workgen.h @@ -86,6 +86,7 @@ struct Track { uint64_t ops_in_progress; // Total operations not completed */ uint64_t ops; // Total operations completed */ + uint64_t rollbacks; // Total operations rolled back */ uint64_t latency_ops; // Total ops sampled for latency uint64_t latency; // Total latency */ uint64_t bucket_ops; // Computed for percentile_latency @@ -282,8 +283,8 @@ struct Value { struct Operation { enum OpType { - OP_CHECKPOINT, OP_INSERT, OP_NONE, OP_NOOP, OP_REMOVE, OP_SEARCH, - OP_SLEEP, OP_UPDATE }; + OP_CHECKPOINT, OP_INSERT, OP_LOG_FLUSH, OP_NONE, OP_NOOP, + OP_REMOVE, OP_SEARCH, OP_SLEEP, OP_UPDATE }; OpType _optype; OperationInternal *_internal; @@ -401,7 +402,7 @@ struct WorkloadOptions { std::string report_file; int report_interval; int run_time; - int sample_interval; + int sample_interval_ms; int sample_rate; std::string sample_file; int warmup; diff --git a/src/third_party/wiredtiger/bench/workgen/workgen_int.h b/src/third_party/wiredtiger/bench/workgen/workgen_int.h index dbcde8472b5..95cdef4fdab 100644 --- a/src/third_party/wiredtiger/bench/workgen/workgen_int.h +++ b/src/third_party/wiredtiger/bench/workgen/workgen_int.h @@ -183,14 +183,22 @@ struct OperationInternal { OperationInternal() : _flags(0) {} OperationInternal(const OperationInternal &other) : _flags(other._flags) {} virtual ~OperationInternal() {} - virtual void parse_config(const std::string &config) {} + virtual void parse_config(const std::string &config) { (void)config; } virtual int run(ThreadRunner *runner, WT_SESSION *session) { (void)runner; (void)session; return (0); } }; struct CheckpointOperationInternal : OperationInternal { CheckpointOperationInternal() : OperationInternal() {} - CheckpointOperationInternal(const CheckpointOperationInternal &other) {} + CheckpointOperationInternal(const CheckpointOperationInternal &other) : + OperationInternal(other) {} + virtual int run(ThreadRunner *runner, WT_SESSION *session); +}; + +struct LogFlushOperationInternal : OperationInternal { + LogFlushOperationInternal() : OperationInternal() {} + LogFlushOperationInternal(const LogFlushOperationInternal &other) : + OperationInternal(other) {} virtual int run(ThreadRunner *runner, WT_SESSION *session); }; @@ -203,6 +211,7 @@ struct TableOperationInternal : OperationInternal { TableOperationInternal() : OperationInternal(), _keysize(0), _valuesize(0), _keymax(0),_valuemax(0) {} TableOperationInternal(const TableOperationInternal &other) : + OperationInternal(other), _keysize(other._keysize), _valuesize(other._valuesize), _keymax(other._keymax), _valuemax(other._valuemax) {} virtual void parse_config(const std::string &config); @@ -213,7 +222,7 @@ struct SleepOperationInternal : OperationInternal { SleepOperationInternal() : OperationInternal(), _sleepvalue(0) {} SleepOperationInternal(const SleepOperationInternal &other) : - _sleepvalue(other._sleepvalue) {} + OperationInternal(other),_sleepvalue(other._sleepvalue) {} virtual void parse_config(const std::string &config); virtual int run(ThreadRunner *runner, WT_SESSION *session); }; diff --git a/src/third_party/wiredtiger/bench/workgen/wtperf.py b/src/third_party/wiredtiger/bench/workgen/wtperf.py index b059b31f8db..84ae126feac 100755 --- a/src/third_party/wiredtiger/bench/workgen/wtperf.py +++ b/src/third_party/wiredtiger/bench/workgen/wtperf.py @@ -77,14 +77,15 @@ class Translator: raise TranslateException(errtype) supported_opt_list = [ 'checkpoint_interval', 'checkpoint_threads', - 'close_conn', 'compact', 'compression', - 'conn_config', 'create', 'icount', + 'close_conn', 'compact', 'compressibility', + 'compression', 'conn_config', 'create', 'icount', 'key_sz', 'log_like_table', 'pareto', 'populate_ops_per_txn', 'populate_threads', 'random_range', 'random_value', 'range_partition', 'readonly', 'reopen_connection', 'run_ops', - 'sess_config', 'table_config', 'table_count', - 'threads', 'transaction_config', 'value_sz' ] + 'sample_interval', 'sess_config', 'table_config', + 'table_count', 'threads', 'transaction_config', + 'value_sz' ] def set_opt(self, optname, val): if optname not in self.supported_opt_list: @@ -125,6 +126,17 @@ class Translator: setattr(self.options, optname, v) return v + # Convert a time value, by default a number of seconds, that can be + # modified to microseconds using 'ms' as a suffix. + def get_intms_opt(self, optname, wtperf_optname, dfault): + s = str(self._get_opt(wtperf_optname, str(dfault))) + if s.endswith('ms'): + v = int(s[:-2]) + else: + v = 1000 * int(s) + setattr(self.options, optname, v) + return v + def get_boolean_opt(self, optname, dfault): v = not not self._get_opt(optname, dfault) setattr(self.options, optname, v) @@ -230,10 +242,19 @@ class Translator: checkpoint_interval = self.get_int_opt('checkpoint_interval', 120) run_ops = self.get_int_opt('run_ops', -1) if log_like_table: + tdecls += '# Log like file, requires that logging be enabled ' + \ + 'in the connection config.\n' tdecls += 'log_name = "table:log"\n' - tdecls += 's.create(log_name, "key_format=S,value_format=S," +' + \ - ' compress_table_config)\n' - tdecls += 'log_table = Table(log_name)\n\n' + tdecls += 's.create(log_name, wtperf_table_config +' \ + ' "key_format=S,value_format=S," +' + \ + ' compress_table_config + table_config +' \ + ' ",log=(enabled=true)")\n' + tdecls += 'log_table = Table(log_name)\n' + if opts.compressibility != 100: + tdecls += 'log_table.options.value_compressibility = ' + \ + str(opts.compressibility) + '\n' + tdecls += '\n' + thread_count = 0 tnames = '' multi = (table_count > 1) @@ -331,6 +352,15 @@ class Translator: tnames += str(checkpoint_threads) + ' * ' tnames += thread_name + ' + ' + if log_like_table: + thread_name = 'logging_thread' + + tdecls += 'ops = Operation(Operation.OP_SLEEP, "0.1") + \\\n' + \ + ' Operation(Operation.OP_LOG_FLUSH, "")\n' + tdecls += thread_name + ' = Thread(ops)\n' + tdecls += '\n' + tnames += thread_name + ' + ' + tnames = tnames.rstrip(' +') return (tdecls, tnames) @@ -365,11 +395,11 @@ class Translator: s += 'tables = []\n' s += 'table_count = ' + str(opts.table_count) + '\n' if opts.table_count == 1: - s += 'tname = "table:test.wt"\n' + s += 'tname = "table:test"\n' indent = '' else: s += 'for i in range(0, table_count):\n' - s += ' tname = "table:test" + str(i) + ".wt"\n' + s += ' tname = "table:test" + str(i)\n' indent = ' ' s += indent + 'table = Table(tname)\n' @@ -383,6 +413,9 @@ class Translator: # In wtperf, the icount plus random_range is the key range table_range = (opts.random_range + opts.icount) / opts.table_count s += indent + 'table.options.range = ' + str(table_range) + '\n' + if opts.compressibility != 100: + s += indent + 'table.options.value_compressibility = ' + \ + str(opts.compressibility) + '\n' s += indent + 'tables.append(table)\n' return s @@ -482,7 +515,7 @@ class Translator: continue (key, val) = self.split_assign(line) if key in [ 'max_latency', 'report_file', 'report_interval', - 'run_time', 'sample_interval', 'sample_rate', + 'run_time', 'sample_rate', 'warmup' ]: workloadopts += 'workload.options.' + key + '=' + val + '\n' else: @@ -495,6 +528,8 @@ class Translator: readonly = self.get_boolean_opt('readonly', False) close_conn = self.get_boolean_opt('close_conn', True) compression = self.get_string_opt('compression', '') + self.get_intms_opt('sample_interval_ms', 'sample_interval', 0) + self.get_int_opt('compressibility', 100) self.get_int_opt('table_count', 1) self.get_string_opt('table_config', '') self.get_int_opt('key_sz', 20) @@ -517,6 +552,10 @@ class Translator: self.fatal_error('random_range and multiple tables without ' + \ 'range_partition is not supported') + if self.options.sample_interval_ms != 0: + workloadopts += 'workload.options.sample_interval_ms = ' + \ + str(self.options.sample_interval_ms) + '\n' + s = '#/usr/bin/env python\n' s += '# generated from ' + self.filename + '\n' s += self.prefix @@ -554,8 +593,11 @@ class Translator: if conn_config != '': s += 'conn_config += ",' + conn_config + '" # explicitly added\n' if compression != '': - s += 'conn_config += extensions_config(["compressors/' + \ - compression + '"])\n' + # We require WiredTiger to be configured with snappy built-in, + # so do not add snappy to the list of extensions to be loaded. + if compression != 'snappy': + s += 'conn_config += extensions_config(["compressors/' + \ + compression + '"])\n' compression = 'block_compressor=' + compression + ',' s += 'conn = wiredtiger_open("' + self.homedir + \ '", "create," + conn_config)\n' @@ -581,6 +623,7 @@ class Translator: s += '\n' s += 'workload = Workload(context, ' + t_var + ')\n' s += workloadopts + if self.verbose > 0: s += 'print("workload:")\n' s += 'workload.run(conn)\n\n' diff --git a/src/third_party/wiredtiger/bench/wtperf/runners/checkpoint-latency.wtperf b/src/third_party/wiredtiger/bench/wtperf/runners/checkpoint-latency-0.wtperf index 80a579cc818..80a579cc818 100644 --- a/src/third_party/wiredtiger/bench/wtperf/runners/checkpoint-latency.wtperf +++ b/src/third_party/wiredtiger/bench/wtperf/runners/checkpoint-latency-0.wtperf diff --git a/src/third_party/wiredtiger/bench/wtperf/runners/checkpoint-latency-1.wtperf b/src/third_party/wiredtiger/bench/wtperf/runners/checkpoint-latency-1.wtperf new file mode 100644 index 00000000000..ca69df1d129 --- /dev/null +++ b/src/third_party/wiredtiger/bench/wtperf/runners/checkpoint-latency-1.wtperf @@ -0,0 +1,38 @@ +# A stress configuration to create checkpoints while doing a mix of inserts +# and reads. +conn_config="cache_size=2GB,eviction=(threads_max=8),log=(enabled=true),session_max=250,statistics=(fast),statistics_log=(wait=1,json)" +# Logging is off for regular tables. The log_like file has logging enabled. +table_config="memory_page_max=10m,leaf_value_max=64MB,checksum=on,split_pct=90,type=file,log=(enabled=false)" +checkpoint_interval=60 +checkpoint_threads=1 +# Compressibility is an option that requires workgen +compressibility=50 +compression="snappy" +create=true +close_conn=false +# 4m records sized 5k = 20G or 10x cache size. +icount=4000000 +log_like_table=true +populate_threads=4 +report_interval=1 +# Run for a longer duration to ensure checkpoints are completing. +run_time=1200 +sample_interval=500ms +sample_rate=1 +# MongoDB always has multiple tables, and checkpoints behave differently when +# there is more than a single table. +table_count=100 +# We are using a mix of 4:1 read vs write operations, and trying to reach +# a total throughput of about 2.5 Gigabytes a sec. +# Updates have a write amplification of 3x, reads have no amplification. +# Write records/sec = 700[throttle] * 100[thread count] * 3[amp] = 210,000 +# Read records/sec = 2800[throttle] * 100[thread count] * 1[amp] = 280,000 +# 490,000 * 5000[bytes/record] = 2.45 Gigabytes a sec. +threads=((count=100,updates=1,throttle=700),(count=100,reads=1,throttle=2800)) +# We've done all our calculations based on a 5K record size. But we have +# compression on, and there is also the factor of any additional btree +# overhead. Experimently, we've observed that workgen records sized as below +# end up with a disk footprint close to 5K, at least in btree data files. +value_sz=7000 +# Wait for the throughput to stabilize +warmup=120 diff --git a/src/third_party/wiredtiger/bench/wtperf/wtperf.c b/src/third_party/wiredtiger/bench/wtperf/wtperf.c index 047ce549746..5390c2b3f73 100644 --- a/src/third_party/wiredtiger/bench/wtperf/wtperf.c +++ b/src/third_party/wiredtiger/bench/wtperf/wtperf.c @@ -809,8 +809,26 @@ op_err: if (ret == WT_ROLLBACK && ops_per_txn != 0) { log_table_cursor, value_buf); if ((ret = log_table_cursor->insert(log_table_cursor)) != 0) { - lprintf(wtperf, ret, 0, "Cursor insert failed"); - goto err; + lprintf(wtperf, ret, 1, "Cursor insert failed"); + if (ret == WT_ROLLBACK && ops_per_txn == 0) { + lprintf(wtperf, ret, 1, + "log-table: ROLLBACK"); + if ((ret = + session->rollback_transaction( + session, NULL)) != 0) { + lprintf(wtperf, ret, 0, "Failed" + " rollback_transaction"); + goto err; + } + if ((ret = session->begin_transaction( + session, NULL)) != 0) { + lprintf(wtperf, ret, 0, + "Worker begin " + "transaction failed"); + goto err; + } + } else + goto err; } } @@ -1256,7 +1274,7 @@ monitor(void *arg) struct timespec t; struct tm localt; CONFIG_OPTS *opts; - FILE *fp; + FILE *fp, *jfp; WTPERF *wtperf; size_t len; uint64_t min_thr, reads, inserts, updates; @@ -1267,15 +1285,18 @@ monitor(void *arg) uint32_t update_avg, update_min, update_max; uint32_t latency_max, level; u_int i; + size_t buf_size; int msg_err; const char *str; char buf[64], *path; + bool first; wtperf = (WTPERF *)arg; opts = wtperf->opts; assert(opts->sample_interval != 0); - fp = NULL; + fp = jfp = NULL; + first = true; path = NULL; min_thr = (uint64_t)opts->min_throughput; @@ -1290,8 +1311,15 @@ monitor(void *arg) lprintf(wtperf, errno, 0, "%s", path); goto err; } + testutil_check(__wt_snprintf( + path, len, "%s/monitor.json", wtperf->monitor_dir)); + if ((jfp = fopen(path, "w")) == NULL) { + lprintf(wtperf, errno, 0, "%s", path); + goto err; + } /* Set line buffering for monitor file. */ __wt_stream_set_line_buffer(fp); + __wt_stream_set_line_buffer(jfp); fprintf(fp, "#time," "totalsec," @@ -1361,6 +1389,43 @@ monitor(void *arg) read_avg, read_min, read_max, insert_avg, insert_min, insert_max, update_avg, update_min, update_max); + if (jfp != NULL) { + buf_size = strftime(buf, + sizeof(buf), "%Y-%m-%dT%H:%M:%S", &localt); + testutil_assert(buf_size != 0); + testutil_check(__wt_snprintf(&buf[buf_size], + sizeof(buf) - buf_size, + ".%3.3" PRIu64 "Z", + ns_to_ms((uint64_t)t.tv_nsec))); + (void)fprintf(jfp, "{"); + if (first) { + (void)fprintf(jfp, "\"version\":\"%s\",", + WIREDTIGER_VERSION_STRING); + first = false; + } + (void)fprintf(jfp, + "\"localTime\":\"%s\",\"wtperf\":{", buf); + /* Note does not have initial comma before "read" */ + (void)fprintf(jfp, + "\"read\":{\"ops per sec\":%" PRIu64 + ",\"average latency\":%" PRIu32 + ",\"min latency\":%" PRIu32 + ",\"max latency\":%" PRIu32 "}", + cur_reads, read_avg, read_min, read_max); + (void)fprintf(jfp, + ",\"insert\":{\"ops per sec\":%" PRIu64 + ",\"average latency\":%" PRIu32 + ",\"min latency\":%" PRIu32 + ",\"max latency\":%" PRIu32 "}", + cur_inserts, insert_avg, insert_min, insert_max); + (void)fprintf(jfp, + ",\"update\":{\"ops per sec\":%" PRIu64 + ",\"average latency\":%" PRIu32 + ",\"min latency\":%" PRIu32 + ",\"max latency\":%" PRIu32 "}", + cur_updates, update_avg, update_min, update_max); + fprintf(jfp, "}}\n"); + } if (latency_max != 0 && (read_max > latency_max || insert_max > latency_max || @@ -1411,6 +1476,8 @@ err: wtperf->error = wtperf->stop = true; if (fp != NULL) (void)fclose(fp); + if (jfp != NULL) + (void)fclose(jfp); free(path); return (WT_THREAD_RET_VALUE); diff --git a/src/third_party/wiredtiger/dist/dist.py b/src/third_party/wiredtiger/dist/dist.py index 7fe473c3abd..bd3f1b2b7e9 100644 --- a/src/third_party/wiredtiger/dist/dist.py +++ b/src/third_party/wiredtiger/dist/dist.py @@ -1,4 +1,4 @@ -import filecmp, glob, os, re, shutil +import filecmp, fnmatch, glob, os, re, shutil # source_files -- # Return a list of the WiredTiger source file names. @@ -19,10 +19,12 @@ def all_c_files(): file_re = re.compile(r'^\w') for line in glob.iglob('../src/*/*.[ci]'): yield line - for line in glob.iglob('../test/*/*.[ci]'): - yield line - for line in glob.iglob('../test/*/*/*.[ci]'): - yield line + files = list() + for (dirpath, dirnames, filenames) in os.walk('../test'): + files += [os.path.join(dirpath, file) for file in filenames] + for file in files: + if fnmatch.fnmatch(file, '*.[ci]'): + yield file # all_h_files -- # Return list of all WiredTiger C include file names. @@ -31,6 +33,12 @@ def all_h_files(): for line in glob.iglob('../src/*/*.h'): yield line yield "../src/include/wiredtiger.in" + files = list() + for (dirpath, dirnames, filenames) in os.walk('../test'): + files += [os.path.join(dirpath, file) for file in filenames] + for file in files: + if fnmatch.fnmatch(file, '*.h'): + yield file # source_dirs -- # Return a list of the WiredTiger source directory names. diff --git a/src/third_party/wiredtiger/dist/function.py b/src/third_party/wiredtiger/dist/function.py index 69ebd4748dc..446f16dc47f 100644 --- a/src/third_party/wiredtiger/dist/function.py +++ b/src/third_party/wiredtiger/dist/function.py @@ -44,12 +44,23 @@ types = [ 'struct', 'union', 'enum', + 'DIR', + 'FILE', 'TEST_', 'WT_', 'wt_', 'double', 'float', + 'intmax_t', + 'intptr_t', + 'pid_t', 'size_t', + 'ssize_t', + 'time_t', + 'uintmax_t', + 'uintptr_t', + 'u_long', + 'long', 'uint64_t', 'int64_t', 'uint32_t', diff --git a/src/third_party/wiredtiger/dist/stat_data.py b/src/third_party/wiredtiger/dist/stat_data.py index 13b1675550e..d6c89c1af70 100644 --- a/src/third_party/wiredtiger/dist/stat_data.py +++ b/src/third_party/wiredtiger/dist/stat_data.py @@ -291,7 +291,8 @@ connection_stats = [ ########################################## # Cursor operations ########################################## - CursorStat('cursor_cache', 'cursors cached on close'), + CursorStat('cursors_cached', 'cursors currently cached', 'no_clear,no_scale'), + CursorStat('cursor_cache', 'cursor close calls that result in cache'), CursorStat('cursor_create', 'cursor create calls'), CursorStat('cursor_insert', 'cursor insert calls'), CursorStat('cursor_modify', 'cursor modify calls'), @@ -694,7 +695,7 @@ dsrc_stats = [ ########################################## # Cursor operations ########################################## - CursorStat('cursor_cache', 'cursors cached on close'), + CursorStat('cursor_cache', 'close calls that result in cache'), CursorStat('cursor_create', 'create calls'), CursorStat('cursor_insert', 'insert calls'), CursorStat('cursor_insert_bulk', 'bulk-loaded cursor-insert calls'), @@ -752,7 +753,7 @@ dsrc_stats = [ # Session operations ########################################## SessionStat('session_compact', 'object compaction'), - SessionStat('session_cursor_cached', 'cached cursor count', 'no_clear,no_scale'), + SessionStat('session_cursors_cached', 'cached cursor count', 'no_clear,no_scale'), SessionStat('session_cursor_open', 'open cursor count', 'no_clear,no_scale'), ########################################## diff --git a/src/third_party/wiredtiger/examples/c/ex_all.c b/src/third_party/wiredtiger/examples/c/ex_all.c index 190c2c421d3..6b2976f11c3 100644 --- a/src/third_party/wiredtiger/examples/c/ex_all.c +++ b/src/third_party/wiredtiger/examples/c/ex_all.c @@ -331,6 +331,8 @@ cursor_ops(WT_SESSION *session) error_check(cursor->insert(cursor)); } + /* Modify requires an explicit transaction. */ + error_check(session->begin_transaction(session, NULL)); { /*! [Modify an existing record] */ WT_MODIFY entries[3]; @@ -361,6 +363,7 @@ cursor_ops(WT_SESSION *session) error_check(cursor->modify(cursor, entries, 3)); /*! [Modify an existing record] */ } + error_check(session->commit_transaction(session, NULL)); { /*! [Update an existing record or insert a new record] */ diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 95368dec07d..bd7309a1a52 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -1,5 +1,5 @@ { - "commit": "231a81ea33bf2ecfb084099ff9af434548d15d54", + "commit": "2ee0f0f4bbfdc7133ec87986006be17a7494aa08", "github": "wiredtiger/wiredtiger.git", "vendor": "wiredtiger", "branch": "mongodb-4.0" diff --git a/src/third_party/wiredtiger/src/block/block_addr.c b/src/third_party/wiredtiger/src/block/block_addr.c index 2ead0e229bc..a2016a22b07 100644 --- a/src/third_party/wiredtiger/src/block/block_addr.c +++ b/src/third_party/wiredtiger/src/block/block_addr.c @@ -108,8 +108,8 @@ __wt_block_addr_invalid(WT_SESSION_IMPL *session, * In diagnostic mode, verify the address isn't on the available list, * or for live systems, the discard list. */ - WT_RET(__wt_block_misplaced( - session, block, "addr-valid", offset, size, live)); + WT_RET(__wt_block_misplaced(session, + block, "addr-valid", offset, size, live, __func__, __LINE__)); #endif /* Check if the address is past the end of the file. */ diff --git a/src/third_party/wiredtiger/src/block/block_ext.c b/src/third_party/wiredtiger/src/block/block_ext.c index a7b55985fa1..8dbf843b4b3 100644 --- a/src/third_party/wiredtiger/src/block/block_ext.c +++ b/src/third_party/wiredtiger/src/block/block_ext.c @@ -272,8 +272,9 @@ __block_off_match(WT_EXTLIST *el, wt_off_t off, wt_off_t size) * Complain if a block appears on the available or discard lists. */ int -__wt_block_misplaced(WT_SESSION_IMPL *session, - WT_BLOCK *block, const char *tag, wt_off_t offset, uint32_t size, bool live) +__wt_block_misplaced( + WT_SESSION_IMPL *session, WT_BLOCK *block, const char *list, + wt_off_t offset, uint32_t size, bool live, const char *func, int line) { const char *name; @@ -308,8 +309,9 @@ __wt_block_misplaced(WT_SESSION_IMPL *session, __wt_spin_unlock(session, &block->live_lock); if (name != NULL) { __wt_errx(session, - "%s failed: %" PRIuMAX "/%" PRIu32 " is on the %s list", - tag, (uintmax_t)offset, size, name); + "%s failed: %" PRIuMAX "/%" PRIu32 " is on the %s list " + "(%s, %d)", + list, (uintmax_t)offset, size, name, func, line); return (__wt_panic(session)); } return (0); @@ -604,8 +606,8 @@ __wt_block_free(WT_SESSION_IMPL *session, "free %" PRIdMAX "/%" PRIdMAX, (intmax_t)offset, (intmax_t)size); #ifdef HAVE_DIAGNOSTIC - WT_RET( - __wt_block_misplaced(session, block, "free", offset, size, true)); + WT_RET(__wt_block_misplaced( + session, block, "free", offset, size, true, __func__, __LINE__)); #endif WT_RET(__wt_block_ext_prealloc(session, 5)); __wt_spin_lock(session, &block->live_lock); diff --git a/src/third_party/wiredtiger/src/block/block_read.c b/src/third_party/wiredtiger/src/block/block_read.c index e43d3b34f66..c022100fa47 100644 --- a/src/third_party/wiredtiger/src/block/block_read.c +++ b/src/third_party/wiredtiger/src/block/block_read.c @@ -94,8 +94,8 @@ __wt_bm_read(WT_BM *bm, WT_SESSION_IMPL *session, * In diagnostic mode, verify the block we're about to read isn't on * the available list, or for live systems, the discard list. */ - WT_RET(__wt_block_misplaced( - session, block, "read", offset, size, bm->is_live)); + WT_RET(__wt_block_misplaced(session, + block, "read", offset, size, bm->is_live, __func__, __LINE__)); #endif /* Read the block. */ WT_RET( @@ -298,6 +298,5 @@ __wt_block_read_off(WT_SESSION_IMPL *session, WT_BLOCK *block, F_SET(S2C(session), WT_CONN_DATA_CORRUPTION); if (block->verify || F_ISSET(session, WT_SESSION_QUIET_CORRUPT_FILE)) return (WT_ERROR); - WT_PANIC_RET( - session, WT_ERROR, "%s: fatal read error", block->name); + WT_PANIC_RET(session, WT_ERROR, "%s: fatal read error", block->name); } diff --git a/src/third_party/wiredtiger/src/btree/bt_curnext.c b/src/third_party/wiredtiger/src/btree/bt_curnext.c index c9cccc63bf6..f5797888d6b 100644 --- a/src/third_party/wiredtiger/src/btree/bt_curnext.c +++ b/src/third_party/wiredtiger/src/btree/bt_curnext.c @@ -595,26 +595,35 @@ __wt_btcur_next(WT_CURSOR_BTREE *cbt, bool truncating) F_CLR(cursor, WT_CURSTD_KEY_SET | WT_CURSTD_VALUE_SET); /* - * In case of retrying a next operation due to a prepare conflict, - * cursor would have been already positioned at an update structure - * which resulted in conflict. So, now when retrying we should examine - * the same update again instead of starting from the next one in the - * update chain. + * When retrying an operation due to a prepare conflict, the cursor is + * is at an update list which resulted in conflict. So, when retrying + * we should examine the same update again instead of iterating to the + * next object. We'll eventually find a valid update, return prepare- + * conflict until successful. */ F_CLR(cbt, WT_CBT_RETRY_PREV); if (F_ISSET(cbt, WT_CBT_RETRY_NEXT)) { - WT_RET(__wt_cursor_valid(cbt, &upd, &valid)); + WT_ERR(__wt_cursor_valid(cbt, &upd, &valid)); + if (!valid) + WT_ERR(WT_PREPARE_CONFLICT); + + /* The update that returned prepared conflict is now visible. */ F_CLR(cbt, WT_CBT_RETRY_NEXT); - if (valid) { - /* - * If the update, which returned prepared conflict is - * visible, return the value. - */ - return (__cursor_kv_return(session, cbt, upd)); - } + + /* + * The underlying key-return function uses a comparison value + * of 0 to indicate the search function has pre-built the key + * we want to return. That's not the case, don't take that path. + */ + cbt->compare = 1; + WT_ERR(__cursor_kv_return(session, cbt, upd)); +#ifdef HAVE_DIAGNOSTIC + WT_ERR(__wt_cursor_key_order_check(session, cbt, true)); +#endif + return (0); } - WT_RET(__cursor_func_init(cbt, false)); + WT_ERR(__cursor_func_init(cbt, false)); /* * If we aren't already iterating in the right direction, there's @@ -696,13 +705,13 @@ __wt_btcur_next(WT_CURSOR_BTREE *cbt, bool truncating) WT_ERR(__wt_tree_walk(session, &cbt->ref, flags)); WT_ERR_TEST(cbt->ref == NULL, WT_NOTFOUND); } -#ifdef HAVE_DIAGNOSTIC - if (ret == 0) - WT_ERR(__wt_cursor_key_order_check(session, cbt, true)); -#endif + err: switch (ret) { case 0: F_SET(cursor, WT_CURSTD_KEY_INT | WT_CURSTD_VALUE_INT); +#ifdef HAVE_DIAGNOSTIC + ret = __wt_cursor_key_order_check(session, cbt, true); +#endif break; case WT_PREPARE_CONFLICT: /* diff --git a/src/third_party/wiredtiger/src/btree/bt_curprev.c b/src/third_party/wiredtiger/src/btree/bt_curprev.c index f72b935c441..75f25ee874d 100644 --- a/src/third_party/wiredtiger/src/btree/bt_curprev.c +++ b/src/third_party/wiredtiger/src/btree/bt_curprev.c @@ -549,26 +549,37 @@ __wt_btcur_prev(WT_CURSOR_BTREE *cbt, bool truncating) F_CLR(cursor, WT_CURSTD_KEY_SET | WT_CURSTD_VALUE_SET); /* - * In case of retrying a prev operation due to a prepare conflict, - * cursor would have been already positioned at an update structure - * which resulted in conflict. So, now when retrying we should examine - * the same update again instead of starting from the next one in the - * update chain. + * When retrying an operation due to a prepare conflict, the cursor is + * is at an update list which resulted in conflict. So, when retrying + * we should examine the same update again instead of iterating to the + * next object. We'll eventually find a valid update, return prepare- + * conflict until successful. */ F_CLR(cbt, WT_CBT_RETRY_NEXT); if (F_ISSET(cbt, WT_CBT_RETRY_PREV)) { - WT_RET(__wt_cursor_valid(cbt, &upd, &valid)); + WT_ERR(__wt_cursor_valid(cbt, &upd, &valid)); + if (!valid) + WT_ERR(WT_PREPARE_CONFLICT); + + /* The update that returned prepared conflict is now visible. */ F_CLR(cbt, WT_CBT_RETRY_PREV); - if (valid) { - /* - * If the update, which returned prepared conflict is - * visible, return the value. - */ - return (__cursor_kv_return(session, cbt, upd)); - } + + /* + * The update that returned prepared conflict is now visible. + * + * The underlying key-return function uses a comparison value + * of 0 to indicate the search function has pre-built the key + * we want to return. That's not the case, don't take that path. + */ + cbt->compare = 1; + WT_ERR(__cursor_kv_return(session, cbt, upd)); +#ifdef HAVE_DIAGNOSTIC + WT_ERR(__wt_cursor_key_order_check(session, cbt, false)); +#endif + return (0); } - WT_RET(__cursor_func_init(cbt, false)); + WT_ERR(__cursor_func_init(cbt, false)); /* * If we aren't already iterating in the right direction, there's @@ -651,13 +662,13 @@ __wt_btcur_prev(WT_CURSOR_BTREE *cbt, bool truncating) WT_ERR(__wt_tree_walk(session, &cbt->ref, flags)); WT_ERR_TEST(cbt->ref == NULL, WT_NOTFOUND); } -#ifdef HAVE_DIAGNOSTIC - if (ret == 0) - WT_ERR(__wt_cursor_key_order_check(session, cbt, false)); -#endif + err: switch (ret) { case 0: F_SET(cursor, WT_CURSTD_KEY_INT | WT_CURSTD_VALUE_INT); +#ifdef HAVE_DIAGNOSTIC + ret = __wt_cursor_key_order_check(session, cbt, false); +#endif break; case WT_PREPARE_CONFLICT: /* diff --git a/src/third_party/wiredtiger/src/btree/bt_random.c b/src/third_party/wiredtiger/src/btree/bt_random.c index ed68513b245..de62622d8d0 100644 --- a/src/third_party/wiredtiger/src/btree/bt_random.c +++ b/src/third_party/wiredtiger/src/btree/bt_random.c @@ -427,10 +427,9 @@ random_page_entry: */ WT_ERR(__wt_row_random_leaf(session, cbt)); WT_ERR(__wt_cursor_valid(cbt, &upd, &valid)); - if (valid) { - WT_ERR(__wt_key_return(session, cbt)); - WT_ERR(__wt_value_return(session, cbt, upd)); - } else { + if (valid) + WT_ERR(__cursor_kv_return(session, cbt, upd)); + else { if ((ret = __wt_btcur_next(cbt, false)) == WT_NOTFOUND) ret = __wt_btcur_prev(cbt, false); WT_ERR(ret); diff --git a/src/third_party/wiredtiger/src/btree/bt_split.c b/src/third_party/wiredtiger/src/btree/bt_split.c index aae22dfd271..2f2023917eb 100644 --- a/src/third_party/wiredtiger/src/btree/bt_split.c +++ b/src/third_party/wiredtiger/src/btree/bt_split.c @@ -336,9 +336,6 @@ __split_ref_prepare(WT_SESSION_IMPL *session, locked = NULL; - /* The newly created subtree is complete. */ - WT_WRITE_BARRIER(); - /* * Update the moved WT_REFs so threads moving through them start looking * at the created children's page index information. Because we've not @@ -529,8 +526,11 @@ __split_root(WT_SESSION_IMPL *session, WT_PAGE *root) WT_ASSERT(session, root_refp - pindex->index == (ptrdiff_t)pindex->entries); - /* Start making real changes to the tree, errors are fatal. */ - complete = WT_ERR_PANIC; + /* + * Flush our writes and start making real changes to the tree, errors + * are fatal. + */ + WT_PUBLISH(complete, WT_ERR_PANIC); /* Prepare the WT_REFs for the move. */ WT_ERR(__split_ref_prepare(session, alloc_index, &locked, false)); @@ -1094,8 +1094,11 @@ __split_internal(WT_SESSION_IMPL *session, WT_PAGE *parent, WT_PAGE *page) WT_ASSERT(session, page_refp - pindex->index == (ptrdiff_t)pindex->entries); - /* Start making real changes to the tree, errors are fatal. */ - complete = WT_ERR_PANIC; + /* + * Flush our writes and start making real changes to the tree, errors + * are fatal. + */ + WT_PUBLISH(complete, WT_ERR_PANIC); /* Prepare the WT_REFs for the move. */ WT_ERR(__split_ref_prepare(session, alloc_index, &locked, true)); diff --git a/src/third_party/wiredtiger/src/cursor/cur_backup.c b/src/third_party/wiredtiger/src/cursor/cur_backup.c index 4b1dfbcb1c8..32021a6f7e2 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_backup.c +++ b/src/third_party/wiredtiger/src/cursor/cur_backup.c @@ -425,8 +425,16 @@ __backup_uri(WT_SESSION_IMPL *session, session, session->bkp_cursor, false)); } else { *log_only = false; - WT_ERR(__wt_schema_worker(session, + + /* + * If backing up individual tables, we have to include + * indexes, which may involve opening those indexes. + * Acquire the table lock in write mode for that case. + */ + WT_WITH_TABLE_WRITE_LOCK(session, + ret = __wt_schema_worker(session, uri, NULL, __backup_list_uri_append, cfg, 0)); + WT_ERR(ret); } } WT_ERR_NOTFOUND_OK(ret); diff --git a/src/third_party/wiredtiger/src/cursor/cur_std.c b/src/third_party/wiredtiger/src/cursor/cur_std.c index ba00a474f02..3217b55cfa4 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_std.c +++ b/src/third_party/wiredtiger/src/cursor/cur_std.c @@ -598,6 +598,10 @@ __wt_cursor_cache(WT_CURSOR *cursor, WT_DATA_HANDLE *dhandle) WT_TRET(cursor->reset(cursor)); + /* Don't keep buffers allocated for cached cursors. */ + __wt_buf_free(session, &cursor->key); + __wt_buf_free(session, &cursor->value); + /* * Acquire a reference while decrementing the in-use counter. * After this point, the dhandle may be marked dead, but the @@ -617,7 +621,8 @@ __wt_cursor_cache(WT_CURSOR *cursor, WT_DATA_HANDLE *dhandle) (void)__wt_atomic_sub32(&S2C(session)->open_cursor_count, 1); WT_STAT_DATA_DECR(session, session_cursor_open); - WT_STAT_DATA_INCR(session, session_cursor_cached); + WT_STAT_DATA_INCR(session, session_cursors_cached); + WT_STAT_CONN_INCR(session, cursors_cached); F_SET(cursor, WT_CURSTD_CACHED); return (ret); } @@ -642,7 +647,8 @@ __wt_cursor_reopen(WT_CURSOR *cursor, WT_DATA_HANDLE *dhandle) } (void)__wt_atomic_add32(&S2C(session)->open_cursor_count, 1); WT_STAT_DATA_INCR(session, session_cursor_open); - WT_STAT_DATA_DECR(session, session_cursor_cached); + WT_STAT_DATA_DECR(session, session_cursors_cached); + WT_STAT_CONN_DECR(session, cursors_cached); bucket = cursor->uri_hash % WT_HASH_ARRAY_SIZE; TAILQ_REMOVE(&session->cursor_cache[bucket], cursor, q); @@ -831,8 +837,7 @@ __wt_cursor_cache_get(WT_SESSION_IMPL *session, const char *uri, F_SET(cursor, WT_CURSTD_RAW); if (cbt) { - WT_RET(__wt_config_gets_def( - session, + WT_RET(__wt_config_gets_def(session, cfg, "read_once", 0, &cval)); if (cval.val != 0) F_SET(cbt, WT_CBT_READ_ONCE); diff --git a/src/third_party/wiredtiger/src/evict/evict_lru.c b/src/third_party/wiredtiger/src/evict/evict_lru.c index ff3772533ae..59b568aab5c 100644 --- a/src/third_party/wiredtiger/src/evict/evict_lru.c +++ b/src/third_party/wiredtiger/src/evict/evict_lru.c @@ -1923,8 +1923,8 @@ __evict_walk_tree(WT_SESSION_IMPL *session, __wt_cache_read_gen_new(session, page); /* Pages being forcibly evicted go on the urgent queue. */ - if (page->read_gen == WT_READGEN_OLDEST || - page->memory_footprint >= btree->splitmempage) { + if (modified && (page->read_gen == WT_READGEN_OLDEST || + page->memory_footprint >= btree->splitmempage)) { WT_STAT_CONN_INCR( session, cache_eviction_pages_queued_oldest); if (__wt_page_evict_urgent(session, ref)) @@ -2639,6 +2639,39 @@ __verbose_dump_cache_single(WT_SESSION_IMPL *session, } /* + * __verbose_dump_cache_apply -- + * Apply dumping cache for all the dhandles. + */ +static int +__verbose_dump_cache_apply(WT_SESSION_IMPL *session, + uint64_t *total_bytesp, uint64_t *total_dirty_bytesp) +{ + WT_CONNECTION_IMPL *conn; + WT_DATA_HANDLE *dhandle; + WT_DECL_RET; + + conn = S2C(session); + for (dhandle = NULL;;) { + WT_DHANDLE_NEXT(session, dhandle, &conn->dhqh, q); + if (dhandle == NULL) + break; + + /* Skip if the tree is marked discarded by another thread. */ + if (dhandle->type != WT_DHANDLE_TYPE_BTREE || + !F_ISSET(dhandle, WT_DHANDLE_OPEN) || + F_ISSET(dhandle, WT_DHANDLE_DISCARD)) + continue; + + WT_WITH_DHANDLE(session, dhandle, + ret = __verbose_dump_cache_single( + session, total_bytesp, total_dirty_bytesp)); + if (ret != 0) + WT_RET(ret); + } + return (0); +} + +/* * __wt_verbose_dump_cache -- * Output diagnostic information about the cache. */ @@ -2646,7 +2679,6 @@ int __wt_verbose_dump_cache(WT_SESSION_IMPL *session) { WT_CONNECTION_IMPL *conn; - WT_DATA_HANDLE *dhandle; WT_DECL_RET; double pct; uint64_t total_bytes, total_dirty_bytes; @@ -2668,21 +2700,9 @@ __wt_verbose_dump_cache(WT_SESSION_IMPL *session) WT_RET(__wt_msg(session, "cache dirty check: %s (%2.3f%%)", needed ? "yes" : "no", pct)); - for (dhandle = NULL;;) { - WT_WITH_HANDLE_LIST_READ_LOCK(session, - WT_DHANDLE_NEXT(session, dhandle, &conn->dhqh, q)); - if (dhandle == NULL) - break; - if (dhandle->type != WT_DHANDLE_TYPE_BTREE || - !F_ISSET(dhandle, WT_DHANDLE_OPEN)) - continue; - - WT_WITH_DHANDLE(session, dhandle, - ret = __verbose_dump_cache_single( - session, &total_bytes, &total_dirty_bytes)); - if (ret != 0) - break; - } + WT_WITH_HANDLE_LIST_READ_LOCK(session, + ret = __verbose_dump_cache_apply( + session, &total_bytes, &total_dirty_bytes)); WT_RET(ret); /* diff --git a/src/third_party/wiredtiger/src/evict/evict_page.c b/src/third_party/wiredtiger/src/evict/evict_page.c index 24056744401..05bda7b3b14 100644 --- a/src/third_party/wiredtiger/src/evict/evict_page.c +++ b/src/third_party/wiredtiger/src/evict/evict_page.c @@ -231,8 +231,7 @@ __wt_evict(WT_SESSION_IMPL *session, if (0) { err: if (!closing) - __evict_exclusive_clear( - session, ref, previous_state); + __evict_exclusive_clear(session, ref, previous_state); WT_STAT_CONN_INCR(session, cache_eviction_fail); WT_STAT_DATA_INCR(session, cache_eviction_fail); diff --git a/src/third_party/wiredtiger/src/include/api.h b/src/third_party/wiredtiger/src/include/api.h index 1c22c99a11c..f363d45efad 100644 --- a/src/third_party/wiredtiger/src/include/api.h +++ b/src/third_party/wiredtiger/src/include/api.h @@ -93,7 +93,7 @@ F_SET(&(s)->txn, WT_TXN_AUTOCOMMIT); \ __update = !F_ISSET(&(s)->txn, WT_TXN_UPDATE); \ if (__update) \ - F_SET(&(s)->txn, WT_TXN_UPDATE); \ + F_SET(&(s)->txn, WT_TXN_UPDATE); /* An API call wrapped in a transaction if necessary. */ #define TXN_API_CALL_NOCONF(s, h, n, dh) do { \ @@ -105,7 +105,7 @@ F_SET(&(s)->txn, WT_TXN_AUTOCOMMIT); \ __update = !F_ISSET(&(s)->txn, WT_TXN_UPDATE); \ if (__update) \ - F_SET(&(s)->txn, WT_TXN_UPDATE); \ + F_SET(&(s)->txn, WT_TXN_UPDATE); /* End a transactional API call, optional retry on deadlock. */ #define TXN_API_END_RETRY(s, ret, retry) \ diff --git a/src/third_party/wiredtiger/src/include/btmem.h b/src/third_party/wiredtiger/src/include/btmem.h index c6f9aa2aa07..65ec0b3b816 100644 --- a/src/third_party/wiredtiger/src/include/btmem.h +++ b/src/third_party/wiredtiger/src/include/btmem.h @@ -857,29 +857,6 @@ struct __wt_ref { #define WT_REF_SPLIT 7 /* Parent page split (WT_REF dead) */ volatile uint32_t state; /* Page state */ -#ifdef HAVE_DIAGNOSTIC - /* Capture history of ref state changes. */ - struct { - WT_SESSION_IMPL *session; - const char *name; - const char *file; - int line; - uint32_t state; - } hist[3]; - int histoff; -#define WT_REF_SET_STATE(ref, s) do { \ - ref->hist[ref->histoff].session = session; \ - ref->hist[ref->histoff].name = session->name; \ - ref->hist[ref->histoff].file = __FILE__; \ - ref->hist[ref->histoff].line = __LINE__; \ - ref->hist[ref->histoff].state = s; \ - ref->histoff = (ref->histoff + 1) % (int)WT_ELEMENTS(ref->hist);\ - WT_PUBLISH(ref->state, s); \ -} while (0) -#else -#define WT_REF_SET_STATE(ref, s) WT_PUBLISH(ref->state, s) -#endif - /* * Address: on-page cell if read from backing block, off-page WT_ADDR * if instantiated in-memory, or NULL if page created in-memory. @@ -901,13 +878,37 @@ struct __wt_ref { WT_PAGE_DELETED *page_del; /* Deleted page information */ WT_PAGE_LOOKASIDE *page_las; /* Lookaside information */ + +#ifdef HAVE_DIAGNOSTIC + /* Capture history of ref state changes. */ + struct __wt_ref_hist { + WT_SESSION_IMPL *session; + const char *name; + const char *file; + int line; + uint32_t state; + } hist[3]; + uint64_t histoff; +#define WT_REF_SET_STATE(ref, s) do { \ + (ref)->hist[(ref)->histoff].session = session; \ + (ref)->hist[(ref)->histoff].name = session->name; \ + (ref)->hist[(ref)->histoff].file = __FILE__; \ + (ref)->hist[(ref)->histoff].line = __LINE__; \ + (ref)->hist[(ref)->histoff].state = s; \ + (ref)->histoff = \ + ((ref)->histoff + 1) % WT_ELEMENTS((ref)->hist); \ + WT_PUBLISH((ref)->state, s); \ +} while (0) +#else +#define WT_REF_SET_STATE(ref, s) WT_PUBLISH((ref)->state, s) +#endif }; /* * WT_REF_SIZE is the expected structure size -- we verify the build to ensure * the compiler hasn't inserted padding which would break the world. */ #ifdef HAVE_DIAGNOSTIC -#define WT_REF_SIZE 56 + 3*32 + 8 +#define WT_REF_SIZE (56 + 3 * sizeof(WT_REF_HIST) + 8) #else #define WT_REF_SIZE 56 #endif diff --git a/src/third_party/wiredtiger/src/include/btree.h b/src/third_party/wiredtiger/src/include/btree.h index 593745cc315..a44c010e51d 100644 --- a/src/third_party/wiredtiger/src/include/btree.h +++ b/src/third_party/wiredtiger/src/include/btree.h @@ -181,12 +181,12 @@ struct __wt_btree { * operation that would conflict with a sync. */ #define WT_BTREE_SYNCING(btree) \ - (btree->syncing != WT_BTREE_SYNC_OFF) + ((btree)->syncing != WT_BTREE_SYNC_OFF) #define WT_SESSION_BTREE_SYNC(session) \ - (S2BT(session)->sync_session == session) + (S2BT(session)->sync_session == (session)) #define WT_SESSION_BTREE_SYNC_SAFE(session, btree) \ ((btree)->syncing != WT_BTREE_SYNC_RUNNING || \ - (btree)->sync_session == session) + (btree)->sync_session == (session)) uint64_t bytes_inmem; /* Cache bytes in memory. */ uint64_t bytes_dirty_intl; /* Bytes in dirty internal pages. */ diff --git a/src/third_party/wiredtiger/src/include/config.h b/src/third_party/wiredtiger/src/include/config.h index 8feefd4201d..a02735c7e0a 100644 --- a/src/third_party/wiredtiger/src/include/config.h +++ b/src/third_party/wiredtiger/src/include/config.h @@ -50,7 +50,7 @@ struct __wt_config_parser_impl { "", 0, 0, WT_CONFIG_ITEM_NUM \ } -#define WT_CONFIG_UNSET -1 +#define WT_CONFIG_UNSET (-1) /* * DO NOT EDIT: automatically built by dist/api_config.py. * configuration section: BEGIN diff --git a/src/third_party/wiredtiger/src/include/cursor.i b/src/third_party/wiredtiger/src/include/cursor.i index cb665e17f5b..daa633f86ba 100644 --- a/src/third_party/wiredtiger/src/include/cursor.i +++ b/src/third_party/wiredtiger/src/include/cursor.i @@ -417,8 +417,14 @@ __cursor_row_slot_return(WT_CURSOR_BTREE *cbt, WT_ROW *rip, WT_UPDATE *upd) * Unpack the cell and deal with overflow and prefix-compressed keys. * Inline building simple prefix-compressed keys from a previous key, * otherwise build from scratch. + * + * Clear the key cell structure. It shouldn't be necessary (as far as I + * can tell, and we don't do it in lots of other places), but disabling + * shared builds (--disable-shared) results in the compiler complaining + * about uninitialized field use. */ kpack = &_kpack; + memset(kpack, 0, sizeof(*kpack)); __wt_cell_unpack(cell, kpack); if (kpack->type == WT_CELL_KEY && cbt->rip_saved != NULL && cbt->rip_saved == rip - 1) { diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h index 9a614dc2c19..e3b3296f405 100644 --- a/src/third_party/wiredtiger/src/include/extern.h +++ b/src/third_party/wiredtiger/src/include/extern.h @@ -27,7 +27,7 @@ extern int __wt_block_compact_start(WT_SESSION_IMPL *session, WT_BLOCK *block) W extern int __wt_block_compact_end(WT_SESSION_IMPL *session, WT_BLOCK *block) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, bool *skipp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_block_compact_page_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *addr, size_t addr_size, bool *skipp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_block_misplaced(WT_SESSION_IMPL *session, WT_BLOCK *block, const char *tag, wt_off_t offset, uint32_t size, bool live) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_block_misplaced(WT_SESSION_IMPL *session, WT_BLOCK *block, const char *list, wt_off_t offset, uint32_t size, bool live, const char *func, int line) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_block_off_remove_overlap(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_EXTLIST *el, wt_off_t off, wt_off_t size) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_block_alloc(WT_SESSION_IMPL *session, WT_BLOCK *block, wt_off_t *offp, wt_off_t size) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_block_free(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *addr, size_t addr_size) 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 5c9f95bc08a..4a34b5211d8 100644 --- a/src/third_party/wiredtiger/src/include/misc.i +++ b/src/third_party/wiredtiger/src/include/misc.i @@ -193,7 +193,7 @@ __wt_snprintf_len_incr( * Return an error if the current transaction is in the prepare state. */ static inline int -__wt_txn_context_prepare_check( WT_SESSION_IMPL *session) +__wt_txn_context_prepare_check(WT_SESSION_IMPL *session) { #ifdef HAVE_TIMESTAMPS if (F_ISSET(&session->txn, WT_TXN_PREPARE)) diff --git a/src/third_party/wiredtiger/src/include/stat.h b/src/third_party/wiredtiger/src/include/stat.h index 6407b5fabfe..3dca894a68c 100644 --- a/src/third_party/wiredtiger/src/include/stat.h +++ b/src/third_party/wiredtiger/src/include/stat.h @@ -454,6 +454,7 @@ struct __wt_connection_stats { int64_t fsync_io; int64_t read_io; int64_t write_io; + int64_t cursor_cache; int64_t cursor_create; int64_t cursor_insert; int64_t cursor_modify; @@ -470,7 +471,7 @@ struct __wt_connection_stats { int64_t cursor_sweep_examined; int64_t cursor_sweep; int64_t cursor_update; - int64_t cursor_cache; + int64_t cursors_cached; int64_t cursor_reopen; int64_t cursor_truncate; int64_t dh_conn_handle_count; @@ -792,12 +793,12 @@ struct __wt_dsrc_stats { int64_t compress_raw_fail; int64_t compress_raw_ok; int64_t cursor_insert_bulk; + int64_t cursor_cache; int64_t cursor_create; int64_t cursor_restart; int64_t cursor_insert_bytes; int64_t cursor_remove_bytes; int64_t cursor_update_bytes; - int64_t cursor_cache; int64_t cursor_reopen; int64_t cursor_insert; int64_t cursor_modify; @@ -824,7 +825,7 @@ struct __wt_dsrc_stats { int64_t rec_pages; int64_t rec_pages_eviction; int64_t rec_page_delete; - int64_t session_cursor_cached; + int64_t session_cursors_cached; int64_t session_compact; int64_t session_cursor_open; int64_t txn_update_conflict; diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in index 2fb4af02900..76151082135 100644 --- a/src/third_party/wiredtiger/src/include/wiredtiger.in +++ b/src/third_party/wiredtiger/src/include/wiredtiger.in @@ -5291,490 +5291,492 @@ extern int wiredtiger_extension_terminate(WT_CONNECTION *connection); #define WT_STAT_CONN_READ_IO 1139 /*! connection: total write I/Os */ #define WT_STAT_CONN_WRITE_IO 1140 +/*! cursor: cursor close calls that result in cache */ +#define WT_STAT_CONN_CURSOR_CACHE 1141 /*! cursor: cursor create calls */ -#define WT_STAT_CONN_CURSOR_CREATE 1141 +#define WT_STAT_CONN_CURSOR_CREATE 1142 /*! cursor: cursor insert calls */ -#define WT_STAT_CONN_CURSOR_INSERT 1142 +#define WT_STAT_CONN_CURSOR_INSERT 1143 /*! cursor: cursor modify calls */ -#define WT_STAT_CONN_CURSOR_MODIFY 1143 +#define WT_STAT_CONN_CURSOR_MODIFY 1144 /*! cursor: cursor next calls */ -#define WT_STAT_CONN_CURSOR_NEXT 1144 +#define WT_STAT_CONN_CURSOR_NEXT 1145 /*! cursor: cursor operation restarted */ -#define WT_STAT_CONN_CURSOR_RESTART 1145 +#define WT_STAT_CONN_CURSOR_RESTART 1146 /*! cursor: cursor prev calls */ -#define WT_STAT_CONN_CURSOR_PREV 1146 +#define WT_STAT_CONN_CURSOR_PREV 1147 /*! cursor: cursor remove calls */ -#define WT_STAT_CONN_CURSOR_REMOVE 1147 +#define WT_STAT_CONN_CURSOR_REMOVE 1148 /*! cursor: cursor reserve calls */ -#define WT_STAT_CONN_CURSOR_RESERVE 1148 +#define WT_STAT_CONN_CURSOR_RESERVE 1149 /*! cursor: cursor reset calls */ -#define WT_STAT_CONN_CURSOR_RESET 1149 +#define WT_STAT_CONN_CURSOR_RESET 1150 /*! cursor: cursor search calls */ -#define WT_STAT_CONN_CURSOR_SEARCH 1150 +#define WT_STAT_CONN_CURSOR_SEARCH 1151 /*! cursor: cursor search near calls */ -#define WT_STAT_CONN_CURSOR_SEARCH_NEAR 1151 +#define WT_STAT_CONN_CURSOR_SEARCH_NEAR 1152 /*! cursor: cursor sweep buckets */ -#define WT_STAT_CONN_CURSOR_SWEEP_BUCKETS 1152 +#define WT_STAT_CONN_CURSOR_SWEEP_BUCKETS 1153 /*! cursor: cursor sweep cursors closed */ -#define WT_STAT_CONN_CURSOR_SWEEP_CLOSED 1153 +#define WT_STAT_CONN_CURSOR_SWEEP_CLOSED 1154 /*! cursor: cursor sweep cursors examined */ -#define WT_STAT_CONN_CURSOR_SWEEP_EXAMINED 1154 +#define WT_STAT_CONN_CURSOR_SWEEP_EXAMINED 1155 /*! cursor: cursor sweeps */ -#define WT_STAT_CONN_CURSOR_SWEEP 1155 +#define WT_STAT_CONN_CURSOR_SWEEP 1156 /*! cursor: cursor update calls */ -#define WT_STAT_CONN_CURSOR_UPDATE 1156 -/*! cursor: cursors cached on close */ -#define WT_STAT_CONN_CURSOR_CACHE 1157 +#define WT_STAT_CONN_CURSOR_UPDATE 1157 +/*! cursor: cursors currently cached */ +#define WT_STAT_CONN_CURSORS_CACHED 1158 /*! cursor: cursors reused from cache */ -#define WT_STAT_CONN_CURSOR_REOPEN 1158 +#define WT_STAT_CONN_CURSOR_REOPEN 1159 /*! cursor: truncate calls */ -#define WT_STAT_CONN_CURSOR_TRUNCATE 1159 +#define WT_STAT_CONN_CURSOR_TRUNCATE 1160 /*! data-handle: connection data handles currently active */ -#define WT_STAT_CONN_DH_CONN_HANDLE_COUNT 1160 +#define WT_STAT_CONN_DH_CONN_HANDLE_COUNT 1161 /*! data-handle: connection sweep candidate became referenced */ -#define WT_STAT_CONN_DH_SWEEP_REF 1161 +#define WT_STAT_CONN_DH_SWEEP_REF 1162 /*! data-handle: connection sweep dhandles closed */ -#define WT_STAT_CONN_DH_SWEEP_CLOSE 1162 +#define WT_STAT_CONN_DH_SWEEP_CLOSE 1163 /*! data-handle: connection sweep dhandles removed from hash list */ -#define WT_STAT_CONN_DH_SWEEP_REMOVE 1163 +#define WT_STAT_CONN_DH_SWEEP_REMOVE 1164 /*! data-handle: connection sweep time-of-death sets */ -#define WT_STAT_CONN_DH_SWEEP_TOD 1164 +#define WT_STAT_CONN_DH_SWEEP_TOD 1165 /*! data-handle: connection sweeps */ -#define WT_STAT_CONN_DH_SWEEPS 1165 +#define WT_STAT_CONN_DH_SWEEPS 1166 /*! data-handle: session dhandles swept */ -#define WT_STAT_CONN_DH_SESSION_HANDLES 1166 +#define WT_STAT_CONN_DH_SESSION_HANDLES 1167 /*! data-handle: session sweep attempts */ -#define WT_STAT_CONN_DH_SESSION_SWEEPS 1167 +#define WT_STAT_CONN_DH_SESSION_SWEEPS 1168 /*! lock: checkpoint lock acquisitions */ -#define WT_STAT_CONN_LOCK_CHECKPOINT_COUNT 1168 +#define WT_STAT_CONN_LOCK_CHECKPOINT_COUNT 1169 /*! lock: checkpoint lock application thread wait time (usecs) */ -#define WT_STAT_CONN_LOCK_CHECKPOINT_WAIT_APPLICATION 1169 +#define WT_STAT_CONN_LOCK_CHECKPOINT_WAIT_APPLICATION 1170 /*! lock: checkpoint lock internal thread wait time (usecs) */ -#define WT_STAT_CONN_LOCK_CHECKPOINT_WAIT_INTERNAL 1170 +#define WT_STAT_CONN_LOCK_CHECKPOINT_WAIT_INTERNAL 1171 /*! * lock: commit timestamp queue lock application thread time waiting * (usecs) */ -#define WT_STAT_CONN_LOCK_COMMIT_TIMESTAMP_WAIT_APPLICATION 1171 +#define WT_STAT_CONN_LOCK_COMMIT_TIMESTAMP_WAIT_APPLICATION 1172 /*! lock: commit timestamp queue lock internal thread time waiting (usecs) */ -#define WT_STAT_CONN_LOCK_COMMIT_TIMESTAMP_WAIT_INTERNAL 1172 +#define WT_STAT_CONN_LOCK_COMMIT_TIMESTAMP_WAIT_INTERNAL 1173 /*! lock: commit timestamp queue read lock acquisitions */ -#define WT_STAT_CONN_LOCK_COMMIT_TIMESTAMP_READ_COUNT 1173 +#define WT_STAT_CONN_LOCK_COMMIT_TIMESTAMP_READ_COUNT 1174 /*! lock: commit timestamp queue write lock acquisitions */ -#define WT_STAT_CONN_LOCK_COMMIT_TIMESTAMP_WRITE_COUNT 1174 +#define WT_STAT_CONN_LOCK_COMMIT_TIMESTAMP_WRITE_COUNT 1175 /*! lock: dhandle lock application thread time waiting (usecs) */ -#define WT_STAT_CONN_LOCK_DHANDLE_WAIT_APPLICATION 1175 +#define WT_STAT_CONN_LOCK_DHANDLE_WAIT_APPLICATION 1176 /*! lock: dhandle lock internal thread time waiting (usecs) */ -#define WT_STAT_CONN_LOCK_DHANDLE_WAIT_INTERNAL 1176 +#define WT_STAT_CONN_LOCK_DHANDLE_WAIT_INTERNAL 1177 /*! lock: dhandle read lock acquisitions */ -#define WT_STAT_CONN_LOCK_DHANDLE_READ_COUNT 1177 +#define WT_STAT_CONN_LOCK_DHANDLE_READ_COUNT 1178 /*! lock: dhandle write lock acquisitions */ -#define WT_STAT_CONN_LOCK_DHANDLE_WRITE_COUNT 1178 +#define WT_STAT_CONN_LOCK_DHANDLE_WRITE_COUNT 1179 /*! lock: metadata lock acquisitions */ -#define WT_STAT_CONN_LOCK_METADATA_COUNT 1179 +#define WT_STAT_CONN_LOCK_METADATA_COUNT 1180 /*! lock: metadata lock application thread wait time (usecs) */ -#define WT_STAT_CONN_LOCK_METADATA_WAIT_APPLICATION 1180 +#define WT_STAT_CONN_LOCK_METADATA_WAIT_APPLICATION 1181 /*! lock: metadata lock internal thread wait time (usecs) */ -#define WT_STAT_CONN_LOCK_METADATA_WAIT_INTERNAL 1181 +#define WT_STAT_CONN_LOCK_METADATA_WAIT_INTERNAL 1182 /*! * lock: read timestamp queue lock application thread time waiting * (usecs) */ -#define WT_STAT_CONN_LOCK_READ_TIMESTAMP_WAIT_APPLICATION 1182 +#define WT_STAT_CONN_LOCK_READ_TIMESTAMP_WAIT_APPLICATION 1183 /*! lock: read timestamp queue lock internal thread time waiting (usecs) */ -#define WT_STAT_CONN_LOCK_READ_TIMESTAMP_WAIT_INTERNAL 1183 +#define WT_STAT_CONN_LOCK_READ_TIMESTAMP_WAIT_INTERNAL 1184 /*! lock: read timestamp queue read lock acquisitions */ -#define WT_STAT_CONN_LOCK_READ_TIMESTAMP_READ_COUNT 1184 +#define WT_STAT_CONN_LOCK_READ_TIMESTAMP_READ_COUNT 1185 /*! lock: read timestamp queue write lock acquisitions */ -#define WT_STAT_CONN_LOCK_READ_TIMESTAMP_WRITE_COUNT 1185 +#define WT_STAT_CONN_LOCK_READ_TIMESTAMP_WRITE_COUNT 1186 /*! lock: schema lock acquisitions */ -#define WT_STAT_CONN_LOCK_SCHEMA_COUNT 1186 +#define WT_STAT_CONN_LOCK_SCHEMA_COUNT 1187 /*! lock: schema lock application thread wait time (usecs) */ -#define WT_STAT_CONN_LOCK_SCHEMA_WAIT_APPLICATION 1187 +#define WT_STAT_CONN_LOCK_SCHEMA_WAIT_APPLICATION 1188 /*! lock: schema lock internal thread wait time (usecs) */ -#define WT_STAT_CONN_LOCK_SCHEMA_WAIT_INTERNAL 1188 +#define WT_STAT_CONN_LOCK_SCHEMA_WAIT_INTERNAL 1189 /*! * lock: table lock application thread time waiting for the table lock * (usecs) */ -#define WT_STAT_CONN_LOCK_TABLE_WAIT_APPLICATION 1189 +#define WT_STAT_CONN_LOCK_TABLE_WAIT_APPLICATION 1190 /*! * lock: table lock internal thread time waiting for the table lock * (usecs) */ -#define WT_STAT_CONN_LOCK_TABLE_WAIT_INTERNAL 1190 +#define WT_STAT_CONN_LOCK_TABLE_WAIT_INTERNAL 1191 /*! lock: table read lock acquisitions */ -#define WT_STAT_CONN_LOCK_TABLE_READ_COUNT 1191 +#define WT_STAT_CONN_LOCK_TABLE_READ_COUNT 1192 /*! lock: table write lock acquisitions */ -#define WT_STAT_CONN_LOCK_TABLE_WRITE_COUNT 1192 +#define WT_STAT_CONN_LOCK_TABLE_WRITE_COUNT 1193 /*! lock: txn global lock application thread time waiting (usecs) */ -#define WT_STAT_CONN_LOCK_TXN_GLOBAL_WAIT_APPLICATION 1193 +#define WT_STAT_CONN_LOCK_TXN_GLOBAL_WAIT_APPLICATION 1194 /*! lock: txn global lock internal thread time waiting (usecs) */ -#define WT_STAT_CONN_LOCK_TXN_GLOBAL_WAIT_INTERNAL 1194 +#define WT_STAT_CONN_LOCK_TXN_GLOBAL_WAIT_INTERNAL 1195 /*! lock: txn global read lock acquisitions */ -#define WT_STAT_CONN_LOCK_TXN_GLOBAL_READ_COUNT 1195 +#define WT_STAT_CONN_LOCK_TXN_GLOBAL_READ_COUNT 1196 /*! lock: txn global write lock acquisitions */ -#define WT_STAT_CONN_LOCK_TXN_GLOBAL_WRITE_COUNT 1196 +#define WT_STAT_CONN_LOCK_TXN_GLOBAL_WRITE_COUNT 1197 /*! log: busy returns attempting to switch slots */ -#define WT_STAT_CONN_LOG_SLOT_SWITCH_BUSY 1197 +#define WT_STAT_CONN_LOG_SLOT_SWITCH_BUSY 1198 /*! log: force archive time sleeping (usecs) */ -#define WT_STAT_CONN_LOG_FORCE_ARCHIVE_SLEEP 1198 +#define WT_STAT_CONN_LOG_FORCE_ARCHIVE_SLEEP 1199 /*! log: log bytes of payload data */ -#define WT_STAT_CONN_LOG_BYTES_PAYLOAD 1199 +#define WT_STAT_CONN_LOG_BYTES_PAYLOAD 1200 /*! log: log bytes written */ -#define WT_STAT_CONN_LOG_BYTES_WRITTEN 1200 +#define WT_STAT_CONN_LOG_BYTES_WRITTEN 1201 /*! log: log files manually zero-filled */ -#define WT_STAT_CONN_LOG_ZERO_FILLS 1201 +#define WT_STAT_CONN_LOG_ZERO_FILLS 1202 /*! log: log flush operations */ -#define WT_STAT_CONN_LOG_FLUSH 1202 +#define WT_STAT_CONN_LOG_FLUSH 1203 /*! log: log force write operations */ -#define WT_STAT_CONN_LOG_FORCE_WRITE 1203 +#define WT_STAT_CONN_LOG_FORCE_WRITE 1204 /*! log: log force write operations skipped */ -#define WT_STAT_CONN_LOG_FORCE_WRITE_SKIP 1204 +#define WT_STAT_CONN_LOG_FORCE_WRITE_SKIP 1205 /*! log: log records compressed */ -#define WT_STAT_CONN_LOG_COMPRESS_WRITES 1205 +#define WT_STAT_CONN_LOG_COMPRESS_WRITES 1206 /*! log: log records not compressed */ -#define WT_STAT_CONN_LOG_COMPRESS_WRITE_FAILS 1206 +#define WT_STAT_CONN_LOG_COMPRESS_WRITE_FAILS 1207 /*! log: log records too small to compress */ -#define WT_STAT_CONN_LOG_COMPRESS_SMALL 1207 +#define WT_STAT_CONN_LOG_COMPRESS_SMALL 1208 /*! log: log release advances write LSN */ -#define WT_STAT_CONN_LOG_RELEASE_WRITE_LSN 1208 +#define WT_STAT_CONN_LOG_RELEASE_WRITE_LSN 1209 /*! log: log scan operations */ -#define WT_STAT_CONN_LOG_SCANS 1209 +#define WT_STAT_CONN_LOG_SCANS 1210 /*! log: log scan records requiring two reads */ -#define WT_STAT_CONN_LOG_SCAN_REREADS 1210 +#define WT_STAT_CONN_LOG_SCAN_REREADS 1211 /*! log: log server thread advances write LSN */ -#define WT_STAT_CONN_LOG_WRITE_LSN 1211 +#define WT_STAT_CONN_LOG_WRITE_LSN 1212 /*! log: log server thread write LSN walk skipped */ -#define WT_STAT_CONN_LOG_WRITE_LSN_SKIP 1212 +#define WT_STAT_CONN_LOG_WRITE_LSN_SKIP 1213 /*! log: log sync operations */ -#define WT_STAT_CONN_LOG_SYNC 1213 +#define WT_STAT_CONN_LOG_SYNC 1214 /*! log: log sync time duration (usecs) */ -#define WT_STAT_CONN_LOG_SYNC_DURATION 1214 +#define WT_STAT_CONN_LOG_SYNC_DURATION 1215 /*! log: log sync_dir operations */ -#define WT_STAT_CONN_LOG_SYNC_DIR 1215 +#define WT_STAT_CONN_LOG_SYNC_DIR 1216 /*! log: log sync_dir time duration (usecs) */ -#define WT_STAT_CONN_LOG_SYNC_DIR_DURATION 1216 +#define WT_STAT_CONN_LOG_SYNC_DIR_DURATION 1217 /*! log: log write operations */ -#define WT_STAT_CONN_LOG_WRITES 1217 +#define WT_STAT_CONN_LOG_WRITES 1218 /*! log: logging bytes consolidated */ -#define WT_STAT_CONN_LOG_SLOT_CONSOLIDATED 1218 +#define WT_STAT_CONN_LOG_SLOT_CONSOLIDATED 1219 /*! log: maximum log file size */ -#define WT_STAT_CONN_LOG_MAX_FILESIZE 1219 +#define WT_STAT_CONN_LOG_MAX_FILESIZE 1220 /*! log: number of pre-allocated log files to create */ -#define WT_STAT_CONN_LOG_PREALLOC_MAX 1220 +#define WT_STAT_CONN_LOG_PREALLOC_MAX 1221 /*! log: pre-allocated log files not ready and missed */ -#define WT_STAT_CONN_LOG_PREALLOC_MISSED 1221 +#define WT_STAT_CONN_LOG_PREALLOC_MISSED 1222 /*! log: pre-allocated log files prepared */ -#define WT_STAT_CONN_LOG_PREALLOC_FILES 1222 +#define WT_STAT_CONN_LOG_PREALLOC_FILES 1223 /*! log: pre-allocated log files used */ -#define WT_STAT_CONN_LOG_PREALLOC_USED 1223 +#define WT_STAT_CONN_LOG_PREALLOC_USED 1224 /*! log: records processed by log scan */ -#define WT_STAT_CONN_LOG_SCAN_RECORDS 1224 +#define WT_STAT_CONN_LOG_SCAN_RECORDS 1225 /*! log: slot close lost race */ -#define WT_STAT_CONN_LOG_SLOT_CLOSE_RACE 1225 +#define WT_STAT_CONN_LOG_SLOT_CLOSE_RACE 1226 /*! log: slot close unbuffered waits */ -#define WT_STAT_CONN_LOG_SLOT_CLOSE_UNBUF 1226 +#define WT_STAT_CONN_LOG_SLOT_CLOSE_UNBUF 1227 /*! log: slot closures */ -#define WT_STAT_CONN_LOG_SLOT_CLOSES 1227 +#define WT_STAT_CONN_LOG_SLOT_CLOSES 1228 /*! log: slot join atomic update races */ -#define WT_STAT_CONN_LOG_SLOT_RACES 1228 +#define WT_STAT_CONN_LOG_SLOT_RACES 1229 /*! log: slot join calls atomic updates raced */ -#define WT_STAT_CONN_LOG_SLOT_YIELD_RACE 1229 +#define WT_STAT_CONN_LOG_SLOT_YIELD_RACE 1230 /*! log: slot join calls did not yield */ -#define WT_STAT_CONN_LOG_SLOT_IMMEDIATE 1230 +#define WT_STAT_CONN_LOG_SLOT_IMMEDIATE 1231 /*! log: slot join calls found active slot closed */ -#define WT_STAT_CONN_LOG_SLOT_YIELD_CLOSE 1231 +#define WT_STAT_CONN_LOG_SLOT_YIELD_CLOSE 1232 /*! log: slot join calls slept */ -#define WT_STAT_CONN_LOG_SLOT_YIELD_SLEEP 1232 +#define WT_STAT_CONN_LOG_SLOT_YIELD_SLEEP 1233 /*! log: slot join calls yielded */ -#define WT_STAT_CONN_LOG_SLOT_YIELD 1233 +#define WT_STAT_CONN_LOG_SLOT_YIELD 1234 /*! log: slot join found active slot closed */ -#define WT_STAT_CONN_LOG_SLOT_ACTIVE_CLOSED 1234 +#define WT_STAT_CONN_LOG_SLOT_ACTIVE_CLOSED 1235 /*! log: slot joins yield time (usecs) */ -#define WT_STAT_CONN_LOG_SLOT_YIELD_DURATION 1235 +#define WT_STAT_CONN_LOG_SLOT_YIELD_DURATION 1236 /*! log: slot transitions unable to find free slot */ -#define WT_STAT_CONN_LOG_SLOT_NO_FREE_SLOTS 1236 +#define WT_STAT_CONN_LOG_SLOT_NO_FREE_SLOTS 1237 /*! log: slot unbuffered writes */ -#define WT_STAT_CONN_LOG_SLOT_UNBUFFERED 1237 +#define WT_STAT_CONN_LOG_SLOT_UNBUFFERED 1238 /*! log: total in-memory size of compressed records */ -#define WT_STAT_CONN_LOG_COMPRESS_MEM 1238 +#define WT_STAT_CONN_LOG_COMPRESS_MEM 1239 /*! log: total log buffer size */ -#define WT_STAT_CONN_LOG_BUFFER_SIZE 1239 +#define WT_STAT_CONN_LOG_BUFFER_SIZE 1240 /*! log: total size of compressed records */ -#define WT_STAT_CONN_LOG_COMPRESS_LEN 1240 +#define WT_STAT_CONN_LOG_COMPRESS_LEN 1241 /*! log: written slots coalesced */ -#define WT_STAT_CONN_LOG_SLOT_COALESCED 1241 +#define WT_STAT_CONN_LOG_SLOT_COALESCED 1242 /*! log: yields waiting for previous log file close */ -#define WT_STAT_CONN_LOG_CLOSE_YIELDS 1242 +#define WT_STAT_CONN_LOG_CLOSE_YIELDS 1243 /*! perf: file system read latency histogram (bucket 1) - 10-49ms */ -#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_LT50 1243 +#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_LT50 1244 /*! perf: file system read latency histogram (bucket 2) - 50-99ms */ -#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_LT100 1244 +#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_LT100 1245 /*! perf: file system read latency histogram (bucket 3) - 100-249ms */ -#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_LT250 1245 +#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_LT250 1246 /*! perf: file system read latency histogram (bucket 4) - 250-499ms */ -#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_LT500 1246 +#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_LT500 1247 /*! perf: file system read latency histogram (bucket 5) - 500-999ms */ -#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_LT1000 1247 +#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_LT1000 1248 /*! perf: file system read latency histogram (bucket 6) - 1000ms+ */ -#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_GT1000 1248 +#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_GT1000 1249 /*! perf: file system write latency histogram (bucket 1) - 10-49ms */ -#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_LT50 1249 +#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_LT50 1250 /*! perf: file system write latency histogram (bucket 2) - 50-99ms */ -#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_LT100 1250 +#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_LT100 1251 /*! perf: file system write latency histogram (bucket 3) - 100-249ms */ -#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_LT250 1251 +#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_LT250 1252 /*! perf: file system write latency histogram (bucket 4) - 250-499ms */ -#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_LT500 1252 +#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_LT500 1253 /*! perf: file system write latency histogram (bucket 5) - 500-999ms */ -#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_LT1000 1253 +#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_LT1000 1254 /*! perf: file system write latency histogram (bucket 6) - 1000ms+ */ -#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_GT1000 1254 +#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_GT1000 1255 /*! perf: operation read latency histogram (bucket 1) - 100-249us */ -#define WT_STAT_CONN_PERF_HIST_OPREAD_LATENCY_LT250 1255 +#define WT_STAT_CONN_PERF_HIST_OPREAD_LATENCY_LT250 1256 /*! perf: operation read latency histogram (bucket 2) - 250-499us */ -#define WT_STAT_CONN_PERF_HIST_OPREAD_LATENCY_LT500 1256 +#define WT_STAT_CONN_PERF_HIST_OPREAD_LATENCY_LT500 1257 /*! perf: operation read latency histogram (bucket 3) - 500-999us */ -#define WT_STAT_CONN_PERF_HIST_OPREAD_LATENCY_LT1000 1257 +#define WT_STAT_CONN_PERF_HIST_OPREAD_LATENCY_LT1000 1258 /*! perf: operation read latency histogram (bucket 4) - 1000-9999us */ -#define WT_STAT_CONN_PERF_HIST_OPREAD_LATENCY_LT10000 1258 +#define WT_STAT_CONN_PERF_HIST_OPREAD_LATENCY_LT10000 1259 /*! perf: operation read latency histogram (bucket 5) - 10000us+ */ -#define WT_STAT_CONN_PERF_HIST_OPREAD_LATENCY_GT10000 1259 +#define WT_STAT_CONN_PERF_HIST_OPREAD_LATENCY_GT10000 1260 /*! perf: operation write latency histogram (bucket 1) - 100-249us */ -#define WT_STAT_CONN_PERF_HIST_OPWRITE_LATENCY_LT250 1260 +#define WT_STAT_CONN_PERF_HIST_OPWRITE_LATENCY_LT250 1261 /*! perf: operation write latency histogram (bucket 2) - 250-499us */ -#define WT_STAT_CONN_PERF_HIST_OPWRITE_LATENCY_LT500 1261 +#define WT_STAT_CONN_PERF_HIST_OPWRITE_LATENCY_LT500 1262 /*! perf: operation write latency histogram (bucket 3) - 500-999us */ -#define WT_STAT_CONN_PERF_HIST_OPWRITE_LATENCY_LT1000 1262 +#define WT_STAT_CONN_PERF_HIST_OPWRITE_LATENCY_LT1000 1263 /*! perf: operation write latency histogram (bucket 4) - 1000-9999us */ -#define WT_STAT_CONN_PERF_HIST_OPWRITE_LATENCY_LT10000 1263 +#define WT_STAT_CONN_PERF_HIST_OPWRITE_LATENCY_LT10000 1264 /*! perf: operation write latency histogram (bucket 5) - 10000us+ */ -#define WT_STAT_CONN_PERF_HIST_OPWRITE_LATENCY_GT10000 1264 +#define WT_STAT_CONN_PERF_HIST_OPWRITE_LATENCY_GT10000 1265 /*! reconciliation: fast-path pages deleted */ -#define WT_STAT_CONN_REC_PAGE_DELETE_FAST 1265 +#define WT_STAT_CONN_REC_PAGE_DELETE_FAST 1266 /*! reconciliation: page reconciliation calls */ -#define WT_STAT_CONN_REC_PAGES 1266 +#define WT_STAT_CONN_REC_PAGES 1267 /*! reconciliation: page reconciliation calls for eviction */ -#define WT_STAT_CONN_REC_PAGES_EVICTION 1267 +#define WT_STAT_CONN_REC_PAGES_EVICTION 1268 /*! reconciliation: pages deleted */ -#define WT_STAT_CONN_REC_PAGE_DELETE 1268 +#define WT_STAT_CONN_REC_PAGE_DELETE 1269 /*! reconciliation: split bytes currently awaiting free */ -#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES 1269 +#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES 1270 /*! reconciliation: split objects currently awaiting free */ -#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS 1270 +#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS 1271 /*! session: open cursor count */ -#define WT_STAT_CONN_SESSION_CURSOR_OPEN 1271 +#define WT_STAT_CONN_SESSION_CURSOR_OPEN 1272 /*! session: open session count */ -#define WT_STAT_CONN_SESSION_OPEN 1272 +#define WT_STAT_CONN_SESSION_OPEN 1273 /*! session: session query timestamp calls */ -#define WT_STAT_CONN_SESSION_QUERY_TS 1273 +#define WT_STAT_CONN_SESSION_QUERY_TS 1274 /*! session: table alter failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_ALTER_FAIL 1274 +#define WT_STAT_CONN_SESSION_TABLE_ALTER_FAIL 1275 /*! session: table alter successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_ALTER_SUCCESS 1275 +#define WT_STAT_CONN_SESSION_TABLE_ALTER_SUCCESS 1276 /*! session: table alter unchanged and skipped */ -#define WT_STAT_CONN_SESSION_TABLE_ALTER_SKIP 1276 +#define WT_STAT_CONN_SESSION_TABLE_ALTER_SKIP 1277 /*! session: table compact failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_COMPACT_FAIL 1277 +#define WT_STAT_CONN_SESSION_TABLE_COMPACT_FAIL 1278 /*! session: table compact successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_COMPACT_SUCCESS 1278 +#define WT_STAT_CONN_SESSION_TABLE_COMPACT_SUCCESS 1279 /*! session: table create failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_CREATE_FAIL 1279 +#define WT_STAT_CONN_SESSION_TABLE_CREATE_FAIL 1280 /*! session: table create successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_CREATE_SUCCESS 1280 +#define WT_STAT_CONN_SESSION_TABLE_CREATE_SUCCESS 1281 /*! session: table drop failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_DROP_FAIL 1281 +#define WT_STAT_CONN_SESSION_TABLE_DROP_FAIL 1282 /*! session: table drop successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_DROP_SUCCESS 1282 +#define WT_STAT_CONN_SESSION_TABLE_DROP_SUCCESS 1283 /*! session: table rebalance failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_REBALANCE_FAIL 1283 +#define WT_STAT_CONN_SESSION_TABLE_REBALANCE_FAIL 1284 /*! session: table rebalance successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_REBALANCE_SUCCESS 1284 +#define WT_STAT_CONN_SESSION_TABLE_REBALANCE_SUCCESS 1285 /*! session: table rename failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_RENAME_FAIL 1285 +#define WT_STAT_CONN_SESSION_TABLE_RENAME_FAIL 1286 /*! session: table rename successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_RENAME_SUCCESS 1286 +#define WT_STAT_CONN_SESSION_TABLE_RENAME_SUCCESS 1287 /*! session: table salvage failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_SALVAGE_FAIL 1287 +#define WT_STAT_CONN_SESSION_TABLE_SALVAGE_FAIL 1288 /*! session: table salvage successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_SALVAGE_SUCCESS 1288 +#define WT_STAT_CONN_SESSION_TABLE_SALVAGE_SUCCESS 1289 /*! session: table truncate failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_TRUNCATE_FAIL 1289 +#define WT_STAT_CONN_SESSION_TABLE_TRUNCATE_FAIL 1290 /*! session: table truncate successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_TRUNCATE_SUCCESS 1290 +#define WT_STAT_CONN_SESSION_TABLE_TRUNCATE_SUCCESS 1291 /*! session: table verify failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_VERIFY_FAIL 1291 +#define WT_STAT_CONN_SESSION_TABLE_VERIFY_FAIL 1292 /*! session: table verify successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_VERIFY_SUCCESS 1292 +#define WT_STAT_CONN_SESSION_TABLE_VERIFY_SUCCESS 1293 /*! thread-state: active filesystem fsync calls */ -#define WT_STAT_CONN_THREAD_FSYNC_ACTIVE 1293 +#define WT_STAT_CONN_THREAD_FSYNC_ACTIVE 1294 /*! thread-state: active filesystem read calls */ -#define WT_STAT_CONN_THREAD_READ_ACTIVE 1294 +#define WT_STAT_CONN_THREAD_READ_ACTIVE 1295 /*! thread-state: active filesystem write calls */ -#define WT_STAT_CONN_THREAD_WRITE_ACTIVE 1295 +#define WT_STAT_CONN_THREAD_WRITE_ACTIVE 1296 /*! thread-yield: application thread time evicting (usecs) */ -#define WT_STAT_CONN_APPLICATION_EVICT_TIME 1296 +#define WT_STAT_CONN_APPLICATION_EVICT_TIME 1297 /*! thread-yield: application thread time waiting for cache (usecs) */ -#define WT_STAT_CONN_APPLICATION_CACHE_TIME 1297 +#define WT_STAT_CONN_APPLICATION_CACHE_TIME 1298 /*! * thread-yield: connection close blocked waiting for transaction state * stabilization */ -#define WT_STAT_CONN_TXN_RELEASE_BLOCKED 1298 +#define WT_STAT_CONN_TXN_RELEASE_BLOCKED 1299 /*! thread-yield: connection close yielded for lsm manager shutdown */ -#define WT_STAT_CONN_CONN_CLOSE_BLOCKED_LSM 1299 +#define WT_STAT_CONN_CONN_CLOSE_BLOCKED_LSM 1300 /*! thread-yield: data handle lock yielded */ -#define WT_STAT_CONN_DHANDLE_LOCK_BLOCKED 1300 +#define WT_STAT_CONN_DHANDLE_LOCK_BLOCKED 1301 /*! * thread-yield: get reference for page index and slot time sleeping * (usecs) */ -#define WT_STAT_CONN_PAGE_INDEX_SLOT_REF_BLOCKED 1301 +#define WT_STAT_CONN_PAGE_INDEX_SLOT_REF_BLOCKED 1302 /*! thread-yield: log server sync yielded for log write */ -#define WT_STAT_CONN_LOG_SERVER_SYNC_BLOCKED 1302 +#define WT_STAT_CONN_LOG_SERVER_SYNC_BLOCKED 1303 /*! thread-yield: page access yielded due to prepare state change */ -#define WT_STAT_CONN_PREPARED_TRANSITION_BLOCKED_PAGE 1303 +#define WT_STAT_CONN_PREPARED_TRANSITION_BLOCKED_PAGE 1304 /*! thread-yield: page acquire busy blocked */ -#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1304 +#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1305 /*! thread-yield: page acquire eviction blocked */ -#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1305 +#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1306 /*! thread-yield: page acquire locked blocked */ -#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1306 +#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1307 /*! thread-yield: page acquire read blocked */ -#define WT_STAT_CONN_PAGE_READ_BLOCKED 1307 +#define WT_STAT_CONN_PAGE_READ_BLOCKED 1308 /*! thread-yield: page acquire time sleeping (usecs) */ -#define WT_STAT_CONN_PAGE_SLEEP 1308 +#define WT_STAT_CONN_PAGE_SLEEP 1309 /*! * thread-yield: page delete rollback time sleeping for state change * (usecs) */ -#define WT_STAT_CONN_PAGE_DEL_ROLLBACK_BLOCKED 1309 +#define WT_STAT_CONN_PAGE_DEL_ROLLBACK_BLOCKED 1310 /*! thread-yield: page reconciliation yielded due to child modification */ -#define WT_STAT_CONN_CHILD_MODIFY_BLOCKED_PAGE 1310 +#define WT_STAT_CONN_CHILD_MODIFY_BLOCKED_PAGE 1311 /*! transaction: Number of prepared updates */ -#define WT_STAT_CONN_TXN_PREPARED_UPDATES_COUNT 1311 +#define WT_STAT_CONN_TXN_PREPARED_UPDATES_COUNT 1312 /*! transaction: Number of prepared updates added to cache overflow */ -#define WT_STAT_CONN_TXN_PREPARED_UPDATES_LOOKASIDE_INSERTS 1312 +#define WT_STAT_CONN_TXN_PREPARED_UPDATES_LOOKASIDE_INSERTS 1313 /*! transaction: Number of prepared updates resolved */ -#define WT_STAT_CONN_TXN_PREPARED_UPDATES_RESOLVED 1313 +#define WT_STAT_CONN_TXN_PREPARED_UPDATES_RESOLVED 1314 /*! transaction: commit timestamp queue entries walked */ -#define WT_STAT_CONN_TXN_COMMIT_QUEUE_WALKED 1314 +#define WT_STAT_CONN_TXN_COMMIT_QUEUE_WALKED 1315 /*! transaction: commit timestamp queue insert to empty */ -#define WT_STAT_CONN_TXN_COMMIT_QUEUE_EMPTY 1315 +#define WT_STAT_CONN_TXN_COMMIT_QUEUE_EMPTY 1316 /*! transaction: commit timestamp queue inserts to head */ -#define WT_STAT_CONN_TXN_COMMIT_QUEUE_HEAD 1316 +#define WT_STAT_CONN_TXN_COMMIT_QUEUE_HEAD 1317 /*! transaction: commit timestamp queue inserts total */ -#define WT_STAT_CONN_TXN_COMMIT_QUEUE_INSERTS 1317 +#define WT_STAT_CONN_TXN_COMMIT_QUEUE_INSERTS 1318 /*! transaction: commit timestamp queue length */ -#define WT_STAT_CONN_TXN_COMMIT_QUEUE_LEN 1318 +#define WT_STAT_CONN_TXN_COMMIT_QUEUE_LEN 1319 /*! transaction: number of named snapshots created */ -#define WT_STAT_CONN_TXN_SNAPSHOTS_CREATED 1319 +#define WT_STAT_CONN_TXN_SNAPSHOTS_CREATED 1320 /*! transaction: number of named snapshots dropped */ -#define WT_STAT_CONN_TXN_SNAPSHOTS_DROPPED 1320 +#define WT_STAT_CONN_TXN_SNAPSHOTS_DROPPED 1321 /*! transaction: prepared transactions */ -#define WT_STAT_CONN_TXN_PREPARE 1321 +#define WT_STAT_CONN_TXN_PREPARE 1322 /*! transaction: prepared transactions committed */ -#define WT_STAT_CONN_TXN_PREPARE_COMMIT 1322 +#define WT_STAT_CONN_TXN_PREPARE_COMMIT 1323 /*! transaction: prepared transactions currently active */ -#define WT_STAT_CONN_TXN_PREPARE_ACTIVE 1323 +#define WT_STAT_CONN_TXN_PREPARE_ACTIVE 1324 /*! transaction: prepared transactions rolled back */ -#define WT_STAT_CONN_TXN_PREPARE_ROLLBACK 1324 +#define WT_STAT_CONN_TXN_PREPARE_ROLLBACK 1325 /*! transaction: query timestamp calls */ -#define WT_STAT_CONN_TXN_QUERY_TS 1325 +#define WT_STAT_CONN_TXN_QUERY_TS 1326 /*! transaction: read timestamp queue entries walked */ -#define WT_STAT_CONN_TXN_READ_QUEUE_WALKED 1326 +#define WT_STAT_CONN_TXN_READ_QUEUE_WALKED 1327 /*! transaction: read timestamp queue insert to empty */ -#define WT_STAT_CONN_TXN_READ_QUEUE_EMPTY 1327 +#define WT_STAT_CONN_TXN_READ_QUEUE_EMPTY 1328 /*! transaction: read timestamp queue inserts to head */ -#define WT_STAT_CONN_TXN_READ_QUEUE_HEAD 1328 +#define WT_STAT_CONN_TXN_READ_QUEUE_HEAD 1329 /*! transaction: read timestamp queue inserts total */ -#define WT_STAT_CONN_TXN_READ_QUEUE_INSERTS 1329 +#define WT_STAT_CONN_TXN_READ_QUEUE_INSERTS 1330 /*! transaction: read timestamp queue length */ -#define WT_STAT_CONN_TXN_READ_QUEUE_LEN 1330 +#define WT_STAT_CONN_TXN_READ_QUEUE_LEN 1331 /*! transaction: rollback to stable calls */ -#define WT_STAT_CONN_TXN_ROLLBACK_TO_STABLE 1331 +#define WT_STAT_CONN_TXN_ROLLBACK_TO_STABLE 1332 /*! transaction: rollback to stable updates aborted */ -#define WT_STAT_CONN_TXN_ROLLBACK_UPD_ABORTED 1332 +#define WT_STAT_CONN_TXN_ROLLBACK_UPD_ABORTED 1333 /*! transaction: rollback to stable updates removed from cache overflow */ -#define WT_STAT_CONN_TXN_ROLLBACK_LAS_REMOVED 1333 +#define WT_STAT_CONN_TXN_ROLLBACK_LAS_REMOVED 1334 /*! transaction: set timestamp calls */ -#define WT_STAT_CONN_TXN_SET_TS 1334 +#define WT_STAT_CONN_TXN_SET_TS 1335 /*! transaction: set timestamp commit calls */ -#define WT_STAT_CONN_TXN_SET_TS_COMMIT 1335 +#define WT_STAT_CONN_TXN_SET_TS_COMMIT 1336 /*! transaction: set timestamp commit updates */ -#define WT_STAT_CONN_TXN_SET_TS_COMMIT_UPD 1336 +#define WT_STAT_CONN_TXN_SET_TS_COMMIT_UPD 1337 /*! transaction: set timestamp oldest calls */ -#define WT_STAT_CONN_TXN_SET_TS_OLDEST 1337 +#define WT_STAT_CONN_TXN_SET_TS_OLDEST 1338 /*! transaction: set timestamp oldest updates */ -#define WT_STAT_CONN_TXN_SET_TS_OLDEST_UPD 1338 +#define WT_STAT_CONN_TXN_SET_TS_OLDEST_UPD 1339 /*! transaction: set timestamp stable calls */ -#define WT_STAT_CONN_TXN_SET_TS_STABLE 1339 +#define WT_STAT_CONN_TXN_SET_TS_STABLE 1340 /*! transaction: set timestamp stable updates */ -#define WT_STAT_CONN_TXN_SET_TS_STABLE_UPD 1340 +#define WT_STAT_CONN_TXN_SET_TS_STABLE_UPD 1341 /*! transaction: transaction begins */ -#define WT_STAT_CONN_TXN_BEGIN 1341 +#define WT_STAT_CONN_TXN_BEGIN 1342 /*! transaction: transaction checkpoint currently running */ -#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1342 +#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1343 /*! transaction: transaction checkpoint generation */ -#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1343 +#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1344 /*! transaction: transaction checkpoint max time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1344 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1345 /*! transaction: transaction checkpoint min time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1345 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1346 /*! transaction: transaction checkpoint most recent time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1346 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1347 /*! transaction: transaction checkpoint scrub dirty target */ -#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TARGET 1347 +#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TARGET 1348 /*! transaction: transaction checkpoint scrub time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TIME 1348 +#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TIME 1349 /*! transaction: transaction checkpoint total time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1349 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1350 /*! transaction: transaction checkpoints */ -#define WT_STAT_CONN_TXN_CHECKPOINT 1350 +#define WT_STAT_CONN_TXN_CHECKPOINT 1351 /*! * transaction: transaction checkpoints skipped because database was * clean */ -#define WT_STAT_CONN_TXN_CHECKPOINT_SKIPPED 1351 +#define WT_STAT_CONN_TXN_CHECKPOINT_SKIPPED 1352 /*! transaction: transaction failures due to cache overflow */ -#define WT_STAT_CONN_TXN_FAIL_CACHE 1352 +#define WT_STAT_CONN_TXN_FAIL_CACHE 1353 /*! * transaction: transaction fsync calls for checkpoint after allocating * the transaction ID */ -#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST 1353 +#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST 1354 /*! * transaction: transaction fsync duration for checkpoint after * allocating the transaction ID (usecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST_DURATION 1354 +#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST_DURATION 1355 /*! transaction: transaction range of IDs currently pinned */ -#define WT_STAT_CONN_TXN_PINNED_RANGE 1355 +#define WT_STAT_CONN_TXN_PINNED_RANGE 1356 /*! transaction: transaction range of IDs currently pinned by a checkpoint */ -#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1356 +#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1357 /*! * transaction: transaction range of IDs currently pinned by named * snapshots */ -#define WT_STAT_CONN_TXN_PINNED_SNAPSHOT_RANGE 1357 +#define WT_STAT_CONN_TXN_PINNED_SNAPSHOT_RANGE 1358 /*! transaction: transaction range of timestamps currently pinned */ -#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP 1358 +#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP 1359 /*! transaction: transaction range of timestamps pinned by a checkpoint */ -#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_CHECKPOINT 1359 +#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_CHECKPOINT 1360 /*! * transaction: transaction range of timestamps pinned by the oldest * timestamp */ -#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_OLDEST 1360 +#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_OLDEST 1361 /*! transaction: transaction sync calls */ -#define WT_STAT_CONN_TXN_SYNC 1361 +#define WT_STAT_CONN_TXN_SYNC 1362 /*! transaction: transactions committed */ -#define WT_STAT_CONN_TXN_COMMIT 1362 +#define WT_STAT_CONN_TXN_COMMIT 1363 /*! transaction: transactions rolled back */ -#define WT_STAT_CONN_TXN_ROLLBACK 1363 +#define WT_STAT_CONN_TXN_ROLLBACK 1364 /*! transaction: update conflicts */ -#define WT_STAT_CONN_TXN_UPDATE_CONFLICT 1364 +#define WT_STAT_CONN_TXN_UPDATE_CONFLICT 1365 /*! * @} @@ -6099,18 +6101,18 @@ extern int wiredtiger_extension_terminate(WT_CONNECTION *connection); #define WT_STAT_DSRC_COMPRESS_RAW_OK 2105 /*! cursor: bulk-loaded cursor-insert calls */ #define WT_STAT_DSRC_CURSOR_INSERT_BULK 2106 +/*! cursor: close calls that result in cache */ +#define WT_STAT_DSRC_CURSOR_CACHE 2107 /*! cursor: create calls */ -#define WT_STAT_DSRC_CURSOR_CREATE 2107 +#define WT_STAT_DSRC_CURSOR_CREATE 2108 /*! cursor: cursor operation restarted */ -#define WT_STAT_DSRC_CURSOR_RESTART 2108 +#define WT_STAT_DSRC_CURSOR_RESTART 2109 /*! cursor: cursor-insert key and value bytes inserted */ -#define WT_STAT_DSRC_CURSOR_INSERT_BYTES 2109 +#define WT_STAT_DSRC_CURSOR_INSERT_BYTES 2110 /*! cursor: cursor-remove key bytes removed */ -#define WT_STAT_DSRC_CURSOR_REMOVE_BYTES 2110 +#define WT_STAT_DSRC_CURSOR_REMOVE_BYTES 2111 /*! cursor: cursor-update value bytes updated */ -#define WT_STAT_DSRC_CURSOR_UPDATE_BYTES 2111 -/*! cursor: cursors cached on close */ -#define WT_STAT_DSRC_CURSOR_CACHE 2112 +#define WT_STAT_DSRC_CURSOR_UPDATE_BYTES 2112 /*! cursor: cursors reused from cache */ #define WT_STAT_DSRC_CURSOR_REOPEN 2113 /*! cursor: insert calls */ @@ -6167,7 +6169,7 @@ extern int wiredtiger_extension_terminate(WT_CONNECTION *connection); /*! reconciliation: pages deleted */ #define WT_STAT_DSRC_REC_PAGE_DELETE 2138 /*! session: cached cursor count */ -#define WT_STAT_DSRC_SESSION_CURSOR_CACHED 2139 +#define WT_STAT_DSRC_SESSION_CURSORS_CACHED 2139 /*! session: object compaction */ #define WT_STAT_DSRC_SESSION_COMPACT 2140 /*! session: open cursor count */ diff --git a/src/third_party/wiredtiger/src/include/wt_internal.h b/src/third_party/wiredtiger/src/include/wt_internal.h index f84ecfe64d4..10ca7330885 100644 --- a/src/third_party/wiredtiger/src/include/wt_internal.h +++ b/src/third_party/wiredtiger/src/include/wt_internal.h @@ -271,6 +271,8 @@ struct __wt_process; typedef struct __wt_process WT_PROCESS; struct __wt_ref; typedef struct __wt_ref WT_REF; +struct __wt_ref_hist; + typedef struct __wt_ref_hist WT_REF_HIST; struct __wt_row; typedef struct __wt_row WT_ROW; struct __wt_rwlock; diff --git a/src/third_party/wiredtiger/src/log/log.c b/src/third_party/wiredtiger/src/log/log.c index 9a5854c8195..690c5841ac8 100644 --- a/src/third_party/wiredtiger/src/log/log.c +++ b/src/third_party/wiredtiger/src/log/log.c @@ -1230,8 +1230,18 @@ __log_newfile(WT_SESSION_IMPL *session, bool conn_open, bool *created) WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_SLOT)); for (yield_cnt = 0; log->log_close_fh != NULL;) { WT_STAT_CONN_INCR(session, log_close_yields); + /* + * Processing slots will conditionally signal the file close + * server thread. But if we've tried a while, signal the + * thread directly here. + */ __wt_log_wrlsn(session, NULL); - if (++yield_cnt > 10000) + if (++yield_cnt % WT_THOUSAND == 0) { + __wt_spin_unlock(session, &log->log_slot_lock); + __wt_cond_signal(session, conn->log_file_cond); + __wt_spin_lock(session, &log->log_slot_lock); + } + if (++yield_cnt > WT_THOUSAND * 10) return (__wt_set_return(session, EBUSY)); __wt_yield(); } @@ -2501,6 +2511,8 @@ advance: * the first pass through recovery. In the second pass * where we truncate the log, this is where it should * end. + * Continue processing where possible, so remember any + * error returns, but don't skip to the error handler. */ if (log != NULL) log->trunc_lsn = rd_lsn; @@ -2537,7 +2549,7 @@ advance: * must be salvaged. */ need_salvage = true; - WT_ERR(__log_salvage_message(session, + WT_TRET(__log_salvage_message(session, log_fh->name, ", bad checksum", rd_lsn.l.offset)); } else { @@ -2546,11 +2558,11 @@ advance: * that the header is corrupt. Make a sanity * check of the log record header. */ - WT_ERR(__log_record_verify(session, log_fh, + WT_TRET(__log_record_verify(session, log_fh, rd_lsn.l.offset, logrec, &corrupt)); if (corrupt) { need_salvage = true; - WT_ERR(__log_salvage_message(session, + WT_TRET(__log_salvage_message(session, log_fh->name, "", rd_lsn.l.offset)); } } @@ -2603,7 +2615,8 @@ advance: __wt_verbose(session, WT_VERB_LOG, "End of recovery truncate end of log %" PRIu32 "/%" PRIu32, rd_lsn.l.file, rd_lsn.l.offset); - WT_ERR(__log_truncate(session, &rd_lsn, false, false)); + /* Preserve prior error and fall through to error handling. */ + WT_TRET(__log_truncate(session, &rd_lsn, false, false)); } err: WT_STAT_CONN_INCR(session, log_scans); @@ -2623,7 +2636,7 @@ err: WT_STAT_CONN_INCR(session, log_scans); * an error recovery is likely going to fail. Try to provide * a helpful failure message. */ - if (ret != 0 && firstrecord) { + if (ret != 0 && firstrecord && LF_ISSET(WT_LOGSCAN_RECOVER)) { __wt_errx(session, "WiredTiger is unable to read the recovery log."); __wt_errx(session, "This may be due to the log" diff --git a/src/third_party/wiredtiger/src/log/log_slot.c b/src/third_party/wiredtiger/src/log/log_slot.c index c75181d0687..2d9f1a04017 100644 --- a/src/third_party/wiredtiger/src/log/log_slot.c +++ b/src/third_party/wiredtiger/src/log/log_slot.c @@ -17,19 +17,22 @@ static void __log_slot_dump(WT_SESSION_IMPL *session) { WT_CONNECTION_IMPL *conn; + WT_DECL_RET; WT_LOG *log; WT_LOGSLOT *slot; int earliest, i; conn = S2C(session); log = conn->log; + ret = __wt_verbose_dump_log(session); + WT_ASSERT(session, ret == 0); earliest = 0; for (i = 0; i < WT_SLOT_POOL; i++) { slot = &log->slot_pool[i]; if (__wt_log_cmp(&slot->slot_release_lsn, &log->slot_pool[earliest].slot_release_lsn) < 0) earliest = i; - __wt_errx(session, "Slot %d:", i); + __wt_errx(session, "Slot %d (0x%p):", i, (void *)slot); __wt_errx(session, " State: %" PRIx64 " Flags: %" PRIx32, (uint64_t)slot->slot_state, slot->flags); __wt_errx(session, " Start LSN: %" PRIu32 "/%" PRIu32, @@ -220,15 +223,6 @@ __log_slot_new(WT_SESSION_IMPL *session) WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_SLOT)); conn = S2C(session); log = conn->log; - /* - * Although this function is single threaded, multiple threads could - * be trying to set a new active slot sequentially. If we find an - * active slot that is valid, return. - */ - if ((slot = log->active_slot) != NULL && - WT_LOG_SLOT_OPEN(slot->slot_state)) - return (0); - #ifdef HAVE_DIAGNOSTIC count = 0; time_start = __wt_clock(session); @@ -238,6 +232,16 @@ __log_slot_new(WT_SESSION_IMPL *session) */ for (;;) { /* + * Although this function is single threaded, multiple threads + * could be trying to set a new active slot sequentially. If + * we find an active slot that is valid, return. This check is + * inside the loop because this function may release the lock + * and needs to check again after acquiring it again. + */ + if ((slot = log->active_slot) != NULL && + WT_LOG_SLOT_OPEN(slot->slot_state)) + return (0); + /* * Rotate among the slots to lessen collisions. */ WT_RET(WT_SESSION_CHECK_PANIC(session)); @@ -264,10 +268,14 @@ __log_slot_new(WT_SESSION_IMPL *session) } /* * If we didn't find any free slots signal the worker thread. + * Release the lock so that any threads waiting for it can + * acquire and possibly move things forward. */ WT_STAT_CONN_INCR(session, log_slot_no_free_slots); __wt_cond_signal(session, conn->log_wrlsn_cond); + __wt_spin_unlock(session, &log->log_slot_lock); __wt_yield(); + __wt_spin_lock(session, &log->log_slot_lock); #ifdef HAVE_DIAGNOSTIC ++count; if (count > WT_MILLION) { diff --git a/src/third_party/wiredtiger/src/reconcile/rec_write.c b/src/third_party/wiredtiger/src/reconcile/rec_write.c index e02f46aadaf..eb0c166c44c 100644 --- a/src/third_party/wiredtiger/src/reconcile/rec_write.c +++ b/src/third_party/wiredtiger/src/reconcile/rec_write.c @@ -1343,14 +1343,14 @@ __rec_txn_read(WT_SESSION_IMPL *session, WT_RECONCILE *r, * globally visible, need to check the update state as well. */ if (F_ISSET(r, WT_REC_EVICT)) { - if (upd->prepare_state == WT_PREPARE_LOCKED || - upd->prepare_state == WT_PREPARE_INPROGRESS) - prepared = true; - - if (F_ISSET(r, WT_REC_VISIBLE_ALL) ? - WT_TXNID_LE(r->last_running, txnid) : - !__txn_visible_id(session, txnid)) - uncommitted = r->update_uncommitted = true; + if (upd->prepare_state == WT_PREPARE_LOCKED || + upd->prepare_state == WT_PREPARE_INPROGRESS) + prepared = true; + + if (F_ISSET(r, WT_REC_VISIBLE_ALL) ? + WT_TXNID_LE(r->last_running, txnid) : + !__txn_visible_id(session, txnid)) + uncommitted = r->update_uncommitted = true; if (prepared || uncommitted) continue; diff --git a/src/third_party/wiredtiger/src/schema/schema_open.c b/src/third_party/wiredtiger/src/schema/schema_open.c index 0964483d57c..9cd0497c73d 100644 --- a/src/third_party/wiredtiger/src/schema/schema_open.c +++ b/src/third_party/wiredtiger/src/schema/schema_open.c @@ -395,8 +395,9 @@ __wt_schema_open_index(WT_SESSION_IMPL *session, { WT_DECL_RET; - WT_WITH_TXN_ISOLATION(session, WT_ISO_READ_UNCOMMITTED, - ret = __schema_open_index(session, table, idxname, len, indexp)); + WT_WITH_TABLE_WRITE_LOCK(session, + WT_WITH_TXN_ISOLATION(session, WT_ISO_READ_UNCOMMITTED, ret = + __schema_open_index(session, table, idxname, len, indexp))); return (ret); } diff --git a/src/third_party/wiredtiger/src/schema/schema_project.c b/src/third_party/wiredtiger/src/schema/schema_project.c index 9bc776bf8f2..c45e88f3ed7 100644 --- a/src/third_party/wiredtiger/src/schema/schema_project.c +++ b/src/third_party/wiredtiger/src/schema/schema_project.c @@ -24,9 +24,9 @@ __wt_schema_project_in(WT_SESSION_IMPL *session, WT_PACK_VALUE old_pv; size_t len, offset, old_len; u_long arg; - char *proj; - uint8_t *p, *end; const uint8_t *next; + uint8_t *p, *end; + char *proj; p = end = NULL; /* -Wuninitialized */ @@ -159,8 +159,8 @@ __wt_schema_project_out(WT_SESSION_IMPL *session, WT_DECL_PACK(pack); WT_DECL_PACK_VALUE(pv); u_long arg; - char *proj; uint8_t *p, *end; + char *proj; p = end = NULL; /* -Wuninitialized */ @@ -228,11 +228,11 @@ __wt_schema_project_slice(WT_SESSION_IMPL *session, WT_CURSOR **cp, WT_DECL_PACK_VALUE(pv); WT_DECL_PACK_VALUE(vpv); WT_PACK vpack; + size_t len, offset, old_len; u_long arg; - char *proj; uint8_t *end, *p; const uint8_t *next, *vp, *vend; - size_t len, offset, old_len; + char *proj; bool skip; p = end = NULL; /* -Wuninitialized */ @@ -403,11 +403,11 @@ __wt_schema_project_merge(WT_SESSION_IMPL *session, WT_DECL_PACK_VALUE(vpv); WT_ITEM *buf; WT_PACK vpack; + size_t len; u_long arg; - char *proj; const uint8_t *p, *end; uint8_t *vp; - size_t len; + char *proj; p = end = NULL; /* -Wuninitialized */ diff --git a/src/third_party/wiredtiger/src/schema/schema_worker.c b/src/third_party/wiredtiger/src/schema/schema_worker.c index aa38ad79bee..46ef694b58b 100644 --- a/src/third_party/wiredtiger/src/schema/schema_worker.c +++ b/src/third_party/wiredtiger/src/schema/schema_worker.c @@ -115,7 +115,15 @@ __wt_schema_worker(WT_SESSION_IMPL *session, file_func, name_func, cfg, open_flags)); } - WT_ERR(__wt_schema_open_indices(session, table)); + /* + * Some operations that walk handles, such as backup, need to + * open indexes. Others, such as checkpoints, do not. Opening + * indexes requires the handle write lock, so check whether + * that lock is held when deciding what to do. + */ + if (F_ISSET(session, WT_SESSION_LOCKED_TABLE_WRITE)) + WT_ERR(__wt_schema_open_indices(session, table)); + for (i = 0; i < table->nindices; i++) { idx = table->indices[i]; skip = false; diff --git a/src/third_party/wiredtiger/src/session/session_compact.c b/src/third_party/wiredtiger/src/session/session_compact.c index 96761ff8745..af93576084f 100644 --- a/src/third_party/wiredtiger/src/session/session_compact.c +++ b/src/third_party/wiredtiger/src/session/session_compact.c @@ -405,10 +405,15 @@ __wt_session_compact( session->compact->max_time = (uint64_t)cval.val; __wt_epoch(session, &session->compact->begin); - /* Find the types of data sources being compacted. */ + /* + * Find the types of data sources being compacted. This could involve + * opening indexes for a table, so acquire the table lock in write + * mode. + */ WT_WITH_SCHEMA_LOCK(session, - ret = __wt_schema_worker(session, uri, - __compact_handle_append, __compact_uri_analyze, cfg, 0)); + WT_WITH_TABLE_WRITE_LOCK(session, + ret = __wt_schema_worker(session, uri, + __compact_handle_append, __compact_uri_analyze, cfg, 0))); WT_ERR(ret); if (session->compact->lsm_count != 0) diff --git a/src/third_party/wiredtiger/src/support/stat.c b/src/third_party/wiredtiger/src/support/stat.c index a0417b3952c..90891c2b28f 100644 --- a/src/third_party/wiredtiger/src/support/stat.c +++ b/src/third_party/wiredtiger/src/support/stat.c @@ -110,12 +110,12 @@ static const char * const __stats_dsrc_desc[] = { "compression: raw compression call failed, no additional data available", "compression: raw compression call succeeded", "cursor: bulk-loaded cursor-insert calls", + "cursor: close calls that result in cache", "cursor: create calls", "cursor: cursor operation restarted", "cursor: cursor-insert key and value bytes inserted", "cursor: cursor-remove key bytes removed", "cursor: cursor-update value bytes updated", - "cursor: cursors cached on close", "cursor: cursors reused from cache", "cursor: insert calls", "cursor: modify calls", @@ -295,12 +295,12 @@ __wt_stat_dsrc_clear_single(WT_DSRC_STATS *stats) stats->compress_raw_fail = 0; stats->compress_raw_ok = 0; stats->cursor_insert_bulk = 0; + stats->cursor_cache = 0; stats->cursor_create = 0; stats->cursor_restart = 0; stats->cursor_insert_bytes = 0; stats->cursor_remove_bytes = 0; stats->cursor_update_bytes = 0; - stats->cursor_cache = 0; stats->cursor_reopen = 0; stats->cursor_insert = 0; stats->cursor_modify = 0; @@ -327,7 +327,7 @@ __wt_stat_dsrc_clear_single(WT_DSRC_STATS *stats) stats->rec_pages = 0; stats->rec_pages_eviction = 0; stats->rec_page_delete = 0; - /* not clearing session_cursor_cached */ + /* not clearing session_cursors_cached */ stats->session_compact = 0; /* not clearing session_cursor_open */ stats->txn_update_conflict = 0; @@ -481,12 +481,12 @@ __wt_stat_dsrc_aggregate_single( to->compress_raw_fail += from->compress_raw_fail; to->compress_raw_ok += from->compress_raw_ok; to->cursor_insert_bulk += from->cursor_insert_bulk; + to->cursor_cache += from->cursor_cache; to->cursor_create += from->cursor_create; to->cursor_restart += from->cursor_restart; to->cursor_insert_bytes += from->cursor_insert_bytes; to->cursor_remove_bytes += from->cursor_remove_bytes; to->cursor_update_bytes += from->cursor_update_bytes; - to->cursor_cache += from->cursor_cache; to->cursor_reopen += from->cursor_reopen; to->cursor_insert += from->cursor_insert; to->cursor_modify += from->cursor_modify; @@ -514,7 +514,7 @@ __wt_stat_dsrc_aggregate_single( to->rec_pages += from->rec_pages; to->rec_pages_eviction += from->rec_pages_eviction; to->rec_page_delete += from->rec_page_delete; - to->session_cursor_cached += from->session_cursor_cached; + to->session_cursors_cached += from->session_cursors_cached; to->session_compact += from->session_compact; to->session_cursor_open += from->session_cursor_open; to->txn_update_conflict += from->txn_update_conflict; @@ -700,12 +700,12 @@ __wt_stat_dsrc_aggregate( to->compress_raw_fail += WT_STAT_READ(from, compress_raw_fail); to->compress_raw_ok += WT_STAT_READ(from, compress_raw_ok); to->cursor_insert_bulk += WT_STAT_READ(from, cursor_insert_bulk); + to->cursor_cache += WT_STAT_READ(from, cursor_cache); to->cursor_create += WT_STAT_READ(from, cursor_create); to->cursor_restart += WT_STAT_READ(from, cursor_restart); to->cursor_insert_bytes += WT_STAT_READ(from, cursor_insert_bytes); to->cursor_remove_bytes += WT_STAT_READ(from, cursor_remove_bytes); to->cursor_update_bytes += WT_STAT_READ(from, cursor_update_bytes); - to->cursor_cache += WT_STAT_READ(from, cursor_cache); to->cursor_reopen += WT_STAT_READ(from, cursor_reopen); to->cursor_insert += WT_STAT_READ(from, cursor_insert); to->cursor_modify += WT_STAT_READ(from, cursor_modify); @@ -739,8 +739,8 @@ __wt_stat_dsrc_aggregate( to->rec_pages += WT_STAT_READ(from, rec_pages); to->rec_pages_eviction += WT_STAT_READ(from, rec_pages_eviction); to->rec_page_delete += WT_STAT_READ(from, rec_page_delete); - to->session_cursor_cached += - WT_STAT_READ(from, session_cursor_cached); + to->session_cursors_cached += + WT_STAT_READ(from, session_cursors_cached); to->session_compact += WT_STAT_READ(from, session_compact); to->session_cursor_open += WT_STAT_READ(from, session_cursor_open); to->txn_update_conflict += WT_STAT_READ(from, txn_update_conflict); @@ -888,6 +888,7 @@ static const char * const __stats_connection_desc[] = { "connection: total fsync I/Os", "connection: total read I/Os", "connection: total write I/Os", + "cursor: cursor close calls that result in cache", "cursor: cursor create calls", "cursor: cursor insert calls", "cursor: cursor modify calls", @@ -904,7 +905,7 @@ static const char * const __stats_connection_desc[] = { "cursor: cursor sweep cursors examined", "cursor: cursor sweeps", "cursor: cursor update calls", - "cursor: cursors cached on close", + "cursor: cursors currently cached", "cursor: cursors reused from cache", "cursor: truncate calls", "data-handle: connection data handles currently active", @@ -1295,6 +1296,7 @@ __wt_stat_connection_clear_single(WT_CONNECTION_STATS *stats) stats->fsync_io = 0; stats->read_io = 0; stats->write_io = 0; + stats->cursor_cache = 0; stats->cursor_create = 0; stats->cursor_insert = 0; stats->cursor_modify = 0; @@ -1311,7 +1313,7 @@ __wt_stat_connection_clear_single(WT_CONNECTION_STATS *stats) stats->cursor_sweep_examined = 0; stats->cursor_sweep = 0; stats->cursor_update = 0; - stats->cursor_cache = 0; + /* not clearing cursors_cached */ stats->cursor_reopen = 0; stats->cursor_truncate = 0; /* not clearing dh_conn_handle_count */ @@ -1747,6 +1749,7 @@ __wt_stat_connection_aggregate( to->fsync_io += WT_STAT_READ(from, fsync_io); to->read_io += WT_STAT_READ(from, read_io); to->write_io += WT_STAT_READ(from, write_io); + to->cursor_cache += WT_STAT_READ(from, cursor_cache); to->cursor_create += WT_STAT_READ(from, cursor_create); to->cursor_insert += WT_STAT_READ(from, cursor_insert); to->cursor_modify += WT_STAT_READ(from, cursor_modify); @@ -1764,7 +1767,7 @@ __wt_stat_connection_aggregate( WT_STAT_READ(from, cursor_sweep_examined); to->cursor_sweep += WT_STAT_READ(from, cursor_sweep); to->cursor_update += WT_STAT_READ(from, cursor_update); - to->cursor_cache += WT_STAT_READ(from, cursor_cache); + to->cursors_cached += WT_STAT_READ(from, cursors_cached); to->cursor_reopen += WT_STAT_READ(from, cursor_reopen); to->cursor_truncate += WT_STAT_READ(from, cursor_truncate); to->dh_conn_handle_count += WT_STAT_READ(from, dh_conn_handle_count); diff --git a/src/third_party/wiredtiger/src/txn/txn_ckpt.c b/src/third_party/wiredtiger/src/txn/txn_ckpt.c index dd00ff7d36a..bddf8d926f4 100644 --- a/src/third_party/wiredtiger/src/txn/txn_ckpt.c +++ b/src/third_party/wiredtiger/src/txn/txn_ckpt.c @@ -697,8 +697,8 @@ __checkpoint_prepare( * then release any clean handles. */ WT_ASSERT(session, session->ckpt_handle_next == 0); - WT_WITH_TABLE_READ_LOCK(session, ret = __checkpoint_apply_all( - session, cfg, __wt_checkpoint_get_handles)); + WT_WITH_TABLE_READ_LOCK(session, ret = + __checkpoint_apply_all(session, cfg, __wt_checkpoint_get_handles)); return (ret); } diff --git a/src/third_party/wiredtiger/src/txn/txn_timestamp.c b/src/third_party/wiredtiger/src/txn/txn_timestamp.c index 29ed31b2afa..3cb8bf79ef7 100644 --- a/src/third_party/wiredtiger/src/txn/txn_timestamp.c +++ b/src/third_party/wiredtiger/src/txn/txn_timestamp.c @@ -444,8 +444,7 @@ __wt_txn_update_pinned_timestamp(WT_SESSION_IMPL *session, bool force) * Scan the global pinned timestamp again, it's possible that it got * changed after the previous scan. */ - if ((ret = __txn_get_pinned_timestamp( - session, &pinned_timestamp, + if ((ret = __txn_get_pinned_timestamp(session, &pinned_timestamp, WT_TXN_TS_ALREADY_LOCKED | WT_TXN_TS_INCLUDE_OLDEST)) != 0) { __wt_writeunlock(session, &txn_global->rwlock); return (ret == WT_NOTFOUND ? 0 : ret); @@ -1061,7 +1060,7 @@ __wt_txn_set_commit_timestamp(WT_SESSION_IMPL *session) } if (qtxn == NULL) { TAILQ_INSERT_HEAD(&txn_global->commit_timestamph, - txn, commit_timestampq); + txn, commit_timestampq); WT_STAT_CONN_INCR(session, txn_commit_queue_head); } else TAILQ_INSERT_AFTER(&txn_global->commit_timestamph, @@ -1171,7 +1170,7 @@ __wt_txn_set_read_timestamp(WT_SESSION_IMPL *session) } if (qtxn == NULL) { TAILQ_INSERT_HEAD(&txn_global->read_timestamph, - txn, read_timestampq); + txn, read_timestampq); WT_STAT_CONN_INCR(session, txn_read_queue_head); } else TAILQ_INSERT_AFTER(&txn_global->read_timestamph, diff --git a/src/third_party/wiredtiger/src/utilities/util_load_json.c b/src/third_party/wiredtiger/src/utilities/util_load_json.c index b6e63fef784..9e120aaf953 100644 --- a/src/third_party/wiredtiger/src/utilities/util_load_json.c +++ b/src/third_party/wiredtiger/src/utilities/util_load_json.c @@ -173,10 +173,10 @@ static int json_strdup(WT_SESSION *session, JSON_INPUT_STATE *ins, char **resultp) { WT_DECL_RET; + size_t srclen; + ssize_t resultlen; char *result, *resultcpy; const char *src; - ssize_t resultlen; - size_t srclen; result = NULL; src = ins->tokstart + 1; /*strip "" from token */ diff --git a/src/third_party/wiredtiger/test/csuite/random_abort/main.c b/src/third_party/wiredtiger/test/csuite/random_abort/main.c index 7834d88a780..e2f2820a63a 100644 --- a/src/third_party/wiredtiger/test/csuite/random_abort/main.c +++ b/src/third_party/wiredtiger/test/csuite/random_abort/main.c @@ -81,8 +81,8 @@ thread_run(void *arg) WT_RAND_STATE rnd; WT_SESSION *session; WT_THREAD_DATA *td; - uint64_t i; size_t lsize; + uint64_t i; char buf[MAX_VAL], kname[64], lgbuf[8]; char large[128*1024]; @@ -240,8 +240,8 @@ main(int argc, char *argv[]) uint64_t absent, count, key, last_key, middle; uint32_t i, nth, timeout; int ch, status, ret; - const char *working_dir; char buf[1024], fname[64], kname[64]; + const char *working_dir; bool fatal, rand_th, rand_time, verify_only; (void)testutil_set_progname(argv); diff --git a/src/third_party/wiredtiger/test/csuite/random_directio/main.c b/src/third_party/wiredtiger/test/csuite/random_directio/main.c index b2831b5d2ea..a88de3e9be7 100644 --- a/src/third_party/wiredtiger/test/csuite/random_directio/main.c +++ b/src/third_party/wiredtiger/test/csuite/random_directio/main.c @@ -70,7 +70,6 @@ #include "test_util.h" #include "util.h" -#include <fcntl.h> #include <signal.h> #include <sys/wait.h> @@ -331,7 +330,7 @@ gen_kv(char *buf, size_t buf_size, uint64_t id, uint32_t threadid, if (!forward) reverse(keyid); testutil_assert(keyid_size + 4 <= buf_size); - large_size = buf_size - 4 - keyid_size; + large_size = (buf_size - 4) - keyid_size; testutil_check(__wt_snprintf(buf, buf_size, "%s" KEY_SEP "%1.1x" KEY_SEP "%.*s", keyid, threadid, (int)large_size, large)); @@ -369,7 +368,7 @@ schema_operation(WT_SESSION *session, uint32_t threadid, uint64_t id, uint32_t op, uint32_t flags) { WT_CURSOR *cursor; - int ret; + WT_DECL_RET; const char *retry_opname; char uri1[50], uri2[50]; @@ -377,7 +376,6 @@ schema_operation(WT_SESSION *session, uint32_t threadid, uint64_t id, return (0); id -= op; - ret = 0; retry_opname = NULL; switch (op) { @@ -401,7 +399,7 @@ schema_operation(WT_SESSION *session, uint32_t threadid, uint64_t id, cursor->set_key(cursor, uri1); cursor->set_value(cursor, uri1); testutil_check(cursor->insert(cursor)); - cursor->close(cursor); + testutil_check(cursor->close(cursor)); break; case 2: /* Rename the table. */ @@ -428,7 +426,7 @@ schema_operation(WT_SESSION *session, uint32_t threadid, uint64_t id, fprintf(stderr, "UPDATE: %s\n", uri2); */ testutil_check(cursor->update(cursor)); - cursor->close(cursor); + testutil_check(cursor->close(cursor)); break; case 4: /* Drop the table. */ @@ -470,13 +468,13 @@ static WT_THREAD_RET thread_run(void *arg) { WT_CURSOR *cursor, *rev; + WT_DECL_RET; WT_RAND_STATE rnd; WT_SESSION *session; WT_THREAD_DATA *td; size_t lsize; uint64_t i; uint32_t kvsize, op; - int ret; char *buf1, *buf2; char large[LARGE_WRITE_SIZE]; @@ -509,8 +507,9 @@ thread_run(void *arg) again: /* if (i > 0 && i % 10000 == 0) - printf("Thread %d completed %d entries\n", - (int)td->id, (int)i); + printf("Thread %" PRIu32 + " completed %" PRIu64 " entries\n", + td->id, i); */ gen_kv(buf1, kvsize, i, td->id, large, true); @@ -680,7 +679,7 @@ fill_db(uint32_t nth, uint32_t datasize, const char *method, uint32_t flags) static void check_kv(WT_CURSOR *cursor, const char *key, const char *value, bool exists) { - int ret; + WT_DECL_RET; char *got; cursor->set_key(cursor, key); @@ -696,7 +695,7 @@ check_kv(WT_CURSOR *cursor, const char *key, const char *value, bool exists) printf("FAIL: unexpected key in rev file: %s\n", key); testutil_assert(exists); } - cursor->get_value(cursor, &got); + testutil_check(cursor->get_value(cursor, &got)); TEST_STREQ(value, got, "value"); } } @@ -709,7 +708,7 @@ static void check_dropped(WT_SESSION *session, const char *uri) { WT_CURSOR *cursor; - int ret; + WT_DECL_RET; ret = session->open_cursor(session, uri, NULL, NULL, &cursor); testutil_assert(ret == WT_NOTFOUND); @@ -723,7 +722,7 @@ static void check_empty(WT_SESSION *session, const char *uri) { WT_CURSOR *cursor; - int ret; + WT_DECL_RET; testutil_check(session->open_cursor(session, uri, NULL, NULL, &cursor)); ret = cursor->next(cursor); @@ -740,13 +739,13 @@ check_one_entry(WT_SESSION *session, const char *uri, const char *key, const char *value) { WT_CURSOR *cursor; - int ret; + WT_DECL_RET; char *gotkey, *gotvalue; testutil_check(session->open_cursor(session, uri, NULL, NULL, &cursor)); testutil_check(cursor->next(cursor)); - cursor->get_key(cursor, &gotkey); - cursor->get_value(cursor, &gotvalue); + testutil_check(cursor->get_key(cursor, &gotkey)); + testutil_check(cursor->get_value(cursor, &gotvalue)); testutil_assert(WT_STREQ(key, gotkey)); testutil_assert(WT_STREQ(value, gotvalue)); ret = cursor->next(cursor); @@ -769,8 +768,9 @@ check_schema(WT_SESSION *session, uint64_t lastid, uint32_t threadid, return; if (LF_ISSET(SCHEMA_VERBOSE)) - fprintf(stderr, "check_schema(%d, thread=%d)\n", - (int)lastid, (int)threadid); + fprintf(stderr, + "check_schema(%" PRIu64 ", thread=%" PRIu32 ")\n", + lastid, threadid); if (has_schema_operation(lastid, 0)) { /* Create table operation. */ gen_table_name(uri, sizeof(uri), lastid, threadid); @@ -828,11 +828,11 @@ check_db(uint32_t nth, uint32_t datasize, bool directio, uint32_t flags) { WT_CONNECTION *conn; WT_CURSOR *cursor, *meta, *rev; + WT_DECL_RET; WT_SESSION *session; uint64_t gotid, id; uint64_t *lastid; uint32_t gotth, kvsize, th, threadmap; - int ret; char checkdir[4096], savedir[4096]; char *gotkey, *gotvalue, *keybuf, *p; char **large_arr; @@ -912,7 +912,7 @@ check_db(uint32_t nth, uint32_t datasize, bool directio, uint32_t flags) for (ret = 0; ret != WT_NOTFOUND && threadmap != 0; ret = cursor->next(cursor)) { testutil_check(ret); - cursor->get_key(cursor, &gotkey); + testutil_check(cursor->get_key(cursor, &gotkey)); gotid = (uint64_t)strtol(gotkey, &p, 10); testutil_assert(*p == KEY_SEP[0]); p++; @@ -920,9 +920,9 @@ check_db(uint32_t nth, uint32_t datasize, bool directio, uint32_t flags) if (isdigit(*p)) gotth = (uint32_t)(*p - '0'); else if (*p >= 'a' && *p <= 'f') - gotth = (uint32_t)(*p - 'a' + 10); + gotth = (uint32_t)((*p - 'a') + 10); else - gotth = (uint32_t)(*p - 'A' + 10); + gotth = (uint32_t)((*p - 'A') + 10); p++; testutil_assert(*p == KEY_SEP[0]); p++; @@ -956,7 +956,7 @@ check_db(uint32_t nth, uint32_t datasize, bool directio, uint32_t flags) */ gen_kv(keybuf, kvsize, id, th, large_arr[th], true); gen_kv(&keybuf[kvsize], kvsize, id, th, large_arr[th], false); - cursor->get_value(cursor, &gotvalue); + testutil_check(cursor->get_value(cursor, &gotvalue)); TEST_STREQ(keybuf, gotkey, "main table key"); /* @@ -992,7 +992,7 @@ check_db(uint32_t nth, uint32_t datasize, bool directio, uint32_t flags) NULL, &meta)); while ((ret = meta->next(meta)) != WT_NOTFOUND) { testutil_check(ret); - meta->get_key(meta, &gotkey); + testutil_check(meta->get_key(meta, &gotkey)); /* * Names involved in schema testing are of the form: * table:Axxx-t @@ -1054,10 +1054,12 @@ handler(int sig) if (termsig == SIGCONT || termsig == SIGSTOP) return; printf("Child got signal %d (status = %d, 0x%x)\n", - termsig, status, (unsigned int)status); + termsig, status, (u_int)status); #ifdef WCOREDUMP if (WCOREDUMP(status)) - printf("Child process id=%d created core file\n", pid); + printf( + "Child process id=%" PRIuMAX " created core file\n", + (uintmax_t)pid); #endif } @@ -1065,8 +1067,8 @@ handler(int sig) * The core file will indicate why the child exited. Choose EINVAL here. */ testutil_die(EINVAL, - "Child process %" PRIu64 " abnormally exited, status=%d (0x%x)", - (uint64_t)pid, status, status); + "Child process %" PRIuMAX " abnormally exited, status=%d (0x%x)", + (uintmax_t)pid, status, (u_int)status); } /* @@ -1096,9 +1098,9 @@ main(int argc, char *argv[]) size_t size; uint32_t datasize, flags, i, interval, ncycles, nth, timeout; int ch, status; - const char *method, *working_dir; char *arg, *p; char args[1024], buf[1024]; + const char *method, *working_dir; bool populate_only, rand_th, rand_time, verify_only; (void)testutil_set_progname(argv); @@ -1114,7 +1116,7 @@ main(int argc, char *argv[]) working_dir = "WT_TEST.random-directio"; method = "none"; pid = 0; - WT_CLEAR(args); + memset(args, 0, sizeof(args)); if (!has_direct_io()) { fprintf(stderr, "**** test_random_directio: this system does " @@ -1123,8 +1125,7 @@ main(int argc, char *argv[]) } for (i = 0, p = args; i < (uint32_t)argc; i++) { testutil_check(__wt_snprintf_len_set(p, - sizeof(args) - (size_t)(p - args), &size, " %s", - argv[i])); + sizeof(args) - (size_t)(p - args), &size, " %s", argv[i])); p += size; } while ((ch = __wt_getopt(progname, argc, argv, diff --git a/src/third_party/wiredtiger/test/csuite/random_directio/util.c b/src/third_party/wiredtiger/test/csuite/random_directio/util.c index 12f82e0a0cc..04821cfcf84 100644 --- a/src/third_party/wiredtiger/test/csuite/random_directio/util.c +++ b/src/third_party/wiredtiger/test/csuite/random_directio/util.c @@ -46,15 +46,15 @@ void copy_directory(const char *fromdir, const char *todir, bool directio) { - DIR *dirp; struct dirent *dp; struct stat sb; - ssize_t ioret; + DIR *dirp; size_t blksize, bufsize, readbytes, n, remaining; + ssize_t ioret; + uintptr_t bufptr; int openflags, rfd, wfd; + u_char *buf, *orig_buf; char fromfile[4096], tofile[4096]; - unsigned char *buf, *orig_buf; - uintptr_t bufptr; #ifdef O_DIRECT openflags = directio ? O_DIRECT : 0; @@ -62,7 +62,7 @@ copy_directory(const char *fromdir, const char *todir, bool directio) testutil_assert(!directio); openflags = 0; #endif - orig_buf = dcalloc(COPY_BUF_SIZE, sizeof(unsigned char)); + orig_buf = dcalloc(COPY_BUF_SIZE, sizeof(u_char)); buf = NULL; blksize = bufsize = 0; @@ -119,8 +119,7 @@ copy_directory(const char *fromdir, const char *todir, bool directio) bufsize = COPY_BUF_SIZE - blksize; bufptr = (uintptr_t)orig_buf; /* Align pointer up to next block boundary */ - buf = (unsigned char *) - ALIGN_UP(bufptr, blksize); + buf = (u_char *)ALIGN_UP(bufptr, blksize); /* Align size down to block boundary */ testutil_assert(bufsize >= blksize); bufsize = ALIGN_DOWN(bufsize, blksize); diff --git a/src/third_party/wiredtiger/test/csuite/schema_abort/main.c b/src/third_party/wiredtiger/test/csuite/schema_abort/main.c index 79832199bf7..14cdf9d9016 100644 --- a/src/third_party/wiredtiger/test/csuite/schema_abort/main.c +++ b/src/third_party/wiredtiger/test/csuite/schema_abort/main.c @@ -185,8 +185,8 @@ static void test_bulk(THREAD_DATA *td) { WT_CURSOR *c; + WT_DECL_RET; WT_SESSION *session; - int ret; bool create; testutil_check(td->conn->open_session(td->conn, NULL, NULL, &session)); @@ -232,9 +232,9 @@ static void test_bulk_unique(THREAD_DATA *td, int force) { WT_CURSOR *c; + WT_DECL_RET; WT_SESSION *session; uint64_t my_uid; - int ret; char new_uri[64]; testutil_check(td->conn->open_session(td->conn, NULL, NULL, &session)); @@ -242,7 +242,7 @@ test_bulk_unique(THREAD_DATA *td, int force) /* Generate a unique object name. */ my_uid = __wt_atomic_addv64(&uid, 1); testutil_check(__wt_snprintf( - new_uri, sizeof(new_uri), "%s.%u", uri, my_uid)); + new_uri, sizeof(new_uri), "%s.%" PRIu64, uri, my_uid)); if (use_txn) testutil_check(session->begin_transaction(session, NULL)); @@ -280,8 +280,8 @@ static void test_cursor(THREAD_DATA *td) { WT_CURSOR *cursor; + WT_DECL_RET; WT_SESSION *session; - int ret; testutil_check(td->conn->open_session(td->conn, NULL, NULL, &session)); @@ -310,8 +310,8 @@ test_cursor(THREAD_DATA *td) static void test_create(THREAD_DATA *td) { + WT_DECL_RET; WT_SESSION *session; - int ret; testutil_check(td->conn->open_session(td->conn, NULL, NULL, &session)); @@ -335,9 +335,9 @@ test_create(THREAD_DATA *td) static void test_create_unique(THREAD_DATA *td, int force) { + WT_DECL_RET; WT_SESSION *session; uint64_t my_uid; - int ret; char new_uri[64]; testutil_check(td->conn->open_session(td->conn, NULL, NULL, &session)); @@ -345,7 +345,7 @@ test_create_unique(THREAD_DATA *td, int force) /* Generate a unique object name. */ my_uid = __wt_atomic_addv64(&uid, 1); testutil_check(__wt_snprintf( - new_uri, sizeof(new_uri), "%s.%u", uri, my_uid)); + new_uri, sizeof(new_uri), "%s.%" PRIu64, uri, my_uid)); if (use_txn) testutil_check(session->begin_transaction(session, NULL)); @@ -377,8 +377,8 @@ test_create_unique(THREAD_DATA *td, int force) static void test_drop(THREAD_DATA *td, int force) { + WT_DECL_RET; WT_SESSION *session; - int ret; testutil_check(td->conn->open_session(td->conn, NULL, NULL, &session)); @@ -412,8 +412,8 @@ test_drop(THREAD_DATA *td, int force) static void test_rebalance(THREAD_DATA *td) { + WT_DECL_RET; WT_SESSION *session; - int ret; testutil_check(td->conn->open_session(td->conn, NULL, NULL, &session)); @@ -431,8 +431,8 @@ test_rebalance(THREAD_DATA *td) static void test_upgrade(THREAD_DATA *td) { + WT_DECL_RET; WT_SESSION *session; - int ret; testutil_check(td->conn->open_session(td->conn, NULL, NULL, &session)); @@ -450,8 +450,8 @@ test_upgrade(THREAD_DATA *td) static void test_verify(THREAD_DATA *td) { + WT_DECL_RET; WT_SESSION *session; - int ret; testutil_check(td->conn->open_session(td->conn, NULL, NULL, &session)); @@ -559,8 +559,7 @@ thread_ckpt_run(void *arg) * Keep writing checkpoints until killed by parent. */ __wt_epoch(NULL, &start); - i = 0; - while (true) { + for (i = 0;;) { sleep_time = __wt_random(&rnd) % MAX_CKPT_INVL; sleep(sleep_time); if (use_ts) { @@ -575,8 +574,7 @@ thread_ckpt_run(void *arg) printf("CKPT: !stable_set time %" PRIu64 "\n", WT_TIMEDIFF_SEC(now, start)); - if (WT_TIMEDIFF_SEC(now, start) > - MAX_STARTUP) { + if (WT_TIMEDIFF_SEC(now, start) > MAX_STARTUP) { fprintf(stderr, "After %d seconds stable still not " "set. Aborting.\n", MAX_STARTUP); @@ -985,20 +983,18 @@ main(int argc, char *argv[]) REPORT c_rep[MAX_TH], l_rep[MAX_TH], o_rep[MAX_TH]; WT_CONNECTION *conn; WT_CURSOR *cur_coll, *cur_local, *cur_oplog; + WT_DECL_RET; WT_RAND_STATE rnd; WT_SESSION *session; pid_t pid; uint64_t absent_coll, absent_local, absent_oplog, count, key, last_key; uint64_t stable_fp, stable_val; - uint32_t i; - int ret; - char fname[64], kname[64]; - bool fatal; - uint32_t nth, timeout; + uint32_t i, nth, timeout; int ch, status; - const char *working_dir; char buf[512], statname[1024]; - bool rand_th, rand_time, verify_only; + char fname[64], kname[64]; + const char *working_dir; + bool fatal, rand_th, rand_time, verify_only; /* We have nothing to do if this is not a timestamp build */ if (!timestamp_build()) diff --git a/src/third_party/wiredtiger/test/csuite/timestamp_abort/main.c b/src/third_party/wiredtiger/test/csuite/timestamp_abort/main.c index ae292ffa5b4..1989f8457c8 100644 --- a/src/third_party/wiredtiger/test/csuite/timestamp_abort/main.c +++ b/src/third_party/wiredtiger/test/csuite/timestamp_abort/main.c @@ -58,16 +58,17 @@ static char home[1024]; /* Program working dir */ */ #define INVALID_KEY UINT64_MAX #define MAX_CKPT_INVL 5 /* Maximum interval between checkpoints */ -#define MAX_DEFAULT_TH 12 #define MAX_TH 200 /* Maximum configurable threads */ #define MAX_TIME 40 #define MAX_VAL 1024 #define MIN_TH 5 #define MIN_TIME 10 #define PREPARE_FREQ 5 +#define PREPARE_PCT 10 #define PREPARE_YIELD (PREPARE_FREQ * 10) #define RECORDS_FILE "records-%" PRIu32 -#define SESSION_MAX MAX_TH + 3 /* Include program worker threads */ +/* Include worker threads and prepare extra sessions */ +#define SESSION_MAX (MAX_TH + 3 + MAX_TH * PREPARE_PCT) static const char * table_pfx = "table"; static const char * const uri_local = "local"; @@ -260,7 +261,7 @@ thread_run(void *arg) * are in use. Thread numbers start at 0 so we're always guaranteed * that at least one thread is using prepared transactions. */ - use_prep = (use_ts && td->info % 10 == 0) ? true : false; + use_prep = (use_ts && td->info % PREPARE_PCT == 0) ? true : false; /* * For the prepared case we have two sessions so that the oplog session @@ -649,7 +650,7 @@ main(int argc, char *argv[]) timeout = MIN_TIME; } if (rand_th) { - nth = __wt_random(&rnd) % MAX_DEFAULT_TH; + nth = __wt_random(&rnd) % MAX_TH; if (nth < MIN_TH) nth = MIN_TH; } diff --git a/src/third_party/wiredtiger/test/csuite/truncated_log/main.c b/src/third_party/wiredtiger/test/csuite/truncated_log/main.c index 1ed1b6e8157..93ad498271e 100644 --- a/src/third_party/wiredtiger/test/csuite/truncated_log/main.c +++ b/src/third_party/wiredtiger/test/csuite/truncated_log/main.c @@ -138,8 +138,8 @@ fill_db(void) WT_LSN lsn, save_lsn; WT_SESSION *session; uint32_t i, max_key, min_key, units, unused; - bool first; char k[K_SIZE], v[V_SIZE]; + bool first; /* * Run in the home directory so that the records file is in there too. diff --git a/src/third_party/wiredtiger/test/csuite/wt2447_join_main_table/main.c b/src/third_party/wiredtiger/test/csuite/wt2447_join_main_table/main.c index 3e64b86599d..c44a87e3ed6 100644 --- a/src/third_party/wiredtiger/test/csuite/wt2447_join_main_table/main.c +++ b/src/third_party/wiredtiger/test/csuite/wt2447_join_main_table/main.c @@ -56,8 +56,8 @@ get_stat_total(WT_SESSION *session, WT_CURSOR *jcursor, const char *descmatch, uint64_t *pval) { WT_CURSOR *statcursor; + WT_DECL_RET; uint64_t val; - int ret; char *desc, *valstr; bool match; diff --git a/src/third_party/wiredtiger/test/csuite/wt2535_insert_race/main.c b/src/third_party/wiredtiger/test/csuite/wt2535_insert_race/main.c index a0239e40a8a..966258163f6 100644 --- a/src/third_party/wiredtiger/test/csuite/wt2535_insert_race/main.c +++ b/src/third_party/wiredtiger/test/csuite/wt2535_insert_race/main.c @@ -117,9 +117,9 @@ thread_insert_race(void *arg) TEST_OPTS *opts; WT_CONNECTION *conn; WT_CURSOR *cursor; + WT_DECL_RET; WT_SESSION *session; uint64_t i, value; - int ret; opts = (TEST_OPTS *)arg; conn = opts->conn; diff --git a/src/third_party/wiredtiger/test/csuite/wt2719_reconfig/main.c b/src/third_party/wiredtiger/test/csuite/wt2719_reconfig/main.c index 739f8c77fc4..5147d6339df 100644 --- a/src/third_party/wiredtiger/test/csuite/wt2719_reconfig/main.c +++ b/src/third_party/wiredtiger/test/csuite/wt2719_reconfig/main.c @@ -208,7 +208,7 @@ on_alarm(int signo) static void reconfig(TEST_OPTS *opts, WT_SESSION *session, const char *config) { - int ret; + WT_DECL_RET; current = config; diff --git a/src/third_party/wiredtiger/test/csuite/wt2909_checkpoint_integrity/main.c b/src/third_party/wiredtiger/test/csuite/wt2909_checkpoint_integrity/main.c index bb9f293edaa..10c0571c9f6 100644 --- a/src/third_party/wiredtiger/test/csuite/wt2909_checkpoint_integrity/main.c +++ b/src/third_party/wiredtiger/test/csuite/wt2909_checkpoint_integrity/main.c @@ -237,7 +237,7 @@ create_big_string(char **bigp) static void cursor_count_items(WT_CURSOR *cursor, uint64_t *countp) { - int ret; + WT_DECL_RET; *countp = 0; diff --git a/src/third_party/wiredtiger/test/csuite/wt3363_checkpoint_op_races/main.c b/src/third_party/wiredtiger/test/csuite/wt3363_checkpoint_op_races/main.c index 47a0f9df760..b6bbfb584ed 100644 --- a/src/third_party/wiredtiger/test/csuite/wt3363_checkpoint_op_races/main.c +++ b/src/third_party/wiredtiger/test/csuite/wt3363_checkpoint_op_races/main.c @@ -133,9 +133,9 @@ static WT_THREAD_RET do_checkpoints(void *_opts) { TEST_OPTS *opts; + WT_DECL_RET; WT_SESSION *session; time_t now, start; - int ret; opts = (TEST_OPTS *)_opts; (void)time(&start); diff --git a/src/third_party/wiredtiger/test/csuite/wt4156_metadata_salvage/main.c b/src/third_party/wiredtiger/test/csuite/wt4156_metadata_salvage/main.c index abce637e5c6..b813a50c458 100644 --- a/src/third_party/wiredtiger/test/csuite/wt4156_metadata_salvage/main.c +++ b/src/third_party/wiredtiger/test/csuite/wt4156_metadata_salvage/main.c @@ -193,13 +193,13 @@ create_data(TABLE_INFO *t) static void corrupt_metadata(void) { - FILE *fp; struct stat sb; - long off; + FILE *fp; size_t meta_size; - bool corrupted; + long off; uint8_t *buf, *corrupt; char path[256]; + bool corrupted; /* * Open the file, read its contents. Find the string "corrupt" and @@ -271,7 +271,7 @@ verify_metadata(WT_CONNECTION *conn, TABLE_INFO *tables) { TABLE_INFO *t; WT_CURSOR *cursor; - int ret; + WT_DECL_RET; const char *kv; /* @@ -424,17 +424,13 @@ static void wt_open_corrupt(const char *) static void wt_open_corrupt(const char *sfx) { - WT_CONNECTION *conn; - int ret; - char buf[1024]; - #ifdef HAVE_ATTACH - WT_UNUSED(buf); - WT_UNUSED(conn); - WT_UNUSED(ret); WT_UNUSED(sfx); #else - conn = NULL; + WT_CONNECTION *conn; + WT_DECL_RET; + char buf[1024]; + if (sfx != NULL) testutil_check(__wt_snprintf(buf, sizeof(buf), "%s.%s", home, sfx)); @@ -545,7 +541,7 @@ run_all_verification(const char *sfx, TABLE_INFO *t) static void setup_database(const char *src, const char *turtle_dir, const char *meta_dir) { - int ret; + WT_DECL_RET; char buf[1024]; /* @@ -685,7 +681,7 @@ main(int argc, char *argv[]) }; TABLE_INFO *t; TEST_OPTS *opts, _opts; - int ret; + WT_DECL_RET; char buf[1024]; opts = &_opts; diff --git a/src/third_party/wiredtiger/test/format/salvage.c b/src/third_party/wiredtiger/test/format/salvage.c index c631ea599e3..b6849a8603a 100644 --- a/src/third_party/wiredtiger/test/format/salvage.c +++ b/src/third_party/wiredtiger/test/format/salvage.c @@ -53,10 +53,10 @@ salvage(void) static int corrupt(void) { - FILE *fp; struct stat sb; - size_t len, nw; + FILE *fp; wt_off_t offset; + size_t len, nw; int fd, ret; char buf[8 * 1024], copycmd[2 * 1024]; diff --git a/src/third_party/wiredtiger/test/format/wts.c b/src/third_party/wiredtiger/test/format/wts.c index f331282ad85..b62885f0369 100644 --- a/src/third_party/wiredtiger/test/format/wts.c +++ b/src/third_party/wiredtiger/test/format/wts.c @@ -579,15 +579,15 @@ wts_verify(const char *tag) void wts_stats(void) { + FILE *fp; WT_CONNECTION *conn; WT_CURSOR *cursor; WT_DECL_RET; WT_SESSION *session; - FILE *fp; size_t len; - char *stat_name; - const char *desc, *pval; uint64_t v; + const char *desc, *pval; + char *stat_name; /* Ignore statistics if they're not configured. */ if (g.c_statistics == 0) diff --git a/src/third_party/wiredtiger/test/salvage/salvage.c b/src/third_party/wiredtiger/test/salvage/salvage.c index 3517405c6ac..d53ab5b3a3d 100644 --- a/src/third_party/wiredtiger/test/salvage/salvage.c +++ b/src/third_party/wiredtiger/test/salvage/salvage.c @@ -566,8 +566,8 @@ void copy(u_int gen, u_int recno) { FILE *ifp, *ofp; - WT_PAGE_HEADER *dsk; WT_BLOCK_HEADER *blk; + WT_PAGE_HEADER *dsk; char buf[PSIZE]; CHECK((ifp = fopen(LOAD, "r")) != NULL); @@ -615,9 +615,9 @@ process(void) FILE *fp; WT_CONNECTION *conn; WT_CURSOR *cursor; - const char *key, *value; WT_SESSION *session; char config[100]; + const char *key, *value; /* Salvage. */ config[0] = '\0'; diff --git a/src/third_party/wiredtiger/test/suite/test_cursor16.py b/src/third_party/wiredtiger/test/suite/test_cursor16.py new file mode 100755 index 00000000000..8eeb46b8de1 --- /dev/null +++ b/src/third_party/wiredtiger/test/suite/test_cursor16.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python +# +# Public Domain 2014-2018 MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +# test_cursor16.py +# Cursors: final close of cached cursors +# + +import wttest +from wiredtiger import stat + +class test_cursor16(wttest.WiredTigerTestCase): + tablename = 'test_cursor16' + uri_prefix = 'table:' + tablename + uri_count = 100 + session_count = 100 + + conn_config = 'cache_cursors=true,statistics=(fast)' + + # Returns the number of cursors cached + def cached_stats(self): + stat_cursor = self.session.open_cursor('statistics:', None, None) + cache = stat_cursor[stat.conn.cursors_cached][2] + stat_cursor.close() + return cache + + def test_cursor16(self): + uris = [] + cursors = [] + #self.tty('begin cursors cached=' + str(self.cached_stats())) + for i in range(0, self.uri_count): + uri = self.uri_prefix + '-' + str(i) + uris.append(uri) + self.session.create(uri, 'key_format=S,value_format=S') + cursor = self.session.open_cursor(uri) + # We keep the cursors open in the main session, so there + # will always be a reference to their dhandle, and cached + # cursors won't get swept. + cursors.append(cursor) + for j in range(0, 10): + cursor[str(j)] = str(j) + + self.assertEqual(0, self.cached_stats()) + + sessions = [] + for i in range(0, self.session_count): + #if i % 10 == 0: + # self.tty('session count=%d cursors cached=%d' % + # (i, self.cached_stats())) + session = self.conn.open_session(self.session_config) + sessions.append(session) + for uri in uris: + cursor = session.open_cursor(uri) + # spot check, and leaves the cursor positioned + self.assertEqual(cursor['3'],'3') + cursor.close() + + #self.tty('max cursors cached=' + str(self.cached_stats())) + i = 0 + for session in sessions: + #if i % 10 == 0: + # self.tty('session count=%d cursors cached=%d' % + # (self.session_count - i, self.cached_stats())) + i += 1 + session.close() + + #self.tty('end cursors cached=' + str(self.cached_stats())) + self.assertEqual(0, self.cached_stats()) + +if __name__ == '__main__': + wttest.run() diff --git a/src/third_party/wiredtiger/test/suite/test_prepare_lookaside02.py b/src/third_party/wiredtiger/test/suite/test_prepare_lookaside02.py index 3dc4eb2d52a..c1b817f992a 100644 --- a/src/third_party/wiredtiger/test/suite/test_prepare_lookaside02.py +++ b/src/third_party/wiredtiger/test/suite/test_prepare_lookaside02.py @@ -81,7 +81,7 @@ class test_prepare_lookaside02(wttest.WiredTigerTestCase, suite_subprocess): else: self.session.rollback_transaction() - # Trigger a checkpoint, which could trigger reconcilation + # Trigger a checkpoint, which could trigger reconciliation self.conn.set_timestamp('stable_timestamp=' + timestamp_str(150)) self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(150)) self.session.checkpoint() @@ -102,7 +102,7 @@ class test_prepare_lookaside02(wttest.WiredTigerTestCase, suite_subprocess): else: self.session.rollback_transaction() - # Trigger a checkpoint, which could trigger reconcilation + # Trigger a checkpoint, which could trigger reconciliation self.conn.set_timestamp('stable_timestamp=' + timestamp_str(250)) self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(250)) self.session.checkpoint() @@ -135,7 +135,7 @@ class test_prepare_lookaside02(wttest.WiredTigerTestCase, suite_subprocess): c[3] = 1 self.session.commit_transaction('commit_timestamp=' + timestamp_str(301)) - # Trigger a checkpoint, which could trigger reconcilation + # Trigger a checkpoint, which could trigger reconciliation self.conn.set_timestamp('stable_timestamp=' + timestamp_str(350)) self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(350)) self.session.checkpoint() @@ -165,7 +165,7 @@ class test_prepare_lookaside02(wttest.WiredTigerTestCase, suite_subprocess): else: self.session.rollback_transaction() - # Trigger a checkpoint, which could trigger reconcilation + # Trigger a checkpoint, which could trigger reconciliation self.conn.set_timestamp('stable_timestamp=' + timestamp_str(450)) self.conn.set_timestamp('oldest_timestamp=' + timestamp_str(450)) self.session.checkpoint() diff --git a/src/third_party/wiredtiger/test/suite/test_sweep03.py b/src/third_party/wiredtiger/test/suite/test_sweep03.py index c378b54b710..29eb9a65bee 100644 --- a/src/third_party/wiredtiger/test/suite/test_sweep03.py +++ b/src/third_party/wiredtiger/test/suite/test_sweep03.py @@ -57,7 +57,7 @@ class test_sweep03(wttest.WiredTigerTestCase, suite_subprocess): scenarios = make_scenarios(types) # Wait for the sweep server to run - let it run twice, since the statistic - # is incrememented at the start of a sweep and the test relies on sweep + # is incremented at the start of a sweep and the test relies on sweep # completing it's work. def wait_for_sweep(self, baseline): # Check regularly for up to 5 seconds total. diff --git a/src/third_party/wiredtiger/test/thread/stats.c b/src/third_party/wiredtiger/test/thread/stats.c index 675a1bcfd87..141e1d07588 100644 --- a/src/third_party/wiredtiger/test/thread/stats.c +++ b/src/third_party/wiredtiger/test/thread/stats.c @@ -40,8 +40,8 @@ stats(void) WT_SESSION *session; uint64_t v; int ret; - char name[64]; const char *desc, *pval; + char name[64]; testutil_check(conn->open_session(conn, NULL, NULL, &session)); diff --git a/src/third_party/wiredtiger/test/windows/windows_shim.c b/src/third_party/wiredtiger/test/windows/windows_shim.c index b562fa97594..21f2a130217 100644 --- a/src/third_party/wiredtiger/test/windows/windows_shim.c +++ b/src/third_party/wiredtiger/test/windows/windows_shim.c @@ -52,8 +52,8 @@ usleep(useconds_t useconds) int gettimeofday(struct timeval* tp, void* tzp) { - uint64_t ns100; FILETIME time; + uint64_t ns100; tzp = tzp; |