summaryrefslogtreecommitdiff
path: root/test/checkpoint
diff options
context:
space:
mode:
Diffstat (limited to 'test/checkpoint')
-rw-r--r--test/checkpoint/checkpointer.c26
-rw-r--r--test/checkpoint/test_checkpoint.c4
-rw-r--r--test/checkpoint/workers.c22
3 files changed, 30 insertions, 22 deletions
diff --git a/test/checkpoint/checkpointer.c b/test/checkpoint/checkpointer.c
index ef49a9492ce..84d2765843a 100644
--- a/test/checkpoint/checkpointer.c
+++ b/test/checkpoint/checkpointer.c
@@ -74,7 +74,7 @@ checkpointer(void *arg)
WT_UNUSED(arg);
- __wt_thread_id(tid, sizeof(tid));
+ testutil_check(__wt_thread_id(tid, sizeof(tid)));
printf("checkpointer thread starting: tid: %s\n", tid);
(void)real_checkpointer();
@@ -107,8 +107,9 @@ real_checkpointer(void)
"WiredTigerCheckpoint", strlen("WiredTigerCheckpoint")) == 0)
checkpoint_config = NULL;
else {
+ testutil_check(__wt_snprintf(
+ _buf, sizeof(_buf), "name=%s", g.checkpoint_name));
checkpoint_config = _buf;
- snprintf(checkpoint_config, 128, "name=%s", g.checkpoint_name);
}
while (g.running) {
/* Execute a checkpoint */
@@ -147,7 +148,8 @@ verify_checkpoint(WT_SESSION *session)
ret = t_ret = 0;
key_count = 0;
- snprintf(ckpt, 128, "checkpoint=%s", g.checkpoint_name);
+ testutil_check(__wt_snprintf(
+ ckpt, sizeof(ckpt), "checkpoint=%s", g.checkpoint_name));
cursors = calloc((size_t)g.ntables, sizeof(*cursors));
if (cursors == NULL)
return (log_print_err("verify_checkpoint", ENOMEM, 1));
@@ -159,7 +161,8 @@ verify_checkpoint(WT_SESSION *session)
*/
if (g.cookies[i].type == LSM)
continue;
- snprintf(next_uri, 128, "table:__wt%04d", i);
+ testutil_check(__wt_snprintf(
+ next_uri, sizeof(next_uri), "table:__wt%04d", i));
if ((ret = session->open_cursor(
session, next_uri, NULL, ckpt, &cursors[i])) != 0) {
(void)log_print_err(
@@ -296,7 +299,8 @@ diagnose_key_error(
session = cursor1->session;
key1_orig = key2_orig = 0;
- snprintf(ckpt, 128, "checkpoint=%s", g.checkpoint_name);
+ testutil_check(__wt_snprintf(
+ ckpt, sizeof(ckpt), "checkpoint=%s", g.checkpoint_name));
/* Save the failed keys. */
if (cursor1->get_key(cursor1, &key1_orig) != 0 ||
@@ -338,7 +342,8 @@ diagnose_key_error(
* Now try opening new cursors on the checkpoints and see if we
* get the same missing key via searching.
*/
- snprintf(next_uri, 128, "table:__wt%04d", index1);
+ testutil_check(__wt_snprintf(
+ next_uri, sizeof(next_uri), "table:__wt%04d", index1));
if (session->open_cursor(session, next_uri, NULL, ckpt, &c) != 0)
return (1);
c->set_key(c, key1_orig);
@@ -350,7 +355,8 @@ diagnose_key_error(
if (c->close(c) != 0)
return (1);
- snprintf(next_uri, 128, "table:__wt%04d", index2);
+ testutil_check(__wt_snprintf(
+ next_uri, sizeof(next_uri), "table:__wt%04d", index2));
if (session->open_cursor(session, next_uri, NULL, ckpt, &c) != 0)
return (1);
c->set_key(c, key1_orig);
@@ -367,7 +373,8 @@ live_check:
* Now try opening cursors on the live checkpoint to see if we get the
* same missing key via searching.
*/
- snprintf(next_uri, 128, "table:__wt%04d", index1);
+ testutil_check(__wt_snprintf(
+ next_uri, sizeof(next_uri), "table:__wt%04d", index1));
if (session->open_cursor(session, next_uri, NULL, NULL, &c) != 0)
return (1);
c->set_key(c, key1_orig);
@@ -376,7 +383,8 @@ live_check:
if (c->close(c) != 0)
return (1);
- snprintf(next_uri, 128, "table:__wt%04d", index2);
+ testutil_check(__wt_snprintf(
+ next_uri, sizeof(next_uri), "table:__wt%04d", index2));
if (session->open_cursor(session, next_uri, NULL, NULL, &c) != 0)
return (1);
c->set_key(c, key2_orig);
diff --git a/test/checkpoint/test_checkpoint.c b/test/checkpoint/test_checkpoint.c
index c7132b433d2..e7e1a0b81a5 100644
--- a/test/checkpoint/test_checkpoint.c
+++ b/test/checkpoint/test_checkpoint.c
@@ -199,11 +199,11 @@ wt_connect(const char *config_open)
testutil_make_work_dir(g.home);
- snprintf(config, sizeof(config),
+ testutil_check(__wt_snprintf(config, sizeof(config),
"create,statistics=(fast),error_prefix=\"%s\",cache_size=1GB%s%s",
progname,
config_open == NULL ? "" : ",",
- config_open == NULL ? "" : config_open);
+ config_open == NULL ? "" : config_open));
if ((ret = wiredtiger_open(
g.home, &event_handler, config, &g.conn)) != 0)
diff --git a/test/checkpoint/workers.c b/test/checkpoint/workers.c
index e4fe7bd1b29..82d1b8685c4 100644
--- a/test/checkpoint/workers.c
+++ b/test/checkpoint/workers.c
@@ -39,14 +39,12 @@ static int
create_table(WT_SESSION *session, COOKIE *cookie)
{
int ret;
- char *p, *end, config[128];
+ char config[128];
- p = config;
- end = config + sizeof(config);
- p += snprintf(p, (size_t)(end - p),
- "key_format=%s,value_format=S", cookie->type == COL ? "r" : "q");
- if (cookie->type == LSM)
- (void)snprintf(p, (size_t)(end - p), ",type=lsm");
+ testutil_check(__wt_snprintf(config, sizeof(config),
+ "key_format=%s,value_format=S,%s",
+ cookie->type == COL ? "r" : "q",
+ cookie->type == LSM ? ",type=lsm" : ""));
if ((ret = session->create(session, cookie->uri, config)) != 0)
if (ret != EEXIST)
@@ -88,8 +86,9 @@ start_workers(table_type type)
(table_type)((i % MAX_TABLE_TYPE) + 1);
else
g.cookies[i].type = type;
- (void)snprintf(g.cookies[i].uri, 128,
- "%s%04d", URI_BASE, g.cookies[i].id);
+ testutil_check(__wt_snprintf(
+ g.cookies[i].uri, sizeof(g.cookies[i].uri),
+ "%s%04d", URI_BASE, g.cookies[i].id));
/* Should probably be atomic to avoid races. */
if ((ret = create_table(session, &g.cookies[i])) != 0)
@@ -132,7 +131,8 @@ worker_op(WT_CURSOR *cursor, uint64_t keyno, u_int new_val)
char valuebuf[64];
cursor->set_key(cursor, keyno);
- (void)snprintf(valuebuf, sizeof(valuebuf), "%037u", new_val);
+ testutil_check(__wt_snprintf(
+ valuebuf, sizeof(valuebuf), "%037u", new_val));
cursor->set_value(cursor, valuebuf);
if ((ret = cursor->insert(cursor)) != 0) {
if (ret == WT_ROLLBACK)
@@ -153,7 +153,7 @@ worker(void *arg)
WT_UNUSED(arg);
- __wt_thread_id(tid, sizeof(tid));
+ testutil_check(__wt_thread_id(tid, sizeof(tid)));
printf("worker thread starting: tid: %s\n", tid);
(void)real_worker();