Skip to content

Commit

Permalink
Fixed bug #7499 : Problem with restore
Browse files Browse the repository at this point in the history
  • Loading branch information
hvlad committed Mar 28, 2023
1 parent 7fb0a59 commit 58ed992
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 23 deletions.
3 changes: 2 additions & 1 deletion src/jrd/err.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())

This comment has been minimized.

Copy link
@dyemanov

dyemanov Mar 28, 2023

Member

I'm not sure whether the inline variable declaration is allowed in the compilers we use for v3...

This comment has been minimized.

Copy link
@hvlad

hvlad Mar 28, 2023

Author Member

I'll change it, ok

request->req_flags |= req_warning;
}


Expand Down
14 changes: 11 additions & 3 deletions src/jrd/opt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
12 changes: 1 addition & 11 deletions src/jrd/par.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down
16 changes: 8 additions & 8 deletions src/jrd/tpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

// If we can't get a lock on the transaction, it must be active.

fb_utils::init_status(tdbb->tdbb_status_vector);
LCK_release(tdbb, &temp_lock);
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
Expand Down

0 comments on commit 58ed992

Please sign in to comment.