8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 01:23:03 +01:00

Better fix for lock files in CORE-2402

This commit is contained in:
alexpeshkoff 2009-04-08 11:30:15 +00:00
parent a1e66acd9b
commit ab90217604
2 changed files with 7 additions and 3 deletions

View File

@ -184,6 +184,7 @@ LockManager* LockManager::create(const Firebird::string& id)
LockManager::LockManager(const Firebird::string& id) LockManager::LockManager(const Firebird::string& id)
: PID(getpid()), : PID(getpid()),
m_bugcheck(false), m_bugcheck(false),
m_sharedFileCreated(false),
m_header(NULL), m_header(NULL),
m_process(NULL), m_process(NULL),
m_processOffset(0), m_processOffset(0),
@ -1064,7 +1065,7 @@ void LockManager::acquire_shmem(SRQ_PTR owner_offset)
fb_assert(owner_offset == CREATE_OWNER); fb_assert(owner_offset == CREATE_OWNER);
owner_offset = DUMMY_OWNER; owner_offset = DUMMY_OWNER;
if (m_header->lhb_active_owner != DUMMY_OWNER) { if (! m_sharedFileCreated) {
ISC_STATUS_ARRAY local_status; ISC_STATUS_ARRAY local_status;
// Someone is going to delete shared file? Reattach. // Someone is going to delete shared file? Reattach.
@ -1082,7 +1083,7 @@ void LockManager::acquire_shmem(SRQ_PTR owner_offset)
} }
else { else {
// complete initialization // complete initialization
m_header->lhb_active_owner = 0; m_sharedFileCreated = false;
// no sense thinking about statistics now // no sense thinking about statistics now
prior_active = 0; prior_active = 0;
@ -1090,6 +1091,7 @@ void LockManager::acquire_shmem(SRQ_PTR owner_offset)
break; break;
} }
} }
fb_assert(!m_sharedFileCreated);
++m_header->lhb_acquires; ++m_header->lhb_acquires;
@ -2243,6 +2245,7 @@ void LockManager::initialize(sh_mem* shmem_data, bool initializeMemory)
#endif #endif
m_header = (lhb*) shmem_data->sh_mem_address; m_header = (lhb*) shmem_data->sh_mem_address;
m_sharedFileCreated = initializeMemory;
if (!initializeMemory) { if (!initializeMemory) {
return; return;
@ -2337,7 +2340,7 @@ void LockManager::initialize(sh_mem* shmem_data, bool initializeMemory)
} }
// Done initializing, unmark owner information // Done initializing, unmark owner information
// m_header->lhb_active_owner = 0; m_header->lhb_active_owner = 0;
} }

View File

@ -149,6 +149,7 @@ private:
} }
bool m_bugcheck; bool m_bugcheck;
bool m_sharedFileCreated;
lhb* volatile m_header; lhb* volatile m_header;
prc* m_process; prc* m_process;
SRQ_PTR m_processOffset; SRQ_PTR m_processOffset;