246246WorkloadRunner::start_table_idle_cycle (WT_CONNECTION *conn)
247247{
248248 WT_SESSION *session;
249- int ret = conn->open_session (conn, nullptr , nullptr , &session);
250- if (ret != 0 ) {
251- THROW_ERRNO (ret, " Error opening a session." );
249+ if (conn->open_session (conn, nullptr , nullptr , &session) != 0 ) {
250+ THROW (" Error opening a session." );
252251 }
253252
254253 for (int cycle_count = 0 ; !stopping; ++cycle_count) {
@@ -259,11 +258,11 @@ WorkloadRunner::start_table_idle_cycle(WT_CONNECTION *conn)
259258 workgen_clock (&start);
260259
261260 /* Create a table. */
262- int ret = session-> create (session, uri, " key_format=S,value_format=S " ) ;
263- if (ret != 0 ) {
261+ int ret;
262+ if (( ret = session-> create (session, uri, " key_format=S,value_format=S " )) != 0 ) {
264263 if (ret == EBUSY)
265264 continue ;
266- THROW_ERRNO (ret, " Table create failed in start_table_idle_cycle." );
265+ THROW ( " Table create failed in start_table_idle_cycle." );
267266 }
268267
269268 uint64_t stop;
@@ -277,13 +276,11 @@ WorkloadRunner::start_table_idle_cycle(WT_CONNECTION *conn)
277276
278277 /* Open and close cursor. */
279278 WT_CURSOR *cursor;
280- ret = session->open_cursor (session, uri, nullptr , nullptr , &cursor);
281- if (ret != 0 ) {
282- THROW_ERRNO (ret, " Cursor open failed." );
279+ if ((ret = session->open_cursor (session, uri, nullptr , nullptr , &cursor)) != 0 ) {
280+ THROW (" Cursor open failed." );
283281 }
284- ret = cursor->close (cursor);
285- if (ret != 0 ) {
286- THROW_ERRNO (ret, " Cursor close failed." );
282+ if ((ret = cursor->close (cursor)) != 0 ) {
283+ THROW (" Cursor close failed." );
287284 }
288285
289286 workgen_clock (&stop);
@@ -303,7 +300,7 @@ WorkloadRunner::start_table_idle_cycle(WT_CONNECTION *conn)
303300 }
304301
305302 if (ret != 0 ) {
306- THROW_ERRNO (ret, " Table drop failed in cycle_idle_tables." );
303+ THROW ( " Table drop failed in cycle_idle_tables." );
307304 }
308305 workgen_clock (&stop);
309306 last_interval = ns_to_sec (stop - start);
470467WorkloadRunner::start_tables_create (WT_CONNECTION *conn)
471468{
472469 WT_SESSION *session;
473- int ret = conn->open_session (conn, nullptr , nullptr , &session);
474- if (ret != 0 ) {
475- THROW_ERRNO (ret, " Error opening a session." );
470+ if (conn->open_session (conn, nullptr , nullptr , &session) != 0 ) {
471+ THROW (" Error opening a session." );
476472 }
477473
478474 ContextInternal *icontext = _workload->_context ->_internal ;
598594WorkloadRunner::start_tables_drop (WT_CONNECTION *conn)
599595{
600596 WT_SESSION *session;
601- int ret = conn->open_session (conn, nullptr , nullptr , &session);
602- if (ret != 0 ) {
603- THROW_ERRNO (ret, " Error opening a session." );
597+ if (conn->open_session (conn, nullptr , nullptr , &session) != 0 ) {
598+ THROW (" Error opening a session." );
604599 }
605600
606601 ContextInternal *icontext = _workload->_context ->_internal ;
@@ -694,7 +689,7 @@ WorkloadRunner::start_tables_drop(WT_CONNECTION *conn)
694689 * removed from the shared data structures, and we know no thread is operating on them.
695690 */
696691 for (auto uri : drop_files) {
697- int ret ;
692+ WT_DECL_RET ;
698693 // Spin on EBUSY. We do not expect to get stuck.
699694 while ((ret = session->drop (session, uri.c_str (), " checkpoint_wait=false" )) == EBUSY) {
700695 if (stopping)
@@ -703,7 +698,7 @@ WorkloadRunner::start_tables_drop(WT_CONNECTION *conn)
703698 sleep (1 );
704699 }
705700 if (ret != 0 )
706- THROW_ERRNO (ret, " Table drop failed for '" << uri << " ' in start_tables_drop." );
701+ THROW ( " Table drop failed for '" << uri << " ' in start_tables_drop." );
707702
708703 VERBOSE (*_workload, " Dropped table: " << uri);
709704 }
@@ -915,31 +910,28 @@ ContextInternal::create_all(WT_CONNECTION *conn)
915910 * dynamic set of tables are marked separately during creation.
916911 */
917912 WT_SESSION *session;
918- int ret = conn->open_session (conn, nullptr , nullptr , &session);
919- if (ret != 0 ) {
920- THROW_ERRNO (ret, " Error opening a session." );
913+ if (conn->open_session (conn, nullptr , nullptr , &session) != 0 ) {
914+ THROW (" Error opening a session." );
921915 }
922916
917+ WT_DECL_RET;
923918 WT_CURSOR *cursor;
924- ret = session->open_cursor (session, " metadata:" , NULL , NULL , &cursor);
925- if (ret != 0 ) {
919+ if ((ret = session->open_cursor (session, " metadata:" , NULL , NULL , &cursor)) != 0 ) {
926920 /* If there is no metadata (yet), this will return ENOENT. */
927921 if (ret == ENOENT) {
928- THROW_ERRNO (ret, " No metadata found while extracting dynamic set of tables." );
922+ THROW ( " No metadata found while extracting dynamic set of tables." );
929923 }
930924 }
931925
932926 /* Walk the entries in the metadata and extract the dynamic set. */
933927 while ((ret = cursor->next (cursor)) == 0 ) {
934928 const char *key, *v;
935- ret = cursor->get_key (cursor, &key);
936- if (ret != 0 ) {
937- THROW_ERRNO (ret,
929+ if ((ret = cursor->get_key (cursor, &key)) != 0 ) {
930+ THROW (
938931 " Error getting the key for a metadata entry while extracting dynamic set of tables." );
939932 }
940- ret = cursor->get_value (cursor, &v);
941- if (ret != 0 ) {
942- THROW_ERRNO (ret,
933+ if ((ret = cursor->get_value (cursor, &v)) != 0 ) {
934+ THROW (
943935 " Error getting the value for a metadata entry while extracting dynamic set of "
944936 " tables." );
945937 }
@@ -982,7 +974,7 @@ ContextInternal::create_all(WT_CONNECTION *conn)
982974 }
983975 }
984976 if (ret != WT_NOTFOUND) {
985- THROW_ERRNO (ret, " Error extracting dynamic set of tables from the metadata." );
977+ THROW ( " Error extracting dynamic set of tables from the metadata." );
986978 }
987979
988980 /* Make sure each base has its mirror and vice-versa. */
@@ -1005,12 +997,11 @@ ContextInternal::create_all(WT_CONNECTION *conn)
1005997 sleep (1 );
1006998 }
1007999 if (ret != 0 )
1008- THROW_ERRNO (ret, " Table drop failed for '" << uri << " ' in create_all." );
1000+ THROW ( " Table drop failed for '" << uri << " ' in create_all." );
10091001 }
10101002
1011- ret = session->close (session, NULL );
1012- if (ret != 0 ) {
1013- THROW_ERRNO (ret, " Session close failed." );
1003+ if ((ret = session->close (session, NULL )) != 0 ) {
1004+ THROW (" Session close failed." );
10141005 }
10151006
10161007 return (0 );
@@ -1368,7 +1359,7 @@ ThreadRunner::cross_check(std::vector<ThreadRunner> &runners)
13681359int
13691360ThreadRunner::run ()
13701361{
1371- int ret ;
1362+ WT_DECL_RET ;
13721363 ThreadOptions *options = &_thread->options ;
13731364 std::string name = options->name ;
13741365
@@ -1607,7 +1598,7 @@ ThreadRunner::op_kv_gen(Operation *op, const tint_t tint)
16071598int
16081599ThreadRunner::op_run_setup (Operation *op)
16091600{
1610- int ret ;
1601+ WT_DECL_RET ;
16111602
16121603 if (_throttle != nullptr ) {
16131604 while (_throttle_ops >= _throttle_limit && !_in_transaction && !_stop) {
@@ -1712,7 +1703,7 @@ ThreadRunner::op_run(Operation *op)
17121703 Track *track;
17131704 WT_CURSOR *cursor;
17141705 WT_ITEM item;
1715- int ret ;
1706+ WT_DECL_RET ;
17161707 bool measure_latency, own_cursor, retry_op;
17171708 timespec start_time;
17181709 uint64_t time_us;
@@ -3168,7 +3159,7 @@ WorkloadRunner::~WorkloadRunner()
31683159int
31693160WorkloadRunner::run (WT_CONNECTION *conn)
31703161{
3171- int ret ;
3162+ WT_DECL_RET ;
31723163 WorkloadOptions *options = &_workload->options ;
31733164
31743165 _wt_home = conn->get_home (conn);
@@ -3300,7 +3291,7 @@ WorkloadRunner::final_report(timespec &totalsecs)
33003291int
33013292WorkloadRunner::run_all (WT_CONNECTION *conn)
33023293{
3303- int ret ;
3294+ WT_DECL_RET ;
33043295
33053296 // Register signal handlers for SIGINT (Ctrl-C) and SIGTERM.
33063297 std::signal (SIGINT, signal_handler);
@@ -3456,19 +3447,17 @@ WorkloadRunner::run_all(WT_CONNECTION *conn)
34563447 if (options->background_compact > 0 ) {
34573448 WT_SESSION *session;
34583449
3459- int ret = conn->open_session (conn, nullptr , nullptr , &session);
3460- if (ret != 0 )
3461- THROW_ERRNO (ret, " Error opening a session." );
3450+ if (conn->open_session (conn, nullptr , nullptr , &session) != 0 )
3451+ THROW (" Error opening a session." );
34623452
34633453 const std::string bg_compact_cfg (" background=true,free_space_target=" +
34643454 std::to_string (options->background_compact ) + " MB" );
3465- ret = session->compact (session, nullptr , bg_compact_cfg.c_str ());
3455+ int ret = session->compact (session, nullptr , bg_compact_cfg.c_str ());
34663456 if (ret != 0 )
34673457 THROW_ERRNO (ret, " WT_SESSION->compact background compaction could not be enabled." );
34683458
3469- ret = session->close (session, NULL );
3470- if (ret != 0 )
3471- THROW_ERRNO (ret, " Session close failed." );
3459+ if ((ret = session->close (session, NULL )) != 0 )
3460+ THROW (" Session close failed." );
34723461 }
34733462
34743463 timespec now;
0 commit comments