mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 14:03:07 +01:00
Misc.
This commit is contained in:
parent
4f5dd005ac
commit
47489fa71b
@ -152,7 +152,6 @@ bool SyncObject::lockConditional(SyncType type)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -180,7 +179,7 @@ bool SyncObject::lockConditional(SyncType type)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -207,8 +207,8 @@ public:
|
||||
class SyncUnlockGuard
|
||||
{
|
||||
public:
|
||||
explicit SyncUnlockGuard(Sync& aSync) :
|
||||
sync(aSync)
|
||||
explicit SyncUnlockGuard(Sync& aSync)
|
||||
: sync(aSync)
|
||||
{
|
||||
oldState = sync.getState();
|
||||
|
||||
|
@ -507,7 +507,7 @@ void ExtEngineManager::Trigger::setValues(thread_db* /*tdbb*/, Array<UCHAR>& msg
|
||||
dsc desc;
|
||||
EVL_field(rpb->rpb_relation, record, i, &desc);
|
||||
// CVC: I'm not sure why it's not important to check EVL_field's result.
|
||||
|
||||
|
||||
unsigned align = type_alignments[desc.dsc_dtype];
|
||||
if (align)
|
||||
msgBuffer.resize(FB_ALIGN(msgBuffer.getCount(), align));
|
||||
|
@ -130,7 +130,7 @@ SLONG GarbageCollector::RelationData::minTranID() const
|
||||
TranData::ConstAccessor accessor(&m_tranData);
|
||||
if (accessor.getFirst())
|
||||
return accessor.current()->first;
|
||||
|
||||
|
||||
return MAX_TRA_NUMBER;
|
||||
}
|
||||
|
||||
|
@ -7281,9 +7281,9 @@ static void start_transaction(thread_db* tdbb, bool transliterate, jrd_tra** tra
|
||||
|
||||
try
|
||||
{
|
||||
if (tpb_length > 0 && tpb == NULL)
|
||||
if (tpb_length > 0 && !tpb)
|
||||
status_exception::raise(Arg::Gds(isc_bad_tpb_form));
|
||||
|
||||
|
||||
jrd_tra* transaction = TRA_start(tdbb, tpb_length, tpb);
|
||||
|
||||
transaction->tra_sibling = NULL;
|
||||
|
@ -154,9 +154,9 @@ BackupManager::StateWriteGuard::StateWriteGuard(thread_db* _tdbb, Jrd::WIN* wnd)
|
||||
|
||||
BackupManager::StateWriteGuard::~StateWriteGuard()
|
||||
{
|
||||
// It is important to set state into nbak_state_unknown *before* release of state lock,
|
||||
// else someone could acquire state lock, fetch and modify some page before state will
|
||||
// be set into unknown. But dirty page can't be written when backup state is unknown
|
||||
// It is important to set state into nbak_state_unknown *before* release of state lock,
|
||||
// otherwise someone could acquire state lock, fetch and modify some page before state will
|
||||
// be set into unknown. But dirty page can't be written when backup state is unknown
|
||||
// because write target (database or delta) is also unknown.
|
||||
|
||||
if (!success)
|
||||
@ -263,22 +263,26 @@ void BackupManager::beginBackup(thread_db* tdbb)
|
||||
struct stat st;
|
||||
PageSpace* pageSpace = database->dbb_page_manager.findPageSpace(DB_PAGE_SPACE);
|
||||
char* func = NULL;
|
||||
|
||||
while (!func && fstat(pageSpace->file->fil_desc, &st) != 0)
|
||||
{
|
||||
if (errno != EINTR)
|
||||
if (errno != EINTR)
|
||||
func = "fstat";
|
||||
}
|
||||
|
||||
while (!func && fchown(diff_file->fil_desc, st.st_uid, st.st_gid) != 0)
|
||||
{
|
||||
if (errno != EINTR)
|
||||
if (errno != EINTR)
|
||||
func = "fchown";
|
||||
}
|
||||
|
||||
while (!func && fchmod(diff_file->fil_desc, st.st_mode) != 0)
|
||||
{
|
||||
if (errno != EINTR)
|
||||
if (errno != EINTR)
|
||||
func = "fchmod";
|
||||
}
|
||||
if (func)
|
||||
|
||||
if (func)
|
||||
{
|
||||
stateGuard.setSuccess();
|
||||
Firebird::system_call_failed::raise(func);
|
||||
|
@ -190,6 +190,7 @@ public:
|
||||
~StateWriteGuard();
|
||||
|
||||
void releaseHeader();
|
||||
|
||||
void setSuccess()
|
||||
{
|
||||
success = true;
|
||||
@ -213,7 +214,7 @@ public:
|
||||
Jrd::Attachment* att = tdbb->getAttachment();
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
const bool ok = att ?
|
||||
const bool ok = att ?
|
||||
att->backupStateReadLock(tdbb, LCK_WAIT) :
|
||||
dbb->dbb_backup_manager->lockStateRead(tdbb, LCK_WAIT);
|
||||
|
||||
|
@ -406,7 +406,7 @@ SLONG TipCache::cacheTransactions(thread_db* tdbb, SLONG oldest)
|
||||
#endif
|
||||
|
||||
// hvlad: No need to cache TIP pages below hdr_oldest just refreshed from
|
||||
// header page. Moreover out tip cache can now contain a gap between the last
|
||||
// header page. Moreover our tip cache can now contain a gap between the last
|
||||
// cached tip page and new pages if our process was idle for long time
|
||||
|
||||
oldest = MAX(oldest, hdr_oldest);
|
||||
|
@ -1271,9 +1271,7 @@ void TRA_rollback(thread_db* tdbb, jrd_tra* transaction, const bool retaining_fl
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VIO_temp_cleanup(tdbb, transaction);
|
||||
}
|
||||
|
||||
// Find out if there is a transaction savepoint we can use to rollback our transaction
|
||||
bool tran_sav = false;
|
||||
@ -3436,20 +3434,23 @@ static jrd_tra* transaction_start(thread_db* tdbb, jrd_tra* temp)
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate attachment-local oldest active and oldest snapshot numbers
|
||||
// looking at current attachment's transactions only. Calculated values
|
||||
// are used to determine garbage collection threshold for attachment-local
|
||||
// Calculate attachment-local oldest active and oldest snapshot numbers
|
||||
// looking at current attachment's transactions only. Calculated values
|
||||
// are used to determine garbage collection threshold for attachment-local
|
||||
// data such as temporary tables (GTT's).
|
||||
|
||||
trans->tra_att_oldest_active = number;
|
||||
SLONG att_oldest_active = number;
|
||||
SLONG att_oldest_snapshot = number;
|
||||
|
||||
for (jrd_tra* tx_att = attachment->att_transactions; tx_att; tx_att = tx_att->tra_next)
|
||||
{
|
||||
att_oldest_active = MIN(att_oldest_active, tx_att->tra_number);
|
||||
att_oldest_snapshot = MIN(att_oldest_snapshot, tx_att->tra_att_oldest_active);
|
||||
}
|
||||
|
||||
trans->tra_att_oldest_active = (trans->tra_flags & TRA_read_committed) ? number : att_oldest_active;
|
||||
|
||||
if (attachment->att_oldest_snapshot < att_oldest_snapshot)
|
||||
attachment->att_oldest_snapshot = att_oldest_snapshot;
|
||||
|
||||
|
@ -550,8 +550,8 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb,
|
||||
|
||||
const bool gcPolicyCooperative = tdbb->getDatabase()->dbb_flags & DBB_gc_cooperative;
|
||||
const bool gcPolicyBackground = tdbb->getDatabase()->dbb_flags & DBB_gc_background;
|
||||
const SLONG oldest_snapshot =
|
||||
rpb->rpb_relation->isTemporary() ? attachment->att_oldest_snapshot : transaction->tra_oldest_active;
|
||||
const SLONG oldest_snapshot = rpb->rpb_relation->isTemporary() ?
|
||||
attachment->att_oldest_snapshot : transaction->tra_oldest_active;
|
||||
|
||||
#ifdef VIO_DEBUG
|
||||
if (debug_flag > DEBUG_TRACE_ALL)
|
||||
@ -1756,8 +1756,8 @@ bool VIO_garbage_collect(thread_db* tdbb, record_param* rpb, const jrd_tra* tran
|
||||
return true;
|
||||
}
|
||||
|
||||
const SLONG oldest_snapshot =
|
||||
rpb->rpb_relation->isTemporary() ? attachment->att_oldest_snapshot : transaction->tra_oldest_active;
|
||||
const SLONG oldest_snapshot = rpb->rpb_relation->isTemporary() ?
|
||||
attachment->att_oldest_snapshot : transaction->tra_oldest_active;
|
||||
|
||||
while (true)
|
||||
{
|
||||
@ -3247,12 +3247,13 @@ void VIO_temp_cleanup(thread_db* tdbb, jrd_tra* transaction)
|
||||
*
|
||||
* Functional description
|
||||
* Remove undo data for GTT ON COMMIT DELETE ROWS as their data will be released
|
||||
* at transaction end anyway and we don't need to waste time backing it out on
|
||||
* rollback
|
||||
* at transaction end anyway and we don't need to waste time backing it out on
|
||||
* rollback.
|
||||
*
|
||||
**************************************/
|
||||
{
|
||||
Savepoint* sav_point = transaction->tra_save_point;
|
||||
|
||||
for (; sav_point; sav_point = sav_point->sav_next)
|
||||
{
|
||||
for (VerbAction* action = sav_point->sav_verb_actions; action; action = action->vct_next)
|
||||
@ -3260,14 +3261,17 @@ void VIO_temp_cleanup(thread_db* tdbb, jrd_tra* transaction)
|
||||
if (action->vct_relation->rel_flags & REL_temp_tran)
|
||||
{
|
||||
RecordBitmap::reset(action->vct_records);
|
||||
|
||||
if (action->vct_undo)
|
||||
{
|
||||
if (action->vct_undo->getFirst())
|
||||
{
|
||||
do {
|
||||
do
|
||||
{
|
||||
action->vct_undo->current().release(transaction);
|
||||
} while (action->vct_undo->getNext());
|
||||
}
|
||||
|
||||
delete action->vct_undo;
|
||||
action->vct_undo = NULL;
|
||||
}
|
||||
@ -3336,7 +3340,8 @@ void VIO_verb_cleanup(thread_db* tdbb, jrd_tra* transaction)
|
||||
|
||||
// Cleanup/merge deferred work/event post
|
||||
|
||||
if (sav_point->sav_verb_actions || sav_point->sav_verb_count || (sav_point->sav_flags & SAV_force_dfw))
|
||||
if (sav_point->sav_verb_actions || sav_point->sav_verb_count ||
|
||||
(sav_point->sav_flags & SAV_force_dfw))
|
||||
{
|
||||
if (sav_point->sav_verb_count) {
|
||||
DFW_delete_deferred(transaction, sav_point->sav_number);
|
||||
@ -4037,9 +4042,8 @@ static void expunge(thread_db* tdbb, record_param* rpb, const jrd_tra* transacti
|
||||
}
|
||||
#endif
|
||||
|
||||
if (attachment->att_flags & ATT_no_cleanup) {
|
||||
if (attachment->att_flags & ATT_no_cleanup)
|
||||
return;
|
||||
}
|
||||
|
||||
// Re-fetch the record
|
||||
|
||||
@ -4066,8 +4070,8 @@ static void expunge(thread_db* tdbb, record_param* rpb, const jrd_tra* transacti
|
||||
|
||||
// Make sure it looks kosher and delete the record.
|
||||
|
||||
const SLONG oldest_snapshot =
|
||||
rpb->rpb_relation->isTemporary() ? attachment->att_oldest_snapshot : transaction->tra_oldest_active;
|
||||
const SLONG oldest_snapshot = rpb->rpb_relation->isTemporary() ?
|
||||
attachment->att_oldest_snapshot : transaction->tra_oldest_active;
|
||||
|
||||
if (!(rpb->rpb_flags & rpb_deleted) || rpb->rpb_transaction_nr >= oldest_snapshot)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user