diff options
author | Luke Chen <luke.chen@mongodb.com> | 2022-06-20 03:18:00 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-06-20 03:46:55 +0000 |
commit | a0fa34fe4c9c6915207ba3e9bc736198a913f06f (patch) | |
tree | 78b7487c596968699c64cf4caa9888dba5690e71 | |
parent | 991697d7ec688b87e534b581ef5d810349be86d4 (diff) | |
download | mongo-a0fa34fe4c9c6915207ba3e9bc736198a913f06f.tar.gz |
Import wiredtiger: f8fca788e9099b5cf9ddace29b499d8f33ae4dd2 from branch mongodb-master
ref: 6942de4463..f8fca788e9
for: 6.1.0-rc0
WT-9378 Fix multiple coverity issues in cursor-bound-01
4 files changed, 9 insertions, 10 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 7a3debf5fb7..980d8bcbd34 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -2,5 +2,5 @@ "vendor": "wiredtiger", "github": "wiredtiger/wiredtiger.git", "branch": "mongodb-master", - "commit": "6942de44633e8b5acb4b17ae165f58adfc569b0d" + "commit": "f8fca788e9099b5cf9ddace29b499d8f33ae4dd2" } diff --git a/src/third_party/wiredtiger/test/cppsuite/src/component/metrics_writer.cpp b/src/third_party/wiredtiger/test/cppsuite/src/component/metrics_writer.cpp index 5c632ab169d..f8c8bb2e242 100644 --- a/src/third_party/wiredtiger/test/cppsuite/src/component/metrics_writer.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/metrics_writer.cpp @@ -39,11 +39,9 @@ metrics_writer::add_stat(const std::string &stat_string) void metrics_writer::output_perf_file(const std::string &test_name) { - std::ofstream perf_file; + std::ofstream perf_file(test_name + ".json"); std::string stat_info = "[{\"info\":{\"test_name\": \"" + test_name + "\"},\"metrics\": ["; - perf_file.open(test_name + ".json"); - for (const auto &stat : _stats) stat_info += stat + ","; diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_perf.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_perf.cpp index 1dda1cc5b78..07a48267633 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_perf.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_perf.cpp @@ -63,7 +63,6 @@ class bounded_cursor_perf : public test { * Each read operation performs next() and prev() calls with both normal cursors and bounded * cursors. */ - int range_ret_next, range_ret_prev, ret_next, ret_prev; /* Initialize the different timers for each function. */ execution_timer bounded_next("bounded_next", test::_args.test_name); @@ -89,14 +88,15 @@ class bounded_cursor_perf : public test { set_bounds(prev_range_cursor); while (tc->running()) { + int ret_next = 0, ret_prev = 0; while (ret_next != WT_NOTFOUND && ret_prev != WT_NOTFOUND && tc->running()) { - range_ret_next = bounded_next.track([&next_range_cursor]() -> int { + auto range_ret_next = bounded_next.track([&next_range_cursor]() -> int { return next_range_cursor->next(next_range_cursor.get()); }); ret_next = default_next.track( [&next_cursor]() -> int { return next_cursor->next(next_cursor.get()); }); - range_ret_prev = bounded_prev.track([&prev_range_cursor]() -> int { + auto range_ret_prev = bounded_prev.track([&prev_range_cursor]() -> int { return prev_range_cursor->prev(prev_range_cursor.get()); }); ret_prev = default_prev.track( diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_01.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_01.cpp index 530c55f0acc..27eb855f10f 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_01.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_01.cpp @@ -392,7 +392,7 @@ class cursor_bound_01 : public test { * When exact < 0, the returned key should be less than the search key and performing a * next() should be greater than the search key. */ - } else if (range_exact < 0) { + } else { testutil_assert(custom_lexicographical_compare(key, search_key, false)); /* Check that the next key is greater than the search key. */ @@ -445,7 +445,8 @@ class cursor_bound_01 : public test { validate_search_near_not_found( scoped_cursor &normal_cursor, const bound &lower_bound, const bound &upper_bound) { - int ret, exact; + int ret = 0, exact = 0; + auto lower_key = lower_bound.get_key(); auto upper_key = upper_bound.get_key(); logger::log_msg(LOG_TRACE, @@ -659,7 +660,7 @@ class cursor_bound_01 : public test { auto srch_key = random_generator::instance().generate_random_string( key_size, characters_type::ALPHABET); - int exact; + int exact = 0; range_cursor->set_key(range_cursor.get(), srch_key.c_str()); auto ret = range_cursor->search_near(range_cursor.get(), &exact); testutil_assert(ret == 0 || ret == WT_NOTFOUND); |