diff options
author | Alex Gorrod <alexg@wiredtiger.com> | 2012-09-07 16:14:21 +1000 |
---|---|---|
committer | Alex Gorrod <alexg@wiredtiger.com> | 2012-09-07 16:14:21 +1000 |
commit | 031de977f249815c69fe5f42f46a1028960f55e1 (patch) | |
tree | 0f430eba32379b3681761d848e6d706079644ebe /test/fops | |
parent | c83edc4cda742c059e766f36e1310673efd5de55 (diff) | |
download | mongo-031de977f249815c69fe5f42f46a1028960f55e1.tar.gz |
Add a bulk cursor operation into fop test.
Diffstat (limited to 'test/fops')
-rw-r--r-- | test/fops/file.c | 27 | ||||
-rw-r--r-- | test/fops/fops.c | 6 | ||||
-rw-r--r-- | test/fops/thread.h | 1 |
3 files changed, 33 insertions, 1 deletions
diff --git a/test/fops/file.c b/test/fops/file.c index aa9aa641526..ee4d7d9724f 100644 --- a/test/fops/file.c +++ b/test/fops/file.c @@ -8,6 +8,33 @@ #include "thread.h" void +obj_bulk(void) +{ + WT_CURSOR *c; + WT_SESSION *session; + int ret; + + if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0) + die("conn.session", ret); + + if ((ret = session->create(session, uri, NULL)) != 0) + if (ret != EEXIST) + die("session.create", ret); + + if (ret != EEXIST) { + if ((ret = session->open_cursor( + session, uri, NULL, "bulk", &c)) != 0) + die("session.open_cursor", ret); + + /* Sleep so that other threads have a chance to interfere. */ + sleep(1); + c->close(c); + } + if ((ret = session->close(session, NULL)) != 0) + die("session.close", ret); +} + +void obj_create(void) { WT_SESSION *session; diff --git a/test/fops/fops.c b/test/fops/fops.c index 1dc777e9df5..6976357b63e 100644 --- a/test/fops/fops.c +++ b/test/fops/fops.c @@ -11,6 +11,7 @@ static void *fop(void *); static void print_stats(u_int); typedef struct { + int bulk; /* bulk load */ int create; /* session.create */ int drop; /* session.drop */ int ckpt; /* session.checkpoint */ @@ -107,7 +108,7 @@ fop(void *arg) s = &run_stats[id]; for (i = 0; i < nops; ++i, sched_yield()) - switch (r() % 5) { + switch (r() % 6) { case 0: ++s->create; obj_create(); @@ -128,6 +129,9 @@ fop(void *arg) ++s->verify; obj_verify(); break; + case 5: + ++s->bulk; + obj_bulk(); default: break; } diff --git a/test/fops/thread.h b/test/fops/thread.h index fdfc333abd1..e4bfa9783cb 100644 --- a/test/fops/thread.h +++ b/test/fops/thread.h @@ -33,6 +33,7 @@ void die(const char *, int) __attribute__((noreturn)); void die(const char *, int); #endif int fop_start(u_int); +void obj_bulk(void); void obj_checkpoint(void); void obj_create(void); void obj_drop(void); |