|
From: <ale...@us...> - 2011-06-10 12:54:00
|
Revision: 53147
http://firebird.svn.sourceforge.net/firebird/?rev=53147&view=rev
Author: alexpeshkoff
Date: 2011-06-10 12:53:51 +0000 (Fri, 10 Jun 2011)
Log Message:
-----------
Used upgradeInterface() in a number of places.
Fixed memory leak when unloading module, related with upgraded interfaces.
Fixed timer on posix to be high resolution.
Better diagnostic in services.
Modified Paths:
--------------
firebird/trunk/builds/posix/make.defaults
firebird/trunk/configure.in
firebird/trunk/lang_helpers/gds_codes.ftn
firebird/trunk/lang_helpers/gds_codes.pas
firebird/trunk/src/auth/AuthDbg.cpp
firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp
firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp
firebird/trunk/src/auth/trusted/AuthSspi.cpp
firebird/trunk/src/common/classes/GetPlugins.h
firebird/trunk/src/common/classes/ImplementHelper.h
firebird/trunk/src/common/security.cpp
firebird/trunk/src/common/utils.cpp
firebird/trunk/src/gpre/boot/gpre_meta_boot.cpp
firebird/trunk/src/include/firebird/ExternalEngine.h
firebird/trunk/src/include/firebird/Interface.h
firebird/trunk/src/include/firebird/Plugin.h
firebird/trunk/src/include/firebird/Provider.h
firebird/trunk/src/include/gen/codetext.h
firebird/trunk/src/include/gen/iberror.h
firebird/trunk/src/include/gen/msgs.h
firebird/trunk/src/include/gen/sql_code.h
firebird/trunk/src/include/gen/sql_state.h
firebird/trunk/src/jrd/ExtEngineManager.cpp
firebird/trunk/src/jrd/UserManagement.cpp
firebird/trunk/src/jrd/jrd.cpp
firebird/trunk/src/jrd/svc.cpp
firebird/trunk/src/jrd/trace/TraceManager.cpp
firebird/trunk/src/msgs/facilities2.sql
firebird/trunk/src/msgs/messages2.sql
firebird/trunk/src/msgs/system_errors2.sql
firebird/trunk/src/plugins/udr_engine/UdrEngine.cpp
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/server/server.cpp
firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp
firebird/trunk/src/utilities/ntrace/traceplugin.cpp
firebird/trunk/src/yvalve/MasterImplementation.cpp
firebird/trunk/src/yvalve/MasterImplementation.h
firebird/trunk/src/yvalve/PluginManager.cpp
firebird/trunk/src/yvalve/PluginManager.h
firebird/trunk/src/yvalve/YObjects.h
firebird/trunk/src/yvalve/why.cpp
Added Paths:
-----------
firebird/trunk/src/common/classes/ImplementHelper.cpp
Modified: firebird/trunk/builds/posix/make.defaults
===================================================================
--- firebird/trunk/builds/posix/make.defaults 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/builds/posix/make.defaults 2011-06-10 12:53:51 UTC (rev 53147)
@@ -292,7 +292,7 @@
# Per-library link rules
LINK_UDF = $(LIB_LINK) $(LIB_LINK_OPTIONS) $(call LIB_LINK_SONAME,$(1).$(SHRLIB_EXT)) $(UNDEF_FLAGS)\
- $(call LIB_LINK_RPATH,lib) -lm
+ $(call LIB_LINK_RPATH,lib) $(SO_LINK_LIBS)
LINK_UDF_LIBS = $(THR_LIBS) -L$(LIB) -lib_util
LINK_IB_UTIL = $(LIB_LINK) $(LINK_IBUTIL_SYMBOLS) $(LIB_LINK_OPTIONS) $(UNDEF_FLAGS)\
Modified: firebird/trunk/configure.in
===================================================================
--- firebird/trunk/configure.in 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/configure.in 2011-06-10 12:53:51 UTC (rev 53147)
@@ -793,6 +793,8 @@
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <atomic_ops.h>]], [[AO_T x; AO_compare_and_swap_full(&x, 0, 0); return 0;]])],
AC_DEFINE(HAVE_AO_COMPARE_AND_SWAP_FULL, 1, [Define this if AO_compare_and_swap_full() is defined in atomic_ops.h]))
+AC_SEARCH_LIBS(clock_gettime, rt)
+AC_CHECK_FUNCS(clock_gettime)
dnl Checks for pthread functions
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
Modified: firebird/trunk/lang_helpers/gds_codes.ftn
===================================================================
--- firebird/trunk/lang_helpers/gds_codes.ftn 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/lang_helpers/gds_codes.ftn 2011-06-10 12:53:51 UTC (rev 53147)
@@ -1460,6 +1460,8 @@
PARAMETER (GDS__invalid_boolean_usage = 335545023)
INTEGER*4 GDS__sysf_argscant_both_be_zero
PARAMETER (GDS__sysf_argscant_both_be_zero = 335545024)
+ INTEGER*4 GDS__spb_no_id
+ PARAMETER (GDS__spb_no_id = 335545025)
INTEGER*4 GDS__gfix_db_name
PARAMETER (GDS__gfix_db_name = 335740929)
INTEGER*4 GDS__gfix_invalid_sw
Modified: firebird/trunk/lang_helpers/gds_codes.pas
===================================================================
--- firebird/trunk/lang_helpers/gds_codes.pas 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/lang_helpers/gds_codes.pas 2011-06-10 12:53:51 UTC (rev 53147)
@@ -737,6 +737,7 @@
gds_cannot_copy_stmt = 335545022;
gds_invalid_boolean_usage = 335545023;
gds_sysf_argscant_both_be_zero = 335545024;
+ gds_spb_no_id = 335545025;
gds_gfix_db_name = 335740929;
gds_gfix_invalid_sw = 335740930;
gds_gfix_incmp_sw = 335740932;
Modified: firebird/trunk/src/auth/AuthDbg.cpp
===================================================================
--- firebird/trunk/src/auth/AuthDbg.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/auth/AuthDbg.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -33,6 +33,8 @@
//#define AUTH_VERBOSE
+static Firebird::MakeUpgradeInfo<> upInfo;
+
// register plugin
static Firebird::SimpleFactory<Auth::DebugClient> clientFactory;
static Firebird::SimpleFactory<Auth::DebugServer> serverFactory;
@@ -60,6 +62,7 @@
{
try
{
+ Firebird::MasterInterfacePtr()->upgradeInterface(writerInterface, FB_AUTH_WRITER_VERSION, upInfo);
str.erase();
Firebird::ClumpletReader rdr(isService ?
Firebird::ClumpletReader::spbList :
@@ -88,6 +91,7 @@
#ifdef AUTH_VERBOSE
fprintf(stderr, "DebugServerInstance::contAuthentication: %.*s\n", size, data);
#endif
+ Firebird::MasterInterfacePtr()->upgradeInterface(writerInterface, FB_AUTH_WRITER_VERSION, upInfo);
writerInterface->add(Firebird::string((const char*) data, size).c_str(), "DEBUG", "");
return AUTH_SUCCESS;
}
@@ -126,6 +130,7 @@
{
try
{
+ Firebird::MasterInterfacePtr()->upgradeInterface(dpb, FB_AUTH_DPB_READER_VERSION, upInfo);
str = "HAND";
if (dpb)
{
Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp
===================================================================
--- firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -42,6 +42,8 @@
#include "../common/classes/ClumpletWriter.h"
#include "firebird/Plugin.h"
+static Firebird::MakeUpgradeInfo<> upInfo;
+
// Here we use version-independent symbolic link (or copy) of actual database
DATABASE database = STATIC FILENAME "security.fdb";
@@ -124,6 +126,8 @@
{
try
{
+ Firebird::MasterInterfacePtr()->upgradeInterface(logonInfo, FB_AUTH_LOGON_INFO_VERSION, upInfo);
+
st->init();
if (secDbKey == INIT_KEY)
@@ -310,6 +314,8 @@
try
{
+ Firebird::MasterInterfacePtr()->upgradeInterface(user, FB_AUTH_USER_VERSION, upInfo);
+
ISC_STATUS_ARRAY isc_status;
fb_utils::init_status(isc_status);
st->init();
@@ -668,12 +674,11 @@
// register plugin
static Firebird::SimpleFactory<Auth::SecurityDatabaseManagement> factory;
-static Firebird::UnloadDetector unloadDetector;
extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
{
Firebird::PluginManagerInterfacePtr pi(master);
pi->registerPluginFactory(Firebird::PluginType::AuthUserManagement, "Legacy_Auth", &factory);
- pi->registerModule(&unloadDetector);
+ pi->registerModule(&Firebird::myModule);
}
Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp
===================================================================
--- firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -49,6 +49,8 @@
namespace {
+MakeUpgradeInfo<> upInfo;
+
// BLR to search database for user name record
const UCHAR PWD_REQUEST[] =
@@ -367,6 +369,7 @@
}
}
+ MasterInterfacePtr()->upgradeInterface(authBlock, FB_AUTH_WRITER_VERSION, upInfo);
authBlock->add(login.c_str(), "SecDB", secureDbName);
return AUTH_SUCCESS;
}
@@ -517,7 +520,7 @@
ClumpletReader rdr(isService ? ClumpletReader::spbList : ClumpletReader::dpbList, dpb, dpbSize);
Result rc = instance->verify(writerInterface, rdr);
- Firebird::TimerInterfacePtr()->start(instance, 10 * 1000 * 1000);
+ TimerInterfacePtr()->start(instance, 10 * 1000 * 1000);
return rc;
}
catch (const Firebird::Exception& ex)
Modified: firebird/trunk/src/auth/trusted/AuthSspi.cpp
===================================================================
--- firebird/trunk/src/auth/trusted/AuthSspi.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/auth/trusted/AuthSspi.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -69,6 +69,8 @@
*data = name;
*dataSize = strlen(name);
}
+
+ MakeUpgradeInfo<> upInfo;
}
namespace Auth {
@@ -380,6 +382,7 @@
bool wheel = false;
string login;
sspi.getLogin(login, wheel);
+ MasterInterfacePtr()->upgradeInterface(writerInterface, FB_AUTH_WRITER_VERSION, upInfo);
writerInterface->add(login.c_str(), "WIN_SSPI", "");
if (wheel)
{
@@ -417,6 +420,8 @@
if (dpb)
{
+ MasterInterfacePtr()->upgradeInterface(dpb, FB_AUTH_DPB_READER_VERSION, upInfo);
+
UCHAR tag = isService ? isc_spb_trusted_role : isc_dpb_trusted_role;
while (dpb->find(tag))
{
Modified: firebird/trunk/src/common/classes/GetPlugins.h
===================================================================
--- firebird/trunk/src/common/classes/GetPlugins.h 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/common/classes/GetPlugins.h 2011-06-10 12:53:51 UTC (rev 53147)
@@ -34,36 +34,27 @@
namespace Firebird {
-// Default replacement for missing virtual functions
-class DefaultMissingEntrypoint
-{
-public:
- virtual void FB_CARG noEntrypoint()
- {
- Arg::Gds(isc_wish_list).raise();
- }
-};
-
// Template to help with loop in the set of plugins
-template <typename P, typename M = DefaultMissingEntrypoint>
+template <typename P>
class GetPlugins
{
public:
- GetPlugins(unsigned int interfaceType, unsigned int desiredVersion, const char* namesList = NULL)
- : masterInterface(), pluginInterface(masterInterface), missing(),
+ GetPlugins(unsigned int interfaceType, unsigned int desiredVersion,
+ UpgradeInfo* ui, const char* namesList = NULL)
+ : masterInterface(), pluginInterface(masterInterface),
pluginSet(pluginInterface->getPlugins(interfaceType, namesList ? namesList : Config::getPlugins(interfaceType),
- desiredVersion, &missing, NULL)),
+ desiredVersion, ui, NULL)),
currentPlugin(NULL)
{
pluginSet->release();
getPlugin();
}
- GetPlugins(unsigned int interfaceType, unsigned int desiredVersion,
+ GetPlugins(unsigned int interfaceType, unsigned int desiredVersion, UpgradeInfo* ui,
Config* knownConfig, const char* namesList = NULL)
- : masterInterface(), pluginInterface(masterInterface), missing(),
+ : masterInterface(), pluginInterface(masterInterface),
pluginSet(pluginInterface->getPlugins(interfaceType, namesList ? namesList : Config::getPlugins(interfaceType),
- desiredVersion, &missing, new FirebirdConf(knownConfig))),
+ desiredVersion, ui, new FirebirdConf(knownConfig))),
currentPlugin(NULL)
{
pluginSet->release();
@@ -124,7 +115,6 @@
private:
MasterInterfacePtr masterInterface;
PluginManagerInterfacePtr pluginInterface;
- M missing;
RefPtr<IPluginSet> pluginSet;
P* currentPlugin;
Added: firebird/trunk/src/common/classes/ImplementHelper.cpp
===================================================================
--- firebird/trunk/src/common/classes/ImplementHelper.cpp (rev 0)
+++ firebird/trunk/src/common/classes/ImplementHelper.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -0,0 +1,34 @@
+/*
+ * PROGRAM: Firebird interface.
+ * MODULE: ImplementHelper.cpp
+ * DESCRIPTION: Tools to help create interfaces.
+ *
+ * The contents of this file are subject to the Initial
+ * Developer's Public License Version 1.0 (the "License");
+ * you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
+ *
+ * Software distributed under the License is distributed AS IS,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied.
+ * See the License for the specific language governing rights
+ * and limitations under the License.
+ *
+ * The Original Code was created by Alex Peshkov
+ * for the Firebird Open Source RDBMS project.
+ *
+ * Copyright (c) 2010 Alex Peshkov <peshkoff at mail.ru>
+ * and all contributors signed below.
+ *
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ *
+ *
+ */
+
+#include "../common/classes/ImplementHelper.h"
+
+namespace Firebird
+{
+ UnloadDetector myModule;
+}
Property changes on: firebird/trunk/src/common/classes/ImplementHelper.cpp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Modified: firebird/trunk/src/common/classes/ImplementHelper.h
===================================================================
--- firebird/trunk/src/common/classes/ImplementHelper.h 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/common/classes/ImplementHelper.h 2011-06-10 12:53:51 UTC (rev 53147)
@@ -71,6 +71,8 @@
return V;
}
+ IPluginModule* getModule();
+
private:
VersionedIface(const VersionedIface&);
VersionedIface& operator=(const VersionedIface&);
@@ -249,7 +251,10 @@
if (flagOsUnload)
{
PluginManagerInterfacePtr pi;
- pi->unregisterModule(this);
+ if (pi)
+ {
+ pi->unregisterModule(this);
+ }
doClean();
}
@@ -282,8 +287,46 @@
};
typedef GlobalPtr<UnloadDetectorHelper, InstanceControl::PRIORITY_DETECT_UNLOAD> UnloadDetector;
+extern UnloadDetector myModule;
+template <class C, int V> IPluginModule* VersionedIface<C, V>::getModule()
+{
+ return &myModule;
+}
+
+// Default replacement for missing virtual functions
+class DefaultMissingEntrypoint
+{
+public:
+ virtual void FB_CARG noEntrypoint()
+ {
+ Arg::Gds(isc_wish_list).raise();
+ }
+};
+
+// Helps to create update information
+template <typename M = DefaultMissingEntrypoint>
+class MakeUpgradeInfo
+{
+public:
+ MakeUpgradeInfo()
+ {
+ ui.missingFunctionClass = &missing;
+ ui.clientModule = &myModule;
+ }
+
+ operator UpgradeInfo*()
+ {
+ return &ui;
+ }
+
+private:
+ M missing;
+ struct UpgradeInfo ui;
+};
+
+
class InternalMessageBuffer : public FbMessage
{
public:
Modified: firebird/trunk/src/common/security.cpp
===================================================================
--- firebird/trunk/src/common/security.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/common/security.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -36,12 +36,14 @@
(Arg::Gds(isc_random) << "Missing user management plugin").raise();
}
+MakeUpgradeInfo<> ui;
+
} // anonymous namespace
namespace Auth {
Get::Get(Config* firebirdConf)
- : GetPlugins<Auth::IManagement>(PluginType::AuthUserManagement, FB_AUTH_MANAGE_VERSION, firebirdConf)
+ : GetPlugins<Auth::IManagement>(PluginType::AuthUserManagement, FB_AUTH_MANAGE_VERSION, ui, firebirdConf)
{
if (!hasData())
{
Modified: firebird/trunk/src/common/utils.cpp
===================================================================
--- firebird/trunk/src/common/utils.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/common/utils.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -807,7 +807,7 @@
return counter.QuadPart;
#elif defined(HAVE_CLOCK_GETTIME)
- // Use high-resultion clock
+ // Use high-resolution clock
struct timespec tp;
if (clock_gettime(CLOCK_REALTIME, &tp) != 0)
return 0;
Modified: firebird/trunk/src/gpre/boot/gpre_meta_boot.cpp
===================================================================
--- firebird/trunk/src/gpre/boot/gpre_meta_boot.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/gpre/boot/gpre_meta_boot.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -683,6 +683,11 @@
return FB_MASTER_VERSION;
}
+ virtual IPluginModule* FB_CARG getModule()
+ {
+ return NULL;
+ }
+
virtual IStatus* FB_CARG getStatus()
{
fb_assert(false);
@@ -697,12 +702,12 @@
virtual IPluginManager* FB_CARG getPluginManager()
{
- fb_assert(false);
+ //fb_assert(false);
return NULL;
}
virtual int FB_CARG upgradeInterface(IVersioned* /*toUpgrade*/, int /*desiredVersion*/,
- void* /*missingFunctionClass*/)
+ struct UpgradeInfo* /*upInfo*/)
{
fb_assert(false);
return 0;
Modified: firebird/trunk/src/include/firebird/ExternalEngine.h
===================================================================
--- firebird/trunk/src/include/firebird/ExternalEngine.h 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/include/firebird/ExternalEngine.h 2011-06-10 12:53:51 UTC (rev 53147)
@@ -33,6 +33,7 @@
#include "./Plugin.h"
#include "./Provider.h"
+#include "firebird.h" //// FIXME:
namespace Firebird {
Modified: firebird/trunk/src/include/firebird/Interface.h
===================================================================
--- firebird/trunk/src/include/firebird/Interface.h 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/include/firebird/Interface.h 2011-06-10 12:53:51 UTC (rev 53147)
@@ -39,14 +39,18 @@
namespace Firebird {
+// Forward declaration - used to identify client and provider of upgraded interface
+class IPluginModule;
+
// Versioned interface - base for all FB interfaces
class IVersioned
{
public:
virtual int FB_CARG getVersion() = 0;
+ virtual IPluginModule* getModule() = 0;
};
// If this is changed, types of all interfaces must be changed
-#define FB_VERSIONED_VERSION 1
+#define FB_VERSIONED_VERSION 2
// Reference counted interface - base for refCounted FB interfaces
class IRefCounted : public IVersioned
@@ -89,6 +93,12 @@
class ITransaction;
class IDtc;
+struct UpgradeInfo
+{
+ void* missingFunctionClass;
+ IPluginModule* clientModule;
+};
+
// Master interface is used to access almost all other interfaces.
class IMaster : public IVersioned
{
@@ -96,7 +106,8 @@
virtual IStatus* FB_CARG getStatus() = 0;
virtual IProvider* FB_CARG getDispatcher() = 0;
virtual IPluginManager* FB_CARG getPluginManager() = 0;
- virtual int FB_CARG upgradeInterface(IVersioned* toUpgrade, int desiredVersion, void* missingFunctionClass) = 0;
+ virtual int FB_CARG upgradeInterface(IVersioned* toUpgrade, int desiredVersion,
+ struct UpgradeInfo* upgradeInfo) = 0;
virtual const char* FB_CARG circularAlloc(const char* s, size_t len, intptr_t thr) = 0;
virtual ITimerControl* FB_CARG getTimerControl() = 0;
virtual IDtc* FB_CARG getDtc() = 0;
Modified: firebird/trunk/src/include/firebird/Plugin.h
===================================================================
--- firebird/trunk/src/include/firebird/Plugin.h 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/include/firebird/Plugin.h 2011-06-10 12:53:51 UTC (rev 53147)
@@ -187,7 +187,7 @@
// If caller already has an interface for firebird.conf, it may be passed here
// If parameter is missing, plugins will get access to default (non database specific) config
virtual IPluginSet* FB_CARG getPlugins(unsigned int interfaceType, const char* namesList,
- int desiredVersion, void* missingFunctionClass,
+ int desiredVersion, UpgradeInfo* ui,
IFirebirdConf* firebirdConf) = 0;
// Get generic config interface for given file
virtual IConfig* FB_CARG getConfig(const char* filename) = 0;
Modified: firebird/trunk/src/include/firebird/Provider.h
===================================================================
--- firebird/trunk/src/include/firebird/Provider.h 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/include/firebird/Provider.h 2011-06-10 12:53:51 UTC (rev 53147)
@@ -29,7 +29,6 @@
#ifndef FB_PROVIDER_INTERFACE
#define FB_PROVIDER_INTERFACE
-#include "firebird.h" //// FIXME:
#include "./Plugin.h"
namespace Firebird {
Modified: firebird/trunk/src/include/gen/codetext.h
===================================================================
--- firebird/trunk/src/include/gen/codetext.h 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/include/gen/codetext.h 2011-06-10 12:53:51 UTC (rev 53147)
@@ -726,6 +726,7 @@
{"cannot_copy_stmt", 335545022},
{"invalid_boolean_usage", 335545023},
{"sysf_argscant_both_be_zero", 335545024},
+ {"spb_no_id", 335545025},
{"gfix_db_name", 335740929},
{"gfix_invalid_sw", 335740930},
{"gfix_incmp_sw", 335740932},
Modified: firebird/trunk/src/include/gen/iberror.h
===================================================================
--- firebird/trunk/src/include/gen/iberror.h 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/include/gen/iberror.h 2011-06-10 12:53:51 UTC (rev 53147)
@@ -760,6 +760,7 @@
const ISC_STATUS isc_cannot_copy_stmt = 335545022L;
const ISC_STATUS isc_invalid_boolean_usage = 335545023L;
const ISC_STATUS isc_sysf_argscant_both_be_zero = 335545024L;
+const ISC_STATUS isc_spb_no_id = 335545025L;
const ISC_STATUS isc_gfix_db_name = 335740929L;
const ISC_STATUS isc_gfix_invalid_sw = 335740930L;
const ISC_STATUS isc_gfix_incmp_sw = 335740932L;
@@ -1179,7 +1180,7 @@
const ISC_STATUS isc_trace_switch_param_miss = 337182758L;
const ISC_STATUS isc_trace_param_act_notcompat = 337182759L;
const ISC_STATUS isc_trace_mandatory_switch_miss = 337182760L;
-const ISC_STATUS isc_err_max = 1123;
+const ISC_STATUS isc_err_max = 1124;
#else /* c definitions */
@@ -1909,6 +1910,7 @@
#define isc_cannot_copy_stmt 335545022L
#define isc_invalid_boolean_usage 335545023L
#define isc_sysf_argscant_both_be_zero 335545024L
+#define isc_spb_no_id 335545025L
#define isc_gfix_db_name 335740929L
#define isc_gfix_invalid_sw 335740930L
#define isc_gfix_incmp_sw 335740932L
@@ -2328,7 +2330,7 @@
#define isc_trace_switch_param_miss 337182758L
#define isc_trace_param_act_notcompat 337182759L
#define isc_trace_mandatory_switch_miss 337182760L
-#define isc_err_max 1123
+#define isc_err_max 1124
#endif
Modified: firebird/trunk/src/include/gen/msgs.h
===================================================================
--- firebird/trunk/src/include/gen/msgs.h 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/include/gen/msgs.h 2011-06-10 12:53:51 UTC (rev 53147)
@@ -729,6 +729,7 @@
{335545022, "Cannot copy statement @1"}, /* cannot_copy_stmt */
{335545023, "Invalid usage of boolean expression"}, /* invalid_boolean_usage */
{335545024, "Arguments for @1 cannot both be zero"}, /* sysf_argscant_both_be_zero */
+ {335545025, "missing service ID in spb"}, /* spb_no_id */
{335740929, "data base file name (@1) already given"}, /* gfix_db_name */
{335740930, "invalid switch @1"}, /* gfix_invalid_sw */
{335740932, "incompatible switch combination"}, /* gfix_incmp_sw */
Modified: firebird/trunk/src/include/gen/sql_code.h
===================================================================
--- firebird/trunk/src/include/gen/sql_code.h 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/include/gen/sql_code.h 2011-06-10 12:53:51 UTC (rev 53147)
@@ -725,6 +725,7 @@
{335545022, -104}, /* 702 cannot_copy_stmt */
{335545023, -104}, /* 703 invalid_boolean_usage */
{335545024, -833}, /* 704 sysf_argscant_both_be_zero */
+ {335545025, -901}, /* 705 spb_no_id */
{335740929, -901}, /* 1 gfix_db_name */
{335740930, -901}, /* 2 gfix_invalid_sw */
{335740932, -901}, /* 4 gfix_incmp_sw */
Modified: firebird/trunk/src/include/gen/sql_state.h
===================================================================
--- firebird/trunk/src/include/gen/sql_state.h 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/include/gen/sql_state.h 2011-06-10 12:53:51 UTC (rev 53147)
@@ -725,6 +725,7 @@
{335545022, "XX000"}, // 702 cannot_copy_stmt
{335545023, "22000"}, // 703 invalid_boolean_usage
{335545024, "42000"}, // 704 sysf_argscant_both_be_zero
+ {335545025, "HY000"}, // 705 spb_no_id
{335740929, "00000"}, // 1 gfix_db_name
{335740930, "00000"}, // 2 gfix_invalid_sw
{335740932, "00000"}, // 4 gfix_incmp_sw
Modified: firebird/trunk/src/jrd/ExtEngineManager.cpp
===================================================================
--- firebird/trunk/src/jrd/ExtEngineManager.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/jrd/ExtEngineManager.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -58,6 +58,7 @@
namespace Jrd {
+MakeUpgradeInfo<> upInfo;
template <typename T> class ExtEngineManager::ContextManager
{
@@ -826,7 +827,7 @@
if (!engines.get(name, engine))
{
GetPlugins<ExternalEngine> engineControl(PluginType::ExternalEngine,
- FB_EXTERNAL_ENGINE_VERSION, name.c_str());
+ FB_EXTERNAL_ENGINE_VERSION, upInfo, name.c_str());
if (engineControl.hasData())
{
Modified: firebird/trunk/src/jrd/UserManagement.cpp
===================================================================
--- firebird/trunk/src/jrd/UserManagement.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/jrd/UserManagement.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -36,6 +36,7 @@
using namespace Jrd;
using namespace Firebird;
+static MakeUpgradeInfo<> upInfo;
const Format* UsersTableScan::getFormat(thread_db* tdbb, jrd_rel* relation) const
{
@@ -212,6 +213,7 @@
void UserManagement::Display::list(Auth::IUser* u)
{
+ MasterInterfacePtr()->upgradeInterface(u, FB_AUTH_USER_VERSION, upInfo);
userManagement->list(u);
}
Modified: firebird/trunk/src/jrd/jrd.cpp
===================================================================
--- firebird/trunk/src/jrd/jrd.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/jrd/jrd.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -296,8 +296,6 @@
}
-static UnloadDetector unloadDetector;
-
static void shutdownBeforeUnload()
{
LocalStatus status;
@@ -310,7 +308,7 @@
// IPluginFactory implementation
IPluginBase* FB_CARG createPlugin(IPluginConfig* factoryParameter)
{
- if (unloadDetector->unloadStarted())
+ if (myModule->unloadStarted())
{
return NULL;
}
@@ -325,9 +323,9 @@
void registerEngine(IPluginManager* iPlugin)
{
- unloadDetector->setCleanup(shutdownBeforeUnload);
+ myModule->setCleanup(shutdownBeforeUnload);
iPlugin->registerPluginFactory(PluginType::Provider, "Engine12", &engineFactory);
- iPlugin->registerModule(&unloadDetector);
+ iPlugin->registerModule(&myModule);
}
} // namespace Jrd
Modified: firebird/trunk/src/jrd/svc.cpp
===================================================================
--- firebird/trunk/src/jrd/svc.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/jrd/svc.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -1890,6 +1890,10 @@
ClumpletReader spb(ClumpletReader::SpbStart, spb_data, spb_length);
// The name of the service is the first element of the buffer
+ if (spb.isEof())
+ {
+ status_exception::raise(Arg::Gds(isc_service_att_err) << Arg::Gds(isc_spb_no_id));
+ }
const UCHAR svc_id = spb.getClumpTag();
const serv_entry* serv;
for (serv = services; serv->serv_action; serv++)
Modified: firebird/trunk/src/jrd/trace/TraceManager.cpp
===================================================================
--- firebird/trunk/src/jrd/trace/TraceManager.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/jrd/trace/TraceManager.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -64,6 +64,9 @@
return 1;
}
};
+
+ MakeUpgradeInfo<IgnoreMissing> upgradePlugin;
+ MakeUpgradeInfo<> upgradeFactory;
}
namespace Jrd {
@@ -156,7 +159,7 @@
init_factories = true;
factories = FB_NEW(*getDefaultMemoryPool()) TraceManager::Factories(*getDefaultMemoryPool());
- for (GetPlugins<TraceFactory, IgnoreMissing> traceItr(PluginType::Trace, FB_TRACE_PLUGIN_VERSION);
+ for (GetPlugins<TraceFactory> traceItr(PluginType::Trace, FB_TRACE_FACTORY_VERSION, upgradeFactory);
traceItr.hasData(); traceItr.next())
{
FactoryInfo info;
@@ -259,6 +262,8 @@
}
}
+ MasterInterfacePtr master;
+
for (FactoryInfo* info = factories->begin(); info != factories->end(); ++info)
{
TraceInitInfoImpl attachInfo(session, attachment, filename);
@@ -267,6 +272,8 @@
if (plugin)
{
+ master->upgradeInterface(plugin, FB_TRACE_PLUGIN_VERSION, upgradePlugin);
+
plugin->addRef();
SessionInfo sesInfo;
sesInfo.plugin = plugin;
Modified: firebird/trunk/src/msgs/facilities2.sql
===================================================================
--- firebird/trunk/src/msgs/facilities2.sql 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/msgs/facilities2.sql 2011-06-10 12:53:51 UTC (rev 53147)
@@ -1,7 +1,7 @@
/* MAX_NUMBER is the next number to be used, always one more than the highest message number. */
set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES (?, ?, ?, ?);
--
-('2011-02-02 12:45:00', 'JRD', 0, 705)
+('2011-06-10 16:23:31', 'JRD', 0, 706)
('2010-03-15 06:59:09', 'QLI', 1, 531)
--
--('2008-11-28 20:27:04', 'GDEF', 2, 346)
Modified: firebird/trunk/src/msgs/messages2.sql
===================================================================
--- firebird/trunk/src/msgs/messages2.sql 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/msgs/messages2.sql 2011-06-10 12:53:51 UTC (rev 53147)
@@ -812,6 +812,7 @@
('cannot_copy_stmt', NULL, NULL, NULL, 0, 702, NULL, 'Cannot copy statement @1', NULL, NULL);
('invalid_boolean_usage', NULL, NULL, NULL, 0, 703, NULL, 'Invalid usage of boolean expression', NULL, NULL);
('sysf_argscant_both_be_zero', 'evlAtan2', 'SysFunction.cpp', NULL, 0, 704, NULL, 'Arguments for @1 cannot both be zero', NULL, NULL)
+('spb_no_id', 'Service::start', 'svc.c', NULL, 0, 705, NULL, 'missing service ID in spb', NULL, NULL);
-- QLI
(NULL, NULL, NULL, NULL, 1, 0, NULL, 'expected type', NULL, NULL);
(NULL, NULL, NULL, NULL, 1, 1, NULL, 'bad block type', NULL, NULL);
Modified: firebird/trunk/src/msgs/system_errors2.sql
===================================================================
--- firebird/trunk/src/msgs/system_errors2.sql 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/msgs/system_errors2.sql 2011-06-10 12:53:51 UTC (rev 53147)
@@ -710,6 +710,7 @@
(-104, 'XX', '000', 0, 702, 'cannot_copy_stmt', NULL, NULL)
(-104, '22', '000', 0, 703, 'invalid_boolean_usage', NULL, NULL)
(-833, '42', '000', 0, 704, 'sysf_argscant_both_be_zero', NULL, NULL)
+(-901, 'HY', '000', 0, 705, 'spb_no_id', NULL, NULL)
-- GFIX
(-901, '00', '000', 3, 1, 'gfix_db_name', NULL, NULL)
(-901, '00', '000', 3, 2, 'gfix_invalid_sw', NULL, NULL)
Modified: firebird/trunk/src/plugins/udr_engine/UdrEngine.cpp
===================================================================
--- firebird/trunk/src/plugins/udr_engine/UdrEngine.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/plugins/udr_engine/UdrEngine.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -754,13 +754,12 @@
class ExternalEngineFactoryImpl : public SimpleFactory<Engine>
{
} factory;
-static Firebird::UnloadDetector unloadDetector;
extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
{
PluginManagerInterfacePtr pi;
pi->registerPluginFactory(PluginType::ExternalEngine, "UDR", &factory);
- pi->registerModule(&unloadDetector);
+ pi->registerModule(&myModule);
libraryName->assign("fbclient");
ModuleLoader::doctorModuleExtension(libraryName);
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/remote/client/interface.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -5779,6 +5779,7 @@
response->p_resp_data = temp;
}
+static MakeUpgradeInfo<> upInfo;
static void init(IStatus* status,
rem_port* port,
@@ -5808,7 +5809,7 @@
// Let plugins try to add data to DPB in order to avoid extra network roundtrip
Auth::DpbImplementation di(dpb);
LocalStatus s;
- GetPlugins<Auth::IClient> authItr(PluginType::AuthClient, FB_AUTH_CLIENT_VERSION);
+ GetPlugins<Auth::IClient> authItr(PluginType::AuthClient, FB_AUTH_CLIENT_VERSION, upInfo);
bool working = true;
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/remote/server/server.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -217,6 +217,8 @@
GlobalPtr<FailedLogins> usernameFailedLogins;
GlobalPtr<FailedLogins> remoteFailedLogins;
+MakeUpgradeInfo<> upInfo;
+
// delayed authentication block for auth callback
class ServerAuth : public GlobalStorage, public ServerAuthBase
{
@@ -231,7 +233,7 @@
wrt(getPool(), op == op_service_attach ? ClumpletReader::spbList : ClumpletReader::dpbList,
MAX_DPB_SIZE, pb, pbLen),
authBlockInterface(op == op_service_attach),
- authItr(PluginType::AuthServer, FB_AUTH_SERVER_VERSION, config),
+ authItr(PluginType::AuthServer, FB_AUTH_SERVER_VERSION, upInfo, config),
remoteId(getPool()), userName(getPool()), authServer(NULL),
part2(p2), operation(op)
{
Modified: firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp
===================================================================
--- firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -38,12 +38,14 @@
#include "../../common/os/path_utils.h"
#include "../../jrd/inf_pub.h"
#include "../../dsql/sqlda_pub.h"
+#include "../common/classes/ImplementHelper.h"
using namespace Firebird;
using namespace Jrd;
static const char* const DEFAULT_LOG_NAME = "default_trace.log";
+static MakeUpgradeInfo<> upInfo;
#ifdef WIN_NT
#define NEWLINE "\r\n"
@@ -89,6 +91,7 @@
services(getDefaultMemoryPool()),
unicodeCollation(*getDefaultMemoryPool())
{
+ MasterInterfacePtr()->upgradeInterface(logWriter, FB_TRACE_LOG_WRITER_VERSION, upInfo);
const char* ses_name = initInfo->getTraceSessionName();
session_name = ses_name && *ses_name ? ses_name : " ";
@@ -1937,6 +1940,8 @@
{
try
{
+ MasterInterfacePtr()->upgradeInterface(connection, FB_TRACE_CONNECTION_VERSION, upInfo);
+
log_event_attach(connection, create_db, att_result);
return true;
}
@@ -1951,6 +1956,8 @@
{
try
{
+ MasterInterfacePtr()->upgradeInterface(connection, FB_TRACE_CONNECTION_VERSION, upInfo);
+
log_event_detach(connection, drop_db);
return true;
}
@@ -1967,6 +1974,10 @@
{
try
{
+ MasterInterfacePtr master;
+ master->upgradeInterface(connection, FB_TRACE_CONNECTION_VERSION, upInfo);
+ master->upgradeInterface(transaction, FB_TRACE_TRANSACTION_VERSION, upInfo);
+
log_event_transaction_start(connection, transaction, tpb_length, tpb, tra_result);
return true;
}
@@ -1982,6 +1993,10 @@
{
try
{
+ MasterInterfacePtr master;
+ master->upgradeInterface(connection, FB_TRACE_CONNECTION_VERSION, upInfo);
+ master->upgradeInterface(transaction, FB_TRACE_TRANSACTION_VERSION, upInfo);
+
log_event_transaction_end(connection, transaction, commit, retain_context, tra_result);
return true;
}
@@ -1998,6 +2013,11 @@
{
try
{
+ MasterInterfacePtr master;
+ master->upgradeInterface(connection, FB_TRACE_CONNECTION_VERSION, upInfo);
+ master->upgradeInterface(transaction, FB_TRACE_TRANSACTION_VERSION, upInfo);
+ master->upgradeInterface(variable, FB_TRACE_CONTEXT_VARIABLE_VERSION, upInfo);
+
log_event_set_context(connection, transaction, variable);
return true;
}
@@ -2015,6 +2035,11 @@
{
try
{
+ MasterInterfacePtr master;
+ master->upgradeInterface(connection, FB_TRACE_CONNECTION_VERSION, upInfo);
+ master->upgradeInterface(transaction, FB_TRACE_TRANSACTION_VERSION, upInfo);
+ master->upgradeInterface(procedure, FB_TRACE_PROCEDURE_VERSION, upInfo);
+
log_event_proc_execute(connection, transaction, procedure, started, proc_result);
return true;
}
@@ -2031,6 +2056,11 @@
{
try
{
+ MasterInterfacePtr master;
+ master->upgradeInterface(connection, FB_TRACE_CONNECTION_VERSION, upInfo);
+ master->upgradeInterface(transaction, FB_TRACE_TRANSACTION_VERSION, upInfo);
+ master->upgradeInterface(trigger, FB_TRACE_TRIGGER_VERSION, upInfo);
+
log_event_trigger_execute(connection, transaction, trigger, started, trig_result);
return true;
}
@@ -2048,6 +2078,11 @@
{
try
{
+ MasterInterfacePtr master;
+ master->upgradeInterface(connection, FB_TRACE_CONNECTION_VERSION, upInfo);
+ master->upgradeInterface(transaction, FB_TRACE_TRANSACTION_VERSION, upInfo);
+ master->upgradeInterface(statement, FB_TRACE_SQL_STATEMENT_VERSION, upInfo);
+
log_event_dsql_prepare(connection, transaction, statement, time_millis, req_result);
return true;
}
@@ -2063,6 +2098,10 @@
{
try
{
+ MasterInterfacePtr master;
+ master->upgradeInterface(connection, FB_TRACE_CONNECTION_VERSION, upInfo);
+ master->upgradeInterface(statement, FB_TRACE_SQL_STATEMENT_VERSION, upInfo);
+
log_event_dsql_free(connection, statement, option);
return true;
}
@@ -2079,6 +2118,11 @@
{
try
{
+ MasterInterfacePtr master;
+ master->upgradeInterface(connection, FB_TRACE_CONNECTION_VERSION, upInfo);
+ master->upgradeInterface(transaction, FB_TRACE_TRANSACTION_VERSION, upInfo);
+ master->upgradeInterface(statement, FB_TRACE_SQL_STATEMENT_VERSION, upInfo);
+
log_event_dsql_execute(connection, transaction, statement, started, req_result);
return true;
}
@@ -2096,6 +2140,11 @@
{
try
{
+ MasterInterfacePtr master;
+ master->upgradeInterface(connection, FB_TRACE_CONNECTION_VERSION, upInfo);
+ master->upgradeInterface(transaction, FB_TRACE_TRANSACTION_VERSION, upInfo);
+ master->upgradeInterface(statement, FB_TRACE_BLR_STATEMENT_VERSION, upInfo);
+
log_event_blr_compile(connection, transaction, statement, time_millis, req_result);
return true;
}
@@ -2111,6 +2160,11 @@
{
try
{
+ MasterInterfacePtr master;
+ master->upgradeInterface(connection, FB_TRACE_CONNECTION_VERSION, upInfo);
+ master->upgradeInterface(transaction, FB_TRACE_TRANSACTION_VERSION, upInfo);
+ master->upgradeInterface(statement, FB_TRACE_BLR_STATEMENT_VERSION, upInfo);
+
log_event_blr_execute(connection, transaction, statement, req_result);
return true;
}
@@ -2127,6 +2181,11 @@
{
try
{
+ MasterInterfacePtr master;
+ master->upgradeInterface(connection, FB_TRACE_CONNECTION_VERSION, upInfo);
+ master->upgradeInterface(transaction, FB_TRACE_TRANSACTION_VERSION, upInfo);
+ master->upgradeInterface(request, FB_TRACE_DYN_REQUEST_VERSION, upInfo);
+
log_event_dyn_execute(connection, transaction, request, time_millis, req_result);
return true;
}
@@ -2142,6 +2201,7 @@
{
try
{
+ MasterInterfacePtr()->upgradeInterface(service, FB_TRACE_SERVICE_VERSION, upInfo);
log_event_service_attach(service, att_result);
return true;
}
@@ -2157,6 +2217,7 @@
{
try
{
+ MasterInterfacePtr()->upgradeInterface(service, FB_TRACE_SERVICE_VERSION, upInfo);
log_event_service_start(service, switches_length, switches, start_result);
return true;
}
@@ -2173,6 +2234,7 @@
{
try
{
+ MasterInterfacePtr()->upgradeInterface(service, FB_TRACE_SERVICE_VERSION, upInfo);
log_event_service_query(service, send_item_length, send_items,
recv_item_length, recv_items, query_result);
return true;
@@ -2189,6 +2251,7 @@
{
try
{
+ MasterInterfacePtr()->upgradeInterface(service, FB_TRACE_SERVICE_VERSION, upInfo);
log_event_service_detach(service, detach_result);
return true;
}
Modified: firebird/trunk/src/utilities/ntrace/traceplugin.cpp
===================================================================
--- firebird/trunk/src/utilities/ntrace/traceplugin.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/utilities/ntrace/traceplugin.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -26,6 +26,8 @@
* 2008 Khorsun Vladyslav
*/
+#include "../common/classes/ImplementHelper.h"
+
#include "TraceConfiguration.h"
#include "TracePluginImpl.h"
@@ -51,6 +53,8 @@
return 1;
}
+static Firebird::MakeUpgradeInfo<> upInfo;
+
ntrace_mask_t FB_CARG TraceFactoryImpl::trace_needs()
{
return (1 << TRACE_EVENT_MAX) - 1;
@@ -58,9 +62,12 @@
TracePlugin* FB_CARG TraceFactoryImpl::trace_create(Firebird::IStatus* status, TraceInitInfo* initInfo)
{
+ Firebird::MasterInterfacePtr master;
const char* dbname = NULL;
try
{
+ master->upgradeInterface(initInfo, FB_TRACE_INIT_INFO_VERSION, upInfo);
+
dbname = initInfo->getDatabaseName();
if (!dbname)
dbname = "";
@@ -69,6 +76,11 @@
TraceCfgReader::readTraceConfiguration(initInfo->getConfigText(), dbname, config);
TraceConnection* connection = initInfo->getConnection();
+ if (connection)
+ {
+ master->upgradeInterface(connection, FB_TRACE_CONNECTION_VERSION, upInfo);
+ }
+
if (!config.enabled ||
(config.connection_id && connection &&
(connection->getConnectionID() != SLONG(config.connection_id))))
@@ -90,6 +102,7 @@
TraceLogWriter* logWriter = initInfo->getLogWriter();
if (logWriter)
{
+ master->upgradeInterface(logWriter, FB_TRACE_LOG_WRITER_VERSION, upInfo);
const char* strEx = TracePluginImpl::marshal_exception(ex);
Firebird::string err;
if (dbname)
@@ -111,12 +124,11 @@
static Firebird::SimpleFactory<TraceFactoryImpl> traceFactory;
-static Firebird::UnloadDetector unloadDetector;
void registerTrace(Firebird::IPluginManager* iPlugin)
{
iPlugin->registerPluginFactory(Firebird::PluginType::Trace, "fbtrace", &traceFactory);
- iPlugin->registerModule(&unloadDetector);
+ iPlugin->registerModule(&Firebird::myModule);
}
Modified: firebird/trunk/src/yvalve/MasterImplementation.cpp
===================================================================
--- firebird/trunk/src/yvalve/MasterImplementation.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/yvalve/MasterImplementation.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -30,6 +30,8 @@
#include "firebird/Interface.h"
#include "firebird/Timer.h"
+#include <string.h>
+
#include "../yvalve/MasterImplementation.h"
#include "../common/classes/init.h"
#include "../common/StatusHolder.h"
@@ -113,14 +115,50 @@
FunctionPtr* vTab;
};
- typedef Firebird::Pair<Firebird::NonPooled<U_IPTR, FunctionPtr*> > FunctionPair;
+ class UpgradeKey
+ {
+ public:
+ UpgradeKey(FunctionPtr* aFunc, IPluginModule* aModuleA, IPluginModule* aModuleB)
+ : func(aFunc), moduleA(aModuleA), moduleB(aModuleB)
+ { }
+
+ UpgradeKey(const UpgradeKey& el)
+ : func(el.func), moduleA(el.moduleA), moduleB(el.moduleB)
+ { }
+
+ UpgradeKey()
+ : func(NULL), moduleA(NULL), moduleB(NULL)
+ { }
+
+ bool operator<(const UpgradeKey& el) const
+ {
+ return memcmp(this, &el, sizeof(UpgradeKey)) < 0;
+ }
+
+ bool operator>(const UpgradeKey& el) const
+ {
+ return memcmp(this, &el, sizeof(UpgradeKey)) > 0;
+ }
+
+ bool contains(IPluginModule* module)
+ {
+ return moduleA == module || moduleB == module;
+ }
+
+ private:
+ FunctionPtr* func;
+ IPluginModule* moduleA;
+ IPluginModule* moduleB;
+ };
+
+ typedef Firebird::Pair<Firebird::NonPooled<UpgradeKey, FunctionPtr*> > FunctionPair;
GlobalPtr<GenericMap<FunctionPair> > functionMap;
GlobalPtr<RWLock> mapLock;
}
int FB_CARG MasterImplementation::upgradeInterface(IVersioned* toUpgrade,
int desiredVersion,
- void* missingFunctionClass)
+ struct UpgradeInfo* upgradeInfo)
{
int existingVersion = toUpgrade->getVersion();
@@ -132,9 +170,11 @@
{
CVirtualClass* target = (CVirtualClass*) toUpgrade;
+ UpgradeKey key(target->vTab, toUpgrade->getModule(), upgradeInfo->clientModule);
+
{ // sync scope
ReadLockGuard sync(mapLock);
- if (functionMap->get((U_IPTR) target->vTab, newTab))
+ if (functionMap->get(key, newTab))
{
target->vTab = newTab;
return 0;
@@ -143,9 +183,9 @@
WriteLockGuard sync(mapLock);
- if (!functionMap->get((U_IPTR) target->vTab, newTab))
+ if (!functionMap->get(key, newTab))
{
- CVirtualClass* miss = (CVirtualClass*) missingFunctionClass;
+ CVirtualClass* miss = (CVirtualClass*) (upgradeInfo->missingFunctionClass);
newTab = FB_NEW(*getDefaultMemoryPool()) FunctionPtr[desiredVersion];
for (int i = 0; i < desiredVersion; ++i)
@@ -153,7 +193,7 @@
newTab[i] = i < existingVersion ? target->vTab[i] : miss->vTab[0];
}
- functionMap->put((U_IPTR) target->vTab, newTab);
+ functionMap->put(key, newTab);
}
target->vTab = newTab;
@@ -173,6 +213,29 @@
return 0;
}
+void releaseUpgradeTabs(IPluginModule* module)
+{
+ HalfStaticArray<UpgradeKey, 16> removeList;
+
+ WriteLockGuard sync(mapLock);
+
+ GenericMap<FunctionPair>::Accessor scan(&functionMap);
+ if (scan.getFirst()) do
+ {
+ UpgradeKey& cur(scan.current()->first);
+ if (cur.contains(module))
+ {
+ removeList.add(cur);
+ }
+ }
+ while (scan.getNext());
+
+ for(unsigned int i = 0; i < removeList.getCount(); ++i)
+ {
+ functionMap->remove(removeList[i]);
+ }
+}
+
} // namespace Why
//
@@ -415,7 +478,7 @@
TimerDelay curTime()
{
- return fb_utils::query_performance_counter() / fb_utils::query_performance_frequency();
+ return fb_utils::query_performance_counter() / (fb_utils::query_performance_frequency() / 1000000);
}
TimerEntry* getTimer(ITimer* timer)
Modified: firebird/trunk/src/yvalve/MasterImplementation.h
===================================================================
--- firebird/trunk/src/yvalve/MasterImplementation.h 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/yvalve/MasterImplementation.h 2011-06-10 12:53:51 UTC (rev 53147)
@@ -57,7 +57,8 @@
Firebird::IStatus* FB_CARG getStatus();
Firebird::IProvider* FB_CARG getDispatcher();
Firebird::IPluginManager* FB_CARG getPluginManager();
- int FB_CARG upgradeInterface(Firebird::IVersioned* toUpgrade, int desiredVersion, void* missingFunctionClass);
+ int FB_CARG upgradeInterface(Firebird::IVersioned* toUpgrade, int desiredVersion,
+ Firebird::UpgradeInfo* upgradeInfo);
const char* FB_CARG circularAlloc(const char* s, size_t len, intptr_t thr);
Firebird::ITimerControl* FB_CARG getTimerControl();
Firebird::IAttachment* registerAttachment(Firebird::IProvider* provider,
@@ -68,6 +69,7 @@
};
void shutdownTimers();
+ void releaseUpgradeTabs(Firebird::IPluginModule* module);
} // namespace Why
#endif // YVALVE_MASTER_IMPLEMENTATION_H
Modified: firebird/trunk/src/yvalve/PluginManager.cpp
===================================================================
--- firebird/trunk/src/yvalve/PluginManager.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/yvalve/PluginManager.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -24,6 +24,7 @@
#include "consts_pub.h"
#include "iberror.h"
#include "../yvalve/PluginManager.h"
+#include "../yvalve/MasterImplementation.h"
#include "../dsql/sqlda_pub.h"
#include "../yvalve/why_proto.h"
@@ -344,6 +345,7 @@
if (cleanup)
{
cleanup->doClean();
+ Why::releaseUpgradeTabs(cleanup);
}
}
@@ -442,6 +444,11 @@
~ConfiguredPlugin();
+ const char* getPlugName()
+ {
+ return plugName.c_str();
+ }
+
// ITimer implementation
void FB_CARG handler()
{ }
@@ -501,6 +508,9 @@
private:
~FactoryParameter()
{
+#ifdef DEBUG_PLUGINS
+ fprintf(stderr, "~FactoryParameter places configuredPlugin %s in unload query\n", configuredPlugin->getPlugName());
+#endif
TimerInterfacePtr()->start(configuredPlugin, 1000000); // 1 sec
}
@@ -645,10 +655,10 @@
void FB_CARG next();
PluginSet(unsigned int pinterfaceType, const char* pnamesList,
- int pdesiredVersion, void* pmissingFunctionClass,
+ int pdesiredVersion, UpgradeInfo* pui,
IFirebirdConf* fbConf)
: interfaceType(pinterfaceType), namesList(getPool()),
- desiredVersion(pdesiredVersion), missingFunctionClass(pmissingFunctionClass),
+ desiredVersion(pdesiredVersion), ui(pui),
currentName(getPool()), currentPlugin(NULL),
firebirdConf(fbConf)
{
@@ -672,7 +682,7 @@
unsigned int interfaceType;
PathName namesList;
int desiredVersion;
- void* missingFunctionClass;
+ UpgradeInfo* ui;
PathName currentName;
RefPtr<ConfiguredPlugin> currentPlugin; // Missing data in this field indicates EOF
@@ -807,7 +817,7 @@
IPluginBase* p = currentPlugin->factory(firebirdConf);
if (p)
{
- if (masterInterface->upgradeInterface(p, desiredVersion, missingFunctionClass) >= 0)
+ if (masterInterface->upgradeInterface(p, desiredVersion, ui) >= 0)
{
return p;
}
@@ -895,13 +905,13 @@
}
IPluginSet* FB_CARG PluginManager::getPlugins(unsigned int interfaceType, const char* namesList,
- int desiredVersion, void* missingFunctionClass,
+ int desiredVersion, UpgradeInfo* ui,
IFirebirdConf* firebirdConf)
{
MutexLockGuard g(plugins->mutex);
IPluginSet* rc = new PluginSet(interfaceType, namesList, desiredVersion,
- missingFunctionClass, firebirdConf);
+ ui, firebirdConf);
rc->addRef();
return rc;
}
Modified: firebird/trunk/src/yvalve/PluginManager.h
===================================================================
--- firebird/trunk/src/yvalve/PluginManager.h 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/yvalve/PluginManager.h 2011-06-10 12:53:51 UTC (rev 53147)
@@ -43,14 +43,14 @@
public:
// IPluginManager implementation
IPluginSet* FB_CARG getPlugins(unsigned int interfaceType, const char* namesList,
- int desiredVersion, void* missingFunctionClass,
+ int desiredVersion, UpgradeInfo* ui,
IFirebirdConf* firebirdConf);
void FB_CARG registerPluginFactory(unsigned int interfaceType, const char* defaultName,
IPluginFactory* factory);
IConfig* FB_CARG getConfig(const char* filename);
void FB_CARG releasePlugin(IPluginBase* plugin);
- void FB_CARG registerModule(IPluginModule* cleanup);
- void FB_CARG unregisterModule(IPluginModule* cleanup);
+ void FB_CARG registerModule(IPluginModule* module);
+ void FB_CARG unregisterModule(IPluginModule* module);
PluginManager();
Modified: firebird/trunk/src/yvalve/YObjects.h
===================================================================
--- firebird/trunk/src/yvalve/YObjects.h 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/yvalve/YObjects.h 2011-06-10 12:53:51 UTC (rev 53147)
@@ -117,10 +117,7 @@
class YHelper : public Firebird::StdPlugin<Intf, Vers>, public YObject
{
public:
- YHelper(Intf* aNext) : next(aNext)
- {
- this->addRef();
- }
+ YHelper(Intf* aNext);
int FB_CARG release()
{
@@ -426,7 +423,7 @@
{
if (--refCounter == 0)
{
- delete this;
+ //delete this;
return 0;
}
Modified: firebird/trunk/src/yvalve/why.cpp
===================================================================
--- firebird/trunk/src/yvalve/why.cpp 2011-06-10 12:35:46 UTC (rev 53146)
+++ firebird/trunk/src/yvalve/why.cpp 2011-06-10 12:53:51 UTC (rev 53147)
@@ -557,10 +557,12 @@
public:
virtual void FB_CARG noEntrypoint(IStatus* s)
{
- s->set(Arg::Gds(isc_unavailable).value());
+ s->set(Arg::Gds(isc_wish_list).value());
}
};
+ MakeUpgradeInfo<NoEntrypoint> upInfo;
+
template <typename T, typename CleanupRoutine> // T = YAttachment or YTransaction
class CleanupCallbackImpl : public CleanupCallback
{
@@ -3269,6 +3271,13 @@
return new YTransaction(static_cast<YAttachment*>(attachment), transaction);
}
+template <typename Impl, typename Intf, int Vers>
+YHelper<Impl, Intf, Vers>::YHelper(Intf* aNext)
+{
+ MasterInterfacePtr()->upgradeInterface(aNext, Vers, upInfo);
+ next = aNext;
+ this->addRef();
+}
//-------------------------------------
@@ -4640,8 +4649,8 @@
RefPtr<Config> config;
ResolveDatabaseAlias(expandedFilename, dummy, &config);
- for (GetPlugins<IProvider, NoEntrypoint> providerIterator(PluginType::Provider,
- FB_PROVIDER_VERSION, config);
+ for (GetPlugins<IProvider> providerIterator(PluginType::Provider,
+ FB_PROVIDER_VERSION, upInfo, config);
providerIterator.hasData();
providerIterator.next())
{
@@ -4763,8 +4772,8 @@
ResolveDatabaseAlias(expandedFilename, dummy, &config);
***/
- for (GetPlugins<IProvider, NoEntrypoint> providerIterator(PluginType::Provider,
- FB_PROVIDER_VERSION/***, config***/);
+ for (GetPlugins<IProvider> providerIterator(PluginType::Provider,
+ FB_PROVIDER_VERSION, upInfo/***, config***/);
providerIterator.hasData();
providerIterator.next())
{
@@ -4827,8 +4836,8 @@
try
{
- for (GetPlugins<IProvider, NoEntrypoint> providerIterator(PluginType::Provider,
- FB_PROVIDER_VERSION);
+ for (GetPlugins<IProvider> providerIterator(PluginType::Provider,
+ FB_PROVIDER_VERSION, upInfo);
providerIterator.hasData();
providerIterator.next())
{
@@ -4916,8 +4925,8 @@
shutdownStarted = true;
// Shutdown providers (if any present).
- for (GetPlugins<IProvider, NoEntrypoint> providerIterator(
- PluginType::Provider, FB_PROVIDER_VERSION);
+ for (GetPlugins<IProvider> providerIterator(PluginType::Provider,
+ FB_PROVIDER_VERSION, upInfo);
providerIterator.hasData();
providerIterator.next())
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|