8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 00:03:02 +01:00
This commit is contained in:
asfernandes 2015-06-29 01:02:52 +00:00
parent eedd10643b
commit ae30b29011
9 changed files with 52 additions and 44 deletions

View File

@ -445,7 +445,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const
case isc_action_svc_trace_stop:
case isc_action_svc_trace_suspend:
case isc_action_svc_trace_resume:
switch(tag)
switch (tag)
{
case isc_spb_trc_cfg:
case isc_spb_trc_name:
@ -455,7 +455,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const
}
break;
case isc_action_svc_validate:
switch(tag)
switch (tag)
{
case isc_spb_val_tab_incl:
case isc_spb_val_tab_excl:

View File

@ -48,7 +48,7 @@ bool SyncObject::lock(Sync* sync, SyncType type, const char* from, int timeOut)
if (type == SYNC_SHARED)
{
// In Vulcan SyncObject locking is not fair. Shared locks have priority
// before Exclusive locks. To change this behavior we should replace
// before Exclusive locks. To change this behavior we should replace
// loop condition below by:
//while (waiters == 0) // activate to make locking fair
while (true)

View File

@ -314,10 +314,10 @@ Lock* jrd_rel::createLock(thread_db* tdbb, MemoryPool* pool, jrd_rel* relation,
lock->lck_type = lckType;
switch (lckType)
{
case LCK_relation:
case LCK_relation:
break;
case LCK_rel_gc:
case LCK_rel_gc:
lock->lck_ast = noAst ? NULL : blocking_ast_gcLock;
break;
@ -338,7 +338,7 @@ bool jrd_rel::acquireGCLock(thread_db* tdbb, int wait)
return true;
}
if (!rel_gc_lock)
if (!rel_gc_lock)
rel_gc_lock = createLock(tdbb, NULL, this, LCK_rel_gc, false);
fb_assert(!rel_gc_lock->lck_id);
@ -386,11 +386,12 @@ void jrd_rel::downgradeGCLock(thread_db* tdbb)
int jrd_rel::blocking_ast_gcLock(void* ast_object)
{
/****
/****
SR - gc forbidden, awaiting moment to re-establish SW lock
SW - gc allowed, usual state
PW - gc allowed to the one connection only
****/
****/
jrd_rel* relation = static_cast<jrd_rel*>(ast_object);
try
@ -401,7 +402,7 @@ int jrd_rel::blocking_ast_gcLock(void* ast_object)
AsyncContextHolder tdbb(dbb, FB_FUNCTION);
fb_assert(!(relation->rel_flags & REL_gc_lockneed));
if (relation->rel_flags & REL_gc_lockneed) // work already done syncronously ?
if (relation->rel_flags & REL_gc_lockneed) // work already done synchronously ?
return 0;
relation->rel_flags |= REL_gc_blocking;
@ -419,7 +420,7 @@ int jrd_rel::blocking_ast_gcLock(void* ast_object)
relation->rel_flags &= ~(REL_gc_disabled | REL_gc_blocking);
relation->rel_flags |= REL_gc_lockneed;
}
else
else
{
// someone acquired PW lock
@ -440,7 +441,7 @@ int jrd_rel::blocking_ast_gcLock(void* ast_object)
/// jrd_rel::GCExclusive
jrd_rel::GCExclusive::GCExclusive(thread_db* tdbb, jrd_rel* relation) :
m_tdbb(tdbb),
m_tdbb(tdbb),
m_relation(relation),
m_lock(NULL)
{

View File

@ -248,15 +248,16 @@ public:
static Lock* createLock(thread_db* tdbb, MemoryPool* pool, jrd_rel* relation, lck_t, bool);
static int blocking_ast_gcLock(void*);
void downgradeGCLock(thread_db* tdbb);
bool acquireGCLock(thread_db* tdbb, int wait);
// This guard is used by regular code to prevent online validation while
// This guard is used by regular code to prevent online validation while
// dead- or back- versions is removed from disk.
class GCShared
{
public:
GCShared(thread_db* tdbb, jrd_rel* relation);
GCShared(thread_db* tdbb, jrd_rel* relation);
~GCShared();
bool gcEnabled() const
@ -275,7 +276,7 @@ public:
class GCExclusive
{
public:
GCExclusive(thread_db* tdbb, jrd_rel* relation);
GCExclusive(thread_db* tdbb, jrd_rel* relation);
~GCExclusive();
bool acquire(int wait);
@ -315,8 +316,8 @@ const ULONG REL_gc_lockneed = 0x80000; // gc lock should be acquired
/// class jrd_rel
inline jrd_rel::jrd_rel(MemoryPool& p)
: rel_pool(&p), rel_flags(REL_gc_lockneed), rel_name(p), rel_owner_name(p),
rel_view_contexts(p), rel_security_name(p), rel_gc_records(p)
: rel_pool(&p), rel_flags(REL_gc_lockneed), rel_name(p), rel_owner_name(p),
rel_view_contexts(p), rel_security_name(p), rel_gc_records(p)
{
}
@ -350,10 +351,10 @@ inline RelationPages* jrd_rel::getPages(thread_db* tdbb, TraNumber tran, bool al
/// class jrd_rel::GCShared
inline jrd_rel::GCShared::GCShared(thread_db* tdbb, jrd_rel* relation) :
m_tdbb(tdbb),
m_relation(relation),
m_gcEnabled(false)
inline jrd_rel::GCShared::GCShared(thread_db* tdbb, jrd_rel* relation)
: m_tdbb(tdbb),
m_relation(relation),
m_gcEnabled(false)
{
if (m_relation->rel_flags & (REL_gc_blocking | REL_gc_disabled))
return;

View File

@ -253,7 +253,7 @@ public:
m_tdbb->tdbb_flags &= ~TDBB_wait_cancel_disable;
if (att)
att->att_wait_lock = lock;
break;
break;
default:
m_tdbb->tdbb_flags |= TDBB_wait_cancel_disable;

View File

@ -50,9 +50,9 @@ void LCK_write_data(Jrd::thread_db*, Jrd::Lock*, SLONG);
class AutoLock
{
public:
explicit AutoLock(Jrd::thread_db* tdbb, Jrd::Lock* lck = NULL) :
m_tdbb(tdbb),
m_lock(lck)
explicit AutoLock(Jrd::thread_db* tdbb, Jrd::Lock* lck = NULL)
: m_tdbb(tdbb),
m_lock(lck)
{
}

View File

@ -601,7 +601,7 @@ static PatternMatcher* createPatternMatcher(thread_db* tdbb, const char* pattern
Collation* obj = INTL_texttype_lookup(tdbb, CS_UTF8);
matcher = obj->createSimilarToMatcher(*tdbb->getDefaultPool(),
(const UCHAR*)pattern, len, (UCHAR*)"\\", 1);
(const UCHAR*) pattern, len, (UCHAR*) "\\", 1);
}
}
catch (const Exception& ex)
@ -690,6 +690,7 @@ static int validate(Firebird::UtilSvc* svc)
const Switches valSwitches(val_option_in_sw_table, FB_NELEM(val_option_in_sw_table), false, true);
const char** argv = svc->argv.begin();
const char* const* end = svc->argv.end();
for (++argv; argv < end; argv++)
{
if (!*argv)
@ -707,7 +708,7 @@ static int validate(Firebird::UtilSvc* svc)
if (argv < end && *argv)
dbName = *argv;
else
;// error
; // error
break;
default:
@ -972,9 +973,9 @@ void Validation::output(const char* format, ...)
int ms;
TimeStamp::getCurrentTimeStamp().decode(&now, &ms);
// s.printf("%04d-%02d-%02d %02d:%02d:%02d.%04d ",
///s.printf("%04d-%02d-%02d %02d:%02d:%02d.%04d ",
s.printf("%02d:%02d:%02d.%02d ",
// now.tm_year + 1900, now.tm_mon + 1, now.tm_mday,
///now.tm_year + 1900, now.tm_mon + 1, now.tm_mday,
now.tm_hour, now.tm_min, now.tm_sec, ms / 100);
vdr_service->outputVerbose(s.c_str());
@ -1173,8 +1174,8 @@ Validation::FETCH_CODE Validation::fetch_page(bool mark, ULONG page_number,
window->win_page = page_number;
window->win_flags = 0;
pag** page_pointer = reinterpret_cast<pag**>(aPage_pointer);
*page_pointer = CCH_FETCH_NO_SHADOW(vdr_tdbb, window,
(vdr_flags & VDR_online ? LCK_read : LCK_write),
*page_pointer = CCH_FETCH_NO_SHADOW(vdr_tdbb, window,
(vdr_flags & VDR_online ? LCK_read : LCK_write),
0);
if ((*page_pointer)->pag_type != type && type != pag_undefined)
@ -1579,17 +1580,21 @@ void Validation::walk_database()
if (vdr_tab_incl)
{
vdr_tab_incl->reset();
if (!vdr_tab_incl->process((UCHAR*)relation->rel_name.c_str(), relation->rel_name.length()) ||
if (!vdr_tab_incl->process((UCHAR*) relation->rel_name.c_str(), relation->rel_name.length()) ||
!vdr_tab_incl->result())
{
continue;
}
}
if (vdr_tab_excl)
{
vdr_tab_excl->reset();
if (!vdr_tab_excl->process((UCHAR*)relation->rel_name.c_str(), relation->rel_name.length()) ||
if (!vdr_tab_excl->process((UCHAR*) relation->rel_name.c_str(), relation->rel_name.length()) ||
vdr_tab_excl->result())
{
continue;
}
}
string relName;
@ -2461,7 +2466,7 @@ Validation::RTN Validation::walk_pointer_page(jrd_rel* relation, ULONG sequence)
if (vdr_flags & VDR_online)
{
// relation could be extended before we acquired its lock in PR mode
// let's re-read pointer pages and check again
// let's re-read pointer pages and check again
DPM_scan_pages(vdr_tdbb);
@ -2690,7 +2695,7 @@ Validation::RTN Validation::walk_relation(jrd_rel* relation)
AutoLock lckRead(vdr_tdbb);
jrd_rel::GCExclusive lckGC(vdr_tdbb, relation);
if (vdr_flags & VDR_online)
if (vdr_flags & VDR_online)
{
lckRead = jrd_rel::createLock(vdr_tdbb, NULL, relation, LCK_relation, false);
if (!LCK_lock(vdr_tdbb, lckRead, LCK_PR, vdr_lock_tout))
@ -2708,8 +2713,8 @@ Validation::RTN Validation::walk_relation(jrd_rel* relation)
}
WIN window(DB_PAGE_SPACE, -1);
header_page* page = 0;
fetch_page(false, (SLONG)HEADER_PAGE, pag_header, &window, &page);
header_page* page = NULL;
fetch_page(false, (SLONG) HEADER_PAGE, pag_header, &window, &page);
vdr_max_transaction = page->hdr_next_transaction;
CCH_RELEASE(vdr_tdbb, &window);
}
@ -2809,14 +2814,14 @@ Validation::RTN Validation::walk_root(jrd_rel* relation)
if (vdr_idx_incl)
{
vdr_idx_incl->reset();
if (!vdr_idx_incl->process((UCHAR*)index.c_str(), index.length()) || !vdr_idx_incl->result())
if (!vdr_idx_incl->process((UCHAR*) index.c_str(), index.length()) || !vdr_idx_incl->result())
continue;
}
if (vdr_idx_excl)
{
vdr_idx_excl->reset();
if (!vdr_idx_excl->process((UCHAR*)index.c_str(), index.length()) || vdr_idx_excl->result())
if (!vdr_idx_excl->process((UCHAR*) index.c_str(), index.length()) || vdr_idx_excl->result())
continue;
}

View File

@ -859,10 +859,10 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb,
}
case tra_precommitted:
{// scope
{ // scope
jrd_rel::GCShared gcGuard(tdbb, rpb->rpb_relation);
if (attachment->att_flags & ATT_NO_CLEANUP || !gcGuard.gcEnabled() ||
if ((attachment->att_flags & ATT_NO_CLEANUP) || !gcGuard.gcEnabled() ||
(rpb->rpb_flags & (rpb_chained | rpb_gc_active)))
{
if (rpb->rpb_b_page == 0)
@ -929,7 +929,7 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb,
if (!DPM_get(tdbb, rpb, LCK_read))
return false;
} // scope
} // scope
break;
// If it's active, prepare to fetch the old version.
@ -1939,7 +1939,7 @@ bool VIO_garbage_collect(thread_db* tdbb, record_param* rpb, const jrd_tra* tran
jrd_rel::GCShared gcGuard(tdbb, rpb->rpb_relation);
if (attachment->att_flags & ATT_no_cleanup || !gcGuard.gcEnabled())
if ((attachment->att_flags & ATT_no_cleanup) || !gcGuard.gcEnabled())
return true;
const TraNumber oldest_snapshot = rpb->rpb_relation->isTemporary() ?
@ -3643,6 +3643,7 @@ bool VIO_sweep(thread_db* tdbb, jrd_tra* transaction, TraceSweepEvent* traceSwee
ERR_punt();
}
return ret;
}
@ -4785,7 +4786,7 @@ static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg)
jrd_rel::GCShared gcGuard(tdbb, relation);
if (!gcGuard.gcEnabled())
continue;
rpb.rpb_relation = relation;
while (gc_bitmap->getFirst())

View File

@ -506,7 +506,7 @@ const SvcSwitches traceChgStateOptions[] =
{0, 0, 0, 0, 0}
};
const SvcSwitches validateOptions[] =
const SvcSwitches validateOptions[] =
{
{"dbname", putStringArgument, 0, isc_spb_dbname, 0},
{"val_tab_incl", putStringArgument, 0, isc_spb_val_tab_incl, 0},