mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 18:43:03 +01:00
1) Major cleanup of the old-style blk and allocator-based blk_type.
2) Added synchronization for the JRD locks.
This commit is contained in:
parent
44d9ace2d0
commit
f5659c0b70
@ -45,7 +45,6 @@
|
||||
#include "../common/thd.h"
|
||||
|
||||
// Definition of block types for data allocation in JRD
|
||||
#include "../jrd/jrd_blks.h"
|
||||
#include "../include/fb_blk.h"
|
||||
|
||||
|
||||
@ -88,4 +87,4 @@ namespace Jrd
|
||||
MemoryPool::deletePool(pool);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace
|
||||
|
@ -81,7 +81,7 @@ GlobalRWLock::GlobalRWLock(thread_db* tdbb, MemoryPool& p, locktype_t lckType,
|
||||
|
||||
cached_lock->lck_dbb = dbb;
|
||||
cached_lock->lck_parent = dbb->dbb_lock;
|
||||
cached_lock->lck_object = reinterpret_cast<blk*>(this);
|
||||
cached_lock->lck_object = this;
|
||||
cached_lock->lck_ast = lockCaching ? blocking_ast_cached_lock : NULL;
|
||||
memcpy(&cached_lock->lck_key, lockStr, lockLen);
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#ifndef JRD_BLF_H
|
||||
#define JRD_BLF_H
|
||||
|
||||
#include "../jrd/jrd_blks.h"
|
||||
#include "../include/fb_blk.h"
|
||||
|
||||
namespace Jrd {
|
||||
|
@ -29,7 +29,6 @@
|
||||
|
||||
#include "../jrd/constants.h"
|
||||
#include "../common/classes/array.h"
|
||||
#include "../jrd/jrd_blks.h"
|
||||
#include "../include/fb_blk.h"
|
||||
|
||||
#include "../jrd/err_proto.h" /* Index error types */
|
||||
|
@ -32,7 +32,6 @@
|
||||
#ifndef JRD_EXE_H
|
||||
#define JRD_EXE_H
|
||||
|
||||
#include "../jrd/jrd_blks.h"
|
||||
#include "../jrd/blb.h"
|
||||
#include "../jrd/Relation.h"
|
||||
#include "../common/classes/array.h"
|
||||
|
@ -28,7 +28,6 @@
|
||||
#ifndef JRD_EXECUTE_STATEMENT_H
|
||||
#define JRD_EXECUTE_STATEMENT_H
|
||||
|
||||
#include "../jrd/jrd_blks.h"
|
||||
#include "../include/fb_blk.h"
|
||||
#include "../jrd/PreparedStatement.h"
|
||||
#include "../jrd/ResultSet.h"
|
||||
|
@ -234,7 +234,7 @@ void* API_ROUTINE gds__alloc_debug(SLONG size_request,
|
||||
const TEXT* filename,
|
||||
ULONG lineno)
|
||||
{
|
||||
return getDefaultMemoryPool()->allocate_nothrow(size_request, 0
|
||||
return getDefaultMemoryPool()->allocate_nothrow(size_request
|
||||
#ifdef DEBUG_GDS_ALLOC
|
||||
, filename, lineno
|
||||
#endif
|
||||
@ -3517,7 +3517,7 @@ void gds__trace_printer(void* arg, SSHORT offset, const TEXT* line)
|
||||
|
||||
void* API_ROUTINE gds__alloc(SLONG size_request)
|
||||
{
|
||||
return getDefaultMemoryPool()->allocate_nothrow(size_request, 0
|
||||
return getDefaultMemoryPool()->allocate_nothrow(size_request
|
||||
#ifdef DEBUG_GDS_ALLOC
|
||||
, __FILE__, __LINE__
|
||||
#endif
|
||||
|
@ -353,7 +353,7 @@ Collation* CharSetContainer::lookupCollation(thread_db* tdbb, USHORT tt_id)
|
||||
{
|
||||
Lock* lock = charset_collations[id]->existenceLock =
|
||||
CharSetContainer::createCollationLock(tdbb, tt_id);
|
||||
lock->lck_object = (blk*)charset_collations[id];
|
||||
lock->lck_object = charset_collations[id];
|
||||
|
||||
LCK_lock(tdbb, lock, LCK_SR, LCK_WAIT);
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ namespace
|
||||
tdbb->setDatabase(attachment->att_database);
|
||||
}
|
||||
|
||||
inline void validateHandle(thread_db* tdbb, jrd_tra* transaction)
|
||||
inline void validateHandle(thread_db* tdbb, jrd_tra* const transaction)
|
||||
{
|
||||
if (!transaction->checkHandle())
|
||||
Firebird::status_exception::raise(isc_bad_trans_handle, 0);
|
||||
@ -185,7 +185,7 @@ namespace
|
||||
tdbb->setTransaction(transaction);
|
||||
}
|
||||
|
||||
inline void validateHandle(thread_db* tdbb, jrd_req* request)
|
||||
inline void validateHandle(thread_db* tdbb, jrd_req* const request)
|
||||
{
|
||||
if (!request->checkHandle())
|
||||
Firebird::status_exception::raise(isc_bad_req_handle, 0);
|
||||
@ -193,7 +193,7 @@ namespace
|
||||
validateHandle(tdbb, request->req_attachment);
|
||||
}
|
||||
|
||||
inline void validateHandle(thread_db* tdbb, dsql_req* statement)
|
||||
inline void validateHandle(thread_db* tdbb, dsql_req* const statement)
|
||||
{
|
||||
if (!statement->checkHandle())
|
||||
Firebird::status_exception::raise(isc_bad_req_handle, 0);
|
||||
@ -216,7 +216,6 @@ namespace
|
||||
Firebird::status_exception::raise(isc_bad_svc_handle, 0);
|
||||
}
|
||||
|
||||
|
||||
class DatabaseContextHolder : public Jrd::ContextPoolHolder
|
||||
{
|
||||
public:
|
||||
@ -4681,7 +4680,7 @@ static void init_database_locks(thread_db* tdbb, Database* dbb)
|
||||
lock->lck_parent = dbb->dbb_lock;
|
||||
lock->lck_length = sizeof(SLONG);
|
||||
lock->lck_dbb = dbb;
|
||||
lock->lck_object = reinterpret_cast<blk*>(dbb);
|
||||
lock->lck_object = dbb;
|
||||
lock->lck_ast = DatabaseSnapshot::blockingAst;
|
||||
LCK_lock(tdbb, lock, LCK_SR, LCK_WAIT);
|
||||
|
||||
|
@ -69,27 +69,9 @@
|
||||
#define IBERROR(number) ERR_error (number)
|
||||
|
||||
|
||||
#define BLKCHK(blk, type) if (MemoryPool::blk_type(blk) != (USHORT) (type)) BUGCHECK (147)
|
||||
#define BLKCHK(blk, type) if (!blk->checkHandle()) BUGCHECK(147)
|
||||
|
||||
/* DEV_BLKCHK is used for internal consistency checking - where
|
||||
* the performance hit in production build isn't desired.
|
||||
* (eg: scatter this everywhere)
|
||||
*
|
||||
* This causes me a problem DEV_BLKCHK fails when the data seems valid
|
||||
* After talking to John this could be because the memory is from the local
|
||||
* stack rather than the heap. However I found to continue I needed to
|
||||
* turn it off by dfining the macro to be empty. But In thinking about
|
||||
* it I think that it would be more helful for a mode where these extra
|
||||
* DEV checks just gave warnings rather than being fatal.
|
||||
* MOD 29-July-2002
|
||||
*
|
||||
*/
|
||||
#ifdef DEV_BUILD
|
||||
#define DEV_BLKCHK(blk,type)
|
||||
//#define DEV_BLKCHK(blk, type) if (blk) {BLKCHK (blk, type);}
|
||||
#else
|
||||
#define DEV_BLKCHK(blk, type) // nothing
|
||||
#endif
|
||||
|
||||
|
||||
// Thread data block / IPC related data blocks
|
||||
@ -100,7 +82,6 @@
|
||||
#include "../common/thd.h"
|
||||
|
||||
// Definition of block types for data allocation in JRD
|
||||
#include "../jrd/jrd_blks.h"
|
||||
#include "../include/fb_blk.h"
|
||||
|
||||
#include "../jrd/blb.h"
|
||||
@ -143,13 +124,11 @@ class ViewContext;
|
||||
class IndexBlock;
|
||||
class IndexLock;
|
||||
class ArrayField;
|
||||
//class PageControl;
|
||||
class Symbol;
|
||||
struct sort_context;
|
||||
class RecordSelExpr;
|
||||
class vcl;
|
||||
class TextType;
|
||||
//class jrd_prc;
|
||||
class Parameter;
|
||||
class jrd_fld;
|
||||
class dsql_dbb;
|
||||
@ -440,7 +419,7 @@ public:
|
||||
|
||||
|
||||
// general purpose vector
|
||||
template <class T, USHORT TYPE = type_vec>
|
||||
template <class T, BlockType TYPE = type_vec>
|
||||
class vec_base : protected pool_alloc<TYPE>
|
||||
{
|
||||
public:
|
||||
@ -760,7 +739,7 @@ private:
|
||||
// duplicate context of firebird string to store in jrd_nod::nod_arg
|
||||
inline char* stringDup(MemoryPool& p, const Firebird::string& s)
|
||||
{
|
||||
char* rc = (char*) p.allocate(s.length() + 1, 0
|
||||
char* rc = (char*) p.allocate(s.length() + 1
|
||||
#ifdef DEBUG_GDS_ALLOC
|
||||
, __FILE__, __LINE__
|
||||
#endif
|
||||
@ -771,7 +750,7 @@ inline char* stringDup(MemoryPool& p, const Firebird::string& s)
|
||||
|
||||
inline char* stringDup(MemoryPool& p, const char* s, size_t l)
|
||||
{
|
||||
char* rc = (char*) p.allocate(l + 1, 0
|
||||
char* rc = (char*) p.allocate(l + 1
|
||||
#ifdef DEBUG_GDS_ALLOC
|
||||
, __FILE__, __LINE__
|
||||
#endif
|
||||
@ -833,7 +812,7 @@ inline Jrd::thread_db* JRD_get_thread_data() {
|
||||
if (p1 && p1->getType() == ThreadData::tddDBB)
|
||||
{
|
||||
Jrd::thread_db* p2 = (Jrd::thread_db*)p1;
|
||||
if (p2->getDatabase() && MemoryPool::blk_type(p2->getDatabase()) != type_dbb)
|
||||
if (p2->getDatabase() && !p2->getDatabase()->checkHandle())
|
||||
{
|
||||
BUGCHECK(147);
|
||||
}
|
||||
@ -842,11 +821,10 @@ inline Jrd::thread_db* JRD_get_thread_data() {
|
||||
}
|
||||
inline void CHECK_TDBB(const Jrd::thread_db* tdbb) {
|
||||
fb_assert(tdbb && (tdbb->getType() == ThreadData::tddDBB) &&
|
||||
(!tdbb->getDatabase() ||
|
||||
MemoryPool::blk_type(tdbb->getDatabase()) == type_dbb));
|
||||
(!tdbb->getDatabase() || tdbb->getDatabase()->checkHandle()));
|
||||
}
|
||||
inline void CHECK_DBB(const Jrd::Database* dbb) {
|
||||
fb_assert(dbb && MemoryPool::blk_type(dbb) == type_dbb);
|
||||
fb_assert(dbb->checkHandle());
|
||||
}
|
||||
|
||||
#else // PROD_BUILD
|
||||
|
@ -334,8 +334,9 @@ void LCK_assert(thread_db* tdbb, Lock* lock)
|
||||
* Assert a logical lock.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
Firebird::MutexLockGuard guard(lock->lck_mutex);
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
|
||||
if (lock->lck_logical == lock->lck_physical ||
|
||||
@ -363,9 +364,11 @@ bool LCK_convert(thread_db* tdbb, Lock* lock, USHORT level, SSHORT wait)
|
||||
* Convert an existing lock to a new level.
|
||||
*
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
Firebird::MutexLockGuard guard(lock->lck_mutex);
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
|
||||
SET_TDBB(tdbb);
|
||||
Database* dbb = lock->lck_dbb;
|
||||
ISC_STATUS* status = tdbb->tdbb_status_vector;
|
||||
|
||||
@ -411,7 +414,10 @@ int LCK_convert_opt(thread_db* tdbb, Lock* lock, USHORT level)
|
||||
*
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
Firebird::MutexLockGuard guard(lock->lck_mutex);
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
|
||||
const USHORT old_level = lock->lck_logical;
|
||||
lock->lck_logical = level;
|
||||
Database* dbb = lock->lck_dbb;
|
||||
@ -438,9 +444,11 @@ int LCK_downgrade(thread_db* tdbb, Lock* lock)
|
||||
* Downgrade a lock.
|
||||
*
|
||||
**************************************/
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
Firebird::MutexLockGuard guard(lock->lck_mutex);
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
|
||||
ISC_STATUS* status = tdbb->tdbb_status_vector;
|
||||
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
@ -585,6 +593,9 @@ bool LCK_set_owner_handle(Jrd::thread_db* tdbb, Jrd::Lock* lock, SLONG owner_han
|
||||
* grant it onto new one.
|
||||
*
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
Firebird::MutexLockGuard guard(lock->lck_mutex);
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
fb_assert(lock->lck_physical > LCK_none);
|
||||
|
||||
@ -653,9 +664,11 @@ int LCK_lock(thread_db* tdbb, Lock* lock, USHORT level, SSHORT wait)
|
||||
* Lock a block. There had better not have been a lock there.
|
||||
*
|
||||
**************************************/
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
Firebird::MutexLockGuard guard(lock->lck_mutex);
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
|
||||
Database* dbb = lock->lck_dbb;
|
||||
ISC_STATUS* status = tdbb->tdbb_status_vector;
|
||||
set_lock_attachment(lock, tdbb->getAttachment());
|
||||
@ -701,9 +714,11 @@ int LCK_lock_opt(thread_db* tdbb, Lock* lock, USHORT level, SSHORT wait)
|
||||
* Assert a lock if the parent is not locked in exclusive mode.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
Firebird::MutexLockGuard guard(lock->lck_mutex);
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
|
||||
lock->lck_logical = level;
|
||||
Database* dbb = lock->lck_dbb;
|
||||
|
||||
@ -731,8 +746,11 @@ SLONG LCK_query_data(thread_db* tdbb, Lock* parent, enum lck_t lock_type, USHORT
|
||||
* at a parent lock.
|
||||
*
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
Firebird::MutexLockGuard guard(parent->lck_mutex);
|
||||
fb_assert(LCK_CHECK_LOCK(parent));
|
||||
|
||||
return lock_query_data(tdbb->getDatabase(), parent->lck_id, lock_type, aggregate);
|
||||
}
|
||||
|
||||
@ -749,7 +767,11 @@ SLONG LCK_read_data(thread_db* tdbb, Lock* lock)
|
||||
* Read the data associated with a lock.
|
||||
*
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
Firebird::MutexLockGuard guard(lock->lck_mutex);
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
|
||||
#ifdef VMS
|
||||
if (!LCK_lock(NULL, lock, LCK_null, LCK_NO_WAIT))
|
||||
return 0;
|
||||
@ -784,8 +806,9 @@ void LCK_release(thread_db* tdbb, Lock* lock)
|
||||
* Release an existing lock.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
Firebird::MutexLockGuard guard(lock->lck_mutex);
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
|
||||
if (lock->lck_physical != LCK_none) {
|
||||
@ -813,8 +836,11 @@ void LCK_re_post(thread_db* tdbb, Lock* lock)
|
||||
* deliver resulted in blockage.
|
||||
*
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
Firebird::MutexLockGuard guard(lock->lck_mutex);
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
|
||||
if (lock->lck_compatible) {
|
||||
if (lock->lck_ast) {
|
||||
(*lock->lck_ast)(lock->lck_object);
|
||||
@ -841,10 +867,14 @@ void LCK_write_data(thread_db* tdbb, Lock* lock, SLONG data)
|
||||
* Write a longword into an existing lock.
|
||||
*
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
Firebird::MutexLockGuard guard(lock->lck_mutex);
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
|
||||
lock_write_data(tdbb->getDatabase(), lock->lck_id, data);
|
||||
lock->lck_data = data;
|
||||
|
||||
fb_assert(LCK_CHECK_LOCK(lock));
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
#ifndef JRD_LCK_H
|
||||
#define JRD_LCK_H
|
||||
|
||||
struct blk;
|
||||
|
||||
namespace Jrd {
|
||||
|
||||
class Database;
|
||||
@ -102,9 +100,9 @@ public:
|
||||
Lock* lck_collision; /* collisions in compatibility table */
|
||||
Lock* lck_identical; /* identical locks in compatibility table */
|
||||
Database* lck_dbb; /* database object is contained in */
|
||||
blk* lck_object; /* argument to be passed to ast */
|
||||
blk* lck_compatible; /* Enter into internal_enqueue() and treat as compatible */
|
||||
blk* lck_compatible2; /* Sub-level for internal compatibility */
|
||||
void* lck_object; /* argument to be passed to ast */
|
||||
void* lck_compatible; /* Enter into internal_enqueue() and treat as compatible */
|
||||
void* lck_compatible2; /* Sub-level for internal compatibility */
|
||||
Attachment* lck_attachment; /* Attachment that owns lock, set only using set_lock_attachment */
|
||||
lock_ast_t lck_ast; /* Blocking AST routine */
|
||||
SLONG lck_id; /* Lock id from lock manager */
|
||||
@ -113,6 +111,7 @@ public:
|
||||
UCHAR lck_logical; /* Logical lock level */
|
||||
UCHAR lck_physical; /* Physical lock level */
|
||||
SLONG lck_data; /* Data associated with a lock */
|
||||
Firebird::Mutex lck_mutex;
|
||||
enum lck_t lck_type;
|
||||
union {
|
||||
UCHAR lck_string[1];
|
||||
|
@ -4259,7 +4259,7 @@ static DSqlCacheItem* get_dsql_cache_item(thread_db* tdbb, int type, const Fireb
|
||||
item->lock->lck_owner_handle = LCK_get_owner_handle(tdbb, item->lock->lck_type);
|
||||
item->lock->lck_parent = dbb->dbb_lock;
|
||||
item->lock->lck_dbb = dbb;
|
||||
item->lock->lck_object = (blk*) item;
|
||||
item->lock->lck_object = item;
|
||||
item->lock->lck_ast = blocking_ast_dsql_cache;
|
||||
item->lock->lck_length = key.length();
|
||||
memcpy(item->lock->lck_key.lck_string, key.c_str(), key.length());
|
||||
|
@ -29,7 +29,6 @@
|
||||
#ifndef JRD_PIO_H
|
||||
#define JRD_PIO_H
|
||||
|
||||
#include "../jrd/jrd_blks.h"
|
||||
#include "../include/fb_blk.h"
|
||||
#include "../jrd/thread_proto.h"
|
||||
#include "../common/classes/rwlock.h"
|
||||
|
@ -33,7 +33,6 @@ namespace Jrd {
|
||||
}
|
||||
|
||||
struct Ods::pag;
|
||||
struct blk;
|
||||
|
||||
int PIO_add_file(Jrd::Database*, Jrd::jrd_file*, const Firebird::PathName&, SLONG);
|
||||
void PIO_close(Jrd::jrd_file*);
|
||||
|
@ -994,7 +994,7 @@ static jrd_file* setup_file(Database* dbb, const Firebird::PathName& file_name,
|
||||
dbb->dbb_lock = lock;
|
||||
lock->lck_type = LCK_database;
|
||||
lock->lck_owner_handle = LCK_get_owner_handle(NULL, lock->lck_type);
|
||||
lock->lck_object = reinterpret_cast<blk*>(dbb);
|
||||
lock->lck_object = dbb;
|
||||
lock->lck_length = l;
|
||||
lock->lck_dbb = dbb;
|
||||
lock->lck_ast = CCH_down_grade_dbb;
|
||||
|
@ -1106,7 +1106,7 @@ static jrd_file* setup_file(Database* dbb,
|
||||
dbb->dbb_lock = lock;
|
||||
lock->lck_type = LCK_database;
|
||||
lock->lck_owner_handle = LCK_get_owner_handle(NULL, lock->lck_type);
|
||||
lock->lck_object = reinterpret_cast<blk*>(dbb);
|
||||
lock->lck_object = dbb;
|
||||
lock->lck_length = l;
|
||||
lock->lck_dbb = dbb;
|
||||
lock->lck_ast = CCH_down_grade_dbb;
|
||||
|
@ -34,7 +34,6 @@
|
||||
#ifndef JRD_PAG_H
|
||||
#define JRD_PAG_H
|
||||
|
||||
#include "../jrd/jrd_blks.h"
|
||||
#include "../include/fb_blk.h"
|
||||
#include "../common/classes/array.h"
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
#ifndef JRD_REQ_H
|
||||
#define JRD_REQ_H
|
||||
|
||||
#include "../jrd/jrd_blks.h"
|
||||
#include "../include/fb_blk.h"
|
||||
|
||||
#include "../jrd/exe.h"
|
||||
|
@ -28,7 +28,6 @@
|
||||
|
||||
// This is really funny: class rse is not defined here but in exe.h!!!
|
||||
|
||||
#include "../jrd/jrd_blks.h"
|
||||
#include "../include/fb_blk.h"
|
||||
|
||||
#include "../common/classes/array.h"
|
||||
|
@ -596,7 +596,7 @@ void SDW_init(bool activate, bool delete_files)
|
||||
lock->lck_parent = dbb->dbb_lock;
|
||||
lock->lck_length = key_length;
|
||||
lock->lck_dbb = dbb;
|
||||
lock->lck_object = reinterpret_cast<blk*>(dbb);
|
||||
lock->lck_object = dbb;
|
||||
lock->lck_ast = blocking_ast_shadowing;
|
||||
|
||||
if (activate)
|
||||
|
@ -24,7 +24,6 @@
|
||||
#ifndef JRD_SDW_H
|
||||
#define JRD_SDW_H
|
||||
|
||||
#include "../jrd/jrd_blks.h"
|
||||
#include "../include/fb_blk.h"
|
||||
|
||||
namespace Jrd {
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "../jrd/common.h"
|
||||
#include "../jrd/fil.h"
|
||||
|
||||
#include "../jrd/jrd_blks.h"
|
||||
#include "../include/fb_blk.h"
|
||||
#include "../jrd/TempSpace.h"
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "../jrd/isc.h"
|
||||
#include "../jrd/svc_undoc.h"
|
||||
#include "../jrd/ThreadStart.h"
|
||||
#include "../jrd/jrd_blks.h"
|
||||
|
||||
#include "../common/classes/semaphore.h"
|
||||
#include "../common/classes/array.h"
|
||||
@ -90,7 +89,7 @@ const int SVC_cmd_line = 128;
|
||||
class thread_db;
|
||||
|
||||
// Service manager
|
||||
class Service : public Firebird::UtilSvc, public LocalType<type_svc>
|
||||
class Service : public Firebird::UtilSvc, public EngineType<type_svc>
|
||||
{
|
||||
public: // utilities interface with service
|
||||
// printf() to svc_stdout
|
||||
|
@ -91,6 +91,7 @@ static SLONG bump_transaction_id(thread_db*, WIN *);
|
||||
#else
|
||||
static header_page* bump_transaction_id(thread_db*, WIN *);
|
||||
#endif
|
||||
static Lock* create_transaction_lock(thread_db* tdbb, void* object);
|
||||
static void retain_context(thread_db*, jrd_tra*, bool, SSHORT);
|
||||
#ifdef VMS
|
||||
static void compute_oldest_retaining(thread_db*, jrd_tra*, bool);
|
||||
@ -1772,34 +1773,6 @@ bool TRA_sweep(thread_db* tdbb, jrd_tra* trans)
|
||||
}
|
||||
|
||||
|
||||
Lock* TRA_transaction_lock(thread_db* tdbb, BLK object)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* T R A _ t r a n s a c t i o n _ l o c k
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Allocate a transaction lock block.
|
||||
*
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
Lock* lock = FB_NEW_RPT(*tdbb->getDefaultPool(), sizeof(SLONG)) Lock();
|
||||
lock->lck_type = LCK_tra;
|
||||
lock->lck_owner_handle = LCK_get_owner_handle(tdbb, lock->lck_type);
|
||||
lock->lck_length = sizeof(SLONG);
|
||||
|
||||
lock->lck_dbb = dbb;
|
||||
lock->lck_parent = dbb->dbb_lock;
|
||||
lock->lck_object = object;
|
||||
|
||||
return lock;
|
||||
}
|
||||
|
||||
|
||||
int TRA_wait(thread_db* tdbb, jrd_tra* trans, SLONG number, jrd_tra::wait_t wait)
|
||||
{
|
||||
/**************************************
|
||||
@ -2028,6 +2001,34 @@ static header_page* bump_transaction_id(thread_db* tdbb, WIN * window)
|
||||
#endif
|
||||
|
||||
|
||||
static Lock* create_transaction_lock(thread_db* tdbb, void* object)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* c r e a t e _ t r a n s a c t i o n _ l o c k
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Allocate a transaction lock block.
|
||||
*
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
Lock* lock = FB_NEW_RPT(*tdbb->getDefaultPool(), sizeof(SLONG)) Lock();
|
||||
lock->lck_type = LCK_tra;
|
||||
lock->lck_owner_handle = LCK_get_owner_handle(tdbb, lock->lck_type);
|
||||
lock->lck_length = sizeof(SLONG);
|
||||
|
||||
lock->lck_dbb = dbb;
|
||||
lock->lck_parent = dbb->dbb_lock;
|
||||
lock->lck_object = object;
|
||||
|
||||
return lock;
|
||||
}
|
||||
|
||||
|
||||
#ifdef VMS
|
||||
static void compute_oldest_retaining(
|
||||
thread_db* tdbb,
|
||||
@ -2063,7 +2064,7 @@ static void compute_oldest_retaining(
|
||||
lock->lck_owner_handle = LCK_get_owner_handle(tdbb, lock->lck_type);
|
||||
lock->lck_parent = dbb->dbb_lock;
|
||||
lock->lck_length = sizeof(SLONG);
|
||||
lock->lck_object = reinterpret_cast<blk*>(dbb);
|
||||
lock->lck_object = dbb;
|
||||
LCK_lock(tdbb, lock, LCK_SR, LCK_WAIT);
|
||||
dbb->dbb_retaining_lock = lock;
|
||||
}
|
||||
@ -2500,8 +2501,7 @@ static void retain_context(thread_db* tdbb, jrd_tra* transaction,
|
||||
Lock* new_lock = 0;
|
||||
Lock* old_lock = transaction->tra_lock;
|
||||
if (old_lock) {
|
||||
new_lock =
|
||||
TRA_transaction_lock(tdbb, transaction);
|
||||
new_lock = create_transaction_lock(tdbb, transaction);
|
||||
new_lock->lck_key.lck_long = new_number;
|
||||
new_lock->lck_data = transaction->tra_lock->lck_data;
|
||||
|
||||
@ -3151,7 +3151,7 @@ static jrd_tra* transaction_start(thread_db* tdbb, jrd_tra* temp)
|
||||
Attachment* attachment = tdbb->getAttachment();
|
||||
WIN window(DB_PAGE_SPACE, -1);
|
||||
|
||||
Lock* lock = TRA_transaction_lock(tdbb, temp);
|
||||
Lock* lock = create_transaction_lock(tdbb, temp);
|
||||
|
||||
/* Read header page and allocate transaction number. Since
|
||||
the transaction inventory page was initialized to zero, it
|
||||
|
@ -32,7 +32,6 @@
|
||||
* to define the types this header uses.
|
||||
*/
|
||||
|
||||
#include "../jrd/jrd_blks.h"
|
||||
#include "../include/fb_blk.h"
|
||||
#include "../common/classes/tree.h"
|
||||
#include "../common/classes/GenericMap.h"
|
||||
|
@ -31,8 +31,6 @@ namespace Jrd {
|
||||
class Database;
|
||||
}
|
||||
|
||||
struct blk;
|
||||
|
||||
bool TRA_active_transactions(Jrd::thread_db*, Jrd::Database*);
|
||||
void TRA_cleanup(Jrd::thread_db*);
|
||||
void TRA_commit(Jrd::thread_db*, Jrd::jrd_tra*, const bool);
|
||||
@ -61,7 +59,6 @@ Jrd::jrd_tra* TRA_start(Jrd::thread_db*, ULONG flags, SSHORT lock_timeout);
|
||||
Jrd::jrd_tra* TRA_start(Jrd::thread_db*, int, const UCHAR*);
|
||||
int TRA_state(const UCHAR*, ULONG, ULONG);
|
||||
bool TRA_sweep(Jrd::thread_db*, Jrd::jrd_tra*);
|
||||
Jrd::Lock* TRA_transaction_lock(Jrd::thread_db*, blk*);
|
||||
int TRA_wait(Jrd::thread_db*, Jrd::jrd_tra*, SLONG, Jrd::jrd_tra::wait_t);
|
||||
void TRA_attach_request(Jrd::jrd_tra* transaction, Jrd::jrd_req* request);
|
||||
void TRA_detach_request(Jrd::jrd_req* request);
|
||||
|
@ -29,7 +29,6 @@
|
||||
#ifndef JRD_VAL_H
|
||||
#define JRD_VAL_H
|
||||
|
||||
#include "../jrd/jrd_blks.h"
|
||||
#include "../include/fb_blk.h"
|
||||
#include "../common/classes/array.h"
|
||||
#include "../common/classes/MetaName.h"
|
||||
|
Loading…
Reference in New Issue
Block a user