summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/bench
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2018-07-30 16:19:19 +1000
committerLuke Chen <luke.chen@mongodb.com>2018-07-30 16:19:19 +1000
commit9ca6c110827ffb212613d4e6c5f9645a41c0432d (patch)
tree842e8c8aa6c8222ef658501044b40580ec15b1d0 /src/third_party/wiredtiger/bench
parent44c522677421537b3cf118d323af82353ad956d4 (diff)
downloadmongo-9ca6c110827ffb212613d4e6c5f9645a41c0432d.tar.gz
Import wiredtiger: 376f355fb03c770b4fc7374ef817c0c786311e7a from branch mongodb-4.2
ref: 1be1b793be..376f355fb0 for: 4.1.2 WT-3963 Add a schema intensive abort testing WT-4147 Log recovery should not ignore corruption outside of log records in a log file WT-4183 Extend verbose option to log more messages on error returns WT-4186 Log recovery should detect and report corruption within log records WT-4187 Coverity: unused value complaints WT-4189 Potential infinite loop in __async_flush_wait(). WT-4191 Fix Coverity static analysis errors WT-4195 When encountering an illegal value, log the value that failed WT-4196 Make log corruption checking work regardless of the machine byte order WT-4198 Some supported MongoDB architectures don't support crc32 hardware WT-4199 Fix an incorrect report of log corruption
Diffstat (limited to 'src/third_party/wiredtiger/bench')
-rw-r--r--src/third_party/wiredtiger/bench/wtperf/idle_table_cycle.c4
-rw-r--r--src/third_party/wiredtiger/bench/wtperf/wtperf.c60
-rw-r--r--src/third_party/wiredtiger/bench/wtperf/wtperf.h2
-rw-r--r--src/third_party/wiredtiger/bench/wtperf/wtperf_truncate.c30
4 files changed, 37 insertions, 59 deletions
diff --git a/src/third_party/wiredtiger/bench/wtperf/idle_table_cycle.c b/src/third_party/wiredtiger/bench/wtperf/idle_table_cycle.c
index f84e9ddaed5..baab2177507 100644
--- a/src/third_party/wiredtiger/bench/wtperf/idle_table_cycle.c
+++ b/src/third_party/wiredtiger/bench/wtperf/idle_table_cycle.c
@@ -129,7 +129,7 @@ cycle_idle_tables(void *arg)
session, uri, "force,checkpoint_wait=false")) == EBUSY)
__wt_sleep(1, 0);
- if (ret != 0 && ret != EBUSY) {
+ if (ret != 0) {
lprintf(wtperf, ret, 0,
"Table drop failed in cycle_idle_tables.");
wtperf->error = true;
@@ -178,5 +178,5 @@ stop_idle_table_cycle(WTPERF *wtperf, wt_thread_t idle_table_cycle_thread)
return;
wtperf->idle_cycle_run = false;
- testutil_check(__wt_thread_join(NULL, idle_table_cycle_thread));
+ testutil_check(__wt_thread_join(NULL, &idle_table_cycle_thread));
}
diff --git a/src/third_party/wiredtiger/bench/wtperf/wtperf.c b/src/third_party/wiredtiger/bench/wtperf/wtperf.c
index 4adb3db3c6c..047ce549746 100644
--- a/src/third_party/wiredtiger/bench/wtperf/wtperf.c
+++ b/src/third_party/wiredtiger/bench/wtperf/wtperf.c
@@ -473,44 +473,31 @@ do_range_reads(WTPERF *wtperf, WT_CURSOR *cursor, int64_t read_range)
/* pre_load_data --
* Pull everything into cache before starting the workload phase.
*/
-static int
+static void
pre_load_data(WTPERF *wtperf)
{
CONFIG_OPTS *opts;
WT_CONNECTION *conn;
WT_CURSOR *cursor;
WT_SESSION *session;
- char *key;
- int ret;
size_t i;
+ int ret;
+ char *key;
opts = wtperf->opts;
conn = wtperf->conn;
- if ((ret = conn->open_session(
- conn, NULL, opts->sess_config, &session)) != 0) {
- lprintf(wtperf, ret, 0, "worker: WT_CONNECTION.open_session");
- goto err;
- }
+ testutil_check(conn->open_session(
+ conn, NULL, opts->sess_config, &session));
for (i = 0; i < opts->table_count; i++) {
- if ((ret = session->open_cursor(session,
- wtperf->uris[i], NULL, NULL, &cursor)) != 0) {
- lprintf(wtperf, ret, 0,
- "worker: WT_SESSION.open_cursor: %s",
- wtperf->uris[i]);
- goto err;
- }
- while (cursor->next(cursor) == 0)
- if ((ret = cursor->get_key(cursor, &key)) != 0)
- goto err;
- if ((ret = cursor->close(cursor)) != 0)
- goto err;
- }
- if ((ret = session->close(session, NULL)) != 0)
- goto err;
- if (ret != 0)
-err: lprintf(wtperf, ret, 0, "Pre-workload traverse error");
- return (ret);
+ testutil_check(session->open_cursor(
+ session, wtperf->uris[i], NULL, NULL, &cursor));
+ while ((ret = cursor->next(cursor)) == 0)
+ testutil_check(cursor->get_key(cursor, &key));
+ testutil_assert(ret == WT_NOTFOUND);
+ testutil_check(cursor->close(cursor));
+ }
+ testutil_check(session->close(session, NULL));
}
static WT_THREAD_RET
@@ -608,8 +595,7 @@ worker(void *arg)
/* Setup for truncate */
if (workload->truncate != 0)
- if ((ret = setup_truncate(wtperf, thread, session)) != 0)
- goto err;
+ setup_truncate(wtperf, thread, session);
key_buf = thread->key_buf;
value_buf = thread->value_buf;
@@ -1268,7 +1254,7 @@ static WT_THREAD_RET
monitor(void *arg)
{
struct timespec t;
- struct tm *tm, _tm;
+ struct tm localt;
CONFIG_OPTS *opts;
FILE *fp;
WTPERF *wtperf;
@@ -1337,8 +1323,9 @@ monitor(void *arg)
continue;
__wt_epoch(NULL, &t);
- tm = localtime_r(&t.tv_sec, &_tm);
- (void)strftime(buf, sizeof(buf), "%b %d %H:%M:%S", tm);
+ testutil_check(__wt_localtime(NULL, &t.tv_sec, &localt));
+ testutil_assert(
+ strftime(buf, sizeof(buf), "%b %d %H:%M:%S", &localt) != 0);
reads = sum_read_ops(wtperf);
inserts = sum_insert_ops(wtperf);
@@ -2197,7 +2184,7 @@ start_all_runs(WTPERF *wtperf)
/* Wait for threads to finish. */
for (i = 0; i < opts->database_count; i++)
- testutil_check(__wt_thread_join(NULL, threads[i]));
+ testutil_check(__wt_thread_join(NULL, &threads[i]));
for (i = 0; i < opts->database_count && wtperfs[i] != NULL; i++) {
wtperf_free(wtperfs[i]);
@@ -2286,8 +2273,9 @@ start_run(WTPERF *wtperf)
start_threads(wtperf, NULL, wtperf->ckptthreads,
opts->checkpoint_threads, checkpoint_worker);
}
- if (opts->pre_load_data && (ret = pre_load_data(wtperf)) != 0)
- goto err;
+ if (opts->pre_load_data)
+ pre_load_data(wtperf);
+
/* Execute the workload. */
if ((ret = execute_workload(wtperf)) != 0)
goto err;
@@ -2341,7 +2329,7 @@ err: if (ret == 0)
stop_threads(1, wtperf->ckptthreads);
if (monitor_created != 0)
- testutil_check(__wt_thread_join(NULL, monitor_thread));
+ testutil_check(__wt_thread_join(NULL, &monitor_thread));
if (wtperf->conn != NULL && opts->close_conn &&
(t_ret = wtperf->conn->close(wtperf->conn, NULL)) != 0) {
@@ -2761,7 +2749,7 @@ stop_threads(u_int num, WTPERF_THREAD *threads)
return;
for (i = 0; i < num; ++i, ++threads) {
- testutil_check(__wt_thread_join(NULL, threads->handle));
+ testutil_check(__wt_thread_join(NULL, &threads->handle));
free(threads->key_buf);
threads->key_buf = NULL;
diff --git a/src/third_party/wiredtiger/bench/wtperf/wtperf.h b/src/third_party/wiredtiger/bench/wtperf/wtperf.h
index 7fb370e0b5c..5efbe5f6e13 100644
--- a/src/third_party/wiredtiger/bench/wtperf/wtperf.h
+++ b/src/third_party/wiredtiger/bench/wtperf/wtperf.h
@@ -268,7 +268,7 @@ int run_truncate(
WTPERF *, WTPERF_THREAD *, WT_CURSOR *, WT_SESSION *, int *);
int setup_log_file(WTPERF *);
void setup_throttle(WTPERF_THREAD *);
-int setup_truncate(WTPERF *, WTPERF_THREAD *, WT_SESSION *);
+void setup_truncate(WTPERF *, WTPERF_THREAD *, WT_SESSION *);
void start_idle_table_cycle(WTPERF *, wt_thread_t *);
void stop_idle_table_cycle(WTPERF *, wt_thread_t);
void worker_throttle(WTPERF_THREAD *);
diff --git a/src/third_party/wiredtiger/bench/wtperf/wtperf_truncate.c b/src/third_party/wiredtiger/bench/wtperf/wtperf_truncate.c
index 1f910b9a3a4..83cfe3ffae0 100644
--- a/src/third_party/wiredtiger/bench/wtperf/wtperf_truncate.c
+++ b/src/third_party/wiredtiger/bench/wtperf/wtperf_truncate.c
@@ -34,7 +34,7 @@ decode_key(char *key_buf)
return (strtoull(key_buf, NULL, 10));
}
-int
+void
setup_truncate(WTPERF *wtperf, WTPERF_THREAD *thread, WT_SESSION *session)
{
CONFIG_OPTS *opts;
@@ -42,9 +42,8 @@ setup_truncate(WTPERF *wtperf, WTPERF_THREAD *thread, WT_SESSION *session)
TRUNCATE_QUEUE_ENTRY *truncate_item;
WORKLOAD *workload;
WT_CURSOR *cursor;
- char *key;
- int ret;
uint64_t end_point, final_stone_gap, i, start_point;
+ char *key;
opts = wtperf->opts;
end_point = final_stone_gap = start_point = 0;
@@ -52,9 +51,8 @@ setup_truncate(WTPERF *wtperf, WTPERF_THREAD *thread, WT_SESSION *session)
workload = thread->workload;
/* We are limited to only one table when running truncate. */
- if ((ret = session->open_cursor(
- session, wtperf->uris[0], NULL, NULL, &cursor)) != 0)
- goto err;
+ testutil_check(session->open_cursor(
+ session, wtperf->uris[0], NULL, NULL, &cursor));
/*
* If we find the workload getting behind we multiply the number of
@@ -79,18 +77,13 @@ setup_truncate(WTPERF *wtperf, WTPERF_THREAD *thread, WT_SESSION *session)
* data available, then we need to setup some initial truncation
* stones.
*/
- if ((ret = cursor->next(cursor)) != 0 ||
- (ret = cursor->get_key(cursor, &key)) != 0) {
- lprintf(wtperf, ret, 0, "truncate setup start: failed");
- goto err;
- }
+ testutil_check(cursor->next(cursor));
+ testutil_check(cursor->get_key(cursor, &key));
start_point = decode_key(key);
- if ((cursor->reset(cursor)) != 0 || (ret = cursor->prev(cursor)) != 0 ||
- (ret = cursor->get_key(cursor, &key)) != 0) {
- lprintf(wtperf, ret, 0, "truncate setup end: failed");
- goto err;
- }
+ testutil_check(cursor->reset(cursor));
+ testutil_check(cursor->prev(cursor));
+ testutil_check(cursor->get_key(cursor, &key));
end_point = decode_key(key);
/* Assign stones if there are enough documents. */
@@ -119,10 +112,7 @@ setup_truncate(WTPERF *wtperf, WTPERF_THREAD *thread, WT_SESSION *session)
}
trunc_cfg->stone_gap = final_stone_gap;
-err: if ((ret = cursor->close(cursor)) != 0) {
- lprintf(wtperf, ret, 0, "truncate setup: cursor close failed");
- }
- return (ret);
+ testutil_check(cursor->close(cursor));
}
int