|
From: <asf...@us...> - 2011-05-10 01:12:21
|
Revision: 52897
http://firebird.svn.sourceforge.net/firebird/?rev=52897&view=rev
Author: asfernandes
Date: 2011-05-10 01:12:14 +0000 (Tue, 10 May 2011)
Log Message:
-----------
Misc.
Modified Paths:
--------------
firebird/trunk/builds/install/misc/firebird.conf.in
firebird/trunk/src/common/classes/SyncObject.h
firebird/trunk/src/common/classes/locks.h
firebird/trunk/src/common/isc_sync.cpp
firebird/trunk/src/jrd/Attachment.cpp
firebird/trunk/src/jrd/Attachment.h
firebird/trunk/src/jrd/Database.cpp
firebird/trunk/src/jrd/Database.h
firebird/trunk/src/jrd/DatabaseSnapshot.cpp
firebird/trunk/src/jrd/ExtEngineManager.cpp
firebird/trunk/src/jrd/Function.epp
firebird/trunk/src/jrd/GlobalRWLock.cpp
firebird/trunk/src/jrd/Relation.cpp
firebird/trunk/src/jrd/cch.cpp
firebird/trunk/src/jrd/cch.h
firebird/trunk/src/jrd/dyn.epp
firebird/trunk/src/jrd/exe.cpp
firebird/trunk/src/jrd/extds/ExtDS.cpp
firebird/trunk/src/jrd/ibase.h
firebird/trunk/src/jrd/inf.cpp
firebird/trunk/src/jrd/intl.cpp
firebird/trunk/src/jrd/jrd.cpp
firebird/trunk/src/jrd/jrd.h
firebird/trunk/src/jrd/lck.cpp
firebird/trunk/src/jrd/os/win32/winnt.cpp
firebird/trunk/src/jrd/tpc.cpp
firebird/trunk/src/jrd/tpc_proto.h
Modified: firebird/trunk/builds/install/misc/firebird.conf.in
===================================================================
--- firebird/trunk/builds/install/misc/firebird.conf.in 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/builds/install/misc/firebird.conf.in 2011-05-10 01:12:14 UTC (rev 52897)
@@ -848,6 +848,6 @@
# SharedCache SharedDatabase Mode
# false false Classic with exlusive access // single attachment only ?
-# false true Classic with shared access // traditional CS\SC
+# false true Classic with shared access // traditional CS/SC
# true false Super with exlusive access // traditional SS
# true true Super with shared access //
Modified: firebird/trunk/src/common/classes/SyncObject.h
===================================================================
--- firebird/trunk/src/common/classes/SyncObject.h 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/common/classes/SyncObject.h 2011-05-10 01:12:14 UTC (rev 52897)
@@ -204,11 +204,11 @@
}
};
-class SyncUnlockGuard
+class SyncUnlockGuard
{
public:
- SyncUnlockGuard(Sync& _sync) :
- sync(_sync)
+ SyncUnlockGuard(Sync& aSync) :
+ sync(aSync)
{
oldState = sync.getState();
@@ -225,7 +225,7 @@
private:
SyncType oldState;
- Sync& sync;
+ Sync& sync;
};
} // namespace Firebird
Modified: firebird/trunk/src/common/classes/locks.h
===================================================================
--- firebird/trunk/src/common/classes/locks.h 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/common/classes/locks.h 2011-05-10 01:12:14 UTC (rev 52897)
@@ -361,7 +361,8 @@
~MutexLockGuard()
{
- try {
+ try
+ {
lock->leave();
}
catch (const Exception&)
@@ -384,7 +385,8 @@
explicit MutexUnlockGuard(Mutex &aLock)
: lock(&aLock)
{
- try {
+ try
+ {
lock->leave();
}
catch (const Exception&)
Modified: firebird/trunk/src/common/isc_sync.cpp
===================================================================
--- firebird/trunk/src/common/isc_sync.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/common/isc_sync.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -2732,13 +2732,14 @@
if (!bInit)
{
HMODULE hLib = GetModuleHandle("kernel32.dll");
- if (hLib) {
+ if (hLib)
fnSwitchToThread = (pfnSwitchToThread) GetProcAddress(hLib, "SwitchToThread");
- }
+
bInit = true;
}
BOOL res = FALSE;
+
if (fnSwitchToThread)
{
const HANDLE hThread = GetCurrentThread();
Modified: firebird/trunk/src/jrd/Attachment.cpp
===================================================================
--- firebird/trunk/src/jrd/Attachment.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/Attachment.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -110,9 +110,7 @@
{
size_t pos;
if (att_pools.find(pool, pos))
- {
att_pools.remove(pos);
- }
MemoryPool::deletePool(pool);
}
@@ -199,10 +197,8 @@
destroyIntlObjects();
delete att_trace_manager;
- while (att_pools.getCount())
- {
+ while (att_pools.hasData())
deletePool(att_pools.pop());
- }
// For normal attachments that happens in release_attachment(),
// but for special ones like GC should be done also in dtor -
@@ -421,16 +417,19 @@
void Jrd::Attachment::shutdown(thread_db* tdbb)
{
- // go through relations and indices and release
- // all existence locks that might have been taken
+ // Go through relations and indices and release
+ // all existence locks that might have been taken.
vec<jrd_rel*>* rvector = att_relations;
+
if (rvector)
{
vec<jrd_rel*>::iterator ptr, end;
+
for (ptr = rvector->begin(), end = rvector->end(); ptr < end; ++ptr)
{
jrd_rel* relation = *ptr;
+
if (relation)
{
if (relation->rel_existence_lock)
@@ -439,16 +438,19 @@
relation->rel_flags |= REL_check_existence;
relation->rel_use_count = 0;
}
+
if (relation->rel_partners_lock)
{
LCK_release(tdbb, relation->rel_partners_lock);
relation->rel_flags |= REL_check_partners;
}
+
if (relation->rel_rescan_lock)
{
LCK_release(tdbb, relation->rel_rescan_lock);
relation->rel_flags &= ~REL_scanned;
}
+
for (IndexLock* index = relation->rel_index_locks; index; index = index->idl_next)
{
if (index->idl_lock)
@@ -461,15 +463,18 @@
}
}
- // release all procedure existence locks that might have been taken
+ // Release all procedure existence locks that might have been taken.
vec<jrd_prc*>* pvector = att_procedures;
+
if (pvector)
{
vec<jrd_prc*>::iterator pptr, pend;
+
for (pptr = pvector->begin(), pend = pvector->end(); pptr < pend; ++pptr)
{
jrd_prc* procedure = *pptr;
+
if (procedure)
{
if (procedure->prc_existence_lock)
@@ -482,20 +487,17 @@
}
}
- // release all function existence locks that might have been taken
+ // Release all function existence locks that might have been taken.
for (Function** iter = att_functions.begin(); iter < att_functions.end(); ++iter)
{
Function* const function = *iter;
if (function)
- {
function->releaseLocks(tdbb);
- }
}
- // release collation existence locks
-
+ // Release collation existence locks.
releaseIntlObjects();
// And release the system requests.
Modified: firebird/trunk/src/jrd/Attachment.h
===================================================================
--- firebird/trunk/src/jrd/Attachment.h 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/Attachment.h 2011-05-10 01:12:14 UTC (rev 52897)
@@ -132,8 +132,8 @@
class SyncGuard
{
public:
- SyncGuard(Attachment* att, bool optional = false) :
- m_mutex(NULL)
+ SyncGuard(Attachment* att, bool optional = false)
+ : m_mutex(NULL)
{
if (att && att->att_interface)
m_mutex = att->att_interface->getMutex();
@@ -161,8 +161,8 @@
class Checkout
{
public:
- Checkout(Attachment* att, bool optional = false) :
- m_mutex(NULL)
+ Checkout(Attachment* att, bool optional = false)
+ : m_mutex(NULL)
{
if (att && att->att_interface)
{
@@ -194,8 +194,8 @@
class CheckoutLockGuard
{
public:
- CheckoutLockGuard(Attachment* att, Firebird::Mutex& mutex, bool optional = false) :
- m_mutex(mutex)
+ CheckoutLockGuard(Attachment* att, Firebird::Mutex& mutex, bool optional = false)
+ : m_mutex(mutex)
{
if (!m_mutex.tryEnter())
{
@@ -267,7 +267,7 @@
Firebird::SortedArray<void*> att_udf_pointers;
dsql_dbb* att_dsql_instance;
bool att_in_use; // attachment in use (can't be detached or dropped)
- int att_use_count; // number of API calls running except of asyncronous ones
+ int att_use_count; // number of API calls running except of asyncronous ones
EDS::Connection* att_ext_connection; // external connection executed by this attachment
ULONG att_ext_call_depth; // external connection call depth, 0 for user attachment
@@ -276,7 +276,8 @@
JAttachment* att_interface;
Firebird::IAttachment* att_public_interface;
-/// former Database members
+ /// former Database members - start
+
vec<jrd_rel*>* att_relations; // relation vector
vec<jrd_prc*>* att_procedures; // scanned procedures
trig_vec* att_triggers[DB_TRIGGER_MAX];
@@ -294,7 +295,7 @@
void releaseIntlObjects(); // defined in intl.cpp
void destroyIntlObjects(); // defined in intl.cpp
-
+
// from CMP_shutdown_database and CMP_fini
void shutdown(thread_db* tdbb);
@@ -303,7 +304,7 @@
MemoryPool* createPool();
void deletePool(MemoryPool* pool);
-/// former Database members
+ /// former Database members - end
bool locksmith() const;
jrd_tra* getSysTransaction();
Modified: firebird/trunk/src/jrd/Database.cpp
===================================================================
--- firebird/trunk/src/jrd/Database.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/Database.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -57,14 +57,14 @@
#endif
}
- Firebird::string Database::getUniqueFileId() const
+ string Database::getUniqueFileId() const
{
const PageSpace* const pageSpace = dbb_page_manager.findPageSpace(DB_PAGE_SPACE);
- Firebird::UCharBuffer buffer;
+ UCharBuffer buffer;
PIO_get_unique_file_id(pageSpace->file, buffer);
- Firebird::string file_id;
+ string file_id;
char* s = file_id.getBuffer(2 * buffer.getCount());
for (size_t i = 0; i < buffer.getCount(); i++)
{
@@ -78,13 +78,12 @@
Database::~Database()
{
{
- Firebird::SyncLockGuard guard(&dbb_pools_sync, SYNC_EXCLUSIVE, "Database::~Database");
-
+ SyncLockGuard guard(&dbb_pools_sync, SYNC_EXCLUSIVE, "Database::~Database");
+
fb_assert(dbb_pools[0] == dbb_permanent);
+
for (size_t i = 1; i < dbb_pools.getCount(); ++i)
- {
MemoryPool::deletePool(dbb_pools[i]);
- }
}
delete dbb_monitoring_data;
@@ -92,7 +91,7 @@
dbb_flags |= DBB_destroying;
-// Checkout dcoHolder(this);
+ //Checkout dcoHolder(this);
// This line decrements the usage counter and may cause the destructor to be called.
// It should happen with the dbb_sync unlocked.
@@ -105,12 +104,11 @@
if (pool)
{
{
- Firebird::SyncLockGuard guard(&dbb_pools_sync, SYNC_EXCLUSIVE, "Database::deletePool");
+ SyncLockGuard guard(&dbb_pools_sync, SYNC_EXCLUSIVE, "Database::deletePool");
size_t pos;
+
if (dbb_pools.find(pool, pos))
- {
dbb_pools.remove(pos);
- }
}
MemoryPool::deletePool(pool);
@@ -204,7 +202,7 @@
LCK_downgrade(tdbb, counter->lock);
}
- catch (const Firebird::Exception&)
+ catch (const Exception&)
{} // no-op
return 0;
Modified: firebird/trunk/src/jrd/Database.h
===================================================================
--- firebird/trunk/src/jrd/Database.h 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/Database.h 2011-05-10 01:12:14 UTC (rev 52897)
@@ -317,9 +317,9 @@
BufferControl* dbb_bcb; // Buffer control block
int dbb_monitoring_id; // dbb monitoring identifier
Lock* dbb_lock; // granddaddy lock
-
+
Firebird::SyncObject dbb_sh_counter_sync;
-
+
Firebird::SyncObject dbb_shadow_sync;
Shadow* dbb_shadow; // shadow control block
Lock* dbb_shadow_lock; // lock for synchronizing addition of shadows
Modified: firebird/trunk/src/jrd/DatabaseSnapshot.cpp
===================================================================
--- firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -363,6 +363,7 @@
if (!(dbb->dbb_flags & DBB_not_in_use))
{
ContextPoolHolder context(tdbb, dbb->dbb_permanent);
+
try
{
dumpData(tdbb);
@@ -410,13 +411,13 @@
{
SyncLockGuard monGuard(&dbb->dbb_mon_sync, SYNC_EXCLUSIVE, "DatabaseSnapshot::DatabaseSnapshot");
- // Release our own lock
+ // Release our own lock.
LCK_release(tdbb, dbb->dbb_monitor_lock);
dbb->dbb_ast_flags &= ~DBB_monitor_off;
{ // scope for the RAII object
- // Ensure we'll be dealing with a valid backup state inside the call below
+ // Ensure we'll be dealing with a valid backup state inside the call below.
BackupManager::StateReadGuard holder(tdbb);
// Dump our own data
@@ -775,7 +776,7 @@
putDatabase(dbb, writer, fb_utils::genUniqueId());
// Attachment information
-
+
Attachment* old_attachment = tdbb->getAttachment();
Attachment::Checkout attCout(old_attachment, true);
Modified: firebird/trunk/src/jrd/ExtEngineManager.cpp
===================================================================
--- firebird/trunk/src/jrd/ExtEngineManager.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/ExtEngineManager.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -299,7 +299,7 @@
ExtEngineManager::Function::~Function()
{
- // Database::Checkout dcoHolder(database);
+ //Database::Checkout dcoHolder(database);
function->dispose(LogError());
}
Modified: firebird/trunk/src/jrd/Function.epp
===================================================================
--- firebird/trunk/src/jrd/Function.epp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/Function.epp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -175,9 +175,7 @@
Database* const dbb = tdbb->getDatabase();
if (id >= attachment->att_functions.getCount())
- {
attachment->att_functions.grow(id + 1);
- }
Function* function = attachment->att_functions[id];
@@ -193,9 +191,7 @@
}
if (!function)
- {
function = FB_NEW(*attachment->att_pool) Function(*attachment->att_pool);
- }
try
{
Modified: firebird/trunk/src/jrd/GlobalRWLock.cpp
===================================================================
--- firebird/trunk/src/jrd/GlobalRWLock.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/GlobalRWLock.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -164,12 +164,15 @@
if (!LCK_lock(tdbb, cachedLock, LCK_write, wait))
{
Attachment::CheckoutLockGuard counterGuard(att, counterMutex, true);
+
--pendingLock;
+
if (--pendingWriters)
{
if (!currentWriter)
writerFinished.notifyAll();
}
+
return false;
}
Modified: firebird/trunk/src/jrd/Relation.cpp
===================================================================
--- firebird/trunk/src/jrd/Relation.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/Relation.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -137,9 +137,8 @@
else
inst_id = PAG_attachment_id(tdbb);
- if (!rel_pages_inst) {
+ if (!rel_pages_inst)
rel_pages_inst = FB_NEW(*rel_pool) RelationPagesInstances(*rel_pool);
- }
size_t pos;
if (!rel_pages_inst->find(inst_id, pos))
Modified: firebird/trunk/src/jrd/cch.cpp
===================================================================
--- firebird/trunk/src/jrd/cch.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/cch.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -109,7 +109,7 @@
#define PAGE_OVERHEAD (sizeof(bcb_repeat) + sizeof(BufferDesc) + sizeof(Lock) + (int) bcb->bcb_page_size)
-enum LatchState
+enum LatchState
{
lsOk,
lsTimeout,
@@ -402,7 +402,7 @@
if (!exLock) {
dsGuard.lock(SYNC_SHARED);
}
-
+
Jrd::Attachment* attachment = tdbb->getAttachment();
if (attachment->att_flags & ATT_exclusive) {
return true;
@@ -772,7 +772,7 @@
BufferDesc* bdb = get_buffer(tdbb, window->win_page, ((lock_type >= LCK_write) ? SYNC_EXCLUSIVE : SYNC_SHARED), wait);
- if (wait != 1 && bdb == 0)
+ if (wait != 1 && bdb == 0)
{
attachment->backupStateReadUnLock(tdbb);
return lsLatchTimeout; // latch timeout
@@ -1351,7 +1351,7 @@
Sync bcbSync(&bcb->bcb_syncObject, "CCH_get_related");
bcbSync.lock(SYNC_SHARED);
-
+
BufferDesc* bdb = find_buffer(bcb, page, false);
bcbSync.unlock();
@@ -1406,7 +1406,7 @@
BufferDesc *bdb = window->win_bdb;
// unmark
- if ((bdb->bdb_writers == 1) && (bdb->bdb_flags & BDB_marked))
+ if ((bdb->bdb_writers == 1) && (bdb->bdb_flags & BDB_marked))
{
bdb->bdb_flags &= ~BDB_marked;
bdb->unLockIO(tdbb);
@@ -1428,8 +1428,8 @@
volatile PageNumber pg = window->win_page;
- // This prevents a deadlock with the precedence queue, as shown by
- // mwrite mwrite1 2 mwrite2 2 test.fdb
+ // This prevents a deadlock with the precedence queue, as shown by
+ // mwrite mwrite1 2 mwrite2 2 test.fdb
const int wait2 = bdb->ourExclusiveLock() ? LCK_NO_WAIT : wait;
LockState must_read = CCH_fetch_lock(tdbb, window, lock, wait2, page_type);
@@ -2005,7 +2005,7 @@
tdbb->getAttachment()->backupStateReadUnLock(tdbb);
// if (bdb->bdb_writers == 1 || bdb->bdb_use_count == 1)
- if (bdb->bdb_writers == 1 ||
+ if (bdb->bdb_writers == 1 ||
bdb->bdb_writers == 0 && (bdb->bdb_flags & BDB_must_write))
{
const bool marked = bdb->bdb_flags & BDB_marked;
@@ -2063,7 +2063,7 @@
{
bdb->bdb_flags &= ~BDB_garbage_collect;
}
-
+
// hvlad: we want to make it least recently used, not most recently used
//recentlyUsed(bdb);
#ifdef CACHE_WRITER
@@ -2235,7 +2235,7 @@
if (bdb->bdb_flags & BDB_marked) {
BUGCHECK(268); // msg 268 buffer marked during cache unwind
}
-
+
tdbb->getAttachment()->backupStateReadUnLock(tdbb);
if (bdb->ourExclusiveLock()) {
@@ -2271,7 +2271,7 @@
// hvlad : as far as I understand thread can't hold more than two shared latches
// on the same bdb, so findSharedLatch below will not be called many times
-
+
SharedLatch* latch = findSharedLatch(tdbb, bdb);
while (latch)
{
@@ -2280,7 +2280,7 @@
release_bdb(tdbb, bdb, true, false, false);
latch = findSharedLatch(tdbb, bdb);
}
-
+
#ifndef SUPERSERVER
const pag* const page = bdb->bdb_buffer;
if (page->pag_type == pag_header || page->pag_type == pag_transactions)
@@ -2359,7 +2359,7 @@
page = (pag*) spare_buffer.getBuffer(dbb->dbb_page_size);
memcpy(page, bdb->bdb_buffer, HDR_SIZE);
old_buffer = bdb->bdb_buffer;
-
+
// hvlad: is it mt-safe ?
bdb->bdb_buffer = page;
}
@@ -2555,7 +2555,7 @@
{
BufferControl *bcb = bdb->bdb_bcb;
fb_assert(!(bcb->bcb_flags & BCB_exclusive));
-
+
Database* dbb = bcb->bcb_database;
fb_assert(dbb);
@@ -2574,7 +2574,7 @@
const bool keep_pages = (bcb->bcb_flags & BCB_keep_pages) != 0;
bcb->bcb_flags |= BCB_keep_pages;
- down_grade(tdbb, bdb);
+ down_grade(tdbb, bdb);
if (!keep_pages) {
bcb->bcb_flags &= ~BCB_keep_pages;
@@ -2665,9 +2665,9 @@
continue;
}
- if ((transaction_mask & bdb->bdb_transactions) ||
+ if ((transaction_mask & bdb->bdb_transactions) ||
(bdb->bdb_flags & BDB_system_dirty) ||
- (!transaction_mask && !sys_only) ||
+ (!transaction_mask && !sys_only) ||
(!bdb->bdb_transactions))
{
flush.add(bdb);
@@ -2799,7 +2799,7 @@
}
bdb->release(tdbb);
- if (release_flag)
+ if (release_flag)
{
PAGE_LOCK_RELEASE(tdbb, bcb, bdb->bdb_lock);
}
@@ -3059,7 +3059,7 @@
dpb.reset(isc_dpb_version1);
dpb.insertString(isc_dpb_trusted_auth, "Cache Writer");
- if (jrd8_attach_database(status_vector, NULL, dbb->dbb_filename.c_str(), &attachment,
+ if (jrd8_attach_database(status_vector, NULL, dbb->dbb_filename.c_str(), &attachment,
dpb.getBufferLength(), dpb.getBuffer()))
{
gds__log_status(dbb->dbb_filename.c_str(), status_vector);
@@ -3245,7 +3245,7 @@
// Start by finding the buffer containing the high priority page
Sync bcbSync(&bcb->bcb_syncObject, "check_precedence");
- bcbSync.lock(SYNC_SHARED);
+ bcbSync.lock(SYNC_SHARED);
BufferDesc* high = find_buffer(bcb, page, false);
bcbSync.unlock();
@@ -3271,7 +3271,7 @@
// forget about about establishing the relationship.
Sync precSync(&bcb->bcb_syncPrecedence, "check_precedence");
- precSync.lock(SYNC_EXCLUSIVE);
+ precSync.lock(SYNC_EXCLUSIVE);
if (QUE_NOT_EMPTY(high->bdb_lower))
{
@@ -3283,7 +3283,7 @@
if (relationship == PRE_UNKNOWN)
{
- precSync.unlock();
+ precSync.unlock();
const PageNumber high_page = high->bdb_page;
if (!write_buffer(tdbb, high, high_page, false, tdbb->tdbb_status_vector, true)) {
CCH_unwind(tdbb, true);
@@ -3372,7 +3372,7 @@
BufferDesc* low_bdb = precedence->pre_low;
QUE_DELETE(precedence->pre_higher);
QUE_DELETE(precedence->pre_lower);
-
+
precedence->pre_hi = (BufferDesc*) bcb->bcb_free;
bcb->bcb_free = precedence;
if (!(precedence->pre_flags & PRE_cleared))
@@ -3492,7 +3492,7 @@
syncPrec.unlock();
down_grade(tdbb, blocking_bdb);
- if (blocking_bdb->bdb_flags & BDB_dirty && !(precedence->pre_flags & PRE_cleared))
+ if (blocking_bdb->bdb_flags & BDB_dirty && !(precedence->pre_flags & PRE_cleared))
{
in_use = true;
}
@@ -3502,7 +3502,7 @@
in_use = false;
que_inst = bdb->bdb_higher.que_forward;
}
-
+
break;
}
}
@@ -3650,7 +3650,7 @@
for (bcb_repeat* old_tail = old_rpt; old_tail < old_end; old_tail++, new_tail++)
{
new_tail->bcb_bdb = old_tail->bcb_bdb;
- while (QUE_NOT_EMPTY(old_tail->bcb_page_mod))
+ while (QUE_NOT_EMPTY(old_tail->bcb_page_mod))
{
QUE que_inst = old_tail->bcb_page_mod.que_forward;
BufferDesc* bdb = BLOCK(que_inst, BufferDesc*, bdb_que);
@@ -3697,7 +3697,7 @@
for (; que_inst != mod_que; que_inst = que_inst->que_forward)
{
BufferDesc* bdb = BLOCK(que_inst, BufferDesc*, bdb_que);
- if (bdb->bdb_page == page)
+ if (bdb->bdb_page == page)
return bdb;
}
@@ -3716,7 +3716,7 @@
}
-static LatchState latch_buffer(thread_db* tdbb, Sync &bcbSync, BufferDesc *bdb,
+static LatchState latch_buffer(thread_db* tdbb, Sync &bcbSync, BufferDesc *bdb,
const PageNumber page, SyncType syncType, int wait)
{
//++bdb->bdb_use_count;
@@ -3730,16 +3730,16 @@
recentlyUsed(bdb);
}
- // If buffer is currently replacing by another page but still writting
- // to disk we should wait until this write finished, else we could
- // allocate another buffer and read old page image (or even zero's)
+ // If buffer is currently replacing by another page but still writting
+ // to disk we should wait until this write finished, else we could
+ // allocate another buffer and read old page image (or even zero's)
// from disk into new buffer
const bool waitPending = (bdb->bdb_flags & BDB_free_pending && bdb->bdb_page == page);
bcbSync.unlock();
- if (waitPending)
+ if (waitPending)
{
//--bdb->bdb_use_count;
if (wait <= 0) {
@@ -3751,7 +3751,7 @@
else
{
bool latchOk = true;
- if (wait <= 0)
+ if (wait <= 0)
latchOk = bdb->addRefConditional(tdbb, syncType);
else
bdb->addRef(tdbb, syncType);
@@ -3814,7 +3814,7 @@
{
bcbSync.lock(SYNC_SHARED);
BufferDesc *bdb = find_buffer(bcb, page, true);
- while (bdb)
+ while (bdb)
{
const LatchState ret = latch_buffer(tdbb, bcbSync, bdb, page, syncType, wait);
if (ret == lsOk) {
@@ -3840,7 +3840,7 @@
{
// Check to see if buffer has already been assigned to page
BufferDesc *bdb = find_buffer(bcb, page, true);
- while (bdb)
+ while (bdb)
{
const LatchState ret = latch_buffer(tdbb, bcbSync, bdb, page, syncType, wait);
if (ret == lsOk) {
@@ -3896,7 +3896,7 @@
que_inst = bcb->bcb_empty.que_forward;
QUE_DELETE(*que_inst);
BufferDesc* bdb = BLOCK(que_inst, BufferDesc*, bdb_que);
-
+
bcb->bcb_inuse++;
bdb->addRef(tdbb, SYNC_EXCLUSIVE);
@@ -3993,7 +3993,7 @@
continue;
}
#endif
-
+
#ifdef CACHE_WRITER
if (oldest->bdb_flags & (BDB_dirty | BDB_db_dirty))
{
@@ -4024,7 +4024,7 @@
QUE_DELETE(bdb->bdb_que);
QUE_INSERT(bcb->bcb_pending, bdb->bdb_que);
-
+
lruSync.unlock();
bcbSync.unlock();
@@ -4050,7 +4050,7 @@
// screwed up, the only precedence blocks that can still be hanging
// around are ones cleared at AST level.
- if (QUE_NOT_EMPTY(bdb->bdb_higher) || QUE_NOT_EMPTY(bdb->bdb_lower))
+ if (QUE_NOT_EMPTY(bdb->bdb_higher) || QUE_NOT_EMPTY(bdb->bdb_lower))
{
Sync precSync(&bcb->bcb_syncPrecedence, "get_buffer");
precSync.lock(SYNC_EXCLUSIVE);
@@ -4074,7 +4074,7 @@
bcbSync.lock(SYNC_EXCLUSIVE);
QUE_DELETE(bdb->bdb_que); // bcb_pending
-
+
QUE mod_que = &bcb->bcb_rpt[page.getPageNum() % bcb->bcb_count].bcb_page_mod;
QUE_INSERT((*mod_que), bdb->bdb_que);
bdb->bdb_flags &= ~BDB_free_pending;
@@ -4092,7 +4092,7 @@
bdb->bdb_flags &= BDB_lru_chained; // yes, clear all except BDB_lru_chained
bdb->bdb_flags |= BDB_read_pending;
bdb->bdb_scan_count = 0;
-
+
bcbSync.unlock();
if (page != FREE_PAGE)
@@ -4242,7 +4242,7 @@
const USHORT lock_type = (bdb->bdb_flags & (BDB_dirty | BDB_writer)) ? LCK_write : LCK_read;
- CCH_TRACE(("FE LOCK %d:%06d, %s", bdb->bdb_page.getPageSpaceID(), bdb->bdb_page.getPageNum(),
+ CCH_TRACE(("FE LOCK %d:%06d, %s", bdb->bdb_page.getPageSpaceID(), bdb->bdb_page.getPageNum(),
(lock_type >= LCK_write) ? "EX" : "SH" ));
Lock* const lock = bdb->bdb_lock;
@@ -4361,7 +4361,7 @@
ERR_log(JRD_BUGCHK, 215, errmsg); // msg 215 page %ld, page type %ld lock conversion denied
CCH_unwind(tdbb, true);
-
+
return lsError; // Added to get rid of Compiler Warning
}
@@ -4923,7 +4923,7 @@
BufferDesc* hi_bdb = precedence->pre_hi;
const PageNumber hi_page = hi_bdb->bdb_page;
-
+
int write_status = 0;
syncPrec.unlock();
@@ -4967,7 +4967,7 @@
{
result = write_page(tdbb, bdb, status, false);
}
-
+
bdb->unLockIO(tdbb);
if (result) {
clear_precedence(tdbb, bdb);
@@ -5006,7 +5006,7 @@
// hvlad: why it is needed in Vulcan ???
//Sync syncWrite(&bcb->bcb_syncPageWrite, "write_page");
//syncWrite.lock(SYNC_EXCLUSIVE);
-
+
if (bdb->bdb_flags & BDB_not_valid)
{
ERR_build_status(status, Arg::Gds(isc_buf_invalid) << Arg::Num(bdb->bdb_page.getPageNum()));
@@ -5389,6 +5389,6 @@
if (--bdb_io_locks == 0) {
bdb_io = NULL;
}
-
+
bdb_syncIO.unlock(NULL, SYNC_EXCLUSIVE);
}
Modified: firebird/trunk/src/jrd/cch.h
===================================================================
--- firebird/trunk/src/jrd/cch.h 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/cch.h 2011-05-10 01:12:14 UTC (rev 52897)
@@ -82,10 +82,10 @@
class BufferControl : public pool_alloc<type_bcb>
{
- explicit BufferControl(MemoryPool& p) :
+ explicit BufferControl(MemoryPool& p) :
bcb_bufferpool(&p),
- bcb_memory(p)
- {
+ bcb_memory(p)
+ {
bcb_database = NULL;
QUE_INIT(bcb_in_use);
QUE_INIT(bcb_pending);
@@ -123,10 +123,10 @@
que bcb_pending; // Que of buffers which are going to be freed and reassigned
que bcb_empty; // Que of empty buffers
- // Recently used buffer put there without locking common LRU que (bcb_in_use).
+ // Recently used buffer put there without locking common LRU que (bcb_in_use).
// When bcb_syncLRU is locked this chain is merged into bcb_in_use. See also
// requeueRecentlyUsed() and recentlyUsed()
- Firebird::AtomicPointer<BufferDesc> bcb_lru_chain;
+ Firebird::AtomicPointer<BufferDesc> bcb_lru_chain;
que bcb_dirty; // que of dirty buffers
SLONG bcb_dirty_count; // count of pages in dirty page btree
@@ -179,8 +179,8 @@
class BufferDesc : public pool_alloc<type_bdb>
{
public:
- BufferDesc(BufferControl* bcb) :
- bdb_bcb(bcb),
+ BufferDesc(BufferControl* bcb) :
+ bdb_bcb(bcb),
bdb_page(0, 0),
bdb_pending_page(0, 0)
{
Modified: firebird/trunk/src/jrd/dyn.epp
===================================================================
--- firebird/trunk/src/jrd/dyn.epp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/dyn.epp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -123,9 +123,8 @@
const UCHAR* ptr = ddl;
- if (*ptr++ != isc_dyn_version_1) {
+ if (*ptr++ != isc_dyn_version_1)
ERR_post(Arg::Gds(isc_wrodynver));
- }
fb_utils::init_status(tdbb->tdbb_status_vector);
@@ -136,7 +135,8 @@
MemoryPool* const tempPool = attachment->createPool();
Jrd::ContextPoolHolder context(tdbb, tempPool);
- try {
+ try
+ {
VIO_start_save_point(tdbb, transaction);
transaction->tra_save_point->sav_verb_count++;
Modified: firebird/trunk/src/jrd/exe.cpp
===================================================================
--- firebird/trunk/src/jrd/exe.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/exe.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -492,7 +492,7 @@
**************************************/
Jrd::Attachment* attachment = tdbb->getAttachment();
- // do nothing if user doesn't want database triggers
+ // Do nothing if user doesn't want database triggers.
if (attachment->att_flags & ATT_no_db_triggers)
return;
Modified: firebird/trunk/src/jrd/extds/ExtDS.cpp
===================================================================
--- firebird/trunk/src/jrd/extds/ExtDS.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/extds/ExtDS.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -1615,16 +1615,17 @@
if (m_tdbb)
{
Jrd::Attachment* attachment = m_tdbb->getAttachment();
- if (attachment)
+
+ if (attachment)
{
attachment->att_interface->getMutex()->enter();
attachment->att_ext_connection = m_saveConnection;
}
jrd_tra* transaction = m_tdbb->getTransaction();
- if (transaction) {
+
+ if (transaction)
transaction->tra_callback_count--;
- }
}
}
Modified: firebird/trunk/src/jrd/ibase.h
===================================================================
--- firebird/trunk/src/jrd/ibase.h 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/ibase.h 2011-05-10 01:12:14 UTC (rev 52897)
@@ -1154,9 +1154,9 @@
ISC_STATUS ISC_EXPORT fb_ping(ISC_STATUS*, isc_db_handle*);
-/***********************/
+/********************/
/* Object interface */
-/***********************/
+/********************/
ISC_STATUS ISC_EXPORT fb_get_database_handle(ISC_STATUS*, isc_db_handle*, void*);
ISC_STATUS ISC_EXPORT fb_get_transaction_handle(ISC_STATUS*, isc_tr_handle*, void*);
Modified: firebird/trunk/src/jrd/inf.cpp
===================================================================
--- firebird/trunk/src/jrd/inf.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/inf.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -589,12 +589,14 @@
{
SyncLockGuard sync(&dbb->dbb_sync, SYNC_SHARED, "INF_database_info");
+
for (const Jrd::Attachment* att = dbb->dbb_attachments; att; att = att->att_next)
{
if (att->att_flags & ATT_shutdown)
continue;
const UserId* user = att->att_user;
+
if (user)
{
const char* user_name = user->usr_user_name.hasData() ?
@@ -603,6 +605,7 @@
const SSHORT len = strlen(user_name);
*p++ = len;
memcpy(p, user_name, len);
+
if (!(info = INF_put_item(item, len + 1, buffer, info, end)))
{
if (transaction)
@@ -610,6 +613,7 @@
sync.unlock();
TRA_commit(tdbb, transaction, false);
}
+
return;
}
}
Modified: firebird/trunk/src/jrd/intl.cpp
===================================================================
--- firebird/trunk/src/jrd/intl.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/intl.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -352,6 +352,7 @@
Jrd::Attachment::CheckoutLockGuard guard(att, createCollationMtx); // are we need it ?
Collation* to_delete = NULL;
+
if (id < charset_collations.getCount() && charset_collations[id] != NULL)
{
if (charset_collations[id]->obsolete)
@@ -364,9 +365,8 @@
delete charset_collations[id];
}
else
- {
to_delete = charset_collations[id];
- }
+
charset_collations[id] = NULL;
}
else
@@ -509,9 +509,7 @@
for (size_t i = 0; i < att_charsets.getCount(); i++)
{
if (att_charsets[i])
- {
att_charsets[i]->release();
- }
}
}
Modified: firebird/trunk/src/jrd/jrd.cpp
===================================================================
--- firebird/trunk/src/jrd/jrd.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/jrd.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -435,7 +435,7 @@
{
public:
AttachmentHolder(thread_db* tdbb, JAttachment* ja, bool lockAsync)
- : mutex(ja->getMutex(lockAsync)),
+ : mutex(ja->getMutex(lockAsync)),
attachment(ja->getHandle()),
async(lockAsync)
{
@@ -880,7 +880,7 @@
if (!lockedAtt && dbb->dbb_attachments != att) {
break;
}
- }
+ }
att = lockedAtt ? lockedAtt->att_next : dbb->dbb_attachments;
}
}
@@ -4927,9 +4927,9 @@
Database* dbb = tdbb->getDatabase();
Jrd::Attachment* attachment = tdbb->getAttachment();
- // hvlad: i think the check below is unnecessary as attachment pointer is
+ // hvlad: i think the check below is unnecessary as attachment pointer is
// already validated at AttachmentHolder. If i'm wrong and check is must be
- // then it should be moved into AttachmentHolder or even into
+ // then it should be moved into AttachmentHolder or even into
// DatabaseContexHolder to not lock dbb_sync with attachment mutex locked.
//
//{
Modified: firebird/trunk/src/jrd/jrd.h
===================================================================
--- firebird/trunk/src/jrd/jrd.h 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/jrd.h 2011-05-10 01:12:14 UTC (rev 52897)
@@ -429,7 +429,7 @@
~thread_db()
{
#ifdef DEV_BUILD
- for (size_t n = 0; n < tdbb_bdbs.getCount(); n++)
+ for (size_t n = 0; n < tdbb_bdbs.getCount(); ++n)
{
fb_assert(tdbb_bdbs[n] == NULL);
}
@@ -548,12 +548,14 @@
tdbb_bdbs.shrink(pos + 1);
break;
}
+
if (pos == 0)
{
tdbb_bdbs.shrink(0);
break;
}
- pos--;
+
+ --pos;
}
}
}
Modified: firebird/trunk/src/jrd/lck.cpp
===================================================================
--- firebird/trunk/src/jrd/lck.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/lck.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -75,23 +75,26 @@
#ifdef DEBUG_LCK
-class LckSync
+namespace
{
-public:
- LckSync(Lock* lock, const char* sWhere) :
- m_sync(&lock->lck_sync, sWhere)
+ class LckSync
{
- ThreadSync *thd = ThreadSync::getThread(NULL);
- m_sync.lock(SYNC_EXCLUSIVE);
- }
+ public:
+ LckSync(Lock* lock, const char* sWhere)
+ : m_sync(&lock->lck_sync, sWhere)
+ {
+ /***ThreadSync* thd =***/ ThreadSync::getThread(NULL);
+ m_sync.lock(SYNC_EXCLUSIVE);
+ }
- ~LckSync()
- {
- }
+ ~LckSync()
+ {
+ }
-private:
- Sync m_sync;
-};
+ private:
+ Sync m_sync;
+ };
+}
#endif
// globals and macros
@@ -236,9 +239,9 @@
class WaitCancelGuard
{
public:
- WaitCancelGuard(thread_db* tdbb, Lock* lock, int wait) :
- m_tdbb(tdbb),
- m_save_lock(NULL)
+ WaitCancelGuard(thread_db* tdbb, Lock* lock, int wait)
+ : m_tdbb(tdbb),
+ m_save_lock(NULL)
{
Jrd::Attachment* att = m_tdbb->getAttachment();
m_save_lock = att ? att->att_wait_lock : NULL;
@@ -254,7 +257,7 @@
fb_assert(att);
m_tdbb->tdbb_flags &= ~TDBB_wait_cancel_disable;
- if (att)
+ if (att)
{
att->att_wait_lock = lock;
}
@@ -1497,7 +1500,7 @@
if (lock->lck_attachment == attachment)
return;
- Database* dbb = attachment ? attachment->att_database :
+ Database* dbb = attachment ? attachment->att_database :
(lock->lck_attachment ? lock->lck_attachment->att_database : NULL);
fb_assert(dbb);
Modified: firebird/trunk/src/jrd/os/win32/winnt.cpp
===================================================================
--- firebird/trunk/src/jrd/os/win32/winnt.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/os/win32/winnt.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -299,7 +299,7 @@
if (!main_file->fil_ext_lock)
return;
-// Database::Checkout dcoHolder(dbb);
+ //Database::Checkout dcoHolder(dbb);
FileExtendLockGuard extLock(main_file->fil_ext_lock, true);
ULONG leftPages = extPages;
@@ -343,11 +343,10 @@
* Flush the operating system cache back to good, solid oxide.
*
**************************************/
-// Database::Checkout dcoHolder(dbb);
+ //Database::Checkout dcoHolder(dbb);
+
for (jrd_file* file = main_file; file; file = file->fil_next)
- {
FlushFileBuffers(file->fil_desc);
- }
}
@@ -495,7 +494,7 @@
const char* const zero_buff = zeros().getBuffer();
const size_t zero_buff_size = zeros().getSize();
-// Database::Checkout dcoHolder(dbb);
+ //Database::Checkout dcoHolder(dbb);
FileExtendLockGuard extLock(main_file->fil_ext_lock, false);
// Fake buffer, used in seek_file. Page space ID doesn't matter there
@@ -626,7 +625,7 @@
const DWORD size = bcb->bcb_page_size;
Database* const dbb = bcb->bcb_database;
-// Database::Checkout dcoHolder(dbb);
+ //Database::Checkout dcoHolder(dbb);
FileExtendLockGuard extLock(file->fil_ext_lock, false);
OVERLAPPED overlapped, *overlapped_ptr;
@@ -697,7 +696,7 @@
**************************************/
OVERLAPPED overlapped, *overlapped_ptr;
-// Database::Checkout dcoHolder(dbb);
+ //Database::Checkout dcoHolder(dbb);
// If an I/O status block was passed the caller wants to queue an asynchronous I/O.
@@ -785,7 +784,7 @@
* Check the status of an asynchronous I/O.
*
**************************************/
-// Database::Checkout dcoHolder(dbb);
+ //Database::Checkout dcoHolder(dbb);
if (!(piob->piob_flags & PIOB_success))
{
@@ -829,7 +828,7 @@
const DWORD size = bcb->bcb_page_size;
Database* const dbb = bcb->bcb_database;
-// Database::Checkout dcoHolder(dbb);
+ //Database::Checkout dcoHolder(dbb);
FileExtendLockGuard extLock(file->fil_ext_lock, false);
file = seek_file(file, bdb, status_vector, &overlapped, &overlapped_ptr);
@@ -1043,7 +1042,7 @@
static jrd_file* setup_file(Database* dbb,
const Firebird::PathName& file_name,
HANDLE desc,
- bool read_only,
+ bool read_only,
bool shareMode)
{
/**************************************
Modified: firebird/trunk/src/jrd/tpc.cpp
===================================================================
--- firebird/trunk/src/jrd/tpc.cpp 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/tpc.cpp 2011-05-10 01:12:14 UTC (rev 52897)
@@ -71,7 +71,7 @@
SyncLockGuard sync(&m_sync, SYNC_SHARED, "TipCache::CacheState");
- if (!m_cache.getCount())
+ if (!m_cache.getCount())
{
SyncUnlockGuard unlock(sync);
InitializeTpc(tdbb, number);
@@ -217,7 +217,7 @@
SyncLockGuard sync(&m_sync, SYNC_SHARED, "TipCache::SnapshotState");
- if (!m_cache.getCount())
+ if (!m_cache.getCount())
{
sync.unlock();
cacheTransactions(tdbb, 0);
@@ -286,7 +286,7 @@
return TRA_fetch_state(tdbb, number);
}
// if the transaction has been started since we last looked, extend the cache upward
-
+
sync.unlock();
return extendCache(tdbb, number);
}
@@ -410,9 +410,9 @@
oldest = MAX(oldest, hdr_oldest);
- // now get the inventory of all transactions, which will automatically
+ // now get the inventory of all transactions, which will automatically
// fill in the tip cache pages
- // hvlad: note, call below will call UpdateCache() which will acquire m_sync
+ // hvlad: note, call below will call UpdateCache() which will acquire m_sync
// in exclusive mode. This is the reason why m_sync must be unlocked at the
// entry of this routine
@@ -515,4 +515,4 @@
return tra_active;
}
-} // namespace Jrd
+} // namespace Jrd
Modified: firebird/trunk/src/jrd/tpc_proto.h
===================================================================
--- firebird/trunk/src/jrd/tpc_proto.h 2011-05-09 10:15:19 UTC (rev 52896)
+++ firebird/trunk/src/jrd/tpc_proto.h 2011-05-10 01:12:14 UTC (rev 52897)
@@ -52,10 +52,10 @@
class TxPage : public pool_alloc_rpt<SCHAR, type_tpc>
{
public:
- SLONG tpc_base; // id of first transaction in this block
- UCHAR tpc_transactions[1]; // two bits per transaction
+ SLONG tpc_base; // id of first transaction in this block
+ UCHAR tpc_transactions[1]; // two bits per transaction
- static const SLONG generate(const void*, const TxPage* item)
+ static const SLONG generate(const void*, const TxPage* item)
{ return item->tpc_base; }
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|