diff options
author | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-10-10 16:29:49 +1100 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-10-10 16:37:55 +1100 |
commit | 39998ac6928c4e7f3acd2f7ee2fc5fb4df056c18 (patch) | |
tree | c075233cd32c6ec0205af77db475836c0fba60e9 /src/third_party/wiredtiger/test/fops | |
parent | dd094ce1bc1fb424ccc6dd71939e5c7a30159e2e (diff) | |
download | mongo-39998ac6928c4e7f3acd2f7ee2fc5fb4df056c18.tar.gz |
Import wiredtiger: 0cd3d5bbd8a5c8779f1129c6754b4463403e788f from branch mongodb-3.6
ref: 6f561957cb..0cd3d5bbd8
for: 3.5.14
WT-3200 LSM bug: Failed lookup in bloom filter.
WT-3435 Lookaside eviction should be able to save unstable updates
WT-3453 Enhance lookaside table test coverage in Python suite
WT-3559 Detect when a checkpoint races with metadata changes
WT-3579 Enhance support for running wtperf workloads with workgen
WT-3582 Cache stuck full of internal pages
WT-3593 Add an API to enforce consistent use of timestamps (#3667)
WT-3599 reconciliation calculates block matching checksums too frequently.
WT-3600 timestamp API lets you set timestamps with invalid characters
WT-3612 Improve documentation of durability with backup cursors
WT-3613 test/format cache full with LSM
WT-3618 WT remove solaris from evergreen builds
WT-3620 POSIX thread attribute structures must be destroyed
WT-3621 Add test for full backups with concurrent table creation
WT-3622 Allow upper case hexadecimal timestamps
WT-3627 test_txn14.test_txn14.test_log_flush timeout
WT-3631 Convert timestamps to integers in Python tests before comparing
WT-3636 Account for page image sizes in cache consistently
WT-3638 format failure, update list without complete visible record
WT-3639 Test/format tried to drop named checkpoints during a hot backup
WT-3641 Track maximum timestamp used in each btree
WT-3642 Avoid lookaside reads for dead trees
Diffstat (limited to 'src/third_party/wiredtiger/test/fops')
-rw-r--r-- | src/third_party/wiredtiger/test/fops/file.c | 64 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/fops/t.c | 13 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/fops/thread.h | 1 |
3 files changed, 75 insertions, 3 deletions
diff --git a/src/third_party/wiredtiger/test/fops/file.c b/src/third_party/wiredtiger/test/fops/file.c index 60320ae3a38..118845ab805 100644 --- a/src/third_party/wiredtiger/test/fops/file.c +++ b/src/third_party/wiredtiger/test/fops/file.c @@ -39,6 +39,8 @@ obj_bulk(void) testutil_check(conn->open_session(conn, NULL, NULL, &session)); + if (use_txn) + testutil_check(session->begin_transaction(session, NULL)); if ((ret = session->create(session, uri, config)) != 0) if (ret != EEXIST && ret != EBUSY) testutil_die(ret, "session.create"); @@ -51,6 +53,21 @@ obj_bulk(void) } else if (ret != ENOENT && ret != EBUSY && ret != EINVAL) testutil_die(ret, "session.open_cursor bulk"); } + + if (use_txn) { + /* + * As the operations are being performed concurrently, + * return value can be ENOENT, EBUSY or EINVAL will set + * error to transaction opened by session. In these + * cases the transaction has to be aborted. + */ + if (ret != ENOENT && ret != EBUSY && ret != EINVAL) + ret = session->commit_transaction(session, NULL); + else + ret = session->rollback_transaction(session, NULL); + if (ret == EINVAL) + testutil_die(ret, "session.commit bulk"); + } testutil_check(session->close(session, NULL)); } @@ -70,6 +87,8 @@ obj_bulk_unique(int force) new_uri, sizeof(new_uri), "%s.%u", uri, ++uid)); testutil_check(pthread_rwlock_unlock(&single)); + if (use_txn) + testutil_check(session->begin_transaction(session, NULL)); testutil_check(session->create(session, new_uri, config)); __wt_yield(); @@ -89,6 +108,10 @@ obj_bulk_unique(int force) if (ret != EBUSY) testutil_die(ret, "session.drop: %s", new_uri); + if (use_txn && + (ret = session->commit_transaction(session, NULL)) != 0 && + ret != EINVAL) + testutil_die(ret, "session.commit bulk unique"); testutil_check(session->close(session, NULL)); } @@ -101,12 +124,19 @@ obj_cursor(void) testutil_check(conn->open_session(conn, NULL, NULL, &session)); + if (use_txn) + testutil_check(session->begin_transaction(session, NULL)); if ((ret = session->open_cursor(session, uri, NULL, NULL, &cursor)) != 0) { if (ret != ENOENT && ret != EBUSY) testutil_die(ret, "session.open_cursor"); } else testutil_check(cursor->close(cursor)); + + if (use_txn && + (ret = session->commit_transaction(session, NULL)) != 0 && + ret != EINVAL) + testutil_die(ret, "session.commit cursor"); testutil_check(session->close(session, NULL)); } @@ -118,10 +148,16 @@ obj_create(void) testutil_check(conn->open_session(conn, NULL, NULL, &session)); + if (use_txn) + testutil_check(session->begin_transaction(session, NULL)); if ((ret = session->create(session, uri, config)) != 0) if (ret != EEXIST && ret != EBUSY) testutil_die(ret, "session.create"); + if (use_txn && + (ret = session->commit_transaction(session, NULL)) != 0 && + ret != EINVAL) + testutil_die(ret, "session.commit create"); testutil_check(session->close(session, NULL)); } @@ -140,13 +176,25 @@ obj_create_unique(int force) new_uri, sizeof(new_uri), "%s.%u", uri, ++uid)); testutil_check(pthread_rwlock_unlock(&single)); + if (use_txn) + testutil_check(session->begin_transaction(session, NULL)); testutil_check(session->create(session, new_uri, config)); + if (use_txn && + (ret = session->commit_transaction(session, NULL)) != 0 && + ret != EINVAL) + testutil_die(ret, "session.commit create unique"); __wt_yield(); + if (use_txn) + testutil_check(session->begin_transaction(session, NULL)); while ((ret = session->drop( session, new_uri, force ? "force" : NULL)) != 0) if (ret != EBUSY) testutil_die(ret, "session.drop: %s", new_uri); + if (use_txn && + (ret = session->commit_transaction(session, NULL)) != 0 && + ret != EINVAL) + testutil_die(ret, "session.commit create unique"); testutil_check(session->close(session, NULL)); } @@ -159,10 +207,26 @@ obj_drop(int force) testutil_check(conn->open_session(conn, NULL, NULL, &session)); + if (use_txn) + testutil_check(session->begin_transaction(session, NULL)); if ((ret = session->drop(session, uri, force ? "force" : NULL)) != 0) if (ret != ENOENT && ret != EBUSY) testutil_die(ret, "session.drop"); + if (use_txn) { + /* + * As the operations are being performed concurrently, + * return value can be ENOENT or EBUSY will set + * error to transaction opened by session. In these + * cases the transaction has to be aborted. + */ + if (ret != ENOENT && ret != EBUSY) + ret = session->commit_transaction(session, NULL); + else + ret = session->rollback_transaction(session, NULL); + if (ret == EINVAL) + testutil_die(ret, "session.commit drop"); + } testutil_check(session->close(session, NULL)); } diff --git a/src/third_party/wiredtiger/test/fops/t.c b/src/third_party/wiredtiger/test/fops/t.c index b6b80ba5db8..fcbbdcabd73 100644 --- a/src/third_party/wiredtiger/test/fops/t.c +++ b/src/third_party/wiredtiger/test/fops/t.c @@ -28,6 +28,7 @@ #include "thread.h" +bool use_txn; /* Operations with user txn */ WT_CONNECTION *conn; /* WiredTiger connection */ pthread_rwlock_t single; /* Single thread */ u_int nops; /* Operations */ @@ -77,8 +78,9 @@ main(int argc, char *argv[]) nops = 1000; nthreads = 10; runs = 1; + use_txn = false; config_open = working_dir = NULL; - while ((ch = __wt_getopt(progname, argc, argv, "C:h:l:n:r:t:")) != EOF) + while ((ch = __wt_getopt(progname, argc, argv, "C:h:l:n:r:t:x")) != EOF) switch (ch) { case 'C': /* wiredtiger_open config */ config_open = __wt_optarg; @@ -102,6 +104,9 @@ main(int argc, char *argv[]) case 't': nthreads = (u_int)atoi(__wt_optarg); break; + case 'x': + use_txn = true; + break; default: return (usage()); } @@ -245,7 +250,8 @@ usage(void) { fprintf(stderr, "usage: %s " - "[-C wiredtiger-config] [-l log] [-n ops] [-r runs] [-t threads]\n", + "[-C wiredtiger-config] [-l log] [-n ops] [-r runs] [-t threads] " + "[-x] \n", progname); fprintf(stderr, "%s", "\t-C specify wiredtiger_open configuration arguments\n" @@ -253,6 +259,7 @@ usage(void) "\t-l specify a log file\n" "\t-n set number of operations each thread does\n" "\t-r set number of runs\n" - "\t-t set number of threads\n"); + "\t-t set number of threads\n" + "\t-x operations within user transaction \n"); return (EXIT_FAILURE); } diff --git a/src/third_party/wiredtiger/test/fops/thread.h b/src/third_party/wiredtiger/test/fops/thread.h index f6b6bdffd63..0df36025be0 100644 --- a/src/third_party/wiredtiger/test/fops/thread.h +++ b/src/third_party/wiredtiger/test/fops/thread.h @@ -30,6 +30,7 @@ #include <signal.h> +extern bool use_txn; /* Operations with user txn */ extern WT_CONNECTION *conn; /* WiredTiger connection */ extern u_int nops; /* Operations per thread */ |