diff --git a/src/jrd/err.cpp b/src/jrd/err.cpp index c78cb7b014..a1d7362b98 100644 --- a/src/jrd/err.cpp +++ b/src/jrd/err.cpp @@ -359,7 +359,8 @@ void ERR_warning(const Arg::StatusVector& v) v.copyTo(s); DEBUG; - tdbb->getRequest()->req_flags |= req_warning; + if (jrd_req* request = tdbb->getRequest()) + request->req_flags |= req_warning; } diff --git a/src/jrd/opt.cpp b/src/jrd/opt.cpp index 5d5987a4e3..f63a18ddd0 100644 --- a/src/jrd/opt.cpp +++ b/src/jrd/opt.cpp @@ -990,10 +990,15 @@ static void check_indices(const CompilerScratch::csb_repeat* csb_tail) // if there were no indices fetched at all but the // user specified some, error out using the first index specified - if (!csb_tail->csb_indices && plan->accessType && !tdbb->getAttachment()->isGbak()) + const bool isGbak = tdbb->getAttachment()->isGbak(); + + if (!csb_tail->csb_indices && plan->accessType) { // index %s cannot be used in the specified plan - ERR_post(Arg::Gds(isc_index_unused) << plan->accessType->items[0].indexName); + if (isGbak) + ERR_post_warning(Arg::Warning(isc_index_unused) << plan->accessType->items[0].indexName); + else + ERR_post(Arg::Gds(isc_index_unused) << plan->accessType->items[0].indexName); } // check to make sure that all indices are either used or marked not to be used, @@ -1013,7 +1018,10 @@ static void check_indices(const CompilerScratch::csb_repeat* csb_tail) index_name = ""; // index %s cannot be used in the specified plan - ERR_post(Arg::Gds(isc_index_unused) << Arg::Str(index_name)); + if (isGbak) + ERR_post_warning(Arg::Warning(isc_index_unused) << Arg::Str(index_name)); + else + ERR_post(Arg::Gds(isc_index_unused) << Arg::Str(index_name)); } ++idx; diff --git a/src/jrd/par.cpp b/src/jrd/par.cpp index ce4ced2cff..7008203e89 100644 --- a/src/jrd/par.cpp +++ b/src/jrd/par.cpp @@ -1707,17 +1707,7 @@ void PAR_warning(const Arg::StatusVector& v) * **************************************/ fb_assert(v.value()[0] == isc_arg_warning); - - thread_db* tdbb = JRD_get_thread_data(); - - // Make sure that the [1] position is 0 indicating that no error has occurred - Arg::Gds p(FB_SUCCESS); - - // Now place your warning messages - p.append(v); - - // Save into tdbb - p.copyTo(tdbb->tdbb_status_vector); + ERR_post_warning(v); } diff --git a/src/jrd/tpc.cpp b/src/jrd/tpc.cpp index c3cb29fa9e..de1adb0d15 100644 --- a/src/jrd/tpc.cpp +++ b/src/jrd/tpc.cpp @@ -364,16 +364,16 @@ int TipCache::snapshotState(thread_db* tdbb, TraNumber number) Lock temp_lock(tdbb, sizeof(TraNumber), LCK_tra); temp_lock.lck_key.lck_long = number; - // If we can't get a lock on the transaction, it must be active. - - if (!LCK_lock(tdbb, &temp_lock, LCK_read, LCK_NO_WAIT)) { - fb_utils::init_status(tdbb->tdbb_status_vector); - return tra_active; - } + ThreadStatusGuard tempStatus(tdbb); - fb_utils::init_status(tdbb->tdbb_status_vector); - LCK_release(tdbb, &temp_lock); + // If we can't get a lock on the transaction, it must be active. + + if (!LCK_lock(tdbb, &temp_lock, LCK_read, LCK_NO_WAIT)) + return tra_active; + + LCK_release(tdbb, &temp_lock); + } // as a last resort we must look at the TIP page to see // whether the transaction is committed or dead; to minimize