mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 15:23:02 +01:00
added (and used in sources) template to change and restore default pool
This commit is contained in:
parent
370ddae086
commit
c3db4aaa97
@ -24,7 +24,7 @@
|
||||
//
|
||||
//____________________________________________________________
|
||||
//
|
||||
// $Id: alice.cpp,v 1.69 2004-08-16 12:28:13 alexpeshkoff Exp $
|
||||
// $Id: alice.cpp,v 1.70 2004-08-30 18:10:28 alexpeshkoff Exp $
|
||||
//
|
||||
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
// conditionals, as the engine now fully supports
|
||||
@ -193,19 +193,20 @@ int common_main(int argc,
|
||||
fAnsiCP = (GetConsoleCP() == GetACP());
|
||||
#endif
|
||||
|
||||
AliceGlobals* tdgbl = (AliceGlobals*) gds__alloc(sizeof(AliceGlobals));
|
||||
if (!tdgbl) {
|
||||
// NOMEM: return error, FREE: during function exit in the SETJMP
|
||||
AliceGlobals* tdgbl = 0;
|
||||
try
|
||||
{
|
||||
// FREE: during function exit in catch
|
||||
tdgbl = FB_NEW(*getDefaultMemoryPool())
|
||||
AliceGlobals(*getDefaultMemoryPool(), output_proc, output_data);
|
||||
}
|
||||
catch (std::bad_alloc)
|
||||
{
|
||||
// NOMEM: return error, FREE: during function exit in catch
|
||||
return FINI_ERROR;
|
||||
}
|
||||
|
||||
AliceGlobals::putSpecific(tdgbl);
|
||||
// SVC_PUTSPECIFIC_DATA;
|
||||
memset((void *) tdgbl, 0, sizeof(AliceGlobals));
|
||||
tdgbl->output_proc = output_proc;
|
||||
tdgbl->output_data = output_data;
|
||||
tdgbl->ALICE_permanent_pool = NULL;
|
||||
tdgbl->setDefaultPool(0);
|
||||
|
||||
try {
|
||||
|
||||
@ -630,12 +631,9 @@ int common_main(int argc,
|
||||
tdgbl->output_file = NULL;
|
||||
}
|
||||
|
||||
// Free all unfreed memory used by Gfix itself
|
||||
ALLA_fini();
|
||||
|
||||
AliceGlobals::restoreSpecific();
|
||||
|
||||
gds__free(tdgbl);
|
||||
delete tdgbl;
|
||||
|
||||
#if defined(DEBUG_GDS_ALLOC) && !defined(SUPERSERVER)
|
||||
gds_alloc_report(0, __FILE__, __LINE__);
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "../alice/all.h"
|
||||
#include "../include/fb_blk.h"
|
||||
#include "../common/classes/alloc.h"
|
||||
#include "../common/classes/array.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -133,23 +134,6 @@ enum tdr_state_vals {
|
||||
};
|
||||
|
||||
|
||||
// a couple of obscure blocks used only in data allocator routines
|
||||
|
||||
//class alice_vec : public pool_alloc_rpt<blk*, alice_type_vec>
|
||||
//{
|
||||
//public:
|
||||
// ULONG vec_count;
|
||||
// blk *vec_object[1];
|
||||
//};
|
||||
//typedef alice_vec* VEC;
|
||||
|
||||
//class alice_vcl : public pool_alloc_rpt<SLONG, alice_type_vcl>
|
||||
//{
|
||||
// ULONG vcl_count;
|
||||
// SLONG vcl_long[1];
|
||||
//};
|
||||
//typedef alice_vcl* VCL;
|
||||
|
||||
// Global switches and data
|
||||
|
||||
#include "../jrd/svc.h"
|
||||
@ -166,19 +150,29 @@ class AliceGlobals;
|
||||
extern AliceGlobals* gdgbl;
|
||||
#endif
|
||||
|
||||
class AliceGlobals : public thdd
|
||||
class AliceGlobals : public ThreadData
|
||||
{
|
||||
private:
|
||||
AliceMemoryPool* ALICE_default_pool;
|
||||
friend class Firebird::SubsystemContextPoolHolder <AliceGlobals, AliceMemoryPool>;
|
||||
|
||||
public:
|
||||
AliceGlobals(AliceMemoryPool* p) : pools(0, (AliceMemoryPool*)0,
|
||||
pool_vec_t::allocator_type(*p)) {}
|
||||
void setDefaultPool(AliceMemoryPool* p)
|
||||
{
|
||||
thdd::setPool(p);
|
||||
ALICE_default_pool = p;
|
||||
}
|
||||
|
||||
public:
|
||||
AliceGlobals(MemoryPool& p, Jrd::pfn_svc_output outProc, Jrd::Service* outData)
|
||||
: ThreadData(ThreadData::tddALICE), pools(p),
|
||||
output_proc(outProc), output_data(outData),
|
||||
ALICE_permanent_pool(0), ALICE_default_pool(0)
|
||||
{
|
||||
}
|
||||
~AliceGlobals()
|
||||
{
|
||||
subsystemCleanup();
|
||||
}
|
||||
|
||||
AliceMemoryPool* getDefaultPool()
|
||||
{
|
||||
return ALICE_default_pool;
|
||||
@ -187,8 +181,8 @@ public:
|
||||
user_action ALICE_data;
|
||||
AliceMemoryPool* ALICE_permanent_pool;
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
typedef std::vector<AliceMemoryPool*, Firebird::allocator<AliceMemoryPool*> > pool_vec_t;
|
||||
pool_vec_t pools;
|
||||
typedef Firebird::HalfStaticArray<AliceMemoryPool*, 4> PoolsArray;
|
||||
PoolsArray pools;
|
||||
int exit_code;
|
||||
Jrd::pfn_svc_output output_proc;
|
||||
Jrd::Service* output_data;
|
||||
@ -203,14 +197,13 @@ public:
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
static inline AliceGlobals* getSpecific() {
|
||||
return (AliceGlobals*) thdd::getSpecific();
|
||||
return (AliceGlobals*) ThreadData::getSpecific();
|
||||
}
|
||||
static inline void putSpecific(AliceGlobals* tdgbl) {
|
||||
tdgbl->thdd_type = THDD_TYPE_TALICE;
|
||||
((thdd*)tdgbl)->putSpecific();
|
||||
tdgbl->ThreadData::putSpecific();
|
||||
}
|
||||
static inline void restoreSpecific() {
|
||||
thdd::restoreSpecific();
|
||||
ThreadData::restoreSpecific();
|
||||
}
|
||||
#else
|
||||
static inline AliceGlobals* getSpecific() {
|
||||
@ -218,13 +211,28 @@ public:
|
||||
}
|
||||
static inline void putSpecific(AliceGlobals* tdgbl) {
|
||||
gdgbl = tdgbl;
|
||||
tdgbl->thdd_type = THDD_TYPE_TALICE;
|
||||
}
|
||||
static inline void restoreSpecific() {
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
// Perform AliceGlobals cleanup
|
||||
void subsystemCleanup(void)
|
||||
{
|
||||
for (int i = 0; i < pools.getCount(); ++i)
|
||||
{
|
||||
AliceMemoryPool::deletePool(pools[i]);
|
||||
pools[i] = 0;
|
||||
}
|
||||
pools.clear();
|
||||
setDefaultPool(0);
|
||||
ALICE_permanent_pool = 0;
|
||||
}
|
||||
};
|
||||
|
||||
typedef Firebird::SubsystemContextPoolHolder <AliceGlobals, AliceMemoryPool>
|
||||
AliceContextPoolHolder;
|
||||
|
||||
#endif // ALICE_ALICE_H
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
//
|
||||
//____________________________________________________________
|
||||
//
|
||||
// $Id: all.cpp,v 1.27 2004-08-16 12:28:13 alexpeshkoff Exp $
|
||||
// $Id: all.cpp,v 1.28 2004-08-30 18:10:28 alexpeshkoff Exp $
|
||||
//
|
||||
|
||||
#include "firebird.h"
|
||||
@ -35,48 +35,6 @@
|
||||
#include "../common/classes/alloc.h"
|
||||
|
||||
|
||||
//____________________________________________________________
|
||||
//
|
||||
// Get rid of everything.
|
||||
//
|
||||
|
||||
void ALLA_fini(void)
|
||||
{
|
||||
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
|
||||
|
||||
for (AliceGlobals::pool_vec_t::iterator curr = tdgbl->pools.begin();
|
||||
curr != tdgbl->pools.end(); ++curr)
|
||||
{
|
||||
AliceMemoryPool::deletePool(*curr);
|
||||
*curr = 0;
|
||||
}
|
||||
tdgbl->pools.clear();
|
||||
|
||||
tdgbl->setDefaultPool(0);
|
||||
tdgbl->ALICE_permanent_pool = 0;
|
||||
}
|
||||
|
||||
|
||||
//____________________________________________________________
|
||||
//
|
||||
// Initialize the pool system.
|
||||
//
|
||||
|
||||
void ALLA_init(void)
|
||||
{
|
||||
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
|
||||
#ifdef NOT_USED_OR_REPLACED
|
||||
tdgbl->ALICE_default_pool = tdgbl->ALICE_permanent_pool =
|
||||
AliceMemoryPool::create_new_pool();
|
||||
#else
|
||||
// TMN: John, what pool to use here?
|
||||
tdgbl->ALICE_permanent_pool = AliceMemoryPool::createPool();
|
||||
tdgbl->setDefaultPool(tdgbl->ALICE_permanent_pool);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef NOT_USED_OR_REPLACED
|
||||
void AliceMemoryPool::ALLA_push(blk* object, alice_lls** stack)
|
||||
{
|
||||
@ -165,22 +123,25 @@ AliceMemoryPool* AliceMemoryPool::create_new_pool(MemoryPool* parent)
|
||||
//BUGCHECK ("ALLA_fini - finishing before starting");
|
||||
return 0;//pool; // Never reached, but makes the compiler happy.
|
||||
}
|
||||
#endif
|
||||
#endif //NOT_USED_OR_REPLACED
|
||||
|
||||
AliceMemoryPool* AliceMemoryPool::createPool() {
|
||||
AliceMemoryPool* result = (AliceMemoryPool*)internal_create(sizeof(AliceMemoryPool));
|
||||
AliceGlobals::getSpecific()->pools.add(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void AliceMemoryPool::deletePool(AliceMemoryPool* pool)
|
||||
{
|
||||
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
|
||||
|
||||
AliceGlobals::pool_vec_t::iterator curr;
|
||||
for (curr = tdgbl->pools.begin(); curr != tdgbl->pools.end(); ++curr)
|
||||
for (int i = 0; i < tdgbl->pools.getCount(); ++i)
|
||||
{
|
||||
if (*curr == pool)
|
||||
if (tdgbl->pools[i] == pool)
|
||||
{
|
||||
*curr = 0;
|
||||
tdgbl->pools.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// pool->lls_cache.~BlockCache<alice_lls>();
|
||||
MemoryPool::deletePool(pool);
|
||||
}
|
||||
|
||||
|
@ -25,34 +25,16 @@
|
||||
#define ALICE_ALL_H
|
||||
|
||||
#include "../jrd/block_cache.h"
|
||||
#include "../alice/lls.h"
|
||||
|
||||
struct blk;
|
||||
|
||||
class AliceMemoryPool : public MemoryPool
|
||||
{
|
||||
protected:
|
||||
// Dummy constructor and destructor. Should never be called
|
||||
AliceMemoryPool() : MemoryPool(NULL, default_stats_group, NULL, NULL)/*, lls_cache(*this)*/ {}
|
||||
AliceMemoryPool() : MemoryPool(NULL, default_stats_group, NULL, NULL) {}
|
||||
~AliceMemoryPool() {}
|
||||
public:
|
||||
static AliceMemoryPool *createPool() {
|
||||
AliceMemoryPool *result = (AliceMemoryPool *)internal_create(sizeof(AliceMemoryPool));
|
||||
//new (&result->lls_cache) BlockCache<alice_lls> (*result);
|
||||
return result;
|
||||
}
|
||||
static AliceMemoryPool* createPool();
|
||||
static void deletePool(AliceMemoryPool* pool);
|
||||
// static AliceMemoryPool *create_new_pool(MemoryPool* = 0);
|
||||
// AliceMemoryPool(MemoryPool* p = 0)
|
||||
// : MemoryPool(0, p),
|
||||
// lls_cache(*this)
|
||||
// {}
|
||||
|
||||
// static blk* ALLA_pop(alice_lls**);
|
||||
// static void ALLA_push(blk*, alice_lls**);
|
||||
|
||||
//private:
|
||||
// BlockCache<alice_lls> lls_cache; // Was plb_lls
|
||||
};
|
||||
|
||||
#endif // ALICE_ALL_H
|
||||
|
@ -24,8 +24,5 @@
|
||||
#ifndef ALICE_ALL_PROTO_H
|
||||
#define ALICE_ALL_PROTO_H
|
||||
|
||||
void ALLA_init(); // initialize pool system
|
||||
void ALLA_fini(); // get rid of everything
|
||||
|
||||
#endif // ALICE_ALL_PROTO_H
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
//
|
||||
//____________________________________________________________
|
||||
//
|
||||
// $Id: exe.cpp,v 1.36 2004-07-02 10:02:46 brodsom Exp $
|
||||
// $Id: exe.cpp,v 1.37 2004-08-30 18:10:28 alexpeshkoff Exp $
|
||||
//
|
||||
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
// conditionals, as the engine now fully supports
|
||||
@ -85,8 +85,7 @@ int EXE_action(const TEXT* database, const ULONG switches)
|
||||
{
|
||||
UCHAR dpb[128];
|
||||
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
|
||||
|
||||
ALLA_init();
|
||||
AliceContextPoolHolder context(tdgbl, AliceMemoryPool::createPool());
|
||||
|
||||
for (USHORT i = 0; i < MAX_VAL_ERRORS; i++)
|
||||
tdgbl->ALICE_data.ua_val_errors[i] = 0;
|
||||
@ -130,8 +129,6 @@ int EXE_action(const TEXT* database, const ULONG switches)
|
||||
isc_detach_database(tdgbl->status, &handle);
|
||||
}
|
||||
|
||||
ALLA_fini();
|
||||
|
||||
return ((error) ? FINI_ERROR : FINI_OK);
|
||||
}
|
||||
|
||||
@ -144,8 +141,7 @@ int EXE_two_phase(const TEXT* database, const ULONG switches)
|
||||
{
|
||||
UCHAR dpb[128];
|
||||
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
|
||||
|
||||
ALLA_init();
|
||||
AliceContextPoolHolder context(tdgbl, AliceMemoryPool::createPool());
|
||||
|
||||
for (USHORT i = 0; i < MAX_VAL_ERRORS; i++)
|
||||
tdgbl->ALICE_data.ua_val_errors[i] = 0;
|
||||
@ -174,8 +170,6 @@ int EXE_two_phase(const TEXT* database, const ULONG switches)
|
||||
if (handle)
|
||||
isc_detach_database(tdgbl->status, &handle);
|
||||
|
||||
ALLA_fini();
|
||||
|
||||
return ((error) ? FINI_ERROR : FINI_OK);
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,6 @@ static int api_gbak(int argc,
|
||||
BurpGlobals ldgbl;
|
||||
BurpGlobals* tdgbl = &ldgbl;
|
||||
BurpGlobals::putSpecific(tdgbl);
|
||||
memset((void *) tdgbl, 0, sizeof(BurpGlobals));
|
||||
tdgbl->output_proc = output_main;
|
||||
|
||||
const TEXT* usr;
|
||||
@ -582,18 +581,10 @@ int common_main(int argc,
|
||||
//BurpGlobals thd_context;
|
||||
|
||||
gbak_action action = QUIT;
|
||||
BurpGlobals *tdgbl = (BurpGlobals*) gds__alloc(sizeof(BurpGlobals));
|
||||
// NOMEM: return error, FREE: during function exit in the SETJMP
|
||||
if (tdgbl == NULL)
|
||||
{
|
||||
Jrd::Service* service = (Jrd::Service*) output_data;
|
||||
service->svc_started();
|
||||
return FINI_ERROR;
|
||||
}
|
||||
BurpGlobals sgbl;
|
||||
BurpGlobals *tdgbl = &sgbl;
|
||||
|
||||
BurpGlobals::putSpecific(tdgbl);
|
||||
// SVC_PUTSPECIFIC_DATA;
|
||||
memset((void *) tdgbl, 0, sizeof(BurpGlobals));
|
||||
tdgbl->burp_env = reinterpret_cast<UCHAR*>(env);
|
||||
tdgbl->file_desc = INVALID_HANDLE_VALUE;
|
||||
tdgbl->output_proc = output_proc;
|
||||
@ -1211,9 +1202,6 @@ int common_main(int argc,
|
||||
}
|
||||
|
||||
BurpGlobals::restoreSpecific();
|
||||
if (tdgbl != NULL) {
|
||||
gds__free(tdgbl);
|
||||
}
|
||||
|
||||
#if defined(DEBUG_GDS_ALLOC) && !defined(SUPERSERVER)
|
||||
gds_alloc_report(0, __FILE__, __LINE__);
|
||||
|
@ -767,9 +767,17 @@ class BurpGlobals;
|
||||
extern BurpGlobals* gdgbl;
|
||||
#endif
|
||||
|
||||
class BurpGlobals : public thdd
|
||||
class BurpGlobals : public ThreadData
|
||||
{
|
||||
public:
|
||||
BurpGlobals() : ThreadData(ThreadData::tddGBL)
|
||||
{
|
||||
// this is VERY dirty hack to keep current behaviour
|
||||
memset (&gbl_database_file_name, 0,
|
||||
reinterpret_cast<char*>(&veryEnd) -
|
||||
reinterpret_cast<char*>(&gbl_database_file_name));
|
||||
}
|
||||
|
||||
const TEXT* gbl_database_file_name;
|
||||
TEXT gbl_backup_start_time[30];
|
||||
bool gbl_sw_verbose;
|
||||
@ -897,14 +905,13 @@ public:
|
||||
TEXT database_security_class[GDS_NAME_LEN]; // To save database security class for deferred update
|
||||
#ifdef SUPERSERVER
|
||||
static inline BurpGlobals* getSpecific() {
|
||||
return (BurpGlobals*) thdd::getSpecific();
|
||||
return (BurpGlobals*) ThreadData::getSpecific();
|
||||
}
|
||||
static inline void putSpecific(BurpGlobals* tdgbl) {
|
||||
tdgbl->thdd_type = THDD_TYPE_TGBL;
|
||||
((thdd*)tdgbl)->putSpecific();
|
||||
tdgbl->ThreadData::putSpecific();
|
||||
}
|
||||
static inline void restoreSpecific() {
|
||||
thdd::restoreSpecific();
|
||||
ThreadData::restoreSpecific();
|
||||
}
|
||||
#else
|
||||
static inline BurpGlobals* getSpecific() {
|
||||
@ -912,11 +919,12 @@ public:
|
||||
}
|
||||
static inline void putSpecific(BurpGlobals* tdgbl) {
|
||||
gdgbl = tdgbl;
|
||||
tdgbl->thdd_type = THDD_TYPE_TGBL;
|
||||
}
|
||||
static inline void restoreSpecific() {
|
||||
}
|
||||
#endif
|
||||
|
||||
char veryEnd;
|
||||
};
|
||||
|
||||
// CVC: This aux routine declared here to not force inclusion of burp.h with burp_proto.h
|
||||
|
@ -29,7 +29,7 @@
|
||||
* Alex Peshkoff <peshkoff@mail.ru>
|
||||
* added PermanentStorage and AutoStorage classes.
|
||||
*
|
||||
* $Id: alloc.h,v 1.49 2004-08-28 05:15:02 skidder Exp $
|
||||
* $Id: alloc.h,v 1.50 2004-08-30 18:10:49 alexpeshkoff Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -396,6 +396,32 @@ private:
|
||||
MemoryPool* savedPool;
|
||||
};
|
||||
|
||||
// template enbaling common use of old and new pools control code
|
||||
// to be dropped when old-style code goes away
|
||||
template <typename SubsystemThreadData, typename SubsystemPool>
|
||||
class SubsystemContextPoolHolder
|
||||
: public ContextPoolHolder
|
||||
{
|
||||
public:
|
||||
SubsystemContextPoolHolder <SubsystemThreadData, SubsystemPool>
|
||||
(
|
||||
SubsystemThreadData* subThreadData,
|
||||
SubsystemPool* newPool
|
||||
)
|
||||
: ContextPoolHolder(newPool),
|
||||
savedThreadData(subThreadData),
|
||||
savedPool(savedThreadData->getDefaultPool())
|
||||
{
|
||||
savedThreadData->setDefaultPool(newPool);
|
||||
}
|
||||
~SubsystemContextPoolHolder() {
|
||||
savedThreadData->setDefaultPool(savedPool);
|
||||
}
|
||||
private:
|
||||
SubsystemThreadData* savedThreadData;
|
||||
SubsystemPool* savedPool;
|
||||
};
|
||||
|
||||
} // namespace Firebird
|
||||
|
||||
using Firebird::MemoryPool;
|
||||
|
@ -48,11 +48,9 @@
|
||||
// it's better to exit with appropriate diags rather continue
|
||||
// with missing / wrong configuration.
|
||||
#if (! defined(BOOT_BUILD)) && (! defined(EMBEDDED)) && (! defined(SUPERCLIENT))
|
||||
#define EXIT_ON_NO_CONF
|
||||
#define INFORM_ON_NO_CONF
|
||||
#define EXCEPTION_ON_NO_CONF
|
||||
#else
|
||||
#undef EXIT_ON_NO_CONF
|
||||
#undef INFORM_ON_NO_CONF
|
||||
#undef EXCEPTION_ON_NO_CONF
|
||||
#endif
|
||||
|
||||
// config_file works with OS case-sensitivity
|
||||
@ -180,21 +178,21 @@ void ConfigFile::loadConfig()
|
||||
|
||||
Firebird::AutoPtr<FILE, FileClose> ifile(fopen(configFile.c_str(), "rt"));
|
||||
|
||||
#ifdef EXIT_ON_NO_CONF
|
||||
#ifdef EXCEPTION_ON_NO_CONF
|
||||
int BadLinesCount = 0;
|
||||
#endif
|
||||
if (!ifile)
|
||||
{
|
||||
// config file does not exist
|
||||
#ifdef EXIT_ON_NO_CONF
|
||||
if (fExitOnError)
|
||||
#ifdef EXCEPTION_ON_NO_CONF
|
||||
if (fExceptionOnError)
|
||||
{
|
||||
Firebird::string Msg = "Missing configuration file: " +
|
||||
configFile.ToString() + ", exiting";
|
||||
Firebird::Syslog::Record(Firebird::Syslog::Error, Msg);
|
||||
Firebird::fatal_exception::raise(Msg.c_str());
|
||||
}
|
||||
#endif //EXIT_ON_NO_CONF
|
||||
#endif //EXCEPTION_ON_NO_CONF
|
||||
return;
|
||||
}
|
||||
string inputLine;
|
||||
@ -215,10 +213,10 @@ void ConfigFile::loadConfig()
|
||||
{
|
||||
Firebird::string Msg = (configFile + ": illegal line \"" +
|
||||
inputLine + "\"").ToString();
|
||||
Firebird::Syslog::Record(fExitOnError ?
|
||||
Firebird::Syslog::Record(fExceptionOnError ?
|
||||
Firebird::Syslog::Error :
|
||||
Firebird::Syslog::Warning, Msg);
|
||||
#ifdef EXIT_ON_NO_CONF
|
||||
#ifdef EXCEPTION_ON_NO_CONF
|
||||
BadLinesCount++;
|
||||
#endif
|
||||
continue;
|
||||
@ -233,8 +231,8 @@ void ConfigFile::loadConfig()
|
||||
|
||||
parameters.add(Parameter(getPool(), key, value));
|
||||
}
|
||||
#ifdef EXIT_ON_NO_CONF
|
||||
if (BadLinesCount && fExitOnError)
|
||||
#ifdef EXCEPTION_ON_NO_CONF
|
||||
if (BadLinesCount && fExceptionOnError)
|
||||
{
|
||||
Firebird::fatal_exception::raise("Bad lines in firebird.conf");
|
||||
}
|
||||
|
@ -67,12 +67,12 @@ class ConfigFile : public Firebird::AutoStorage
|
||||
string, Firebird::FirstObjectKey<Parameter> > mymap_t;
|
||||
|
||||
public:
|
||||
ConfigFile(MemoryPool& p, bool ExitOnError)
|
||||
ConfigFile(MemoryPool& p, bool ExceptionOnError)
|
||||
: AutoStorage(p), isLoadedFlg(false),
|
||||
fExitOnError(ExitOnError), parameters(getPool()) {}
|
||||
explicit ConfigFile(bool ExitOnError)
|
||||
fExceptionOnError(ExceptionOnError), parameters(getPool()) {}
|
||||
explicit ConfigFile(bool ExceptionOnError)
|
||||
: AutoStorage(), isLoadedFlg(false),
|
||||
fExitOnError(ExitOnError), parameters(getPool()) {}
|
||||
fExceptionOnError(ExceptionOnError), parameters(getPool()) {}
|
||||
|
||||
// configuration file management
|
||||
const string getConfigFile() { return configFile; }
|
||||
@ -95,7 +95,7 @@ public:
|
||||
private:
|
||||
string configFile;
|
||||
bool isLoadedFlg;
|
||||
bool fExitOnError;
|
||||
bool fExceptionOnError;
|
||||
mymap_t parameters;
|
||||
};
|
||||
|
||||
|
@ -105,40 +105,15 @@ void ALLD_init()
|
||||
DSQL_permanent_pool = DsqlMemoryPool::createPool();
|
||||
pools = FB_NEW(*DSQL_permanent_pool) Firebird::vector<DsqlMemoryPool*>
|
||||
(10, *DSQL_permanent_pool, dsql_type_vec);
|
||||
tdsql->setDefaultPool(DSQL_permanent_pool);
|
||||
// I don't catch why this happens only for !init_flag. Alex.
|
||||
// tdsql->setDefaultPool(DSQL_permanent_pool);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NOT_USED_OR_REPLACED
|
||||
void DsqlMemoryPool::ALLD_push(BLK object, dsql_lls** stack)
|
||||
{
|
||||
tsql* tdsql = DSQL_get_thread_data();
|
||||
DsqlMemoryPool* pool = tdsql->getDefaultPool();
|
||||
|
||||
dsql_lls* node = pool->lls_cache.newBlock();
|
||||
node->lls_object = object;
|
||||
node->lls_next = *stack;
|
||||
*stack = node;
|
||||
}
|
||||
|
||||
|
||||
BLK DsqlMemoryPool::ALLD_pop(dsql_lls* *stack)
|
||||
{
|
||||
dsql_lls* node = *stack;
|
||||
*stack = node->lls_next;
|
||||
BLK object = node->lls_object;
|
||||
|
||||
DsqlMemoryPool* pool = (DsqlMemoryPool*)MemoryPool::blk_pool(node);
|
||||
pool->lls_cache.returnBlock(node);
|
||||
|
||||
return object;
|
||||
}
|
||||
#endif //NOT_USED_OR_REPLACED
|
||||
|
||||
DsqlMemoryPool* DsqlMemoryPool::createPool()
|
||||
{
|
||||
DsqlMemoryPool* result = (DsqlMemoryPool*)internal_create(sizeof(DsqlMemoryPool));
|
||||
// new (&result->lls_cache) BlockCache<class dsql_lls> (*result);
|
||||
|
||||
if (!DSQL_permanent_pool)
|
||||
return result;
|
||||
@ -168,7 +143,6 @@ DsqlMemoryPool* DsqlMemoryPool::createPool()
|
||||
|
||||
void DsqlMemoryPool::deletePool(DsqlMemoryPool* pool)
|
||||
{
|
||||
// pool->lls_cache.~BlockCache<class dsql_lls>();
|
||||
MemoryPool::deletePool(pool);
|
||||
|
||||
if (pool == DSQL_permanent_pool)
|
||||
|
@ -436,23 +436,20 @@ GDS_DSQL_ALLOCATE_CPP( ISC_STATUS* user_status,
|
||||
FB_API_HANDLE* db_handle,
|
||||
dsql_req** req_handle)
|
||||
{
|
||||
tsql thd_context;
|
||||
tsql thd_context(user_status);
|
||||
tsql* tdsql;
|
||||
|
||||
DSQL_set_thread_data(tdsql, &thd_context);
|
||||
|
||||
try
|
||||
{
|
||||
tdsql->tsql_status = user_status;
|
||||
tdsql->setDefaultPool(0);
|
||||
|
||||
init(0);
|
||||
|
||||
// If we haven't been initialized yet, do it now
|
||||
|
||||
dsql_dbb* database = init(db_handle);
|
||||
|
||||
tdsql->setDefaultPool(DsqlMemoryPool::createPool());
|
||||
DsqlContextPoolHolder context(tdsql, DsqlMemoryPool::createPool());
|
||||
|
||||
// allocate the request block
|
||||
|
||||
@ -509,7 +506,7 @@ ISC_STATUS GDS_DSQL_EXECUTE_CPP(
|
||||
USHORT out_msg_length,
|
||||
UCHAR* out_msg)
|
||||
{
|
||||
tsql thd_context;
|
||||
tsql thd_context(user_status);
|
||||
tsql* tdsql;
|
||||
ISC_STATUS sing_status;
|
||||
|
||||
@ -517,14 +514,11 @@ ISC_STATUS GDS_DSQL_EXECUTE_CPP(
|
||||
|
||||
try
|
||||
{
|
||||
tdsql->tsql_status = user_status;
|
||||
tdsql->setDefaultPool(0);
|
||||
|
||||
init(0);
|
||||
sing_status = 0;
|
||||
|
||||
dsql_req* request = *req_handle;
|
||||
tdsql->setDefaultPool(&request->req_pool);
|
||||
DsqlContextPoolHolder context(tdsql, &request->req_pool);
|
||||
|
||||
if ((SSHORT) in_msg_type == -1) {
|
||||
request->req_type = REQ_EMBED_SELECT;
|
||||
@ -651,19 +645,16 @@ static ISC_STATUS dsql8_execute_immediate_common(ISC_STATUS* user_status,
|
||||
*
|
||||
**************************************/
|
||||
ISC_STATUS status;
|
||||
tsql thd_context;
|
||||
tsql thd_context(user_status);
|
||||
tsql* tdsql;
|
||||
|
||||
DSQL_set_thread_data(tdsql, &thd_context);
|
||||
|
||||
try
|
||||
{
|
||||
tdsql->tsql_status = user_status;
|
||||
tdsql->setDefaultPool(0);
|
||||
|
||||
dsql_dbb* database = init(db_handle);
|
||||
|
||||
tdsql->setDefaultPool(DsqlMemoryPool::createPool());
|
||||
DsqlContextPoolHolder context(tdsql, DsqlMemoryPool::createPool());
|
||||
|
||||
// allocate the request block, then prepare the request
|
||||
|
||||
@ -958,20 +949,17 @@ ISC_STATUS GDS_DSQL_FETCH_CPP( ISC_STATUS* user_status,
|
||||
dsql_msg* message;
|
||||
dsql_par* parameter;
|
||||
ISC_STATUS s;
|
||||
tsql thd_context;
|
||||
tsql thd_context(user_status);
|
||||
tsql* tdsql;
|
||||
|
||||
DSQL_set_thread_data(tdsql, &thd_context);
|
||||
|
||||
try
|
||||
{
|
||||
tdsql->tsql_status = user_status;
|
||||
tdsql->setDefaultPool(0);
|
||||
|
||||
init(0);
|
||||
|
||||
dsql_req* request = *req_handle;
|
||||
tdsql->setDefaultPool(&request->req_pool);
|
||||
DsqlContextPoolHolder context(tdsql, &request->req_pool);
|
||||
|
||||
// if the cursor isn't open, we've got a problem
|
||||
|
||||
@ -1178,20 +1166,17 @@ ISC_STATUS GDS_DSQL_FREE_CPP(ISC_STATUS* user_status,
|
||||
USHORT option)
|
||||
{
|
||||
dsql_req* request;
|
||||
tsql thd_context;
|
||||
tsql thd_context(user_status);
|
||||
tsql* tdsql;
|
||||
|
||||
DSQL_set_thread_data(tdsql, &thd_context);
|
||||
|
||||
try
|
||||
{
|
||||
tdsql->tsql_status = user_status;
|
||||
tdsql->setDefaultPool(0);
|
||||
|
||||
init(0);
|
||||
|
||||
request = *req_handle;
|
||||
tdsql->setDefaultPool(&request->req_pool);
|
||||
DsqlContextPoolHolder context(tdsql, &request->req_pool);
|
||||
|
||||
if (option & DSQL_drop) {
|
||||
// Release everything associate with the request.
|
||||
@ -1244,20 +1229,17 @@ ISC_STATUS GDS_DSQL_INSERT_CPP( ISC_STATUS* user_status,
|
||||
USHORT msg_length,
|
||||
const UCHAR* dsql_msg_buf)
|
||||
{
|
||||
tsql thd_context;
|
||||
tsql thd_context(user_status);
|
||||
tsql* tdsql;
|
||||
|
||||
DSQL_set_thread_data(tdsql, &thd_context);
|
||||
|
||||
try
|
||||
{
|
||||
tdsql->tsql_status = user_status;
|
||||
tdsql->setDefaultPool(0);
|
||||
|
||||
init(0);
|
||||
|
||||
dsql_req* request = *req_handle;
|
||||
tdsql->setDefaultPool(&request->req_pool);
|
||||
DsqlContextPoolHolder context(tdsql, &request->req_pool);
|
||||
|
||||
// if the cursor isn't open, we've got a problem
|
||||
|
||||
@ -1332,16 +1314,13 @@ ISC_STATUS GDS_DSQL_PREPARE_CPP(ISC_STATUS* user_status,
|
||||
UCHAR* buffer)
|
||||
{
|
||||
ISC_STATUS status;
|
||||
tsql thd_context;
|
||||
tsql thd_context(user_status);
|
||||
tsql* tdsql;
|
||||
|
||||
DSQL_set_thread_data(tdsql, &thd_context);
|
||||
|
||||
try
|
||||
{
|
||||
tdsql->tsql_status = user_status;
|
||||
tdsql->setDefaultPool(0);
|
||||
|
||||
init(0);
|
||||
|
||||
dsql_req* old_request = *req_handle;
|
||||
@ -1376,7 +1355,7 @@ ISC_STATUS GDS_DSQL_PREPARE_CPP(ISC_STATUS* user_status,
|
||||
/* Because that's the client's allocated statement handle and we
|
||||
don't want to trash the context in it -- 2001-Oct-27 Ann Harrison */
|
||||
|
||||
tdsql->setDefaultPool(DsqlMemoryPool::createPool());
|
||||
DsqlContextPoolHolder context(tdsql, DsqlMemoryPool::createPool());
|
||||
dsql_req* request = FB_NEW(*tdsql->getDefaultPool())
|
||||
dsql_req(*tdsql->getDefaultPool());
|
||||
request->req_dbb = database;
|
||||
@ -1440,9 +1419,10 @@ ISC_STATUS GDS_DSQL_PREPARE_CPP(ISC_STATUS* user_status,
|
||||
|
||||
// Now that we know that the new request exists, zap the old one.
|
||||
|
||||
tdsql->setDefaultPool(&old_request->req_pool);
|
||||
{
|
||||
DsqlContextPoolHolder context(tdsql, &old_request->req_pool);
|
||||
release_request(old_request, true);
|
||||
tdsql->setDefaultPool(0);
|
||||
}
|
||||
|
||||
/* The request was sucessfully prepared, and the old request was
|
||||
* successfully zapped, so set the client's handle to the new request */
|
||||
@ -1494,20 +1474,17 @@ ISC_STATUS GDS_DSQL_SET_CURSOR_CPP( ISC_STATUS* user_status,
|
||||
const TEXT* input_cursor,
|
||||
USHORT type)
|
||||
{
|
||||
tsql thd_context;
|
||||
tsql thd_context(user_status);
|
||||
tsql* tdsql;
|
||||
|
||||
DSQL_set_thread_data(tdsql, &thd_context);
|
||||
|
||||
try
|
||||
{
|
||||
tdsql->tsql_status = user_status;
|
||||
tdsql->setDefaultPool(0);
|
||||
|
||||
init(0);
|
||||
|
||||
dsql_req* request = *req_handle;
|
||||
tdsql->setDefaultPool(&request->req_pool);
|
||||
DsqlContextPoolHolder context(tdsql, &request->req_pool);
|
||||
|
||||
TEXT cursor[132];
|
||||
|
||||
@ -1604,16 +1581,13 @@ ISC_STATUS GDS_DSQL_SQL_INFO_CPP( ISC_STATUS* user_status,
|
||||
{
|
||||
UCHAR buffer[256], *buffer_ptr;
|
||||
USHORT length, number, first_index;
|
||||
tsql thd_context;
|
||||
tsql thd_context(user_status);
|
||||
tsql* tdsql;
|
||||
|
||||
DSQL_set_thread_data(tdsql, &thd_context);
|
||||
|
||||
try
|
||||
{
|
||||
tdsql->tsql_status = user_status;
|
||||
tdsql->setDefaultPool(0);
|
||||
|
||||
init(0);
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
|
||||
@ -4150,6 +4124,10 @@ static dsql_dbb* init(FB_API_HANDLE* db_handle)
|
||||
{
|
||||
init_flag = true;
|
||||
ALLD_init();
|
||||
|
||||
// may be someone needs context pool later -
|
||||
// lets set it correctly here, not in ALLD_init()
|
||||
DsqlContextPoolHolder context(DSQL_get_thread_data(), DSQL_permanent_pool);
|
||||
HSHD_init();
|
||||
|
||||
#ifdef DSQL_DEBUG
|
||||
@ -4916,13 +4894,12 @@ static void release_request(dsql_req* request, bool top_level)
|
||||
// If request is parent, orphan the children and
|
||||
// release a portion of their requests
|
||||
|
||||
for (dsql_req* child = request->req_offspring; child; child = child->req_sibling) {
|
||||
for (dsql_req* child = request->req_offspring; child; child = child->req_sibling)
|
||||
{
|
||||
child->req_flags |= REQ_orphan;
|
||||
child->req_parent = NULL;
|
||||
DsqlMemoryPool *save_default = tdsql->getDefaultPool();
|
||||
tdsql->setDefaultPool(&child->req_pool);
|
||||
DsqlContextPoolHolder(tdsql, &child->req_pool);
|
||||
release_request(child, false);
|
||||
tdsql->setDefaultPool(save_default);
|
||||
}
|
||||
|
||||
// For top level requests that are linked to a parent, unlink it
|
||||
|
@ -606,35 +606,45 @@ public:
|
||||
|
||||
// DSQL threading declarations
|
||||
|
||||
class tsql : public thdd
|
||||
class tsql : public ThreadData
|
||||
{
|
||||
private:
|
||||
DsqlMemoryPool* tsql_default;
|
||||
public:
|
||||
ISC_STATUS* tsql_status;
|
||||
ISC_STATUS* tsql_user_status;
|
||||
friend class Firebird::SubsystemContextPoolHolder <tsql, DsqlMemoryPool>;
|
||||
|
||||
void setDefaultPool(DsqlMemoryPool* p)
|
||||
{
|
||||
thdd::setPool(p);
|
||||
tsql_default = p;
|
||||
}
|
||||
|
||||
public:
|
||||
tsql(ISC_STATUS* status)
|
||||
: ThreadData(tddSQL), tsql_default(0),
|
||||
tsql_status(status), tsql_user_status(0)
|
||||
{
|
||||
}
|
||||
|
||||
ISC_STATUS* tsql_status;
|
||||
ISC_STATUS* tsql_user_status;
|
||||
|
||||
DsqlMemoryPool* getDefaultPool()
|
||||
{
|
||||
return tsql_default;
|
||||
}
|
||||
};
|
||||
|
||||
typedef Firebird::SubsystemContextPoolHolder <tsql, DsqlMemoryPool>
|
||||
DsqlContextPoolHolder;
|
||||
|
||||
inline tsql* DSQL_get_thread_data() {
|
||||
return (tsql*) thdd::getSpecific();
|
||||
return (tsql*) ThreadData::getSpecific();
|
||||
}
|
||||
inline void DSQL_set_thread_data(tsql* &tdsql, tsql* thd_context) {
|
||||
tdsql = thd_context;
|
||||
tdsql->thdd_type = THDD_TYPE_TSQL;
|
||||
tdsql->putSpecific();
|
||||
}
|
||||
inline void DSQL_restore_thread_data() {
|
||||
thdd::restoreSpecific();
|
||||
ThreadData::restoreSpecific();
|
||||
}
|
||||
|
||||
/*! \var unsigned DSQL_debug
|
||||
|
@ -651,7 +651,7 @@ typedef struct eventq {
|
||||
|
||||
/* interprocess database thread structure */
|
||||
|
||||
class tidb : public thdd
|
||||
class tidb : public ThreadData
|
||||
{
|
||||
public:
|
||||
struct rdb *tidb_database;
|
||||
|
@ -188,7 +188,7 @@ void ALL_init(void)
|
||||
Database* dbb = tdbb->tdbb_database;
|
||||
|
||||
JrdMemoryPool* pool = dbb->dbb_permanent;
|
||||
tdbb->setDefaultPool(pool);
|
||||
// tdbb->setDefaultPool(pool);
|
||||
// dbb->dbb_permanent->setExtendSize(PERM_EXTEND_SIZE);
|
||||
dbb->dbb_pools[0] = pool;
|
||||
dbb->dbb_bufferpool = JrdMemoryPool::createPool();
|
||||
|
@ -33,7 +33,7 @@
|
||||
*
|
||||
*/
|
||||
/*
|
||||
$Id: blb.cpp,v 1.85 2004-08-16 12:28:16 alexpeshkoff Exp $
|
||||
$Id: blb.cpp,v 1.86 2004-08-30 18:10:33 alexpeshkoff Exp $
|
||||
*/
|
||||
|
||||
#include "firebird.h"
|
||||
@ -661,7 +661,7 @@ SLONG BLB_get_slice(thread_db* tdbb,
|
||||
|
||||
SET_TDBB(tdbb);
|
||||
Database* database = GET_DBB();
|
||||
tdbb->setDefaultPool(transaction->tra_pool);
|
||||
Jrd::ContextPoolHolder context(tdbb, transaction->tra_pool);
|
||||
|
||||
/* Checkout slice description language */
|
||||
SLONG variables[64];
|
||||
@ -1429,7 +1429,7 @@ void BLB_put_slice( thread_db* tdbb,
|
||||
*
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
tdbb->setDefaultPool(transaction->tra_pool);
|
||||
Jrd::ContextPoolHolder context(tdbb, transaction->tra_pool);
|
||||
|
||||
/* Do initial parse of slice description to get relation and field identification */
|
||||
sdl_info info;
|
||||
|
@ -848,8 +848,8 @@ IDX_E BTR_key(thread_db* tdbb, jrd_rel* relation, Record* record, index_desc* id
|
||||
tdbb->tdbb_request = idx->idx_expression_request;
|
||||
tdbb->tdbb_request->req_rpb[0].rpb_record = record;
|
||||
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(tdbb->tdbb_request->req_pool);
|
||||
{
|
||||
Jrd::ContextPoolHolder(tdbb, tdbb->tdbb_request->req_pool);
|
||||
|
||||
tdbb->tdbb_request->req_flags &= ~req_null;
|
||||
|
||||
@ -859,7 +859,7 @@ IDX_E BTR_key(thread_db* tdbb, jrd_rel* relation, Record* record, index_desc* id
|
||||
|
||||
isNull = (tdbb->tdbb_request->req_flags & req_null);
|
||||
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
}
|
||||
tdbb->tdbb_request = idx->idx_expression_request->req_caller;
|
||||
idx->idx_expression_request->req_caller = NULL;
|
||||
}
|
||||
|
@ -1961,9 +1961,7 @@ void CCH_prefetch(thread_db* tdbb, SLONG * pages, SSHORT count)
|
||||
|
||||
/* Switch default pool to permanent pool for setting bits in
|
||||
prefetch bitmap. */
|
||||
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(dbb->dbb_bufferpool);
|
||||
Jrd::ContextPoolHolder context(tdbb, dbb->dbb_bufferpool);
|
||||
|
||||
/* The global prefetch bitmap is the key to the I/O coalescense
|
||||
mechanism which dovetails all thread prefetch requests to
|
||||
@ -1991,8 +1989,6 @@ void CCH_prefetch(thread_db* tdbb, SLONG * pages, SSHORT count)
|
||||
prefetch_io(&prefetch, tdbb->tdbb_status_vector);
|
||||
prefetch_epilogue(&prefetch, tdbb->tdbb_status_vector);
|
||||
}
|
||||
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -3085,7 +3081,7 @@ static THREAD_ENTRY_DECLARE cache_reader(THREAD_ENTRY_PARAM arg)
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
/* Dummy attachment needed for lock owner identification. */
|
||||
tdbb->tdbb_database = dbb;
|
||||
tdbb->setDefaultPool(dbb->dbb_bufferpool);
|
||||
Jrd::ContextPoolHolder context(tdbb, dbb->dbb_bufferpool);
|
||||
tdbb->tdbb_status_vector = status_vector;
|
||||
tdbb->tdbb_quantum = QUANTUM;
|
||||
tdbb->tdbb_attachment = FB_NEW(*dbb->dbb_bufferpool) Attachment();
|
||||
@ -3257,7 +3253,7 @@ static THREAD_ENTRY_DECLARE cache_writer(THREAD_ENTRY_PARAM arg)
|
||||
/* Dummy attachment needed for lock owner identification. */
|
||||
|
||||
tdbb->tdbb_database = dbb;
|
||||
tdbb->setDefaultPool(dbb->dbb_bufferpool);
|
||||
Jrd::ContextPoolHolder context(tdbb, dbb->dbb_bufferpool);
|
||||
tdbb->tdbb_status_vector = status_vector;
|
||||
tdbb->tdbb_quantum = QUANTUM;
|
||||
tdbb->tdbb_attachment = FB_NEW(*dbb->dbb_bufferpool) Attachment(dbb);
|
||||
@ -3777,9 +3773,7 @@ static void expand_buffers(thread_db* tdbb, ULONG number)
|
||||
ULONG left_to_do = num_per_seg;
|
||||
|
||||
/* Allocate and initialize buffers control block */
|
||||
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(dbb->dbb_bufferpool);
|
||||
Jrd::ContextPoolHolder context(tdbb, dbb->dbb_bufferpool);
|
||||
|
||||
old = dbb->dbb_bcb;
|
||||
const bcb_repeat* const old_end = old->bcb_rpt + old->bcb_count;
|
||||
@ -3869,7 +3863,6 @@ static void expand_buffers(thread_db* tdbb, ULONG number)
|
||||
dbb->dbb_bcb = new_block;
|
||||
|
||||
delete old;
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
}
|
||||
|
||||
|
||||
|
@ -553,14 +553,15 @@ jrd_req* CMP_compile2(thread_db* tdbb, const UCHAR* blr, USHORT internal_flag)
|
||||
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
|
||||
// 26.09.2002 Nickolay Samofatov: default memory pool will become statement pool
|
||||
// and will be freed by CMP_release
|
||||
JrdMemoryPool* new_pool = JrdMemoryPool::createPool();
|
||||
tdbb->setDefaultPool(new_pool);
|
||||
JrdMemoryPool* new_pool = 0;
|
||||
|
||||
try {
|
||||
|
||||
JrdMemoryPool* new_pool = JrdMemoryPool::createPool();
|
||||
Jrd::ContextPoolHolder context(tdbb, new_pool);
|
||||
|
||||
CompilerScratch* csb = PAR_parse(tdbb, blr, internal_flag);
|
||||
request = CMP_make_request(tdbb, csb);
|
||||
|
||||
@ -571,12 +572,10 @@ jrd_req* CMP_compile2(thread_db* tdbb, const UCHAR* blr, USHORT internal_flag)
|
||||
CMP_verify_access(tdbb, request);
|
||||
|
||||
delete csb;
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
|
||||
}
|
||||
catch (const std::exception& ex) {
|
||||
Firebird::stuff_exception(tdbb->tdbb_status_vector, ex);
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
if (request) {
|
||||
CMP_release(tdbb, request);
|
||||
}
|
||||
|
@ -1379,16 +1379,16 @@ void CVT_move(const dsc* from, dsc* to, FPTR_ERROR err)
|
||||
/** Cannot call JRD_get_thread_data because that macro calls
|
||||
BUGCHECK i.e. ERR_bugcheck() which is not part of
|
||||
client library **/
|
||||
thread_db* tdbb = (thread_db*) thdd::getSpecific();
|
||||
thread_db* tdbb = (thread_db*) ThreadData::getSpecific();
|
||||
|
||||
/* If we're in the engine, then the THDD type must
|
||||
be a THDD_TYPE_TDBB. So, if we're in the engine
|
||||
/* If we're in the engine, then the ThreadData type must
|
||||
be a ThreadData_TYPE_TDBB. So, if we're in the engine
|
||||
and have a request, pull the effective date out
|
||||
of the request timestamp.
|
||||
Otherwise, take the CURRENT date to populate the
|
||||
date portion of the timestamp */
|
||||
|
||||
if (tdbb && (tdbb->thdd_type == THDD_TYPE_TDBB) &&
|
||||
if (tdbb && (tdbb->getType() == ThreadData::tddDBB) &&
|
||||
tdbb->tdbb_request)
|
||||
{
|
||||
if (tdbb->tdbb_request->req_timestamp)
|
||||
@ -1836,8 +1836,8 @@ static void datetime_to_text(const dsc* from, dsc* to, FPTR_ERROR err)
|
||||
/** Cannot call JRD_get_thread_data because that macro calls
|
||||
BUGCHECK i.e. ERR_bugcheck() which is not part of
|
||||
client library **/
|
||||
tdbb = (thread_db*) thdd::getSpecific();
|
||||
if (tdbb && (tdbb->thdd_type == THDD_TYPE_TDBB) &&
|
||||
tdbb = (thread_db*) ThreadData::getSpecific();
|
||||
if (tdbb && (tdbb->getType() == ThreadData::tddDBB) &&
|
||||
tdbb->tdbb_request)
|
||||
{
|
||||
version4 = (tdbb->tdbb_request->req_flags & req_blr_version4) ?
|
||||
|
@ -474,7 +474,7 @@ void DFW_perform_work(jrd_tra* transaction)
|
||||
return;
|
||||
}
|
||||
|
||||
tdbb->setDefaultPool(transaction->tra_pool);
|
||||
Jrd::ContextPoolHolder context(tdbb, transaction->tra_pool);
|
||||
|
||||
/* Loop for as long as any of the deferred work routines says that it has
|
||||
more to do. A deferred work routine should be able to deal with any
|
||||
@ -3244,22 +3244,29 @@ static void get_procedure_dependencies(DeferredWork* work)
|
||||
|
||||
if (procedure && !blob_id.isEmpty())
|
||||
{
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
|
||||
jrd_req* request = 0;
|
||||
/* Nickolay Samofatov: allocate statement memory pool... */
|
||||
tdbb->setDefaultPool(JrdMemoryPool::createPool());
|
||||
jrd_req* request;
|
||||
JrdMemoryPool* new_pool = JrdMemoryPool::createPool();
|
||||
// block is used to ensure MET_verify_cache
|
||||
// works in not deleted context
|
||||
{
|
||||
Jrd::ContextPoolHolder context(tdbb, new_pool);
|
||||
|
||||
MET_get_dependencies(tdbb, NULL, NULL, NULL, &blob_id, &request,
|
||||
NULL, work->dfw_name, obj_procedure);
|
||||
if (request)
|
||||
{
|
||||
CMP_release(tdbb, request);
|
||||
}
|
||||
else
|
||||
JrdMemoryPool::deletePool(tdbb->getDefaultPool());
|
||||
{
|
||||
JrdMemoryPool::deletePool(new_pool);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEV_BUILD
|
||||
MET_verify_cache(tdbb);
|
||||
#endif
|
||||
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3302,18 +3309,20 @@ static void get_trigger_dependencies( DeferredWork* work)
|
||||
|
||||
if (relation && !blob_id.isEmpty())
|
||||
{
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
|
||||
jrd_req* request = 0;
|
||||
/* Nickolay Samofatov: allocate statement memory pool... */
|
||||
tdbb->setDefaultPool(JrdMemoryPool::createPool());
|
||||
jrd_req* request;
|
||||
JrdMemoryPool* new_pool = JrdMemoryPool::createPool();
|
||||
Jrd::ContextPoolHolder context(tdbb, new_pool);
|
||||
MET_get_dependencies(tdbb, relation, NULL, NULL, &blob_id,
|
||||
&request, NULL, work->dfw_name, obj_trigger);
|
||||
if (request)
|
||||
{
|
||||
CMP_release(tdbb, request);
|
||||
}
|
||||
else
|
||||
{
|
||||
JrdMemoryPool::deletePool(tdbb->getDefaultPool());
|
||||
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,9 +126,8 @@ void DYN_ddl(Attachment* attachment, jrd_tra* transaction, USHORT length,
|
||||
|
||||
// Create a pool for DYN to operate in. It will be released when
|
||||
// the routine exits.
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
|
||||
JrdMemoryPool* tempPool = JrdMemoryPool::createPool();
|
||||
tdbb->setDefaultPool(tempPool);
|
||||
Jrd::ContextPoolHolder context(tdbb, tempPool);
|
||||
|
||||
try {
|
||||
|
||||
@ -183,13 +182,8 @@ void DYN_ddl(Attachment* attachment, jrd_tra* transaction, USHORT length,
|
||||
#endif
|
||||
#endif
|
||||
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
JrdMemoryPool::deletePool(tempPool);
|
||||
ERR_punt();
|
||||
}
|
||||
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
JrdMemoryPool::deletePool(tempPool);
|
||||
}
|
||||
|
||||
|
||||
|
@ -967,8 +967,7 @@ void EXE_unwind(thread_db* tdbb, jrd_req* request)
|
||||
|
||||
if (request->req_flags & req_active) {
|
||||
if (request->req_fors.getCount()) {
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(request->req_pool);
|
||||
Jrd::ContextPoolHolder context(tdbb, request->req_pool);
|
||||
jrd_req* old_request = tdbb->tdbb_request;
|
||||
tdbb->tdbb_request = request;
|
||||
jrd_tra* old_transaction = tdbb->tdbb_transaction;
|
||||
@ -981,7 +980,6 @@ void EXE_unwind(thread_db* tdbb, jrd_req* request)
|
||||
if (*ptr)
|
||||
RSE_close(tdbb, *ptr);
|
||||
}
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
tdbb->tdbb_request = old_request;
|
||||
tdbb->tdbb_transaction = old_transaction;
|
||||
}
|
||||
@ -1169,13 +1167,12 @@ static jrd_nod* erase(thread_db* tdbb, jrd_nod* node, SSHORT which_trig)
|
||||
rpb,
|
||||
NULL,
|
||||
transaction,
|
||||
reinterpret_cast<blk*>(tdbb->getDefaultPool()),
|
||||
tdbb->getDefaultPool(),
|
||||
false)))
|
||||
{
|
||||
ERR_post(isc_deadlock, isc_arg_gds, isc_update_conflict, 0);
|
||||
}
|
||||
VIO_data(tdbb, rpb,
|
||||
reinterpret_cast<blk*>(tdbb->tdbb_request->req_pool));
|
||||
VIO_data(tdbb, rpb, tdbb->tdbb_request->req_pool);
|
||||
|
||||
/* If record is present, and the transaction is read committed,
|
||||
* make sure the record has not been updated. Also, punt after
|
||||
@ -1441,14 +1438,12 @@ static void execute_procedure(thread_db* tdbb, jrd_nod* node)
|
||||
(SCHAR *) FB_ALIGN((U_IPTR) temp_buffer->str_data, DOUBLE_ALIGN);
|
||||
}
|
||||
|
||||
/* Save the old pool */
|
||||
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(proc_request->req_pool);
|
||||
|
||||
/* Catch errors so we can unwind cleanly */
|
||||
|
||||
try {
|
||||
// Save the old pool
|
||||
Jrd::ContextPoolHolder context(tdbb, proc_request->req_pool);
|
||||
|
||||
jrd_tra* transaction = request->req_transaction;
|
||||
const SLONG save_point_number = transaction->tra_save_point->sav_number;
|
||||
@ -1477,7 +1472,6 @@ static void execute_procedure(thread_db* tdbb, jrd_nod* node)
|
||||
|
||||
} // try
|
||||
catch (const std::exception&) {
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
tdbb->tdbb_request = request;
|
||||
EXE_unwind(tdbb, proc_request);
|
||||
proc_request->req_attachment = NULL;
|
||||
@ -1487,7 +1481,6 @@ static void execute_procedure(thread_db* tdbb, jrd_nod* node)
|
||||
throw;
|
||||
}
|
||||
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
EXE_unwind(tdbb, proc_request);
|
||||
tdbb->tdbb_request = request;
|
||||
|
||||
@ -1834,9 +1827,8 @@ static jrd_nod* looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node)
|
||||
BLKCHK(in_node, type_nod);
|
||||
|
||||
// Save the old pool and request to restore on exit
|
||||
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(request->req_pool);
|
||||
Jrd::ContextPoolHolder context(tdbb, request->req_pool);
|
||||
|
||||
jrd_req* old_request = tdbb->tdbb_request;
|
||||
tdbb->tdbb_request = request;
|
||||
@ -2330,7 +2322,8 @@ static jrd_nod* looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node)
|
||||
On recursive calling we will loose the actual old
|
||||
request for that invocation of looper. Avoid this. */
|
||||
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
{
|
||||
Jrd::ContextPoolHolder contextLooper(tdbb, old_pool);
|
||||
tdbb->tdbb_request = old_request;
|
||||
fb_assert(request->req_caller == old_request);
|
||||
request->req_caller = NULL;
|
||||
@ -2361,10 +2354,10 @@ static jrd_nod* looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node)
|
||||
terminating the processing. */
|
||||
|
||||
catch_disabled = false;
|
||||
tdbb->setDefaultPool(request->req_pool);
|
||||
tdbb->tdbb_request = request;
|
||||
fb_assert(request->req_caller == NULL);
|
||||
request->req_caller = old_request;
|
||||
}
|
||||
|
||||
/* The error is dealt with by the application, cleanup
|
||||
this block's savepoint. */
|
||||
@ -2839,7 +2832,6 @@ static jrd_nod* looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node)
|
||||
}
|
||||
|
||||
request->req_next = node;
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
tdbb->tdbb_transaction = (tdbb->tdbb_request = old_request) ?
|
||||
old_request->req_transaction : NULL;
|
||||
fb_assert(request->req_caller == old_request);
|
||||
@ -2932,13 +2924,12 @@ static jrd_nod* modify(thread_db* tdbb, jrd_nod* node, SSHORT which_trig)
|
||||
org_rpb,
|
||||
NULL,
|
||||
transaction,
|
||||
reinterpret_cast<blk*>(tdbb->getDefaultPool()),
|
||||
tdbb->getDefaultPool(),
|
||||
false)))
|
||||
{
|
||||
ERR_post(isc_deadlock, isc_arg_gds, isc_update_conflict, 0);
|
||||
}
|
||||
VIO_data(tdbb, org_rpb,
|
||||
reinterpret_cast<BLK>(tdbb->tdbb_request->req_pool));
|
||||
VIO_data(tdbb, org_rpb, tdbb->tdbb_request->req_pool);
|
||||
|
||||
/* If record is present, and the transaction is read committed,
|
||||
* make sure the record has not been updated. Also, punt after
|
||||
|
@ -289,8 +289,7 @@ void IDX_create_index(
|
||||
else {
|
||||
primary.rpb_record = gc_record;
|
||||
// JrdMemoryPool and its parent MemoryPool are unrelated to blk.
|
||||
VIO_data(tdbb, &primary,
|
||||
reinterpret_cast<BLK>(dbb->dbb_permanent));
|
||||
VIO_data(tdbb, &primary, dbb->dbb_permanent);
|
||||
gc_record = primary.rpb_record;
|
||||
stack.push(primary.rpb_record);
|
||||
}
|
||||
@ -301,8 +300,7 @@ void IDX_create_index(
|
||||
if (!DPM_fetch(tdbb, &secondary, LCK_read))
|
||||
break; /* must be garbage collected */
|
||||
secondary.rpb_record = NULL;
|
||||
VIO_data(tdbb, &secondary,
|
||||
reinterpret_cast<BLK>(tdbb->getDefaultPool()));
|
||||
VIO_data(tdbb, &secondary, tdbb->getDefaultPool());
|
||||
stack.push(secondary.rpb_record);
|
||||
secondary.rpb_page = secondary.rpb_b_page;
|
||||
secondary.rpb_line = secondary.rpb_b_line;
|
||||
@ -908,7 +906,7 @@ static IDX_E check_duplicates(
|
||||
{
|
||||
if (rpb.rpb_number != insertion->iib_number
|
||||
&& VIO_get_current(tdbb, &rpb, insertion->iib_transaction,
|
||||
reinterpret_cast<BLK>(tdbb->getDefaultPool()),
|
||||
tdbb->getDefaultPool(),
|
||||
(record_idx->idx_flags & idx_foreign) != 0))
|
||||
{
|
||||
// dimitr: we shouldn't ignore status exceptions which take place
|
||||
|
100
src/jrd/jrd.cpp
100
src/jrd/jrd.cpp
@ -218,18 +218,15 @@ void Jrd::Trigger::compile(thread_db* tdbb)
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
compile_in_progress = true;
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool(),
|
||||
*new_pool = JrdMemoryPool::createPool();
|
||||
// Allocate statement memory pool
|
||||
tdbb->setDefaultPool(new_pool);
|
||||
JrdMemoryPool* new_pool = JrdMemoryPool::createPool();
|
||||
// Trigger request is not compiled yet. Lets do it now
|
||||
try {
|
||||
Jrd::ContextPoolHolder context(tdbb, new_pool);
|
||||
PAR_blr(tdbb, relation, blr.begin(), NULL, NULL, &request, true,
|
||||
(USHORT)(flags & TRG_ignore_perm ? csb_ignore_perm : 0));
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
}
|
||||
catch (const std::exception&) {
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
compile_in_progress = false;
|
||||
if (request) {
|
||||
CMP_release(tdbb,request);
|
||||
@ -240,7 +237,6 @@ void Jrd::Trigger::compile(thread_db* tdbb)
|
||||
}
|
||||
throw;
|
||||
}
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
|
||||
if (name.hasData())
|
||||
{
|
||||
@ -419,7 +415,6 @@ inline static void api_entry_point_init(ISC_STATUS* user_status)
|
||||
inline static thread_db* JRD_MAIN_set_thread_data(thread_db& thd_context)
|
||||
{
|
||||
thread_db* tdbb = &thd_context;
|
||||
MOVE_CLEAR(tdbb, sizeof(thread_db));
|
||||
JRD_set_context(tdbb);
|
||||
return tdbb;
|
||||
}
|
||||
@ -580,6 +575,9 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status,
|
||||
return user_status[1];
|
||||
}
|
||||
|
||||
// use database context pool
|
||||
Jrd::ContextPoolHolder context(tdbb, dbb->dbb_permanent);
|
||||
|
||||
dbb->dbb_flags |= DBB_being_opened;
|
||||
#if defined(V4_THREADING) && !defined(SUPERSERVER)
|
||||
V4_JRD_MUTEX_LOCK(dbb->dbb_mutexes + DBB_MUTX_init_fini);
|
||||
@ -1713,6 +1711,9 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status,
|
||||
return user_status[1];
|
||||
}
|
||||
|
||||
// use database context pool
|
||||
Jrd::ContextPoolHolder context(tdbb, dbb->dbb_permanent);
|
||||
|
||||
dbb->dbb_flags |= DBB_being_opened;
|
||||
#if defined(V4_THREADING) && !defined(SUPERSERVER)
|
||||
V4_JRD_MUTEX_LOCK(dbb->dbb_mutexes + DBB_MUTX_init_fini);
|
||||
@ -2209,7 +2210,6 @@ ISC_STATUS GDS_DETACH(ISC_STATUS* user_status, Attachment** handle)
|
||||
tdbb->tdbb_attachment = attachment;
|
||||
tdbb->tdbb_request = NULL;
|
||||
tdbb->tdbb_transaction = NULL;
|
||||
tdbb->setDefaultPool(0);
|
||||
|
||||
/* Count active thread in database */
|
||||
|
||||
@ -2318,11 +2318,14 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS* user_status, Attachment** handle)
|
||||
if (!attach)
|
||||
return handle_error(user_status, isc_bad_db_handle, tdbb);
|
||||
|
||||
bool err = false; // so much for uninitialized vars... if something
|
||||
// failed before the first call to drop_files, which was the value?
|
||||
{
|
||||
Jrd::ContextPoolHolder context(tdbb, dbb->dbb_permanent);
|
||||
tdbb->tdbb_database = dbb;
|
||||
tdbb->tdbb_attachment = attachment;
|
||||
tdbb->tdbb_request = NULL;
|
||||
tdbb->tdbb_transaction = NULL;
|
||||
tdbb->setDefaultPool(dbb->dbb_permanent);
|
||||
|
||||
/* Count active thread in database */
|
||||
|
||||
@ -2397,9 +2400,7 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS* user_status, Attachment** handle)
|
||||
JRD_SS_MUTEX_UNLOCK;
|
||||
return error(user_status, ex);
|
||||
}
|
||||
|
||||
bool err = false; // so much for uninitialized vars... if something
|
||||
// failed before the first call to drop_files, which was the value?
|
||||
} // dbb permanent context
|
||||
|
||||
/* A default catch all */
|
||||
try {
|
||||
@ -2417,8 +2418,6 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS* user_status, Attachment** handle)
|
||||
const jrd_file* file = dbb->dbb_file;
|
||||
const Shadow* shadow = dbb->dbb_shadow;
|
||||
|
||||
tdbb->setDefaultPool(NULL);
|
||||
|
||||
#ifdef GOVERNOR
|
||||
if (JRD_max_users) {
|
||||
fb_assert(num_attached > 0);
|
||||
@ -2438,7 +2437,8 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS* user_status, Attachment** handle)
|
||||
/* drop the files here. */
|
||||
|
||||
err = drop_files(file);
|
||||
for (; shadow; shadow = shadow->sdw_next) {
|
||||
for (; shadow; shadow = shadow->sdw_next)
|
||||
{
|
||||
err = err || drop_files(shadow->sdw_file);
|
||||
}
|
||||
|
||||
@ -3697,41 +3697,42 @@ ISC_STATUS GDS_TRANSACT_REQUEST(ISC_STATUS* user_status,
|
||||
blr_length, blr, in_msg_length, in_msg, out_msg_length);
|
||||
#endif
|
||||
|
||||
JrdMemoryPool *old_pool, *new_pool;
|
||||
new_pool = old_pool = NULL;
|
||||
jrd_req* request = NULL;
|
||||
JrdMemoryPool* new_pool = 0;
|
||||
|
||||
tdbb->tdbb_status_vector = user_status;
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
|
||||
jrd_tra* transaction = find_transaction(tdbb, *tra_handle, isc_req_wrong_db);
|
||||
jrd_nod* in_message = NULL;
|
||||
jrd_nod* out_message = NULL;
|
||||
|
||||
old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(new_pool = JrdMemoryPool::createPool());
|
||||
{
|
||||
new_pool = JrdMemoryPool::createPool();
|
||||
Jrd::ContextPoolHolder context(tdbb, new_pool);
|
||||
|
||||
CompilerScratch* csb = PAR_parse(tdbb, reinterpret_cast<const UCHAR*>(blr), FALSE);
|
||||
request = CMP_make_request(tdbb, csb);
|
||||
CMP_verify_access(tdbb, request);
|
||||
|
||||
jrd_nod* in_message = NULL;
|
||||
jrd_nod* out_message = NULL;
|
||||
jrd_nod* node;
|
||||
for (int i = 0; i < csb->csb_rpt.getCount(); i++)
|
||||
{
|
||||
if ( (node = csb->csb_rpt[i].csb_message) )
|
||||
{
|
||||
if ((int) (IPTR) node->nod_arg[e_msg_number] == 0) {
|
||||
if ((int) (IPTR) node->nod_arg[e_msg_number] == 0)
|
||||
{
|
||||
in_message = node;
|
||||
}
|
||||
else if ((int) (IPTR) node->nod_arg[e_msg_number] == 1) {
|
||||
else if ((int) (IPTR) node->nod_arg[e_msg_number] == 1)
|
||||
{
|
||||
out_message = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
old_pool = NULL;
|
||||
} // new context
|
||||
|
||||
request->req_attachment = attachment;
|
||||
|
||||
@ -3799,9 +3800,6 @@ ISC_STATUS GDS_TRANSACT_REQUEST(ISC_STATUS* user_status,
|
||||
/* Set up to trap error in case release pool goes wrong. */
|
||||
|
||||
try {
|
||||
if (old_pool) {
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
}
|
||||
if (request) {
|
||||
CMP_release(tdbb, request);
|
||||
}
|
||||
@ -4026,7 +4024,7 @@ bool JRD_getdir(Firebird::PathName& buf)
|
||||
char* t_data = NULL;
|
||||
char b[MAXPATHLEN];
|
||||
|
||||
thdd::getSpecificData((void**) &t_data);
|
||||
ThreadData::getSpecificData((void**) &t_data);
|
||||
|
||||
if (t_data) {
|
||||
#ifdef WIN_NT
|
||||
@ -4060,7 +4058,7 @@ bool JRD_getdir(Firebird::PathName& buf)
|
||||
**/
|
||||
|
||||
Attachment* attachment;
|
||||
if (tdbb && (tdbb->thdd_type == THDD_TYPE_TDBB))
|
||||
if (tdbb && (tdbb->getType() == ThreadData::tddDBB))
|
||||
attachment = tdbb->tdbb_attachment;
|
||||
else
|
||||
return false;
|
||||
@ -4321,7 +4319,7 @@ void JRD_restore_context(void)
|
||||
/* Charlie will fill this in
|
||||
cleaned_up |= INUSE_cleanup (&tdbb->tdbb_pages, (FPTR_VOID) CCH_?);
|
||||
*/
|
||||
thdd::restoreSpecific();
|
||||
ThreadData::restoreSpecific();
|
||||
|
||||
#ifdef DEV_BUILD
|
||||
if (tdbb->tdbb_status_vector &&
|
||||
@ -4334,6 +4332,27 @@ cleaned_up |= INUSE_cleanup (&tdbb->tdbb_pages, (FPTR_VOID) CCH_?);
|
||||
}
|
||||
|
||||
|
||||
void JRD_inuse_clear(thread_db* tdbb)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* J R D _ i n u s e _ c l e a r
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Prepare thread_db for later use .Initialize the in-use
|
||||
* blocks so that we can unwind cleanly if an error occurs.
|
||||
* Used in constructor and JRD_set_context().
|
||||
*
|
||||
**************************************/
|
||||
|
||||
INUSE_clear(&tdbb->tdbb_mutexes);
|
||||
INUSE_clear(&tdbb->tdbb_rw_locks);
|
||||
INUSE_clear(&tdbb->tdbb_pages);
|
||||
}
|
||||
|
||||
|
||||
void JRD_set_context(thread_db* tdbb)
|
||||
{
|
||||
/**************************************
|
||||
@ -4349,11 +4368,8 @@ void JRD_set_context(thread_db* tdbb)
|
||||
*
|
||||
**************************************/
|
||||
|
||||
INUSE_clear(&tdbb->tdbb_mutexes);
|
||||
INUSE_clear(&tdbb->tdbb_rw_locks);
|
||||
INUSE_clear(&tdbb->tdbb_pages);
|
||||
JRD_inuse_clear(tdbb);
|
||||
tdbb->tdbb_status_vector = NULL;
|
||||
tdbb->thdd_type = THDD_TYPE_TDBB;
|
||||
tdbb->putSpecific();
|
||||
}
|
||||
|
||||
@ -4499,7 +4515,7 @@ static ISC_STATUS check_database(thread_db* tdbb, Attachment* attachment, ISC_ST
|
||||
tdbb->tdbb_quantum = QUANTUM;
|
||||
tdbb->tdbb_request = NULL;
|
||||
tdbb->tdbb_transaction = NULL;
|
||||
tdbb->setDefaultPool(0);
|
||||
Jrd::ContextPoolHolder context(tdbb, 0);
|
||||
tdbb->tdbb_inhibit = 0;
|
||||
tdbb->tdbb_flags = 0;
|
||||
|
||||
@ -4853,7 +4869,7 @@ static void get_options(const UCHAR* dpb,
|
||||
options->dpb_working_directory =
|
||||
get_string_parameter(&p, scratch, &buf_size);
|
||||
|
||||
thdd::getSpecificData((void **) &t_data);
|
||||
ThreadData::getSpecificData((void **) &t_data);
|
||||
|
||||
/*
|
||||
Null value for working_directory implies remote database. So get
|
||||
@ -4893,7 +4909,7 @@ static void get_options(const UCHAR* dpb,
|
||||
t_data = NULL;
|
||||
}
|
||||
/* Null out the thread local data so that further references will fail */
|
||||
thdd::putSpecificData(0);
|
||||
ThreadData::putSpecificData(0);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -5424,6 +5440,8 @@ static Database* init(thread_db* tdbb,
|
||||
tdbb->tdbb_database = dbb;
|
||||
|
||||
ALL_init();
|
||||
// provide context pool for the rest stuff
|
||||
Jrd::ContextPoolHolder context(tdbb, perm);
|
||||
|
||||
dbb->dbb_next = databases;
|
||||
databases = dbb;
|
||||
@ -6175,7 +6193,7 @@ ULONG JRD_shutdown_all()
|
||||
tdbb->tdbb_attachment = attach;
|
||||
tdbb->tdbb_request = NULL;
|
||||
tdbb->tdbb_transaction = NULL;
|
||||
tdbb->setDefaultPool(0);
|
||||
Jrd::ContextPoolHolder context(tdbb, 0);
|
||||
|
||||
++dbb->dbb_use_count;
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "../jrd/nbak.h"
|
||||
#include "../jrd/btn.h"
|
||||
#include "../jrd/all.h"
|
||||
#include "../jrd/jrd_proto.h"
|
||||
#if defined(UNIX) && defined(SUPERSERVER)
|
||||
#include <setjmp.h>
|
||||
#endif
|
||||
@ -911,11 +912,31 @@ const USHORT WIN_garbage_collect = 8; /* scan left a page for garbage collector
|
||||
|
||||
|
||||
// Thread specific database block
|
||||
class thread_db : public thdd
|
||||
class thread_db : public ThreadData
|
||||
{
|
||||
private:
|
||||
JrdMemoryPool* tdbb_default;
|
||||
void setDefaultPool(JrdMemoryPool* p)
|
||||
{
|
||||
tdbb_default = p;
|
||||
}
|
||||
friend class Firebird::SubsystemContextPoolHolder <Jrd::thread_db, JrdMemoryPool>;
|
||||
public:
|
||||
thread_db()
|
||||
: ThreadData(ThreadData::tddDBB)
|
||||
{
|
||||
tdbb_default = 0;
|
||||
tdbb_database = 0;
|
||||
tdbb_attachment = 0;
|
||||
tdbb_transaction = 0;
|
||||
tdbb_request = 0;
|
||||
tdbb_status_vector = 0;
|
||||
tdbb_setjmp = 0;
|
||||
tdbb_inhibit = 0;
|
||||
tdbb_quantum = 0;
|
||||
tdbb_flags = 0;
|
||||
JRD_inuse_clear(this);
|
||||
}
|
||||
Database* tdbb_database;
|
||||
Attachment* tdbb_attachment;
|
||||
jrd_tra* tdbb_transaction;
|
||||
@ -933,11 +954,6 @@ public:
|
||||
sigjmp_buf tdbb_sigsetjmp;
|
||||
#endif
|
||||
|
||||
void setDefaultPool(JrdMemoryPool* p)
|
||||
{
|
||||
thdd::setPool(p);
|
||||
tdbb_default = p;
|
||||
}
|
||||
JrdMemoryPool* getDefaultPool()
|
||||
{
|
||||
return tdbb_default;
|
||||
@ -1032,8 +1048,8 @@ public:
|
||||
#include "../jrd/err_proto.h"
|
||||
|
||||
inline Jrd::thread_db* JRD_get_thread_data() {
|
||||
thdd* p1 = thdd::getSpecific();
|
||||
if (p1 && p1->thdd_type == THDD_TYPE_TDBB)
|
||||
ThreadData* p1 = ThreadData::getSpecific();
|
||||
if (p1 && p1->getType() == ThreadData::tddDBB)
|
||||
{
|
||||
Jrd::thread_db* p2 = (Jrd::thread_db*)p1;
|
||||
if (p2->tdbb_database && MemoryPool::blk_type(p2->tdbb_database) != type_dbb)
|
||||
@ -1044,7 +1060,7 @@ inline Jrd::thread_db* JRD_get_thread_data() {
|
||||
return (Jrd::thread_db*) p1;
|
||||
}
|
||||
inline void CHECK_TDBB(const Jrd::thread_db* tdbb) {
|
||||
fb_assert(tdbb && (tdbb->thdd_type == THDD_TYPE_TDBB) &&
|
||||
fb_assert(tdbb && (tdbb->getType() == ThreadData::tddDBB) &&
|
||||
(!tdbb->tdbb_database ||
|
||||
MemoryPool::blk_type(tdbb->tdbb_database) == type_dbb));
|
||||
}
|
||||
@ -1055,7 +1071,7 @@ inline void CHECK_DBB(const Jrd::Database* dbb) {
|
||||
#else
|
||||
/* PROD_BUILD */
|
||||
inline Jrd::thread_db* JRD_get_thread_data() {
|
||||
return (Jrd::thread_db*) thdd::getSpecific();
|
||||
return (Jrd::thread_db*) ThreadData::getSpecific();
|
||||
}
|
||||
inline void CHECK_DBB(const Jrd::Database* dbb) {
|
||||
}
|
||||
@ -1126,16 +1142,17 @@ extern int debug;
|
||||
inline static void JRD_set_thread_data(Jrd::thread_db* &tdbb, Jrd::thread_db& thd_context)
|
||||
{
|
||||
tdbb = &thd_context;
|
||||
MOVE_CLEAR(tdbb, sizeof(Jrd::thread_db));
|
||||
tdbb->thdd_type = THDD_TYPE_TDBB;
|
||||
tdbb->putSpecific();
|
||||
}
|
||||
|
||||
inline void JRD_restore_thread_data() {
|
||||
thdd::restoreSpecific();
|
||||
ThreadData::restoreSpecific();
|
||||
}
|
||||
|
||||
|
||||
namespace Jrd {
|
||||
typedef Firebird::SubsystemContextPoolHolder <Jrd::thread_db, JrdMemoryPool>
|
||||
ContextPoolHolder;
|
||||
}
|
||||
|
||||
#endif /* JRD_JRD_H */
|
||||
|
||||
|
@ -155,6 +155,7 @@ void JRD_mutex_unlock(struct mutx_t *);
|
||||
bool JRD_reschedule(Jrd::thread_db*, SLONG, bool);
|
||||
void JRD_restore_context(void);
|
||||
void JRD_set_context(Jrd::thread_db*);
|
||||
void JRD_inuse_clear(Jrd::thread_db* tdbb);
|
||||
void JRD_unblock(Jrd::BlockingThread**);
|
||||
void JRD_wlck_lock(struct mutx_t *);
|
||||
void JRD_wlck_unlock(struct mutx_t *);
|
||||
|
@ -37,7 +37,7 @@
|
||||
* 2004.01.16 Vlad Horsun: added support for default parameters
|
||||
*/
|
||||
/*
|
||||
$Id: met.epp,v 1.136 2004-08-27 04:45:55 robocop Exp $
|
||||
$Id: met.epp,v 1.137 2004-08-30 18:10:41 alexpeshkoff Exp $
|
||||
*/
|
||||
// This MUST be at the top of the file
|
||||
#ifdef DARWIN
|
||||
@ -2425,12 +2425,11 @@ void MET_parse_sys_trigger(thread_db* tdbb, jrd_rel* relation)
|
||||
const USHORT par_flags = (USHORT)
|
||||
((trig_flags & TRG_ignore_perm) ? csb_ignore_perm : 0);
|
||||
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(JrdMemoryPool::createPool());
|
||||
{
|
||||
Jrd::ContextPoolHolder context(tdbb, JrdMemoryPool::createPool());
|
||||
PAR_blr(tdbb, relation, blr, NULL, NULL,
|
||||
&request, true, par_flags);
|
||||
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
}
|
||||
|
||||
request->req_trg_name = name;
|
||||
|
||||
@ -2521,7 +2520,6 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags)
|
||||
jrd_req* request;
|
||||
jrd_req* request2;
|
||||
vec::iterator ptr, end;
|
||||
JrdMemoryPool *old_pool;
|
||||
jrd_nod* node;
|
||||
Format* format;
|
||||
Format::fmt_desc_iterator desc;
|
||||
@ -2697,18 +2695,15 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags)
|
||||
F.RDB$FIELD_SUB_TYPE, F.RDB$CHARACTER_SET_ID,
|
||||
F.RDB$COLLATION_ID);
|
||||
|
||||
if ((PA.RDB$PARAMETER_TYPE == 0) && !F.RDB$DEFAULT_VALUE.NULL) {
|
||||
if ((PA.RDB$PARAMETER_TYPE == 0) && !F.RDB$DEFAULT_VALUE.NULL)
|
||||
{
|
||||
procedure->prc_defaults++;
|
||||
|
||||
old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(JrdMemoryPool::createPool());
|
||||
|
||||
Jrd::ContextPoolHolder context(tdbb, JrdMemoryPool::createPool());
|
||||
CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), 5);
|
||||
parameter->prm_default_val =
|
||||
parse_param_blr(tdbb, procedure, &F.RDB$DEFAULT_VALUE, csb);
|
||||
|
||||
delete csb;
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
}
|
||||
|
||||
END_FOR;
|
||||
@ -2744,8 +2739,8 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags)
|
||||
format->fmt_length = (USHORT) length;
|
||||
}
|
||||
|
||||
old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(JrdMemoryPool::createPool());
|
||||
{
|
||||
Jrd::ContextPoolHolder context(tdbb, JrdMemoryPool::createPool());
|
||||
CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), 5);
|
||||
// Now, check the result of this function here! Null pointer means failure.
|
||||
// Or should parse_procedure_blr and its callee throw exceptions instead?
|
||||
@ -2767,7 +2762,7 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags)
|
||||
}
|
||||
}
|
||||
delete csb;
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
}
|
||||
|
||||
END_FOR;
|
||||
|
||||
@ -3246,8 +3241,7 @@ void MET_scan_relation( thread_db* tdbb, jrd_rel* relation)
|
||||
for (USHORT itr = 0; itr < TRIGGER_MAX; ++itr) {
|
||||
triggers[itr] = NULL;
|
||||
}
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(dbb->dbb_permanent);
|
||||
Jrd::ContextPoolHolder context(tdbb, dbb->dbb_permanent);
|
||||
|
||||
/* If anything errors, catch it to reset the scan flag. This will
|
||||
make sure that the error will be caught if the operation is tried
|
||||
@ -3506,7 +3500,6 @@ void MET_scan_relation( thread_db* tdbb, jrd_rel* relation)
|
||||
THD_rec_mutex_unlock(&dbb->dbb_sp_rec_mutex);
|
||||
#endif
|
||||
relation->rel_current_format = NULL;
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
|
||||
} // try
|
||||
catch (const std::exception&) {
|
||||
@ -3520,7 +3513,6 @@ void MET_scan_relation( thread_db* tdbb, jrd_rel* relation)
|
||||
#ifdef SUPERSERVER
|
||||
THD_rec_mutex_unlock(&dbb->dbb_sp_rec_mutex);
|
||||
#endif
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -3659,7 +3651,7 @@ static int blocking_ast_procedure(void* ast_object)
|
||||
tdbb->tdbb_quantum = QUANTUM;
|
||||
tdbb->tdbb_request = NULL;
|
||||
tdbb->tdbb_transaction = NULL;
|
||||
tdbb->setDefaultPool(0);
|
||||
Jrd::ContextPoolHolder context(tdbb, 0);
|
||||
|
||||
if (procedure->prc_existence_lock) {
|
||||
LCK_release(tdbb, procedure->prc_existence_lock);
|
||||
@ -3702,7 +3694,7 @@ static int blocking_ast_relation(void* ast_object)
|
||||
tdbb->tdbb_quantum = QUANTUM;
|
||||
tdbb->tdbb_request = NULL;
|
||||
tdbb->tdbb_transaction = NULL;
|
||||
tdbb->setDefaultPool(0);
|
||||
Jrd::ContextPoolHolder context(tdbb, 0);
|
||||
|
||||
if (relation->rel_use_count) {
|
||||
relation->rel_flags |= REL_blocking;
|
||||
|
@ -1604,7 +1604,7 @@ static bool get_record(
|
||||
rpb,
|
||||
rsb,
|
||||
request->req_transaction,
|
||||
reinterpret_cast<blk*>(request->req_pool));
|
||||
request->req_pool);
|
||||
|
||||
temporary_key value;
|
||||
if (result)
|
||||
|
@ -3141,13 +3141,13 @@ static bool expression_equal(thread_db* tdbb, OptimizerBlk* opt,
|
||||
fb_assert(idx->idx_expression_request->req_caller == NULL);
|
||||
idx->idx_expression_request->req_caller = tdbb->tdbb_request;
|
||||
tdbb->tdbb_request = idx->idx_expression_request;
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(tdbb->tdbb_request->req_pool);
|
||||
bool result = false;
|
||||
{
|
||||
Jrd::ContextPoolHolder(tdbb, tdbb->tdbb_request->req_pool);
|
||||
|
||||
bool result = expression_equal2(tdbb, opt, idx->idx_expression,
|
||||
result = expression_equal2(tdbb, opt, idx->idx_expression,
|
||||
node, stream);
|
||||
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
}
|
||||
tdbb->tdbb_request = idx->idx_expression_request->req_caller;
|
||||
idx->idx_expression_request->req_caller = NULL;
|
||||
|
||||
|
@ -154,10 +154,9 @@ bool PCMET_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork* work,
|
||||
|
||||
/* allocate a new pool to contain the expression tree
|
||||
for the expression index */
|
||||
|
||||
JrdMemoryPool* const old_pool = tdbb->getDefaultPool();
|
||||
new_pool = JrdMemoryPool::createPool();
|
||||
tdbb->setDefaultPool(new_pool);
|
||||
{
|
||||
Jrd::ContextPoolHolder context(tdbb, new_pool);
|
||||
MET_scan_relation(tdbb, relation);
|
||||
|
||||
if (!IDX.RDB$EXPRESSION_BLR.NULL)
|
||||
@ -168,7 +167,7 @@ bool PCMET_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork* work,
|
||||
&csb,
|
||||
IDX.RDB$INDEX_NAME,
|
||||
obj_expression_index);
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
}
|
||||
|
||||
/* fake a description of the index */
|
||||
|
||||
@ -288,12 +287,12 @@ void PCMET_lookup_index(thread_db* tdbb, jrd_rel* relation, index_desc* idx)
|
||||
tree and request in its own pool so that it may be cached
|
||||
with the index block in the "permanent" metadata cache */
|
||||
|
||||
JrdMemoryPool* const old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(JrdMemoryPool::createPool());
|
||||
{
|
||||
Jrd::ContextPoolHolder(tdbb, JrdMemoryPool::createPool());
|
||||
idx->idx_expression =
|
||||
MET_parse_blob(tdbb, relation, &IDX.RDB$EXPRESSION_BLR, &csb,
|
||||
&idx->idx_expression_request, false, false);
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
}
|
||||
|
||||
END_FOR;
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*
|
||||
* $Id: rse.cpp,v 1.75 2004-08-17 11:28:49 dimitr Exp $
|
||||
* $Id: rse.cpp,v 1.76 2004-08-30 18:10:42 alexpeshkoff Exp $
|
||||
*
|
||||
* 2001.07.28: John Bellardo: Implemented rse_skip and made rse_first work with
|
||||
* seekable streams.
|
||||
@ -2251,7 +2251,7 @@ static bool get_record(thread_db* tdbb,
|
||||
rpb,
|
||||
rsb,
|
||||
request->req_transaction,
|
||||
(BLK) request->req_pool,
|
||||
request->req_pool,
|
||||
(mode == RSE_get_backward),
|
||||
false))
|
||||
{
|
||||
@ -2281,7 +2281,7 @@ static bool get_record(thread_db* tdbb,
|
||||
}
|
||||
#endif
|
||||
if (VIO_get(tdbb, rpb, rsb, request->req_transaction,
|
||||
(BLK) request->req_pool))
|
||||
request->req_pool))
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
|
@ -220,7 +220,7 @@ void SCH_abort(void)
|
||||
|
||||
/* See if we can find thread. If not, don't worry about it */
|
||||
|
||||
const FB_THREAD_ID id = thdd::getId();
|
||||
const FB_THREAD_ID id = ThreadData::getId();
|
||||
THREAD thread;
|
||||
for (THREAD* ptr = &active_thread; thread = *ptr; ptr = &thread->thread_next) {
|
||||
if (thread->thread_id == id)
|
||||
@ -295,7 +295,7 @@ void SCH_ast(enum ast_t action)
|
||||
break;
|
||||
|
||||
case AST_init:
|
||||
ast_thread->thread_id = thdd::getId();
|
||||
ast_thread->thread_id = ThreadData::getId();
|
||||
break;
|
||||
|
||||
/* Check out of thread scheduler as AST thread */
|
||||
@ -400,7 +400,7 @@ void SCH_enter(void)
|
||||
free_threads = NULL;
|
||||
thread->thread_next = thread->thread_prior = thread;
|
||||
thread->thread_flags = 0;
|
||||
thread->thread_id = thdd::getId();
|
||||
thread->thread_id = ThreadData::getId();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -417,7 +417,7 @@ void SCH_enter(void)
|
||||
}
|
||||
|
||||
THREAD thread = alloc_thread();
|
||||
thread->thread_id = thdd::getId();
|
||||
thread->thread_id = ThreadData::getId();
|
||||
|
||||
/* Link thread block into circular list of active threads */
|
||||
|
||||
@ -595,7 +595,7 @@ bool SCH_thread_enter_check(void)
|
||||
|
||||
/* if active thread is not null and thread_id matches the we are the
|
||||
active thread */
|
||||
if ((active_thread) && (active_thread->thread_id == thdd::getId()))
|
||||
if ((active_thread) && (active_thread->thread_id == ThreadData::getId()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -624,7 +624,7 @@ bool SCH_validate(void)
|
||||
}
|
||||
|
||||
#ifdef MULTI_THREAD
|
||||
if (active_thread->thread_id != thdd::getId()) {
|
||||
if (active_thread->thread_id != ThreadData::getId()) {
|
||||
gds__log("SCH_validate -- wrong thread");
|
||||
return false;
|
||||
}
|
||||
@ -705,7 +705,7 @@ static bool ast_enable(void)
|
||||
return false;
|
||||
|
||||
if (ast_thread->thread_flags & THREAD_ast_active &&
|
||||
ast_thread->thread_id == thdd::getId())
|
||||
ast_thread->thread_id == ThreadData::getId())
|
||||
return false;
|
||||
|
||||
if (!ast_thread->thread_count || !--ast_thread->thread_count) {
|
||||
@ -739,11 +739,11 @@ static void ast_disable(void)
|
||||
return;
|
||||
|
||||
if (ast_thread->thread_flags & THREAD_ast_active) {
|
||||
if (ast_thread->thread_id == thdd::getId())
|
||||
if (ast_thread->thread_id == ThreadData::getId())
|
||||
return;
|
||||
else {
|
||||
if (active_thread
|
||||
&& active_thread->thread_id == thdd::getId())
|
||||
&& active_thread->thread_id == ThreadData::getId())
|
||||
{
|
||||
stall(active_thread);
|
||||
return;
|
||||
|
@ -58,7 +58,7 @@
|
||||
#ifdef VMS
|
||||
// THE SOLE PURPOSE OF THE FOLLOWING DECLARATION IS TO ALLOW THE VMS KIT TO
|
||||
// COMPILE. IT IS NOT CORRECT AND MUST BE REMOVED AT SOME POINT.
|
||||
thdd* gdbb;
|
||||
ThreadData* gdbb;
|
||||
#endif
|
||||
|
||||
#ifdef VMS
|
||||
@ -136,7 +136,7 @@ Firebird::Mutex ib_mutex;
|
||||
namespace {
|
||||
|
||||
TLS_DECLARE (void*, tSpecific);
|
||||
TLS_DECLARE (thdd*, tData);
|
||||
TLS_DECLARE (ThreadData*, tData);
|
||||
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ int API_ROUTINE gds__thread_start(
|
||||
|
||||
int rc = 0;
|
||||
try {
|
||||
thdd::start(entrypoint, arg, priority, flags, thd_id);
|
||||
ThreadData::start(entrypoint, arg, priority, flags, thd_id);
|
||||
}
|
||||
catch(const Firebird::status_exception& status) {
|
||||
rc = status.value()[1];
|
||||
@ -168,7 +168,7 @@ int API_ROUTINE gds__thread_start(
|
||||
}
|
||||
|
||||
|
||||
FB_THREAD_ID thdd::getId(void)
|
||||
FB_THREAD_ID ThreadData::getId(void)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -206,7 +206,7 @@ FB_THREAD_ID thdd::getId(void)
|
||||
}
|
||||
|
||||
|
||||
thdd* thdd::getSpecific(void)
|
||||
ThreadData* ThreadData::getSpecific(void)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -223,7 +223,7 @@ thdd* thdd::getSpecific(void)
|
||||
}
|
||||
|
||||
|
||||
void thdd::getSpecificData(void **t_data)
|
||||
void ThreadData::getSpecificData(void **t_data)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -311,7 +311,7 @@ int THD_wlck_unlock(WLCK_T* wlock)
|
||||
}
|
||||
|
||||
|
||||
void thdd::putSpecific()
|
||||
void ThreadData::putSpecific()
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -323,12 +323,12 @@ void thdd::putSpecific()
|
||||
*
|
||||
**************************************/
|
||||
|
||||
thdd_prior_context = TLS_GET(tData);
|
||||
threadDataPriorContext = TLS_GET(tData);
|
||||
TLS_SET(tData, this);
|
||||
}
|
||||
|
||||
|
||||
void thdd::putSpecificData(void *t_data)
|
||||
void ThreadData::putSpecificData(void *t_data)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -345,7 +345,7 @@ void thdd::putSpecificData(void *t_data)
|
||||
}
|
||||
|
||||
|
||||
void thdd::restoreSpecific()
|
||||
void ThreadData::restoreSpecific()
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -356,9 +356,9 @@ void thdd::restoreSpecific()
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
thdd* current_context = getSpecific();
|
||||
ThreadData* current_context = getSpecific();
|
||||
|
||||
TLS_SET(tData, current_context->thdd_prior_context);
|
||||
TLS_SET(tData, current_context->threadDataPriorContext);
|
||||
}
|
||||
|
||||
|
||||
@ -410,12 +410,12 @@ int THD_rec_mutex_lock(REC_MUTX_T * rec_mutex)
|
||||
**************************************/
|
||||
int ret;
|
||||
|
||||
if (rec_mutex->rec_mutx_id == thdd::getId())
|
||||
if (rec_mutex->rec_mutx_id == ThreadData::getId())
|
||||
rec_mutex->rec_mutx_count++;
|
||||
else {
|
||||
if (ret = THD_mutex_lock(rec_mutex->rec_mutx_mtx))
|
||||
return ret;
|
||||
rec_mutex->rec_mutx_id = thdd::getId();
|
||||
rec_mutex->rec_mutx_id = ThreadData::getId();
|
||||
rec_mutex->rec_mutx_count = 1;
|
||||
}
|
||||
return 0;
|
||||
@ -434,7 +434,7 @@ int THD_rec_mutex_unlock(REC_MUTX_T * rec_mutex)
|
||||
*
|
||||
**************************************/
|
||||
|
||||
if (rec_mutex->rec_mutx_id != thdd::getId())
|
||||
if (rec_mutex->rec_mutx_id != ThreadData::getId())
|
||||
return FB_FAILURE;
|
||||
|
||||
rec_mutex->rec_mutx_count--;
|
||||
@ -635,7 +635,7 @@ static THREAD_ENTRY_DECLARE threadStart(THREAD_ENTRY_PARAM arg) {
|
||||
|
||||
#else //THREAD_PSCHED
|
||||
|
||||
// due to same names of parameters for various thdd::start(...),
|
||||
// due to same names of parameters for various ThreadData::start(...),
|
||||
// we may use common macro for various platforms
|
||||
#define THREAD_ENTRYPOINT reinterpret_cast<THREAD_ENTRY_RETURN (THREAD_ENTRY_CALL *) (THREAD_ENTRY_PARAM)>(routine)
|
||||
#define THREAD_ARG reinterpret_cast<THREAD_ENTRY_PARAM>(arg)
|
||||
@ -645,7 +645,7 @@ static THREAD_ENTRY_DECLARE threadStart(THREAD_ENTRY_PARAM arg) {
|
||||
#ifdef ANY_THREADING
|
||||
#ifdef USE_POSIX_THREADS
|
||||
#define START_THREAD
|
||||
void thdd::start(ThreadEntryPoint* routine,
|
||||
void ThreadData::start(ThreadEntryPoint* routine,
|
||||
void *arg,
|
||||
int priority_arg,
|
||||
int flags,
|
||||
@ -738,7 +738,7 @@ void thdd::start(ThreadEntryPoint* routine,
|
||||
|
||||
#ifdef SOLARIS_MT
|
||||
#define START_THREAD
|
||||
void thdd::start(ThreadEntryPoint* routine,
|
||||
void ThreadData::start(ThreadEntryPoint* routine,
|
||||
void *arg,
|
||||
int priority_arg,
|
||||
int flags,
|
||||
@ -782,7 +782,7 @@ void thdd::start(ThreadEntryPoint* routine,
|
||||
|
||||
#ifdef WIN_NT
|
||||
#define START_THREAD
|
||||
void thdd::start(ThreadEntryPoint* routine,
|
||||
void ThreadData::start(ThreadEntryPoint* routine,
|
||||
void *arg,
|
||||
int priority_arg,
|
||||
int flags,
|
||||
@ -886,7 +886,7 @@ void thdd::start(ThreadEntryPoint* routine,
|
||||
|
||||
|
||||
#ifndef START_THREAD
|
||||
void thdd::start(ThreadEntryPoint* routine,
|
||||
void ThreadData::start(ThreadEntryPoint* routine,
|
||||
void *arg,
|
||||
int priority_arg,
|
||||
int flags,
|
||||
|
@ -26,7 +26,7 @@
|
||||
*
|
||||
*/
|
||||
/*
|
||||
$Id: thd.h,v 1.36 2004-08-27 17:39:34 skidder Exp $
|
||||
$Id: thd.h,v 1.37 2004-08-30 18:10:42 alexpeshkoff Exp $
|
||||
*/
|
||||
|
||||
#ifndef JRD_THD_H
|
||||
@ -126,15 +126,31 @@ const int SWEEP_QUANTUM = 10; /* Make sweeps less disruptive */
|
||||
// The definition inside the thdd class should be replaced with the following one.
|
||||
typedef THREAD_ENTRY_DECLARE ThreadEntryPoint(THREAD_ENTRY_PARAM);
|
||||
|
||||
class thdd
|
||||
class ThreadData
|
||||
{
|
||||
public:
|
||||
thdd* thdd_prior_context;
|
||||
ULONG thdd_type; /* what kind of thread context this is */
|
||||
//public:
|
||||
// typedef THREAD_ENTRY_DECLARE EntryPoint(THREAD_ENTRY_PARAM);
|
||||
enum ThreadDataType {
|
||||
tddGBL = 1, // used by backup/restore
|
||||
tddSQL = 2, // used by DSQL
|
||||
tddDBB = 3, // used in engine
|
||||
tddRDB = 4, // used in remote interface
|
||||
tddDBA = 5, // used in DBA utility
|
||||
tddIDB = 6, // used by interprocess server // ??
|
||||
tddALICE = 7, // used by gfix
|
||||
tddSEC = 8, // used by gsec
|
||||
};
|
||||
private:
|
||||
ThreadData* threadDataPriorContext;
|
||||
ThreadDataType threadDataType; // what kind of thread context this is
|
||||
|
||||
public:
|
||||
ThreadData(ThreadDataType t)
|
||||
: threadDataPriorContext(0), threadDataType(t) {}
|
||||
ThreadDataType getType() const
|
||||
{
|
||||
return threadDataType;
|
||||
}
|
||||
|
||||
static void start(ThreadEntryPoint* routine,
|
||||
void* arg,
|
||||
int priority_arg,
|
||||
@ -142,66 +158,15 @@ public:
|
||||
void* thd_id);
|
||||
static void init(void) {}
|
||||
static void cleanup(void) {}
|
||||
static thdd* getSpecific(void);
|
||||
static ThreadData* getSpecific(void);
|
||||
void putSpecific();
|
||||
static void restoreSpecific(void);
|
||||
static FB_THREAD_ID getId(void);
|
||||
static void getSpecificData(void** t_data);
|
||||
static void putSpecificData(void* t_data);
|
||||
|
||||
private:
|
||||
MemoryPool* thdd_pool;
|
||||
|
||||
public:
|
||||
thdd() : thdd_prior_context(NULL), thdd_type(0), thdd_pool(NULL) {}
|
||||
|
||||
void makeDefaultPool()
|
||||
{
|
||||
thdd* previous = getSpecific();
|
||||
if (previous)
|
||||
{
|
||||
thdd_pool = &previous->getPool();
|
||||
}
|
||||
if (! thdd_pool)
|
||||
{
|
||||
thdd_pool = getDefaultMemoryPool();
|
||||
}
|
||||
}
|
||||
|
||||
void setPool(MemoryPool* p)
|
||||
{
|
||||
if (p)
|
||||
{
|
||||
thdd_pool = p;
|
||||
}
|
||||
else
|
||||
{
|
||||
makeDefaultPool();
|
||||
}
|
||||
}
|
||||
|
||||
MemoryPool& getPool()
|
||||
{
|
||||
return *thdd_pool;
|
||||
}
|
||||
|
||||
static MemoryPool& getDefaultPool()
|
||||
{
|
||||
return getSpecific()->getPool();
|
||||
}
|
||||
};
|
||||
|
||||
/* Thread structure types */
|
||||
|
||||
const USHORT THDD_TYPE_TGBL = 1; /* used by backup/restore */
|
||||
const USHORT THDD_TYPE_TSQL = 2; /* used by DSQL */
|
||||
const USHORT THDD_TYPE_TDBB = 3; /* used in engine */
|
||||
const USHORT THDD_TYPE_TRDB = 4; /* used in remote interface */
|
||||
const USHORT THDD_TYPE_TDBA = 5; /* used in DBA utility */
|
||||
const USHORT THDD_TYPE_TIDB = 6; /* used by interprocess server */
|
||||
const USHORT THDD_TYPE_TALICE = 7; /* used by gfix */
|
||||
const USHORT THDD_TYPE_TSEC = 8; /* used by gsec */
|
||||
|
||||
/* General purpose in use object structure */
|
||||
|
||||
struct iuo {
|
||||
|
@ -361,7 +361,7 @@ void TRA_commit(thread_db* tdbb, jrd_tra* transaction, const bool retaining_flag
|
||||
if (transaction->tra_flags & TRA_invalidated)
|
||||
ERR_post(isc_trans_invalid, 0);
|
||||
|
||||
tdbb->setDefaultPool(transaction->tra_pool);
|
||||
Jrd::ContextPoolHolder context(tdbb, transaction->tra_pool);
|
||||
|
||||
/* Perform any meta data work deferred */
|
||||
|
||||
@ -758,8 +758,7 @@ void TRA_post_resources(thread_db* tdbb, jrd_tra* transaction, ResourceList& res
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
JrdMemoryPool* const old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(transaction->tra_pool);
|
||||
Jrd::ContextPoolHolder context(tdbb, transaction->tra_pool);
|
||||
|
||||
for (Resource* rsc = resources.begin(); rsc < resources.end(); rsc++)
|
||||
{
|
||||
@ -792,8 +791,6 @@ void TRA_post_resources(thread_db* tdbb, jrd_tra* transaction, ResourceList& res
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
}
|
||||
|
||||
|
||||
@ -939,7 +936,7 @@ jrd_tra* TRA_reconnect(thread_db* tdbb, const UCHAR* id, USHORT length)
|
||||
ERR_post(isc_read_only_database, 0);
|
||||
|
||||
|
||||
tdbb->setDefaultPool(JrdMemoryPool::createPool());
|
||||
Jrd::ContextPoolHolder context(tdbb, JrdMemoryPool::createPool());
|
||||
jrd_tra* trans = FB_NEW_RPT(*tdbb->getDefaultPool(), 0) jrd_tra(*tdbb->getDefaultPool());
|
||||
trans->tra_pool = tdbb->getDefaultPool();
|
||||
trans->tra_number = gds__vax_integer(id, length);
|
||||
@ -1095,7 +1092,7 @@ void TRA_rollback(thread_db* tdbb, jrd_tra* transaction, const bool retaining_fl
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
tdbb->setDefaultPool(transaction->tra_pool);
|
||||
Jrd::ContextPoolHolder context(tdbb, transaction->tra_pool);
|
||||
|
||||
/* Check in with external file system */
|
||||
|
||||
@ -1424,7 +1421,7 @@ jrd_tra* TRA_start(thread_db* tdbb, int tpb_length, const SCHAR* tpb)
|
||||
transaction block first, sieze relation locks, the go ahead and
|
||||
make up the real transaction block. */
|
||||
|
||||
tdbb->setDefaultPool(JrdMemoryPool::createPool());
|
||||
Jrd::ContextPoolHolder context(tdbb, JrdMemoryPool::createPool());
|
||||
jrd_tra* temp = FB_NEW_RPT(*tdbb->getDefaultPool(), 0) jrd_tra(*tdbb->getDefaultPool());
|
||||
temp->tra_pool = tdbb->getDefaultPool();
|
||||
transaction_options(tdbb, temp, reinterpret_cast<const UCHAR*>(tpb),
|
||||
|
@ -688,7 +688,6 @@ bool VAL_validate(thread_db* tdbb, USHORT switches)
|
||||
**************************************/
|
||||
struct vdr control;
|
||||
JrdMemoryPool* val_pool = 0;
|
||||
JrdMemoryPool* old_pool = 0;
|
||||
|
||||
SET_TDBB(tdbb);
|
||||
Database* dbb = tdbb->tdbb_database;
|
||||
@ -696,9 +695,8 @@ bool VAL_validate(thread_db* tdbb, USHORT switches)
|
||||
|
||||
try {
|
||||
|
||||
old_pool = tdbb->getDefaultPool();
|
||||
val_pool = 0;
|
||||
tdbb->setDefaultPool(val_pool = JrdMemoryPool::createPool());
|
||||
val_pool = JrdMemoryPool::createPool();
|
||||
Jrd::ContextPoolHolder context(tdbb, val_pool);
|
||||
|
||||
control.vdr_page_bitmap = NULL;
|
||||
control.vdr_flags = 0;
|
||||
@ -735,18 +733,16 @@ bool VAL_validate(thread_db* tdbb, USHORT switches)
|
||||
garbage_collect(tdbb, &control);
|
||||
CCH_flush(tdbb, FLUSH_FINI, 0);
|
||||
|
||||
JrdMemoryPool::deletePool(val_pool);
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
tdbb->tdbb_flags &= ~TDBB_sweeper;
|
||||
} // try
|
||||
catch (const std::exception& ex) {
|
||||
Firebird::stuff_exception(tdbb->tdbb_status_vector, ex);
|
||||
JrdMemoryPool::deletePool(val_pool);
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
tdbb->tdbb_flags &= ~TDBB_sweeper;
|
||||
return false;
|
||||
}
|
||||
|
||||
JrdMemoryPool::deletePool(val_pool);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ void VIO_backout(thread_db* tdbb, record_param* rpb, const jrd_tra* transaction)
|
||||
CCH_RELEASE(tdbb, &temp.rpb_window);
|
||||
else {
|
||||
temp.rpb_record = VIO_gc_record(tdbb, relation);
|
||||
VIO_data(tdbb, &temp, reinterpret_cast<blk*>(dbb->dbb_permanent));
|
||||
VIO_data(tdbb, &temp, dbb->dbb_permanent);
|
||||
data = temp.rpb_prior;
|
||||
old_data = temp.rpb_record;
|
||||
rpb->rpb_prior = temp.rpb_prior;
|
||||
@ -297,8 +297,7 @@ void VIO_backout(thread_db* tdbb, record_param* rpb, const jrd_tra* transaction)
|
||||
if (temp.rpb_flags & rpb_deleted)
|
||||
CCH_RELEASE(tdbb, &temp.rpb_window);
|
||||
else
|
||||
VIO_data(tdbb, &temp,
|
||||
reinterpret_cast<blk*>(dbb->dbb_permanent));
|
||||
VIO_data(tdbb, &temp, dbb->dbb_permanent);
|
||||
gc_rec1 = temp.rpb_record;
|
||||
temp.rpb_page = rpb->rpb_b_page;
|
||||
temp.rpb_line = rpb->rpb_b_line;
|
||||
@ -462,7 +461,7 @@ void VIO_bump_count(thread_db* tdbb, USHORT count_id, jrd_rel* relation, bool er
|
||||
|
||||
bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb, RecordSource* rsb,
|
||||
jrd_tra* transaction,
|
||||
BLK pool, bool writelock)
|
||||
JrdMemoryPool* pool, bool writelock)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -1025,7 +1024,7 @@ bool VIO_check_if_updated(thread_db* tdbb, record_param* rpb)
|
||||
#endif
|
||||
|
||||
|
||||
void VIO_data(thread_db* tdbb, record_param* rpb, BLK pool)
|
||||
void VIO_data(thread_db* tdbb, record_param* rpb, JrdMemoryPool* pool)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -1066,7 +1065,7 @@ void VIO_data(thread_db* tdbb, record_param* rpb, BLK pool)
|
||||
the format block and set up the record block. This is a performance
|
||||
optimization. */
|
||||
|
||||
Record* record = VIO_record(tdbb, rpb, 0, (JrdMemoryPool*) pool);
|
||||
Record* record = VIO_record(tdbb, rpb, 0, pool);
|
||||
const Format* format = record->rec_format;
|
||||
|
||||
/* If the record is a delta version, start with data from prior record. */
|
||||
@ -1686,7 +1685,7 @@ Record* VIO_gc_record(thread_db* tdbb, jrd_rel* relation)
|
||||
}
|
||||
|
||||
|
||||
bool VIO_get(thread_db* tdbb, record_param* rpb, RecordSource* rsb, jrd_tra* transaction, BLK pool)
|
||||
bool VIO_get(thread_db* tdbb, record_param* rpb, RecordSource* rsb, jrd_tra* transaction, JrdMemoryPool* pool)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -1750,7 +1749,10 @@ bool VIO_get(thread_db* tdbb, record_param* rpb, RecordSource* rsb, jrd_tra* tra
|
||||
|
||||
bool VIO_get_current(
|
||||
thread_db* tdbb,
|
||||
record_param* rpb, jrd_tra* transaction, BLK pool, bool foreign_key)
|
||||
record_param* rpb,
|
||||
jrd_tra* transaction,
|
||||
JrdMemoryPool* pool,
|
||||
bool foreign_key)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2028,13 +2030,12 @@ static void RefetchRecord(thread_db* tdbb, record_param* rpb, jrd_tra* transacti
|
||||
if ((!DPM_get(tdbb, rpb, LCK_read)) ||
|
||||
(!VIO_chase_record_version
|
||||
(tdbb, rpb, NULL, transaction,
|
||||
reinterpret_cast<blk*>(tdbb->getDefaultPool()),
|
||||
tdbb->getDefaultPool(),
|
||||
false)))
|
||||
{
|
||||
ERR_post(isc_deadlock, isc_arg_gds, isc_update_conflict, 0);
|
||||
}
|
||||
VIO_data(tdbb, rpb,
|
||||
reinterpret_cast<blk*>(tdbb->tdbb_request->req_pool));
|
||||
VIO_data(tdbb, rpb, tdbb->tdbb_request->req_pool);
|
||||
|
||||
/* If record is present, and the transaction is read committed,
|
||||
* make sure the record has not been updated. Also, punt after
|
||||
@ -2332,12 +2333,11 @@ bool VIO_writelock(thread_db* tdbb, record_param* org_rpb, RecordSource* rsb,
|
||||
if ((!DPM_get(tdbb, org_rpb, LCK_read)) ||
|
||||
(!VIO_chase_record_version
|
||||
(tdbb, org_rpb, NULL, transaction,
|
||||
reinterpret_cast<blk*>(tdbb->getDefaultPool()), true)))
|
||||
tdbb->getDefaultPool(), true)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
VIO_data(tdbb, org_rpb,
|
||||
reinterpret_cast<blk*>(tdbb->tdbb_request->req_pool));
|
||||
VIO_data(tdbb, org_rpb, tdbb->tdbb_request->req_pool);
|
||||
|
||||
org_rpb->rpb_stream_flags &= ~RPB_s_refetch;
|
||||
|
||||
@ -2403,7 +2403,7 @@ bool VIO_next_record(thread_db* tdbb,
|
||||
record_param* rpb,
|
||||
RecordSource* rsb,
|
||||
jrd_tra* transaction,
|
||||
BLK pool, bool backwards, bool onepage)
|
||||
JrdMemoryPool* pool, bool backwards, bool onepage)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2861,12 +2861,12 @@ void VIO_verb_cleanup(thread_db* tdbb, jrd_tra* transaction)
|
||||
}
|
||||
|
||||
Savepoint* sav_point = transaction->tra_save_point;
|
||||
if (!sav_point) {
|
||||
if (!sav_point)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(transaction->tra_pool);
|
||||
Jrd::ContextPoolHolder context(tdbb, transaction->tra_pool);
|
||||
|
||||
// If the current to-be-cleaned-up savepoint is very big, and the next
|
||||
// level savepoint is the transaction level savepoint, then get rid of
|
||||
@ -2933,8 +2933,7 @@ void VIO_verb_cleanup(thread_db* tdbb, jrd_tra* transaction)
|
||||
BUGCHECK(186); /* msg 186 record disappeared */
|
||||
}
|
||||
if (rpb.rpb_flags & rpb_delta) {
|
||||
VIO_data(tdbb, &rpb,
|
||||
reinterpret_cast<blk*>(tdbb->getDefaultPool()));
|
||||
VIO_data(tdbb, &rpb, tdbb->getDefaultPool());
|
||||
}
|
||||
else {
|
||||
CCH_RELEASE(tdbb, &rpb.rpb_window);
|
||||
@ -2967,8 +2966,7 @@ void VIO_verb_cleanup(thread_db* tdbb, jrd_tra* transaction)
|
||||
BUGCHECK(186); /* msg 186 record disappeared */
|
||||
}
|
||||
if (rpb.rpb_flags & rpb_delta) {
|
||||
VIO_data(tdbb, &rpb,
|
||||
reinterpret_cast<blk*>(tdbb->getDefaultPool()));
|
||||
VIO_data(tdbb, &rpb, tdbb->getDefaultPool());
|
||||
}
|
||||
else {
|
||||
CCH_RELEASE(tdbb, &rpb.rpb_window);
|
||||
@ -2987,8 +2985,7 @@ void VIO_verb_cleanup(thread_db* tdbb, jrd_tra* transaction)
|
||||
if (!DPM_get(tdbb, &rpb, LCK_write)) {
|
||||
BUGCHECK(186); /* msg 186 record disappeared */
|
||||
}
|
||||
VIO_data(tdbb, &rpb,
|
||||
reinterpret_cast<blk*>(tdbb->getDefaultPool()));
|
||||
VIO_data(tdbb, &rpb, tdbb->getDefaultPool());
|
||||
}
|
||||
update_in_place(tdbb, transaction, &rpb, &new_rpb);
|
||||
if (!(transaction->tra_flags & TRA_system)) {
|
||||
@ -3071,8 +3068,6 @@ void VIO_verb_cleanup(thread_db* tdbb, jrd_tra* transaction)
|
||||
{
|
||||
VIO_verb_cleanup(tdbb, transaction); // get rid of savepoint
|
||||
}
|
||||
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
}
|
||||
|
||||
|
||||
@ -3921,8 +3916,7 @@ static void list_staying(thread_db* tdbb, record_param* rpb, RecordStack& stayin
|
||||
CCH_RELEASE(tdbb, &temp.rpb_window);
|
||||
}
|
||||
else {
|
||||
VIO_data(tdbb, &temp,
|
||||
reinterpret_cast<blk*>(tdbb->getDefaultPool()));
|
||||
VIO_data(tdbb, &temp, tdbb->getDefaultPool());
|
||||
staying.push(temp.rpb_record);
|
||||
data = temp.rpb_record;
|
||||
}
|
||||
@ -4418,7 +4412,7 @@ static void purge(thread_db* tdbb, record_param* rpb)
|
||||
jrd_rel* relation = rpb->rpb_relation;
|
||||
rpb->rpb_record = VIO_gc_record(tdbb, relation);
|
||||
|
||||
VIO_data(tdbb, rpb, reinterpret_cast<blk*>(dbb->dbb_permanent));
|
||||
VIO_data(tdbb, rpb, dbb->dbb_permanent);
|
||||
|
||||
temp.rpb_prior = rpb->rpb_prior;
|
||||
Record* record = rpb->rpb_record;
|
||||
@ -4635,8 +4629,7 @@ static void update_in_place(
|
||||
BUGCHECK(291); // msg 291 cannot find record back version
|
||||
}
|
||||
|
||||
VIO_data(tdbb, &temp2,
|
||||
reinterpret_cast<blk*>(dbb->dbb_permanent));
|
||||
VIO_data(tdbb, &temp2, dbb->dbb_permanent);
|
||||
gc_rec = temp2.rpb_record;
|
||||
temp2.rpb_flags = rpb_chained;
|
||||
if (temp2.rpb_prior) {
|
||||
@ -4742,8 +4735,7 @@ static void verb_post(
|
||||
#pragma FB_COMPILER_MESSAGE("Out-of-memory condition in this function corrupts database. And it is likely due to huge amounts of allocations")
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
JrdMemoryPool* old_pool = tdbb->getDefaultPool();
|
||||
tdbb->setDefaultPool(transaction->tra_pool);
|
||||
Jrd::ContextPoolHolder context(tdbb, transaction->tra_pool);
|
||||
|
||||
/* Find action block for relation */
|
||||
VerbAction* action;
|
||||
@ -4840,8 +4832,6 @@ static void verb_post(
|
||||
|
||||
garbage_collect_idx(tdbb, rpb, new_rpb, old_data);
|
||||
}
|
||||
|
||||
tdbb->setDefaultPool(old_pool);
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,24 +35,23 @@ namespace Jrd {
|
||||
class Savepoint;
|
||||
class Format;
|
||||
}
|
||||
struct blk;
|
||||
|
||||
void VIO_backout(Jrd::thread_db*, Jrd::record_param*, const Jrd::jrd_tra*);
|
||||
void VIO_bump_count(Jrd::thread_db*, USHORT, Jrd::jrd_rel*, bool);
|
||||
bool VIO_chase_record_version(Jrd::thread_db*, Jrd::record_param*, Jrd::RecordSource*,
|
||||
Jrd::jrd_tra*, blk*, bool);
|
||||
Jrd::jrd_tra*, JrdMemoryPool*, bool);
|
||||
#ifdef PC_ENGINE
|
||||
bool VIO_check_if_updated(Jrd::thread_db*, Jrd::record_param*);
|
||||
#endif
|
||||
void VIO_data(Jrd::thread_db*, Jrd::record_param*, blk*);
|
||||
void VIO_data(Jrd::thread_db*, Jrd::record_param*, JrdMemoryPool*);
|
||||
void VIO_erase(Jrd::thread_db*, Jrd::record_param*, Jrd::jrd_tra*);
|
||||
#ifdef GARBAGE_THREAD
|
||||
void VIO_fini(Jrd::thread_db*);
|
||||
#endif
|
||||
bool VIO_garbage_collect(Jrd::thread_db*, Jrd::record_param*, const Jrd::jrd_tra*);
|
||||
Jrd::Record* VIO_gc_record(Jrd::thread_db*, Jrd::jrd_rel*);
|
||||
bool VIO_get(Jrd::thread_db*, Jrd::record_param*, Jrd::RecordSource*, Jrd::jrd_tra*, blk*);
|
||||
bool VIO_get_current(Jrd::thread_db*, Jrd::record_param*, Jrd::jrd_tra*, blk*, bool);
|
||||
bool VIO_get(Jrd::thread_db*, Jrd::record_param*, Jrd::RecordSource*, Jrd::jrd_tra*, JrdMemoryPool*);
|
||||
bool VIO_get_current(Jrd::thread_db*, Jrd::record_param*, Jrd::jrd_tra*, JrdMemoryPool*, bool);
|
||||
#ifdef GARBAGE_THREAD
|
||||
void VIO_init(Jrd::thread_db*);
|
||||
#endif
|
||||
@ -60,7 +59,7 @@ void VIO_merge_proc_sav_points(Jrd::thread_db*, Jrd::jrd_tra*, Jrd::Savepoint**)
|
||||
bool VIO_writelock(Jrd::thread_db*, Jrd::record_param*, Jrd::RecordSource*, Jrd::jrd_tra*);
|
||||
void VIO_modify(Jrd::thread_db*, Jrd::record_param*, Jrd::record_param*, Jrd::jrd_tra*);
|
||||
bool VIO_next_record(Jrd::thread_db*, Jrd::record_param*, Jrd::RecordSource*, Jrd::jrd_tra*,
|
||||
blk*, bool, bool);
|
||||
JrdMemoryPool*, bool, bool);
|
||||
Jrd::Record* VIO_record(Jrd::thread_db*, Jrd::record_param*, const Jrd::Format*, JrdMemoryPool*);
|
||||
void VIO_start_save_point(Jrd::thread_db*, Jrd::jrd_tra*);
|
||||
void VIO_store(Jrd::thread_db*, Jrd::record_param*, Jrd::jrd_tra*);
|
||||
|
@ -256,7 +256,7 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status,
|
||||
*
|
||||
**************************************/
|
||||
UCHAR expanded_name[MAXPATHLEN];
|
||||
trdb thd_context;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
TEXT node_name[MAXPATHLEN];
|
||||
@ -324,7 +324,6 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status,
|
||||
RDB rdb = port->port_context;
|
||||
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
try
|
||||
{
|
||||
@ -373,7 +372,8 @@ ISC_STATUS GDS_BLOB_INFO(ISC_STATUS* user_status,
|
||||
* Provide information on blob object.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -383,7 +383,6 @@ ISC_STATUS GDS_BLOB_INFO(ISC_STATUS* user_status,
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
ISC_STATUS status;
|
||||
@ -414,7 +413,8 @@ ISC_STATUS GDS_CANCEL_BLOB(ISC_STATUS * user_status, RBL * blob_handle)
|
||||
* Abort a partially completed blob.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
RBL blob = *blob_handle;
|
||||
if (!blob) {
|
||||
@ -433,7 +433,6 @@ ISC_STATUS GDS_CANCEL_BLOB(ISC_STATUS * user_status, RBL * blob_handle)
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
try
|
||||
{
|
||||
@ -465,7 +464,8 @@ ISC_STATUS GDS_CANCEL_EVENTS(ISC_STATUS * user_status, RDB * handle, SLONG * id)
|
||||
* Cancel an outstanding event.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -473,7 +473,6 @@ ISC_STATUS GDS_CANCEL_EVENTS(ISC_STATUS * user_status, RDB * handle, SLONG * id)
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
rem_port* port = rdb->rdb_port;
|
||||
|
||||
@ -514,7 +513,8 @@ ISC_STATUS GDS_CLOSE_BLOB(ISC_STATUS * user_status, RBL * blob_handle)
|
||||
* Close a completed blob.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -523,7 +523,6 @@ ISC_STATUS GDS_CLOSE_BLOB(ISC_STATUS * user_status, RBL * blob_handle)
|
||||
RDB rdb = blob->rbl_rdb;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
rem_port* port = rdb->rdb_port;
|
||||
|
||||
@ -565,7 +564,8 @@ ISC_STATUS GDS_COMMIT(ISC_STATUS * user_status, RTR * rtr_handle)
|
||||
* Commit a transaction.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -575,7 +575,6 @@ ISC_STATUS GDS_COMMIT(ISC_STATUS * user_status, RTR * rtr_handle)
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -608,7 +607,8 @@ ISC_STATUS GDS_COMMIT_RETAINING(ISC_STATUS * user_status, RTR * rtr_handle)
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -618,7 +618,6 @@ ISC_STATUS GDS_COMMIT_RETAINING(ISC_STATUS * user_status, RTR * rtr_handle)
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -655,7 +654,8 @@ ISC_STATUS GDS_COMPILE(ISC_STATUS* user_status,
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -666,7 +666,6 @@ ISC_STATUS GDS_COMPILE(ISC_STATUS* user_status,
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -768,7 +767,8 @@ ISC_STATUS GDS_CREATE_BLOB2(ISC_STATUS* user_status,
|
||||
* Open an existing blob.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -779,7 +779,6 @@ ISC_STATUS GDS_CREATE_BLOB2(ISC_STATUS* user_status,
|
||||
RTR transaction = *rtr_handle;
|
||||
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -850,7 +849,8 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status,
|
||||
*
|
||||
**************************************/
|
||||
UCHAR expanded_name[MAXPATHLEN];
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
TEXT node_name[MAXPATHLEN];
|
||||
memset((void *) node_name, 0, (size_t) MAXPATHLEN);
|
||||
@ -913,7 +913,6 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status,
|
||||
|
||||
RDB rdb = port->port_context;
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -965,7 +964,8 @@ ISC_STATUS GDS_DATABASE_INFO(ISC_STATUS* user_status,
|
||||
**************************************/
|
||||
ISC_STATUS status;
|
||||
UCHAR temp[1024];
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -973,7 +973,6 @@ ISC_STATUS GDS_DATABASE_INFO(ISC_STATUS* user_status,
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -1037,7 +1036,8 @@ ISC_STATUS GDS_DDL(ISC_STATUS* user_status,
|
||||
*
|
||||
**************************************/
|
||||
ISC_STATUS status;
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -1049,7 +1049,6 @@ ISC_STATUS GDS_DDL(ISC_STATUS* user_status,
|
||||
RTR transaction = *rtr_handle;
|
||||
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -1093,7 +1092,8 @@ ISC_STATUS GDS_DETACH(ISC_STATUS* user_status, RDB* handle)
|
||||
* Close down a database.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -1102,7 +1102,6 @@ ISC_STATUS GDS_DETACH(ISC_STATUS* user_status, RDB* handle)
|
||||
|
||||
rem_port* port = rdb->rdb_port;
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -1178,7 +1177,8 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS* user_status, RDB* handle)
|
||||
*
|
||||
**************************************/
|
||||
ISC_STATUS_ARRAY local_status;
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -1186,7 +1186,6 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS* user_status, RDB* handle)
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
rem_port* port = rdb->rdb_port;
|
||||
|
||||
@ -1246,7 +1245,8 @@ ISC_STATUS GDS_DSQL_ALLOCATE(ISC_STATUS* user_status,
|
||||
* Allocate a statement handle.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -1255,7 +1255,6 @@ ISC_STATUS GDS_DSQL_ALLOCATE(ISC_STATUS* user_status,
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -1345,7 +1344,8 @@ ISC_STATUS GDS_DSQL_EXECUTE2(ISC_STATUS* user_status,
|
||||
* Execute a non-SELECT dynamic SQL statement.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -1361,7 +1361,6 @@ ISC_STATUS GDS_DSQL_EXECUTE2(ISC_STATUS* user_status,
|
||||
|
||||
rem_port* port = rdb->rdb_port;
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -1557,7 +1556,8 @@ ISC_STATUS GDS_DSQL_EXECUTE_IMMED2(ISC_STATUS* user_status,
|
||||
* Prepare and execute a statement.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -1572,7 +1572,6 @@ ISC_STATUS GDS_DSQL_EXECUTE_IMMED2(ISC_STATUS* user_status,
|
||||
|
||||
rem_port* port = rdb->rdb_port;
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -1737,7 +1736,8 @@ ISC_STATUS GDS_DSQL_FETCH(ISC_STATUS* user_status,
|
||||
*
|
||||
**************************************/
|
||||
ISC_STATUS status;
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -1748,7 +1748,6 @@ ISC_STATUS GDS_DSQL_FETCH(ISC_STATUS* user_status,
|
||||
RDB rdb = statement->rsr_rdb;
|
||||
rem_port* port = rdb->rdb_port;
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -1998,7 +1997,8 @@ ISC_STATUS GDS_DSQL_FREE(ISC_STATUS * user_status, RSR * stmt_handle, USHORT opt
|
||||
* Release request for a Dynamic SQL statement
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -2009,7 +2009,6 @@ ISC_STATUS GDS_DSQL_FREE(ISC_STATUS * user_status, RSR * stmt_handle, USHORT opt
|
||||
RDB rdb = statement->rsr_rdb;
|
||||
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -2070,7 +2069,8 @@ ISC_STATUS GDS_DSQL_INSERT(ISC_STATUS * user_status,
|
||||
* Insert next record into a dynamic SQL cursor.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -2080,7 +2080,6 @@ ISC_STATUS GDS_DSQL_INSERT(ISC_STATUS * user_status,
|
||||
CHECK_HANDLE(statement, type_rsr, isc_bad_req_handle);
|
||||
RDB rdb = statement->rsr_rdb;
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -2172,7 +2171,8 @@ ISC_STATUS GDS_DSQL_PREPARE(ISC_STATUS * user_status, RTR * rtr_handle, RSR * st
|
||||
* Prepare a dynamic SQL statement for execution.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -2187,7 +2187,6 @@ ISC_STATUS GDS_DSQL_PREPARE(ISC_STATUS * user_status, RTR * rtr_handle, RSR * st
|
||||
CHECK_HANDLE(transaction, type_rtr, isc_bad_trans_handle);
|
||||
}
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -2276,7 +2275,8 @@ ISC_STATUS GDS_DSQL_SET_CURSOR(ISC_STATUS* user_status,
|
||||
* parameter.
|
||||
*
|
||||
*****************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -2286,7 +2286,6 @@ ISC_STATUS GDS_DSQL_SET_CURSOR(ISC_STATUS* user_status,
|
||||
CHECK_HANDLE(statement, type_rsr, isc_bad_req_handle);
|
||||
RDB rdb = statement->rsr_rdb;
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -2346,7 +2345,8 @@ ISC_STATUS GDS_DSQL_SQL_INFO(ISC_STATUS* user_status,
|
||||
*
|
||||
**************************************/
|
||||
ISC_STATUS status;
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -2356,7 +2356,6 @@ ISC_STATUS GDS_DSQL_SQL_INFO(ISC_STATUS* user_status,
|
||||
CHECK_HANDLE(statement, type_rsr, isc_bad_req_handle);
|
||||
RDB rdb = statement->rsr_rdb;
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -2396,7 +2395,8 @@ ISC_STATUS GDS_GET_SEGMENT(ISC_STATUS * user_status,
|
||||
* them one by one to the caller.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -2407,7 +2407,6 @@ ISC_STATUS GDS_GET_SEGMENT(ISC_STATUS * user_status,
|
||||
RDB rdb = blob->rbl_rdb;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
rem_port* port = rdb->rdb_port;
|
||||
|
||||
@ -2632,7 +2631,8 @@ ISC_STATUS GDS_GET_SLICE(ISC_STATUS* user_status,
|
||||
* Snatch a slice of an array.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -2641,7 +2641,6 @@ ISC_STATUS GDS_GET_SLICE(ISC_STATUS* user_status,
|
||||
CHECK_HANDLE((*tra_handle), type_rtr, isc_bad_trans_handle);
|
||||
RTR transaction = *tra_handle;
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -2736,7 +2735,8 @@ ISC_STATUS GDS_OPEN_BLOB2(ISC_STATUS* user_status,
|
||||
* Open an existing blob.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -2746,7 +2746,6 @@ ISC_STATUS GDS_OPEN_BLOB2(ISC_STATUS* user_status,
|
||||
CHECK_HANDLE((*rtr_handle), type_rtr, isc_bad_trans_handle);
|
||||
RTR transaction = *rtr_handle;
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -2812,7 +2811,8 @@ ISC_STATUS GDS_PREPARE(ISC_STATUS * user_status,
|
||||
* phase commit.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -2821,7 +2821,6 @@ ISC_STATUS GDS_PREPARE(ISC_STATUS * user_status,
|
||||
RDB rdb = (*rtr_handle)->rtr_rdb;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -2875,7 +2874,8 @@ ISC_STATUS GDS_PUT_SEGMENT(ISC_STATUS* user_status,
|
||||
* batch put.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -2886,7 +2886,6 @@ ISC_STATUS GDS_PUT_SEGMENT(ISC_STATUS* user_status,
|
||||
RDB rdb = blob->rbl_rdb;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
rem_port* port = rdb->rdb_port;
|
||||
|
||||
@ -2972,7 +2971,8 @@ ISC_STATUS GDS_PUT_SLICE(ISC_STATUS* user_status,
|
||||
* Store a slice of an array.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -2981,7 +2981,6 @@ ISC_STATUS GDS_PUT_SLICE(ISC_STATUS* user_status,
|
||||
CHECK_HANDLE((*tra_handle), type_rtr, isc_bad_trans_handle);
|
||||
RTR transaction = *tra_handle;
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -3066,14 +3065,14 @@ ISC_STATUS GDS_QUE_EVENTS(ISC_STATUS* user_status,
|
||||
* Queue a request for event notification.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
RDB rdb = *handle;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
rem_port* port = rdb->rdb_port;
|
||||
PACKET* packet = &rdb->rdb_packet;
|
||||
@ -3180,7 +3179,8 @@ ISC_STATUS GDS_RECEIVE(ISC_STATUS * user_status,
|
||||
* Remote server to send it to us if necessary.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -3191,7 +3191,6 @@ ISC_STATUS GDS_RECEIVE(ISC_STATUS * user_status,
|
||||
RDB rdb = request->rrq_rdb;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -3420,7 +3419,8 @@ ISC_STATUS GDS_RECONNECT(ISC_STATUS* user_status,
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -3428,7 +3428,6 @@ ISC_STATUS GDS_RECONNECT(ISC_STATUS* user_status,
|
||||
RDB rdb = *db_handle;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -3467,7 +3466,8 @@ ISC_STATUS GDS_RELEASE_REQUEST(ISC_STATUS * user_status, rrq** req_handle)
|
||||
* Release a request.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -3476,7 +3476,6 @@ ISC_STATUS GDS_RELEASE_REQUEST(ISC_STATUS * user_status, rrq** req_handle)
|
||||
RDB rdb = request->rrq_rdb;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -3514,7 +3513,8 @@ ISC_STATUS GDS_REQUEST_INFO(ISC_STATUS* user_status,
|
||||
*
|
||||
**************************************/
|
||||
ISC_STATUS status;
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -3523,7 +3523,6 @@ ISC_STATUS GDS_REQUEST_INFO(ISC_STATUS* user_status,
|
||||
RDB rdb = request->rrq_rdb;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -3612,7 +3611,8 @@ ISC_STATUS GDS_ROLLBACK_RETAINING(ISC_STATUS * user_status, RTR * rtr_handle)
|
||||
* Abort a transaction but keep its environment valid
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -3621,7 +3621,6 @@ ISC_STATUS GDS_ROLLBACK_RETAINING(ISC_STATUS * user_status, RTR * rtr_handle)
|
||||
RDB rdb = (*rtr_handle)->rtr_rdb;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -3657,7 +3656,8 @@ ISC_STATUS GDS_ROLLBACK(ISC_STATUS * user_status, RTR * rtr_handle)
|
||||
* Abort a transaction.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -3666,7 +3666,6 @@ ISC_STATUS GDS_ROLLBACK(ISC_STATUS * user_status, RTR * rtr_handle)
|
||||
RDB rdb = (*rtr_handle)->rtr_rdb;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -3702,7 +3701,8 @@ ISC_STATUS GDS_SEEK_BLOB(ISC_STATUS * user_status,
|
||||
* Seek into a blob.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -3711,7 +3711,6 @@ ISC_STATUS GDS_SEEK_BLOB(ISC_STATUS * user_status,
|
||||
RDB rdb = blob->rbl_rdb;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -3764,7 +3763,8 @@ ISC_STATUS GDS_SEND(ISC_STATUS * user_status,
|
||||
* Send a message to the server.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -3776,7 +3776,6 @@ ISC_STATUS GDS_SEND(ISC_STATUS * user_status,
|
||||
return handle_error(user_status, isc_badmsgnum);
|
||||
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -3830,7 +3829,8 @@ ISC_STATUS GDS_SERVICE_ATTACH(ISC_STATUS* user_status,
|
||||
*
|
||||
**************************************/
|
||||
UCHAR expanded_name[MAXPATHLEN];
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -3887,7 +3887,6 @@ ISC_STATUS GDS_SERVICE_ATTACH(ISC_STATUS* user_status,
|
||||
|
||||
RDB rdb = port->port_context;
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -3941,7 +3940,8 @@ ISC_STATUS GDS_SERVICE_DETACH(ISC_STATUS * user_status, RDB * handle)
|
||||
* Close down a connection to an Interbase service.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -3950,7 +3950,6 @@ ISC_STATUS GDS_SERVICE_DETACH(ISC_STATUS * user_status, RDB * handle)
|
||||
RDB rdb = *handle;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_svc_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
rem_port* port = rdb->rdb_port;
|
||||
|
||||
@ -4011,7 +4010,8 @@ ISC_STATUS GDS_SERVICE_QUERY(ISC_STATUS* user_status,
|
||||
* a later date.
|
||||
**************************************/
|
||||
ISC_STATUS status;
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -4020,7 +4020,6 @@ ISC_STATUS GDS_SERVICE_QUERY(ISC_STATUS* user_status,
|
||||
RDB rdb = *svc_handle;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_svc_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -4066,7 +4065,8 @@ ISC_STATUS GDS_SERVICE_START(ISC_STATUS * user_status,
|
||||
* a later date.
|
||||
**************************************/
|
||||
ISC_STATUS status;
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -4075,7 +4075,6 @@ ISC_STATUS GDS_SERVICE_START(ISC_STATUS * user_status,
|
||||
RDB rdb = *svc_handle;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_svc_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -4117,7 +4116,8 @@ ISC_STATUS GDS_START_AND_SEND(ISC_STATUS * user_status,
|
||||
* Get a record from the host program.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -4130,7 +4130,6 @@ ISC_STATUS GDS_START_AND_SEND(ISC_STATUS * user_status,
|
||||
if (msg_type > request->rrq_max_msg)
|
||||
return handle_error(user_status, isc_badmsgnum);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -4204,7 +4203,8 @@ ISC_STATUS GDS_START(ISC_STATUS * user_status,
|
||||
* Get a record from the host program.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -4215,7 +4215,6 @@ ISC_STATUS GDS_START(ISC_STATUS * user_status,
|
||||
RDB rdb = request->rrq_rdb;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -4278,7 +4277,8 @@ ISC_STATUS GDS_START_TRANSACTION(ISC_STATUS * user_status,
|
||||
* Start a transaction.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -4286,7 +4286,6 @@ ISC_STATUS GDS_START_TRANSACTION(ISC_STATUS * user_status,
|
||||
RDB rdb = *db_handle;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
@ -4332,7 +4331,8 @@ ISC_STATUS GDS_TRANSACT_REQUEST(ISC_STATUS* user_status,
|
||||
* Execute a procedure on remote host.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -4341,7 +4341,6 @@ ISC_STATUS GDS_TRANSACT_REQUEST(ISC_STATUS* user_status,
|
||||
RTR transaction = *rtr_handle;
|
||||
CHECK_HANDLE(transaction, type_rtr, isc_bad_trans_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
rem_port* port = rdb->rdb_port;
|
||||
|
||||
@ -4467,7 +4466,8 @@ ISC_STATUS GDS_TRANSACTION_INFO(ISC_STATUS* user_status,
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -4476,7 +4476,6 @@ ISC_STATUS GDS_TRANSACTION_INFO(ISC_STATUS* user_status,
|
||||
RDB rdb = transaction->rtr_rdb;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
ISC_STATUS status;
|
||||
@ -4510,7 +4509,8 @@ ISC_STATUS GDS_UNWIND(ISC_STATUS* user_status, rrq** req_handle, USHORT level)
|
||||
* Unwind a running request.
|
||||
*
|
||||
**************************************/
|
||||
trdb thd_context, *tdrdb;
|
||||
trdb thd_context(user_status);
|
||||
trdb* tdrdb;
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
|
||||
@ -4519,7 +4519,6 @@ ISC_STATUS GDS_UNWIND(ISC_STATUS* user_status, rrq** req_handle, USHORT level)
|
||||
RDB rdb = request->rrq_rdb;
|
||||
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
|
||||
rdb->rdb_status_vector = user_status;
|
||||
tdrdb->trdb_status_vector = user_status;
|
||||
tdrdb->trdb_database = rdb;
|
||||
|
||||
try
|
||||
|
@ -393,7 +393,7 @@ void REMOTE_get_timeout_params(
|
||||
t_data[i] = 0;
|
||||
|
||||
|
||||
thdd::putSpecificData((void *) t_data);
|
||||
ThreadData::putSpecificData((void *) t_data);
|
||||
|
||||
}
|
||||
break;
|
||||
|
@ -502,9 +502,14 @@ const USHORT PORT_dummy_pckt_set= 1024; /* A dummy packet interval is set */
|
||||
|
||||
/* Thread specific remote database block */
|
||||
|
||||
class trdb : public thdd
|
||||
class trdb : public ThreadData
|
||||
{
|
||||
public:
|
||||
trdb(ISC_STATUS* status)
|
||||
: ThreadData(ThreadData::tddRDB), trdb_status_vector(status)
|
||||
{
|
||||
trdb_database = 0;
|
||||
}
|
||||
rdb* trdb_database;
|
||||
ISC_STATUS* trdb_status_vector;
|
||||
};
|
||||
@ -513,16 +518,14 @@ typedef trdb* TRDB;
|
||||
|
||||
|
||||
inline trdb* REM_get_thread_data() {
|
||||
return (trdb*) thdd::getSpecific();
|
||||
return (trdb*) ThreadData::getSpecific();
|
||||
}
|
||||
inline void REM_set_thread_data(trdb* &tdrdb, trdb* thd_context) {
|
||||
tdrdb = thd_context;
|
||||
tdrdb->trdb_status_vector = NULL;
|
||||
tdrdb->thdd_type = THDD_TYPE_TRDB;
|
||||
tdrdb->putSpecific();
|
||||
}
|
||||
inline void REM_restore_thread_data() {
|
||||
thdd::restoreSpecific();
|
||||
ThreadData::restoreSpecific();
|
||||
}
|
||||
|
||||
/* Queuing structure for Client batch fetches */
|
||||
|
@ -265,15 +265,15 @@ void SRVR_multi_thread( rem_port* main_port, USHORT flags)
|
||||
SSHORT request_count = 0;
|
||||
#endif /* DEBUG */
|
||||
#endif /* DEV_BUILD */
|
||||
trdb thd_context, *tdrdb;
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
trdb thd_context(status_vector);
|
||||
trdb* tdrdb;
|
||||
|
||||
gds__thread_enable(-1);
|
||||
|
||||
THREAD_ENTER();
|
||||
|
||||
REM_set_thread_data(tdrdb, &thd_context);
|
||||
tdrdb->trdb_status_vector = status_vector;
|
||||
|
||||
try {
|
||||
|
||||
@ -2945,11 +2945,9 @@ bool process_packet(rem_port* port,
|
||||
*
|
||||
**************************************/
|
||||
TEXT msg[128];
|
||||
trdb thd_context;
|
||||
// BRS: This is the same as REM_set_thread_data but it not set status vector to null
|
||||
trdb thd_context(port->port_status_vector);
|
||||
// BRS: This is the same as REM_set_thread_data
|
||||
trdb* tdrdb = &thd_context;
|
||||
tdrdb->trdb_status_vector = port->port_status_vector;
|
||||
tdrdb->thdd_type = THDD_TYPE_TRDB;
|
||||
tdrdb->putSpecific();
|
||||
|
||||
try {
|
||||
@ -2973,7 +2971,7 @@ bool process_packet(rem_port* port,
|
||||
gds__log
|
||||
("SERVER/process_packet: connect reject, server exiting",
|
||||
0);
|
||||
thdd::restoreSpecific();
|
||||
ThreadData::restoreSpecific();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -3017,7 +3015,7 @@ bool process_packet(rem_port* port,
|
||||
gds__log("SERVER/process_packet: Multi-client server shutdown", 0);
|
||||
}
|
||||
port->disconnect(sendL, receive);
|
||||
thdd::restoreSpecific();
|
||||
ThreadData::restoreSpecific();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -3195,7 +3193,7 @@ bool process_packet(rem_port* port,
|
||||
port->disconnect();
|
||||
else
|
||||
port->disconnect(sendL, receive);
|
||||
thdd::restoreSpecific();
|
||||
ThreadData::restoreSpecific();
|
||||
return false;
|
||||
}
|
||||
port->disconnect(sendL, receive);
|
||||
@ -3205,7 +3203,7 @@ bool process_packet(rem_port* port,
|
||||
if (result)
|
||||
*result = port;
|
||||
|
||||
thdd::restoreSpecific();
|
||||
ThreadData::restoreSpecific();
|
||||
|
||||
} // try
|
||||
catch (const std::exception&) {
|
||||
@ -3217,7 +3215,7 @@ bool process_packet(rem_port* port,
|
||||
port->send_response(sendL, 0, 0, tdrdb->trdb_status_vector);
|
||||
port->disconnect(sendL, receive); /* Well, how about this... */
|
||||
|
||||
thdd::restoreSpecific();
|
||||
ThreadData::restoreSpecific();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -167,15 +167,9 @@ int common_main(int argc,
|
||||
argc = VMS_parse(&argv, argc);
|
||||
#endif
|
||||
|
||||
tsec* tdsec = (tsec *) gds__alloc(sizeof(tsec));
|
||||
/* NOMEM: return error, FREE: during function exit in the SETJMP */
|
||||
if (tdsec == NULL) {
|
||||
gsec_exit(FINI_ERROR, tdsec);
|
||||
}
|
||||
|
||||
tsec tsecInstance(output_proc, output_data);
|
||||
tsec* tdsec = &tsecInstance;
|
||||
tsec::putSpecific(tdsec);
|
||||
// SVC_PUTSPECIFIC_DATA;
|
||||
memset((void *) tdsec, 0, sizeof(*tdsec));
|
||||
|
||||
tdsec->tsec_user_data =
|
||||
(internal_user_data*) gds__alloc(sizeof(internal_user_data));
|
||||
@ -183,7 +177,6 @@ int common_main(int argc,
|
||||
if (tdsec->tsec_user_data == NULL) {
|
||||
gsec_exit(FINI_ERROR, tdsec);
|
||||
}
|
||||
|
||||
memset((void *) tdsec->tsec_user_data, 0, sizeof(internal_user_data));
|
||||
|
||||
try {
|
||||
@ -193,13 +186,7 @@ int common_main(int argc,
|
||||
by 3 file descriptors to use in re-directing stdin, stdout, and stderr. */
|
||||
|
||||
tdsec->tsec_env = &env;
|
||||
tdsec->tsec_output_proc = output_proc;
|
||||
tdsec->tsec_output_data = output_data;
|
||||
tdsec->tsec_interactive = true;
|
||||
tdsec->tsec_service_gsec = false;
|
||||
tdsec->tsec_service_thd = false;
|
||||
tdsec->tsec_service_blk = NULL;
|
||||
tdsec->tsec_status = tdsec->tsec_status_vector;
|
||||
internal_user_data* user_data = tdsec->tsec_user_data;
|
||||
|
||||
if (argc > 1 && !strcmp(argv[1], "-svc")) {
|
||||
@ -357,10 +344,9 @@ int common_main(int argc,
|
||||
const int exit_code = tdsec->tsec_exit_code;
|
||||
|
||||
if (tdsec->tsec_user_data != NULL)
|
||||
{
|
||||
gds__free((SLONG *) tdsec->tsec_user_data);
|
||||
|
||||
if (tdsec != NULL)
|
||||
gds__free((SLONG *) tdsec);
|
||||
}
|
||||
|
||||
/* All returns occur from this point - even normal returns */
|
||||
return exit_code;
|
||||
|
@ -104,9 +104,25 @@ class tsec;
|
||||
extern tsec* gdsec;
|
||||
#endif
|
||||
|
||||
class tsec : public thdd
|
||||
class tsec : public ThreadData
|
||||
{
|
||||
public:
|
||||
tsec(Jrd::pfn_svc_output outProc, Jrd::Service* outData)
|
||||
: ThreadData(ThreadData::tddSEC),
|
||||
tsec_output_proc(outProc), tsec_output_data(outData)
|
||||
{
|
||||
tsec_user_data = 0;
|
||||
tsec_exit_code = 0;
|
||||
tsec_env = 0;
|
||||
tsec_status = tsec_status_vector;
|
||||
tsec_interactive = false;
|
||||
tsec_sw_version = false;
|
||||
tsec_service_gsec = false;
|
||||
tsec_service_thd = false;
|
||||
tsec_output_file = 0;
|
||||
tsec_service_blk = 0;
|
||||
}
|
||||
|
||||
internal_user_data* tsec_user_data;
|
||||
int tsec_exit_code;
|
||||
jmp_buf* tsec_env;
|
||||
@ -122,21 +138,19 @@ public:
|
||||
Jrd::Service* tsec_service_blk;
|
||||
#ifdef SUPERSERVER
|
||||
static inline tsec* getSpecific() {
|
||||
return (tsec*) thdd::getSpecific();
|
||||
return (tsec*) ThreadData::getSpecific();
|
||||
}
|
||||
static inline void putSpecific(tsec* tdsec) {
|
||||
tdsec->thdd_type = THDD_TYPE_TSEC;
|
||||
((thdd*)tdsec)->putSpecific();
|
||||
tdsec->ThreadData::putSpecific();
|
||||
}
|
||||
static inline void restoreSpecific() {
|
||||
thdd::restoreSpecific();
|
||||
ThreadData::restoreSpecific();
|
||||
}
|
||||
#else
|
||||
static inline tsec* getSpecific() {
|
||||
return gdsec;
|
||||
}
|
||||
static inline void putSpecific(tsec* tdsec) {
|
||||
tdsec->thdd_type = THDD_TYPE_TSEC;
|
||||
gdsec = tdsec;
|
||||
}
|
||||
static inline void restoreSpecific() {
|
||||
|
@ -195,9 +195,32 @@ class tdba;
|
||||
static tdba* gddba;
|
||||
#endif
|
||||
|
||||
class tdba : public thdd
|
||||
class tdba : public ThreadData
|
||||
{
|
||||
public:
|
||||
tdba()
|
||||
: ThreadData(tddDBA)
|
||||
{
|
||||
dba_env = 0;
|
||||
files = 0;
|
||||
relations = 0;
|
||||
page_size = 0;
|
||||
page_number = 0;
|
||||
buffer1 = 0;
|
||||
buffer2 = 0;
|
||||
global_buffer = 0;
|
||||
exit_code = 0;
|
||||
#ifdef SUPERSERVER
|
||||
sw_outfile = 0;
|
||||
head_of_mem_list = 0;
|
||||
head_of_files_list = 0;
|
||||
dba_service_blk = 0;
|
||||
#else
|
||||
sw_outfile = 0;
|
||||
#endif
|
||||
dba_status = dba_status_vector;
|
||||
}
|
||||
|
||||
UCHAR *dba_env;
|
||||
dba_fil* files;
|
||||
dba_rel* relations;
|
||||
@ -220,15 +243,14 @@ public:
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
static inline tdba* getSpecific() {
|
||||
return (tdba*) thdd::getSpecific();
|
||||
return (tdba*) ThreadData::getSpecific();
|
||||
}
|
||||
static inline void putSpecific(tdba* &tddba, tdba* thd_context) {
|
||||
tddba = thd_context;
|
||||
tddba->thdd_type = THDD_TYPE_TDBA;
|
||||
((thdd*)tddba)->putSpecific();
|
||||
tddba->ThreadData::putSpecific();
|
||||
}
|
||||
static inline void restoreSpecific() {
|
||||
thdd::restoreSpecific();
|
||||
ThreadData::restoreSpecific();
|
||||
}
|
||||
#else
|
||||
static inline tdba* getSpecific() {
|
||||
@ -237,7 +259,6 @@ public:
|
||||
static inline void putSpecific(tdba* &tddba, tdba* thd_context) {
|
||||
tddba = thd_context;
|
||||
gddba = tddba;
|
||||
tddba->thdd_type = THDD_TYPE_TDBA;
|
||||
}
|
||||
static inline void restoreSpecific() {
|
||||
}
|
||||
@ -304,8 +325,6 @@ int CLIB_ROUTINE main(int argc, char** argv)
|
||||
#endif
|
||||
|
||||
tdba::putSpecific(tddba, &thd_context);
|
||||
// SVC_PUTSPECIFIC_DATA;
|
||||
memset(tddba, 0, sizeof(*tddba));
|
||||
tddba->dba_env = (UCHAR *) env;
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
|
Loading…
Reference in New Issue
Block a user