diff options
author | Luke Chen <luke.chen@mongodb.com> | 2021-10-07 17:44:57 +1100 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-10-07 07:04:01 +0000 |
commit | 58971da1ef93435a9f62bf4708a81713def6e88c (patch) | |
tree | c75ff94f74016177b2eef5f82c76a7d79238e8a5 /src/third_party/wiredtiger/test/format/ops.c | |
parent | cf4ce26ca21a836aa336313a4a10676ca91c3131 (diff) | |
download | mongo-58971da1ef93435a9f62bf4708a81713def6e88c.tar.gz |
Import wiredtiger: e8bf2e5fcb33197b73c7bb550742926f59e22218 from branch mongodb-4.4r4.4.10-rc0r4.4.10
ref: a9bd69a7ca..e8bf2e5fcb
for: 4.4.10
WT-5270 Create wtperf script for evergreen
WT-7169 Commit ts should not be lesser than the last durable ts in test_timestamp22.py
WT-7392 Added evicted flag to dhandle for use by session sweep
WT-7757 Skip obsolete leaf pages without having to read them
WT-7924 Create a stress test for prefix search near key validation
WT-7980 Create interface to "log:" cursor which switches log files before returning them
WT-7992 Provide API to return the last key in a table regardless of visibility
WT-8022 Verify WT_CURSOR.modify return values in format test program
WT-8036 Added connection panic flag in two assert statements in wt_evict_thread_run and _wt_evict_thread_stop.
WT-8048 Remove split_8 timing stress configuration
WT-8055 Fix issue when compact quits when running at the same time as a checkpoint
WT-8059 Add a check in salvage when no overflow items are found
WT-8068 Improve __rollback_row_modify control flow
WT-8069 Coverity analysis defect 120706: Redundant test
WT-8070 Remove discrepancy between prefix_key and prefix_search
WT-8078 Implement tiered storage local retention caching
WT-8086 Create cpp test for prefix search near entries
WT-8092 Prefix early exit when keys are present in the insert list
WT-8101 Enable diagnostic mode for the CPP tests in evergreen
WT-8115 Define macros only when necessary in cpp files
WT-8119 Add targeted compact testing to the existing testing framework
WT-8146 Stop the tracking component when a CPP test ends
WT-8161 Reduce verbosity of CMake Evergreen smoke
WT-8162 Refactor uses of SMOKE arg in 'define_c_test' helper
WT-8164 Disable rollback_to_stable10 python test on Windows
WT-8171 Implement a C style test in the CPP testing framework
WT-8193 Wrong corner case in VLCS rollback-to-stable
Diffstat (limited to 'src/third_party/wiredtiger/test/format/ops.c')
-rw-r--r-- | src/third_party/wiredtiger/test/format/ops.c | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/src/third_party/wiredtiger/test/format/ops.c b/src/third_party/wiredtiger/test/format/ops.c index 81d21111ec3..4c24ba9fd45 100644 --- a/src/third_party/wiredtiger/test/format/ops.c +++ b/src/third_party/wiredtiger/test/format/ops.c @@ -171,6 +171,8 @@ tinfo_teardown(void) tinfo = tinfo_list[i]; __wt_buf_free(NULL, &tinfo->vprint); + __wt_buf_free(NULL, &tinfo->moda); + __wt_buf_free(NULL, &tinfo->modb); /* * Assert records were not removed unless configured to do so, otherwise subsequent runs can @@ -1454,26 +1456,50 @@ modify_build(TINFO *tinfo, WT_MODIFY *entries, int *nentriesp) } /* + * modify -- + * Cursor modify worker function. + */ +static int +modify(TINFO *tinfo, WT_CURSOR *cursor, bool positioned) +{ + WT_MODIFY entries[MAX_MODIFY_ENTRIES]; + int nentries; + bool modify_check; + + /* Periodically verify the WT_CURSOR.modify return. */ + modify_check = positioned && mmrand(&tinfo->rnd, 1, 10) == 1; + if (modify_check) { + testutil_check(cursor->get_value(cursor, &tinfo->moda)); + testutil_check( + __wt_buf_set(CUR2S(cursor), &tinfo->moda, tinfo->moda.data, tinfo->moda.size)); + } + + modify_build(tinfo, entries, &nentries); + WT_RET(cursor->modify(cursor, entries, nentries)); + + testutil_check(cursor->get_value(cursor, tinfo->value)); + if (modify_check) { + testutil_modify_apply(&tinfo->moda, &tinfo->modb, entries, nentries); + testutil_assert(tinfo->moda.size == tinfo->value->size && + memcmp(tinfo->moda.data, tinfo->value->data, tinfo->moda.size) == 0); + } + return (0); +} + +/* * row_modify -- * Modify a row in a row-store file. */ static int row_modify(TINFO *tinfo, WT_CURSOR *cursor, bool positioned) { - WT_DECL_RET; - WT_MODIFY entries[MAX_MODIFY_ENTRIES]; - int nentries; if (!positioned) { key_gen(tinfo->key, tinfo->keyno); cursor->set_key(cursor, tinfo->key); } - modify_build(tinfo, entries, &nentries); - if ((ret = cursor->modify(cursor, entries, nentries)) != 0) - return (ret); - - testutil_check(cursor->get_value(cursor, tinfo->value)); + WT_RET(modify(tinfo, cursor, positioned)); trace_op(tinfo, "modify %" PRIu64 " {%.*s}, {%s}", tinfo->keyno, (int)tinfo->key->size, (char *)tinfo->key->data, trace_item(tinfo, tinfo->value)); @@ -1488,18 +1514,10 @@ row_modify(TINFO *tinfo, WT_CURSOR *cursor, bool positioned) static int col_modify(TINFO *tinfo, WT_CURSOR *cursor, bool positioned) { - WT_DECL_RET; - WT_MODIFY entries[MAX_MODIFY_ENTRIES]; - int nentries; - if (!positioned) cursor->set_key(cursor, tinfo->keyno); - modify_build(tinfo, entries, &nentries); - if ((ret = cursor->modify(cursor, entries, nentries)) != 0) - return (ret); - - testutil_check(cursor->get_value(cursor, tinfo->value)); + WT_RET(modify(tinfo, cursor, positioned)); trace_op(tinfo, "modify %" PRIu64 ", {%s}", tinfo->keyno, trace_item(tinfo, tinfo->value)); |