Skip to main content

Connect/disconnect pool

Connection management for the C++ Replication API

Abstract

This class provides connection management (logon, logoff, and so forth.).

This class provides connection management (logon, logoff, and so forth.).

Class

FCREPLConn

Replication Manager connection. It can keep both connections to the local DBEngine and replication server, keeping both data providers.

Getters

Table 1. Getters

Return current configuration object

pFCREPLConfig GetConfig() { return (pFCREPLConfig)((pRCESConn)this)->GetConfig(); };



Class

FCREPLConfig

This class sets the Replication Manager (referred to as Memphis) connection information. It also includes a number of advanced options that could be configured. Usually, it is loaded from the ctsrvr.cfg SUBSYSTEM REPLICATION AGENT session.

Table 2. Supported options

Option

Default

Notes

EMBEDDED YES

YES

Indicates if the Replication Manager agent will be standalone or embedded in a DBEngine.

LOG_FILE <file name>

NULL

Null means no log.

MEMPHIS_TYPE <CTREE> or <ODBC>

<CTREE>

MEMPHIS_SERVER_NAME <master server name>

<MEMPHIS>

MEMPHIS_SQL_PORT <master server SQL port>

<6597>

MEMPHIS_HOST <master server host>

<>

MEMPHIS_DATABASE <master database name>

<MEMPHIS>

MEMPHIS_MAX_CONN <maximum master connection count>

<8>

QUEUE_THREAD_COUNT <queue thread count for the non-ctree consumer>

4

LOCAL_CTREE_CHECK <YES or NO>

YES

CTREE_CHECK_MASK <File mask to be checked as c-tree file>

<*.dat;*.idx>

Supported multiple masks delimited by [;].

DBENGINE_CHECK <YES for automatic scan and track c-tree DBEngine changes>

YES

VERBOSE_SCAN_COUNT <frequency of scan files to be displayed> or <0>

<0>

VERBOSE_SHOW_NAME <YES for display file name on scan message displayed> or <NO>

<NO>

LOCAL_CONN_POOL_SIZE <local connection pool size>

50

SCAN_THREAD_COUNT <scan thread count>

50

ADV_FULL_MASK <YES for enable the full mask advanced filter by the callback>

NO

MASTER_CONN_POOL_SIZE = <master connection pool size>

10

LOAD_THREAD_COUNT = <load thread count to insert the filesystem blocks into the master DB>

4

STANDALONE_AGENT <YES for standalone agent only>

<YES>

TRACE NO

NO

Enable the tracing for the Replication Manager agent.

DBENGINE_CONN_BY_IP <YES | NO | ip address>

<NO>

Defines how the DBEngine should be connected by the Replication Manager.

ACCEPT_CONN <YES | NO>

<YES>

This is a flag indicating if the agent accept external connection or not.

JVM_LIB <JBM library path>

<>

If embedded in a SQL server, use the JVM from SQL.



Replication server specific keywords

Table 3. Replication server-specific keywords

Keyword

Default

WEB_TRACE NO

NO (enable the tracing for the web server)

INACTIVE_TIMEOUT <pool inactive timeout in seconds>

60 (seconds)

MEMPHIS_CONN_POOL_SIZE <memphis connection pool size>

10

CHECKSTATUS_WAIT <seconds to wait for the next DBEngine Status check>

30 (seconds)

DEBUG_WEB_API <YES for WEB API debug>

NO

ARCHIVE_ACTION <number of days to wait before archiving ACTION events>

1

ARCHIVE_LOG <number of days to wait before archiving LOG events>

7

ARCHIVE_REPLSTAT <number of days to wait before archiving REPLSTAT events>

7

CHECK_DBENGINE_THRD_COUNT <number of threads to be used for checking DBEngines status>

10

CHECK_REPLPLAN_THRD_COUNT <number of threads to be used for checking replication plan status>

5



Getters

Table 4. Getters

Local agent type (DBEngine, ReplStudio, ReplAgent, WebServer, and so forth)

FCREPLLogAgent GetAgentType() { return (FCREPLLogAgent)((pRCESConfig)this)->GetAgentType(); };

Retrieve a configuration value by its name

const char *GetParam(const char *key) { return ((pRCESConfig)this)->GetParam(key); };

Retrieve a configuration value by its code

const char *GetParam(RCESParam param) { return ((pRCESConfig)this)->GetParam(param); };

Retrieve the username and password from an authentication .set file

void GetUser(char *authFileName, char **userName, char **userPass) { ((pRCESConfig)this)->GetUser(authFileName, userName, userPass); };



Inherited getters

Table 5. Inherited getters

Check if the provided configuration object matches the current one

bool Matches(pFCConfig config);

Retrieve an advanced configuration by its KEY

const char *GetParam(const char *key);

Retrieve an advanced configuration by its param

const char *GetParam(RCESParam param);

Return if connection will check for local FairCom files: LOCAL_CTREE_CHECK

bool HasCtreeLocalCheck();

Return if file system scan is set to be executed in multi-threaded mode: SCAN_THREAD_COUNT

bool HasMultiThreadScan();

Return if file system scan has a full mask advanced filter by the callback: ADV_FULL_MASK

bool IsAdvFullMask();

Printf the configuration options

static void PrintfConfigOptions();

Retrieve the username and password

void GetUser(char *authFileName, char **userName, char **userPass);

Local DBEngine identification

Note

It is linked to FCREPLDBEngine class

int GetLocalDBEngineID();

Local agent identification

Note

It is linked to FCREPLAgent class.

int GetAgentID() { return _agentID; };

Return if current agent is embedded into a DBEngine

bool IsEmbedded();

Local library handle (can be mtclient.dll or ctreedbs.dll handles)

void *GetLocalLibHandle();

Local logger

pRCESLogger GetLoggerLocal();

Agent type

RCESLogAgent GetAgentType();

Local agent name

const char *GetAgentName();

Local server name

const char *GetLocalServerName();

Local user name

const char *GetLocalUserName();

Local user password

const char *GetLocalUserPass();

Return if WebAPIDebug is enabled

bool IsWebAPIDebug();

Memphis Volume identification

Note

It is linked to FCREPLVolume class.

int GetMemphisDBVolID();

Memphis directory

const char *GetMemphisDBDir();

Local directory path

const char *GetLocalPath();

Retrieve a path buffer populated with the local directory

char *GetLocalPathBuffer();

Master conn pool

FCPool<RCESMasterConnPooled> *GetMasterConnPool();

Return if local server is shutting down

bool IsShutDown();

Return if Trace is active

bool IsTrace();

Return if WebTrace is active

bool IsWebTrace();

Return if its local agent is executing a FileSystem scan

bool HasFSScan();

Memphis OpSystem identification

Note

It is linked to FCREPLOpSystem class.

int GetMasterOS();

Local OpSystem identification

Note

It is linked to FCREPLOpSystem class.

int GetAgentOS();

Return if local DBEngine is Memphis

bool IsMasterAgent();

Return is automatic scan and track FairCom DBEngine changes: DBENGINE_CHECK

bool IsCheckDBEngine();

Memphis database user login

const char *GetMasterLogin();

Memphis database password

const char *GetMasterPass();

Plan manager hash

FCHashTable<RCESReplPlanMngr> *GetReplPlanMngrHash();

Engine manager hash

FCHashTable<RCESDBEngineMngr> *GetDBEngineMngrHash();

Failover hash

FCHashTable<RCESFailOverMngr> *GetFailOverMngrHash();

Repl agent data hash

FCHashTable<ReplicationAgentData> *GetReplAgentDataHash();

Repl monitor data hash

FCHashTable<ReplicationMonitorData> *GetReplMonitorDataHash();

Repl dump data hash

FCHashTable<ReplicationDumpData> *GetReplDumpDataHash();

Platform

RCESPlatform GetPlatform();

Retrieve the Platform name

const char *GetPlatformName();

Retrieve accept connection

bool GetAcceptConn();

Retrieve read-only

RCESReadOnly GetReadOnly();

Retrieve the JVM lib path

const char *GetJVMLibPath();

Clean up global FailOver manager hash

void CleanFailOverMngrHash();

Retrieve ISConnected flag

bool IsConnected();



Setters

Table 6. Setters

Local agent type (DBEngine, ReplStudio, ReplAgent, WebServer, and so forth)

void SetAgentType(FCREPLLogAgent agentType) { ((pRCESConfig)this)->SetAgentType((RCESLogAgent)agentType); };

Local agent name

void SetAgentName(const char *agentName) { ((pRCESConfig)this)->SetAgentName(agentName); };

Local server name

void SetLocalServerName(const char *localServerName) { ((pRCESConfig)this)->SetLocalServerName(localServerName); };

Local user name

void SetLocalUserName(const char *localUserName) { ((pRCESConfig)this)->SetLocalUserName(localUserName); };

Local user password

void SetLocalUserPass(const char *localUserPass) { ((pRCESConfig)this)->SetLocalUserPass(localUserPass); };

Memphis directory

void SetMemphisDBDir(const char *dbDir) { ((pRCESConfig)this)->SetMemphisDBDir(dbDir); };

Local directory path

void SetLocalPath(const char *localPath) { ((pRCESConfig)this)->SetLocalPath(localPath); };

Memphis database user login

void SetMasterLogin(const char *masterLogin) { ((pRCESConfig)this)->SetMasterLogin(masterLogin); };

Memphis database password

void SetMasterPass(const char *masterPass) { ((pRCESConfig)this)->SetMasterPass(masterPass); };



Inherited setters

Table 7. Inherited setters

Memphis OpSystem identification

Note

It is linked to FCREPLOpSystem class.

void SetMasterOS( int masterOS );

Local OpSystem identification

Note

It is linked to FCREPLOpSystem class.

void SetAgentOS( int agentOS );

Local DBEngine identification

Note

It is linked to FCREPLDBEngine class.

void SetLocalDBEngineID( int localDBEngineID );

Local agent identification

Note

It is linked to FCREPLAgent class.

void SetAgentID( int agentID );

Set if current agent is embedded to a DBEngine

void SetIsEmbedded( bool isEmbedded );

Local library handle (can be mtclient.dll or ctreedbs.dll handles)

void SetLocalLibHandle( void *localLibHandle );

Set agent type

void SetAgentType(RCESLogAgent agentType);

Set agent name

void SetAgentName(const char *agentName);

Set local server name

void SetLocalServerName(const char *localServerName);

Set local user name

void SetLocalUserName(const char *localUserName);

Set local user password

void SetLocalUserPass(const char *localUserPass);

Return if WebAPIDebug is enabled

void SetWebAPIDebug( bool enable );

Memphis volume identification

Note

It is linked to FCREPLVolume class.

void SetMemphisDBVolID( int volumeID );

Set Memphis DB directory

void SetMemphisDBDir(const char *dbDir);

Set local path

void SetLocalPath(const char *localPath);

Set master connection pool

void SetMasterConnPool(FCPool<RCESMasterConnPooled> *masterConnPool);

Trace status

void SetTrace( bool isTrace );

Web trace status

void SetWebTrace( bool webTrace );

FilSystem scan

void SetFSScan(bool fsScan);

Set master login

void SetMasterLogin(const char *masterLogin);

Set master password

void SetMasterPass(const char *masterPass);

Set DB engine manager hash

void SetDBEngineMngrHash(FCHashTable<RCESDBEngineMngr> *dbEngineMngrHash);

Set accept connection flag

void SetAcceptConn(bool acceptConn);

Set read only

void SetJVMLibPath(const char *jvmLibPath);

Set JVM library path

void SetJVMLibPath(const char *jvmLibPath);

Set is connected path

void SetIsConnected(bool isConnected);



Create a connection object for the Replication database based on a configuration object. It will keep the config object, logger object, and database connection.

Prototype

FCREPL_API int fcReplConnect(pFCREPLConfig config, ppFCREPLConn replConn, char **errorMsg);

Parameters

Table 8. Parameters

Parameter

Description

config [IN]

Configuration object

replConn [OUT]

New replication connection object

errorMsg [OUT]

Error message buffer



Return

Error code

Create a connection object for the replication database based on Replication Manager login information. This function will create a basic configuration object internally. It will keep the config object, logger object, and database connection.

Prototype

FCREPL_API int fcReplConnect(const char *masterHost, const char *masterServerName, const char *masterSQLPort, const char *masterDatabase, const char *masterLogin, const char *masterPass, ppFCREPLConn replConn, char **errorMsg);

Parameters

Table 9. Parameters

Parameter

Description

masterHost [IN]

Master server host

masterServerName [IN]

Master server name

masterSQLPort [IN]

Master SQL port

masterDatabase [IN]

Master database name

masterLogin [IN]

Master database user login

masterPass [IN]

Master database user password

replConn [OUT]

New replication connection handle

errorMsg [OUT]

Error message buffer



Return

Error code

Disconnect from the replication database.

Prototype

FCREPL_API int fcReplDisconnect(pFCREPLConn replConn);

Parameters

Table 10. Parameters

Parameter

Description

replConn [IN]

Replication connection handle



Return

Error code