diff options
58 files changed, 575 insertions, 323 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..c0c1882fc42 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 = 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,11 @@ 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' + print('X: ' + workloadopts) + s = '#/usr/bin/env python\n' s += '# generated from ' + self.filename + '\n' s += self.prefix @@ -581,6 +621,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/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/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 047c7a16450..c45a35282e1 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -1,5 +1,5 @@ { - "commit": "22b1224ee0623db1ed03f6bf5dd681deb1aa8b2e", + "commit": "e8cf194d813096cc2b30c0dd2d9d9c93ade79756", "github": "wiredtiger/wiredtiger.git", "vendor": "wiredtiger", "branch": "mongodb-4.2" 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..597323cb4fa 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_std.c +++ b/src/third_party/wiredtiger/src/cursor/cur_std.c @@ -831,8 +831,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_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/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/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_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; |