summaryrefslogtreecommitdiff
path: root/test/format/util.c
diff options
context:
space:
mode:
authorDavid Hows <david.hows@mongodb.com>2017-01-06 12:12:50 +1100
committerDavid Hows <david.hows@mongodb.com>2017-01-06 12:12:50 +1100
commitd48181f6f4db08761ed7b80b0332908b272ad0d0 (patch)
tree38929fdcc5415ee7b001b6f1a406bd5bd777b737 /test/format/util.c
parent040e3d6f764c0fb626cb47fede54469f57d0c6e0 (diff)
parent8d2324943364286056ae399043f70b8a937de312 (diff)
Merge branch 'mongodb-3.6' into mongodb-3.2mongodb-3.2.12
Diffstat (limited to 'test/format/util.c')
-rw-r--r--test/format/util.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/format/util.c b/test/format/util.c
index a709aa93a2e..b9788f1ac75 100644
--- a/test/format/util.c
+++ b/test/format/util.c
@@ -459,3 +459,47 @@ fclose_and_clear(FILE **fpp)
testutil_die(errno, "fclose");
return;
}
+
+/*
+ * alter --
+ * Periodically alter a table's metadata.
+ */
+void *
+alter(void *arg)
+{
+ WT_CONNECTION *conn;
+ WT_SESSION *session;
+ u_int period;
+ bool access_value;
+ char buf[32];
+
+ (void)(arg);
+ conn = g.wts_conn;
+
+ /*
+ * Only alter the access pattern hint. If we alter the cache resident
+ * setting we may end up with a setting that fills cache and doesn't
+ * allow it to be evicted.
+ */
+ access_value = false;
+
+ /* Open a session */
+ testutil_check(conn->open_session(conn, NULL, NULL, &session));
+
+ while (!g.workers_finished) {
+ period = mmrand(NULL, 1, 10);
+
+ snprintf(buf, sizeof(buf),
+ "access_pattern_hint=%s", access_value ? "random" : "none");
+ access_value = !access_value;
+ if (session->alter(session, g.uri, buf) != 0)
+ break;
+ while (period > 0 && !g.workers_finished) {
+ --period;
+ sleep(1);
+ }
+ }
+
+ testutil_check(session->close(session, NULL));
+ return (NULL);
+}