summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/test/cursor_order
diff options
context:
space:
mode:
authorAlex Gorrod <alexander.gorrod@mongodb.com>2017-04-01 07:14:43 +1100
committerAlex Gorrod <alexander.gorrod@mongodb.com>2017-04-01 07:25:11 +1100
commitf6cbdfb8c5c52209f58562ccbe14013c72df3f40 (patch)
tree850ab25ff8e499689bd40ccdad284e629fafec7e /src/third_party/wiredtiger/test/cursor_order
parent08d29c36403608802c45375277f88c7fcaf708e0 (diff)
downloadmongo-f6cbdfb8c5c52209f58562ccbe14013c72df3f40.tar.gz
Import wiredtiger: af735d14a603a6ef6256a6685f09ec13755a5024 from branch mongodb-3.6
ref: cc2f15f595..af735d14a6 for: 3.5.6 SERVER-28168 Cannot start or repair mongodb after unexpected shutdown. SERVER-28194 Missing WiredTiger.turtle file loses data WT-2439 Enhance reconciliation page layout WT-2978 Make WiredTiger python binding pip-compatible WT-2990 Fix a new bug where checkpoint load live_open failed WT-3136 bug fix: WiredTiger doesn't check sprintf calls for error return WT-3155 Remove WT_CONN_SERVER_RUN flag WT-3182 Switch make-check to run the short test suite by default WT-3190 Enhance eviction thread auto-tuning algorithm WT-3191 Fix lint complaints WT-3193 Close a race between verify opening a handle and eviction visiting it WT-3196 Race with LSM and eviction when switching chunks WT-3199 bug: eviction assertion failure WT-3202 wtperf report an error on in_memory=true mode : No such file or directory WT-3203 bulk-load state changes can race WT-3204 eviction changes cost LSM performance WT-3206 bug: core dump on NULL page index WT-3207 Drops with checkpoint_wait=false should not wait for checkpoints WT-3208 test format hung with 9mb cache WT-3211 WT_CURSOR.remove cannot always retain its position. WT-3212 'wt dump' crashes when given table with unknown collator WT-3213 generated test/format CONFIG invalid on next run WT-3216 add support for clang-tidy WT-3218 unexpected checkpoint ordering failures WT-3224 LSM assertion failure pindex->entries == 1 WT-3225 WiredTiger won't build with clang on CentOS 7.3.1611 WT-3227 Python test suite inserts unnecessary whitespace in error output. WT-3228 Remove with overwrite shouldn't return WT_NOTFOUND WT-3234 Update WiredTiger build for clang 4.0. WT-3238 Java: Cursor.compare and Cursor.equals throw Exceptions for valid return values WT-3240 Coverity reports WT-3243 Reorder log slot release so joins don't wait on IO WT-3244 Metadata operations failing in in-memory configurations when the cache is full WT-98 Update the current cursor value without a search
Diffstat (limited to 'src/third_party/wiredtiger/test/cursor_order')
-rw-r--r--src/third_party/wiredtiger/test/cursor_order/cursor_order.c14
-rw-r--r--src/third_party/wiredtiger/test/cursor_order/cursor_order_file.c30
-rw-r--r--src/third_party/wiredtiger/test/cursor_order/cursor_order_ops.c20
3 files changed, 31 insertions, 33 deletions
diff --git a/src/third_party/wiredtiger/test/cursor_order/cursor_order.c b/src/third_party/wiredtiger/test/cursor_order/cursor_order.c
index 85b8c68e545..d3c64b54ab5 100644
--- a/src/third_party/wiredtiger/test/cursor_order/cursor_order.c
+++ b/src/third_party/wiredtiger/test/cursor_order/cursor_order.c
@@ -29,7 +29,6 @@
#include "cursor_order.h"
static char home[512]; /* Program working dir */
-static char *progname; /* Program name */
static FILE *logfp; /* Log file */
static int handle_error(WT_EVENT_HANDLER *, WT_SESSION *, int, const char *);
@@ -51,10 +50,7 @@ main(int argc, char *argv[])
int ch, cnt, runs;
char *config_open, *working_dir;
- if ((progname = strrchr(argv[0], DIR_DELIM)) == NULL)
- progname = argv[0];
- else
- ++progname;
+ (void)testutil_set_progname(argv);
cfg = &_cfg;
config_open = NULL;
@@ -185,19 +181,15 @@ wt_connect(SHARED_CONFIG *cfg, char *config_open)
};
int ret;
char config[512];
- size_t print_count;
testutil_clean_work_dir(home);
testutil_make_work_dir(home);
- print_count = (size_t)snprintf(config, sizeof(config),
+ testutil_check(__wt_snprintf(config, sizeof(config),
"create,statistics=(all),error_prefix=\"%s\",%s%s",
progname,
config_open == NULL ? "" : ",",
- config_open == NULL ? "" : config_open);
-
- if (print_count >= sizeof(config))
- testutil_die(EINVAL, "Config string too long");
+ config_open == NULL ? "" : config_open));
if ((ret = wiredtiger_open(
home, &event_handler, config, &cfg->conn)) != 0)
diff --git a/src/third_party/wiredtiger/test/cursor_order/cursor_order_file.c b/src/third_party/wiredtiger/test/cursor_order/cursor_order_file.c
index 5dc7194b5fb..42d7af54de4 100644
--- a/src/third_party/wiredtiger/test/cursor_order/cursor_order_file.c
+++ b/src/third_party/wiredtiger/test/cursor_order/cursor_order_file.c
@@ -34,23 +34,21 @@ file_create(SHARED_CONFIG *cfg, const char *name)
WT_CONNECTION *conn;
WT_SESSION *session;
int ret;
- char *p, *end, config[128];
+ char config[128];
conn = cfg->conn;
if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
testutil_die(ret, "conn.session");
- p = config;
- end = config + sizeof(config);
- p += snprintf(p, (size_t)(end - p),
+ testutil_check(__wt_snprintf(config, sizeof(config),
"key_format=%s,"
"internal_page_max=%d,"
"split_deepen_min_child=200,"
- "leaf_page_max=%d,",
- cfg->ftype == ROW ? "S" : "r", 16 * 1024, 128 * 1024);
- if (cfg->ftype == FIX)
- (void)snprintf(p, (size_t)(end - p), ",value_format=3t");
+ "leaf_page_max=%d,"
+ "%s",
+ cfg->ftype == ROW ? "S" : "r", 16 * 1024, 128 * 1024,
+ cfg->ftype == FIX ? ",value_format=3t" : ""));
if ((ret = session->create(session, name, config)) != 0)
if (ret != EEXIST)
@@ -67,9 +65,10 @@ load(SHARED_CONFIG *cfg, const char *name)
WT_CURSOR *cursor;
WT_ITEM *value, _value;
WT_SESSION *session;
- char keybuf[64], valuebuf[64];
- int64_t keyno;
+ size_t len;
+ uint64_t keyno;
int ret;
+ char keybuf[64], valuebuf[64];
conn = cfg->conn;
@@ -83,9 +82,10 @@ load(SHARED_CONFIG *cfg, const char *name)
testutil_die(ret, "cursor.open");
value = &_value;
- for (keyno = 1; keyno <= (int64_t)cfg->nkeys; ++keyno) {
+ for (keyno = 1; keyno <= cfg->nkeys; ++keyno) {
if (cfg->ftype == ROW) {
- snprintf(keybuf, sizeof(keybuf), "%016u", (u_int)keyno);
+ testutil_check(__wt_snprintf(
+ keybuf, sizeof(keybuf), "%016" PRIu64, keyno));
cursor->set_key(cursor, keybuf);
} else
cursor->set_key(cursor, (uint32_t)keyno);
@@ -93,8 +93,10 @@ load(SHARED_CONFIG *cfg, const char *name)
if (cfg->ftype == FIX)
cursor->set_value(cursor, 0x01);
else {
- value->size = (uint32_t)snprintf(
- valuebuf, sizeof(valuebuf), "%37u", (u_int)keyno);
+ testutil_check(__wt_snprintf_len_set(
+ valuebuf, sizeof(valuebuf),
+ &len, "%37" PRIu64, keyno));
+ value->size = (uint32_t)len;
cursor->set_value(cursor, value);
}
if ((ret = cursor->insert(cursor)) != 0)
diff --git a/src/third_party/wiredtiger/test/cursor_order/cursor_order_ops.c b/src/third_party/wiredtiger/test/cursor_order/cursor_order_ops.c
index 58da49b2991..299f22684c9 100644
--- a/src/third_party/wiredtiger/test/cursor_order/cursor_order_ops.c
+++ b/src/third_party/wiredtiger/test/cursor_order/cursor_order_ops.c
@@ -69,7 +69,8 @@ ops_start(SHARED_CONFIG *cfg)
run_info[i].cfg = cfg;
if (i == 0 || cfg->multiple_files) {
run_info[i].name = dmalloc(64);
- snprintf(run_info[i].name, 64, FNAME, (int)i);
+ testutil_check(__wt_snprintf(
+ run_info[i].name, 64, FNAME, (int)i));
/* Vary by orders of magnitude */
if (cfg->vary_nops)
@@ -93,8 +94,8 @@ ops_start(SHARED_CONFIG *cfg)
run_info[offset].name = dmalloc(64);
/* Have reverse scans read from tables with writes. */
name_index = i % cfg->append_inserters;
- snprintf(
- run_info[offset].name, 64, FNAME, (int)name_index);
+ testutil_check(__wt_snprintf(
+ run_info[offset].name, 64, FNAME, (int)name_index));
/* Vary by orders of magnitude */
if (cfg->vary_nops)
@@ -231,7 +232,7 @@ reverse_scan(void *arg)
id = (uintmax_t)arg;
s = &run_info[id];
cfg = s->cfg;
- __wt_thread_id(tid, sizeof(tid));
+ testutil_check(__wt_thread_id(tid, sizeof(tid)));
__wt_random_init(&s->rnd);
printf(" reverse scan thread %2" PRIuMAX
@@ -272,6 +273,7 @@ append_insert_op(
{
WT_ITEM *value, _value;
uint64_t keyno;
+ size_t len;
int ret;
char keybuf[64], valuebuf[64];
@@ -281,7 +283,8 @@ append_insert_op(
keyno = __wt_atomic_add64(&cfg->key_range, 1);
if (cfg->ftype == ROW) {
- snprintf(keybuf, sizeof(keybuf), "%016u", (u_int)keyno);
+ testutil_check(__wt_snprintf(
+ keybuf, sizeof(keybuf), "%016" PRIu64, keyno));
cursor->set_key(cursor, keybuf);
} else
cursor->set_key(cursor, (uint32_t)keyno);
@@ -291,8 +294,9 @@ append_insert_op(
if (cfg->ftype == FIX)
cursor->set_value(cursor, 0x10);
else {
- value->size = (uint32_t)snprintf(
- valuebuf, sizeof(valuebuf), "XXX %37u", (u_int)keyno);
+ testutil_check(__wt_snprintf_len_set(
+ valuebuf, sizeof(valuebuf), &len, "XXX %37" PRIu64, keyno));
+ value->size = (uint32_t)len;
cursor->set_value(cursor, value);
}
if ((ret = cursor->insert(cursor)) != 0)
@@ -318,7 +322,7 @@ append_insert(void *arg)
id = (uintmax_t)arg;
s = &run_info[id];
cfg = s->cfg;
- __wt_thread_id(tid, sizeof(tid));
+ testutil_check(__wt_thread_id(tid, sizeof(tid)));
__wt_random_init(&s->rnd);
printf("write thread %2" PRIuMAX " starting: tid: %s, file: %s\n",