Commit 7aeaa7cc authored by Steven Murray's avatar Steven Murray
Browse files

bug #82673: RFE: Tapebridged and rtcpd should support buffered tape-marks over multiple files

After further reverse engineering rtcpd it became apparent that there should
only be one configuration parameter to specify which of the following 3 possible
tape-flush behaviours the tapebridged and rtcpd daemons should follow:

  * N_FLUSHES_PER_FILE
  * ONE_FLUSH_PER_FILE
  * ONE_FLUSH_PER_N_FILES

This commit adds the following tapebridge configuration parameter, which today
is ignored:

  TAPEBRIDGE TAPEFLUSHMODE N_FLUSHES_PER_FILE

More importantly and the real reason for this commit is the value of this
configuration parameter is now passed from the tapebridged daemon to the rtcpd
daemon via the tapeFlushMode member of the newly updated TAPEBRIDGE_CLIENTINFO2
message:

typedef struct {
  uint32_t volReqId;
  uint32_t bridgeCallbackPort;
  uint32_t bridgeClientCallbackPort;
  uint32_t clientUID;
  uint32_t clientGID;
  uint32_t tapeFlushMode;
  uint64_t maxBytesBeforeFlush;
  uint64_t maxFilesBeforeFlush;
  char     bridgeHost[CA_MAXHOSTNAMELEN+1];
  char     bridgeClientHost[CA_MAXHOSTNAMELEN+1];
  char     dgn[CA_MAXDGNLEN+1];
  char     drive[CA_MAXUNMLEN+1];
  char     clientName[CA_MAXUSRNAMELEN+1];
} tapeBridgeClientInfo2MsgBody_t;

Please note that the TAPEBRIDGE_CLIENTINFO2 has not been released in any version
of CASTOR and is therefore subject to change until the next release where it
will be frozen.
parent 4a5bcd60
......@@ -38,6 +38,7 @@
#include "castor/tape/tapebridge/FailedToCopyTapeFile.hpp"
#include "castor/tape/tapebridge/LegacyTxRx.hpp"
#include "castor/tape/tapebridge/RtcpTxRx.hpp"
#include "castor/tape/tapebridge/TapeFlushConfigParams.hpp"
#include "castor/tape/net/net.hpp"
#include "castor/tape/tapegateway/EndNotificationErrorReport.hpp"
#include "castor/tape/tapegateway/FileMigratedNotification.hpp"
......@@ -65,6 +66,7 @@
// constructor
//-----------------------------------------------------------------------------
castor::tape::tapebridge::BridgeProtocolEngine::BridgeProtocolEngine(
const TapeFlushConfigParams &tapeFlushConfigParams,
const Cuuid_t &cuuid,
const int listenSock,
const int initialRtcpdSock,
......@@ -73,6 +75,7 @@ castor::tape::tapebridge::BridgeProtocolEngine::BridgeProtocolEngine(
const uint32_t nbFilesOnDestinationTape,
BoolFunctor &stoppingGracefully,
Counter<uint64_t> &tapebridgeTransactionCounter) throw() :
m_tapeFlushConfigParams(tapeFlushConfigParams),
m_cuuid(cuuid),
m_jobRequest(jobRequest),
m_volume(volume),
......@@ -304,62 +307,6 @@ void castor::tape::tapebridge::BridgeProtocolEngine::processSocks()
}
//------------------------------------------------------------------------------
// getNbRtcpdDiskIOThreads
//------------------------------------------------------------------------------
castor::tape::tapebridge::ConfigParamAndSource<uint32_t>
castor::tape::tapebridge::BridgeProtocolEngine::getNbRtcpdDiskIOThreads()
throw(castor::exception::Exception) {
const std::string paramName = "RTCPD/THREAD_POOL";
const char *paramCStr = NULL;
uint32_t paramUInt32 = 0;
std::string paramSource = "UNKNOWN";
// Try to get the number of disk-IO threads from the environment variables
if(NULL != (paramCStr = getenv("RTCPD_THREAD_POOL"))) {
paramSource = "environment variable";
if(!utils::isValidUInt(paramCStr)) {
castor::exception::InvalidArgument ex;
ex.getMessage() <<
"Configuration parameter is not a valid unsigned integer"
": name=" << paramName <<
" value=" << paramCStr <<
" source=" << paramSource;
throw(ex);
}
// Safe to cast to uint32_t as utils::isValidUInt has been performed
paramUInt32 = (uint32_t)atoi(paramCStr);
// Else try to get the number of disk IO threads of castor.conf
} else if(NULL != (paramCStr = getconfent("RTCPD", "THREAD_POOL", 0))) {
paramSource = "castor.conf";
if(!utils::isValidUInt(paramCStr)) {
castor::exception::InvalidArgument ex;
ex.getMessage() <<
"Configuration parameter is not a valid unsigned integer"
": name=" << paramName <<
" value=" << paramCStr <<
" source=" << paramSource;
throw(ex);
}
// Safe to cast to uint32_t as utils::isValidUInt has been performed
paramUInt32 = (uint32_t)atoi(paramCStr);
// Else use the compile-time default
} else {
paramSource = "compile-time default";
paramUInt32 = RTCPD_THREAD_POOL;
}
return ConfigParamAndSource<uint32_t>(paramName, paramUInt32, paramSource);
}
//------------------------------------------------------------------------------
// processAPendingSocket
//------------------------------------------------------------------------------
......@@ -404,35 +351,6 @@ bool castor::tape::tapebridge::BridgeProtocolEngine::
// Throw an exception if connection is not from localhost
checkPeerIsLocalhost(acceptedConnection);
const ConfigParamAndSource<uint32_t>
nbRtcpdDiskIOThreads(getNbRtcpdDiskIOThreads());
// Log the value and source of the number of rtcpd disk-IO threads
castor::dlf::Param params[] = {
castor::dlf::Param("name" , nbRtcpdDiskIOThreads.name),
castor::dlf::Param("value" , nbRtcpdDiskIOThreads.value),
castor::dlf::Param("source", nbRtcpdDiskIOThreads.source)};
castor::dlf::dlf_writep(m_cuuid, DLF_LVL_SYSTEM, TAPEBRIDGE_CONFIG_PARAM,
params);
// Determine maximum number of RTCPD disk/tape IO control connections
// This is the number of disk IO threads plus 1 for the tape IO thread
const int maxNbDiskTapeIOControlConns = nbRtcpdDiskIOThreads.value + 1;
// Throw an exception if the expected maximum number of disk/tape IO
// control connections has been exceeded
if(m_sockCatalogue.getNbDiskTapeIOControlConns() >
maxNbDiskTapeIOControlConns) {
castor::exception::Exception ex(ECANCELED);
ex.getMessage() <<
"Maximum number of disk/tape IO control connections exceeded"
": maxNbDiskTapeIOControlConns=" << maxNbDiskTapeIOControlConns <<
": actual=" << m_sockCatalogue.getNbDiskTapeIOControlConns();
throw(ex);
}
return true; // Continue the RTCOPY session
}
......
......@@ -28,10 +28,10 @@
#include "castor/exception/Exception.hpp"
#include "castor/tape/tapebridge/BoolFunctor.hpp"
#include "castor/tape/tapebridge/BridgeSocketCatalogue.hpp"
#include "castor/tape/tapebridge/ConfigParamAndSource.hpp"
#include "castor/tape/tapebridge/Constants.hpp"
#include "castor/tape/tapebridge/Counter.hpp"
#include "castor/tape/tapebridge/PendingMigrationsStore.hpp"
#include "castor/tape/tapebridge/TapeFlushConfigParams.hpp"
#include "castor/tape/legacymsg/CommonMarshal.hpp"
#include "castor/tape/legacymsg/RtcpMarshal.hpp"
#include "castor/tape/tapegateway/Volume.hpp"
......@@ -59,6 +59,9 @@ public:
/**
* Constructor.
*
* @param tapeFlushConfigParams The values of the tape-flush
* configuration-parameters to be used by the
* tape-bridge.
* @param cuuid The ccuid to be used for logging.
* @param listenSock The socket-descriptor of the listen socket
* to be used to accept callback connections
......@@ -79,6 +82,7 @@ public:
* IDS used in requests to the clients.
*/
BridgeProtocolEngine(
const TapeFlushConfigParams &tapeFlushConfigParams,
const Cuuid_t &cuuid,
const int rtcpdListenSock,
const int initialRtcpdSock,
......@@ -93,20 +97,13 @@ public:
*/
void run() throw(castor::exception::Exception);
private:
/**
* Determines the number of rtcpd disk-IO threads.
*
* This method determines the required value by first reading the
* environment variables, then if unsuccessful by reading castor.conf and
* finally if still unsuccessfull by using the compile-time default.
*
* @return The configuration parameter including its source, either
* "environment variable", "castor.conf" or "compile-time default".
* The values of the tape-flush configuration-parameters to be used by the
* tape-bridge.
*/
ConfigParamAndSource<uint32_t> getNbRtcpdDiskIOThreads()
throw(castor::exception::Exception);
private:
const TapeFlushConfigParams m_tapeFlushConfigParams;
/**
* The cuuid to be used for logging.
......
......@@ -38,28 +38,45 @@ namespace tapebridge {
* have user readable values like "environment variable", * "castor.conf" or
* "compile-time constant".
*/
template <typename T> struct ConfigParamAndSource {
template <typename ValueType> struct ConfigParamAndSource {
/**
* Constructor used to initialise the members of this structure.
*
* @param n The name of the configuration parameter.
* @param c The category name of the configuration parameter as used in the
* castor.conf file.
* @param n The name of the configuration parameter as used in the
* castor.conf file.
* @param v The value of the configuration parameter.
* @param s The source of the configuration parameter.
*/
ConfigParamAndSource(const std::string &n, T v, const std::string &s) :
name(n), value(v), source(s) {
ConfigParamAndSource(
const std::string &c,
const std::string &n,
const ValueType &v,
const std::string &s):
category(c),
name(n),
value(v),
source(s) {
// Do nothing
}
/**
* The name of the configuration parameter.
* The category name of the configuration parameter as used in the
* castor.conf file.
*/
std::string category;
/**
* The name of the configuration parameter as used in the castor.conf file.
*/
std::string name;
/**
* The value of the configuration parameter.
*/
T value;
ValueType value;
/**
* The source of the configuration paremeter.
......
......@@ -27,6 +27,7 @@
#define CASTOR_TAPE_TAPEBRIDGE_CONSTANTS_HPP 1
#include "h/Castor_limits.h"
#include "h/tapebridge_constants.h"
#include <stdint.h>
#include <stdlib.h>
......@@ -128,13 +129,12 @@ namespace tapebridge {
/**
* The compile-time default value of the tapebridged configuration parameter
* named TAPEBRIDGE/USEBUFFEREDTAPEMARKSOVERMULTIPLEFILES.
* named TAPEBRIDGE/TAPEFLUSHMODE.
*
* The value of this parameter defines whether or not the tapebridged and
* rtcpd daemons will use buffered tape-marks over multiple files when
* migrating data to tape.
* The value of this parameter defines the mode of flush behaviour used when
* writing data to tape.
*/
const bool TAPEBRIDGE_USEBUFFEREDTAPEMARKSOVERMULTIPLEFILES = false;
const uint32_t TAPEBRIDGE_TAPEFLUSHMODE = TAPEBRIDGE_N_FLUSHES_PER_FILE;
/**
* The compile-time default value of the tapebridged configuration parameter
......@@ -162,7 +162,7 @@ namespace tapebridge {
* used over multiple files as defined by the parameter named
* TAPEBRIDGE/USEBUFFEREDTAPEMARKSOVERMULTIPLEFILES.
*/
const uint64_t TAPEBRIDGE_MAXFILESBEFOREFLUSH = 1;
const uint64_t TAPEBRIDGE_MAXFILESBEFOREFLUSH = 2;
} // namespace tapebridge
} // namespace tape
......
......@@ -38,6 +38,7 @@ TAPEBRIDGEBIN_SRCS = \
BridgeSocketCatalogue.cpp \
BoolFunctor.cpp \
ClientTxRx.cpp \
TapeFlushConfigParams.cpp \
DlfMessageStrings.cpp \
FailedToCopyTapeFile.cpp \
LegacyTxRx.cpp \
......
......@@ -118,14 +118,14 @@ public:
/**
* == operator.
*/
friend bool operator== (RtcpdIOConnState const& a, RtcpdIOConnState const& b) {
friend bool operator==(RtcpdIOConnState const& a, RtcpdIOConnState const& b) {
return a.m_value == b.m_value;
}
/**
* != operator.
*/
friend bool operator!= (RtcpdIOConnState const& a, RtcpdIOConnState const& b) {
friend bool operator!=(RtcpdIOConnState const& a, RtcpdIOConnState const& b) {
return a.m_value != b.m_value;
}
......@@ -139,8 +139,8 @@ private:
static const RtcpdIOConnState *s_objects[];
/**
* The enumeration value of this RtcpdIOConnState. This value can be used in switch
* statements.
* The enumeration value of this RtcpdIOConnState. This value can be used in
* switch statements via the value() getter method.
*/
Value m_value;
......@@ -150,7 +150,8 @@ private:
const char *m_str;
/**
* Private constructor preventing RtcpdIOConnState objects from being instantiated.
* Private constructor preventing RtcpdIOConnState objects from being
* instantiated.
*/
RtcpdIOConnState(const Value value, const char *str) throw();
......
......@@ -29,6 +29,7 @@
#include "castor/server/TCPListenerThreadPool.hpp"
#include "castor/tape/tapebridge/DlfMessageConstants.hpp"
#include "castor/tape/tapebridge/TapeBridgeDaemon.hpp"
#include "castor/tape/tapebridge/TapeFlushConfigParams.hpp"
#include "castor/tape/tapebridge/Constants.hpp"
#include "castor/tape/utils/utils.hpp"
#include "castor/tape/tapebridge/VdqmRequestHandler.hpp"
......@@ -123,6 +124,57 @@ int castor::tape::tapebridge::TapeBridgeDaemon::exceptionThrowingMain(
// Pass the foreground option to the super class BaseDaemon
m_foreground = m_parsedCommandLine.foregroundOptionSet;
// Determine and log the values of the tape-bridge configuration-parameters.
// Only log the maximum number of bytes and files before a flush to tape if
// the tape flush mode requires them.
TapeFlushConfigParams tapeFlushConfigParams;
/* THIS CODE IS NOT TO EXECUTED ON THE v2_1_11Version BRANCH
tapeFlushConfigParams.determineTapeFlushConfigParams();
{
castor::dlf::Param params[] = {
castor::dlf::Param("category",
tapeFlushConfigParams.getTapeFlushMode().category),
castor::dlf::Param("name" ,
tapeFlushConfigParams.getTapeFlushMode().name ),
castor::dlf::Param("value" ,
tapeFlushConfigParams.getTapeFlushMode().value ),
castor::dlf::Param("source" ,
tapeFlushConfigParams.getTapeFlushMode().source )};
castor::dlf::dlf_writep(nullCuuid, DLF_LVL_SYSTEM, TAPEBRIDGE_CONFIG_PARAM,
params);
}
if(TAPEBRIDGE_ONE_FLUSH_PER_N_FILES ==
tapeFlushConfigParams.getTapeFlushMode().value) {
{
castor::dlf::Param params[] = {
castor::dlf::Param("category",
tapeFlushConfigParams.getMaxBytesBeforeFlush().category),
castor::dlf::Param("name",
tapeFlushConfigParams.getMaxBytesBeforeFlush().name),
castor::dlf::Param("value",
tapeFlushConfigParams.getMaxBytesBeforeFlush().value),
castor::dlf::Param("source",
tapeFlushConfigParams.getMaxBytesBeforeFlush().source)};
castor::dlf::dlf_writep(nullCuuid, DLF_LVL_SYSTEM,
TAPEBRIDGE_CONFIG_PARAM, params);
}
{
castor::dlf::Param params[] = {
castor::dlf::Param("category",
tapeFlushConfigParams.getMaxFilesBeforeFlush().category),
castor::dlf::Param("name",
tapeFlushConfigParams.getMaxFilesBeforeFlush().name),
castor::dlf::Param("value",
tapeFlushConfigParams.getMaxFilesBeforeFlush().value),
castor::dlf::Param("source",
tapeFlushConfigParams.getMaxFilesBeforeFlush().source)};
castor::dlf::dlf_writep(nullCuuid, DLF_LVL_SYSTEM,
TAPEBRIDGE_CONFIG_PARAM, params);
}
}
*/
// Extract the tape-drive names from the TPCONFIG file
utils::TpconfigLines tpconfigLines;
utils::parseTpconfigFile(TPCONFIGPATH, tpconfigLines);
......@@ -150,7 +202,7 @@ int castor::tape::tapebridge::TapeBridgeDaemon::exceptionThrowingMain(
castor::dlf::dlf_writep(nullCuuid, DLF_LVL_SYSTEM,
TAPEBRIDGE_PARSED_TPCONFIG, params);
createVdqmRequestHandlerPool(driveNames.size());
createVdqmRequestHandlerPool(tapeFlushConfigParams, driveNames.size());
// Start the threads
start();
......@@ -308,14 +360,16 @@ void castor::tape::tapebridge::TapeBridgeDaemon::parseCommandLine(
// createVdqmRequestHandlerPool
//------------------------------------------------------------------------------
void castor::tape::tapebridge::TapeBridgeDaemon::
createVdqmRequestHandlerPool(const uint32_t nbDrives)
createVdqmRequestHandlerPool(
const TapeFlushConfigParams &tapeFlushConfigParams, const uint32_t nbDrives)
throw(castor::exception::Exception) {
const int vdqmListenPort = utils::getPortFromConfig("TAPEBRIDGE", "VDQMPORT",
TAPEBRIDGE_VDQMPORT);
std::auto_ptr<server::IThread>
thread(new castor::tape::tapebridge::VdqmRequestHandler(nbDrives));
thread(new castor::tape::tapebridge::VdqmRequestHandler(
tapeFlushConfigParams, nbDrives));
std::auto_ptr<server::BaseThreadPool>
threadPool(new castor::server::TCPListenerThreadPool(
......
......@@ -29,6 +29,7 @@
#include "castor/exception/InvalidConfigEntry.hpp"
#include "castor/server/BaseDaemon.hpp"
#include "castor/server/BaseThreadPool.hpp"
#include "castor/tape/tapebridge/TapeFlushConfigParams.hpp"
#include <stdint.h>
#include <iostream>
......@@ -139,11 +140,16 @@ private:
/**
* Creates the VDQM request handler thread pool.
*
* @param nbDrives The number of tape drives attached to the tape server
* tapebridged is running on.
* @param tapeFlushConfigParams The values of the tape-flush
* configuration-parameters to be used by the
* tape-bridge.
* @param nbDrives The number of tape drives attached to the
* tape server that the tapebridged daemon is
* running on.
*/
void createVdqmRequestHandlerPool(const uint32_t nbDrives)
throw (castor::exception::Exception);
void createVdqmRequestHandlerPool(
const TapeFlushConfigParams &tapeFlushConfigParams,
const uint32_t nbDrives) throw (castor::exception::Exception);
/**
* DLF message strings.
......
/******************************************************************************
* castor/tape/tapebridge/TapeFlushConfigParams.cpp
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
*
* @author Steven.Murray@cern.ch
*****************************************************************************/
#include "castor/exception/InvalidArgument.hpp"
#include "castor/tape/tapebridge/TapeFlushConfigParams.hpp"
#include "castor/tape/tapebridge/Constants.hpp"
#include "castor/tape/utils/utils.hpp"
#include "h/getconfent.h"
#include "h/rtcpd_constants.h"
#include "h/tapebridge_constants.h"
#include "h/u64subr.h"
//-----------------------------------------------------------------------------
// Constructor
//-----------------------------------------------------------------------------
castor::tape::tapebridge::TapeFlushConfigParams::TapeFlushConfigParams():
m_tapeFlushMode("TAPEBRIDGE", "TAPEFLUSHMODE", TAPEBRIDGE_N_FLUSHES_PER_FILE,
"UNKNOWN"),
m_maxBytesBeforeFlush("TAPEBRIDGE", "MAXBYTESBEFOREFLUSH", (uint64_t)0,
"UNKNOWN"),
m_maxFilesBeforeFlush("TAPEBRIDGE", "MAXFILESBEFOREFLUSH", (uint64_t)0,
"UNKNOWN") {
// Do nothing
}
//------------------------------------------------------------------------------
// determineTapeFlushConfigParams
//------------------------------------------------------------------------------
void castor::tape::tapebridge::TapeFlushConfigParams::
determineTapeFlushConfigParams() throw(castor::exception::Exception) {
getTapeFlushMode();
// Only try to determine the maximum number of bytes and files before a flush
// if the flush mode requires them
if(TAPEBRIDGE_ONE_FLUSH_PER_N_FILES == m_tapeFlushMode.value) {
getMaxBytesBeforeFlush();
getMaxFilesBeforeFlush();
}
}
//------------------------------------------------------------------------------
// determineTapeFlushMode
//------------------------------------------------------------------------------
void castor::tape::tapebridge::TapeFlushConfigParams::determineTapeFlushMode()
throw(castor::exception::Exception) {
const std::string envVarName = m_tapeFlushMode.category + "_" +
m_tapeFlushMode.name;
const char *paramCStr = NULL;
// Try to get the value from the environment variables, else try to get it
// from castor.conf
if(NULL != (paramCStr = getenv(envVarName.c_str()))) {
m_tapeFlushMode.source = "environment variable";
} else if(NULL != (paramCStr = getconfent(m_tapeFlushMode.category.c_str(),
m_tapeFlushMode.name.c_str(), 0))) {
m_tapeFlushMode.source = "castor.conf";
}
// If we got the value, then try to convert it to a uint32_t, else use the
// compile-time default
if(NULL != paramCStr) {
if(0 == strcmp("N_FLUSHES_PER_FILE", paramCStr)) {
m_tapeFlushMode.value = TAPEBRIDGE_N_FLUSHES_PER_FILE;
} else if(0 == strcmp("ONE_FLUSH_PER_FILE", paramCStr)) {
m_tapeFlushMode.value = TAPEBRIDGE_ONE_FLUSH_PER_FILE;
} else if(0 == strcmp("ONE_FLUSH_PER_N_FILES", paramCStr)) {
m_tapeFlushMode.value = TAPEBRIDGE_ONE_FLUSH_PER_N_FILES;
} else {
castor::exception::InvalidArgument ex;
ex.getMessage() <<
"Value of configuration parameter is not valid"
": expected N_FLUSHES_PER_FILE, ONE_FLUSH_PER_FILE or"
" ONE_FLUSH_PER_N_FILES"
": category=" << m_tapeFlushMode.category <<
" name=" << m_tapeFlushMode.name <<
" value=" << paramCStr <<
" source=" << m_tapeFlushMode.source;
throw(ex);
}
} else {
m_tapeFlushMode.source = "compile-time default";
m_tapeFlushMode.value = TAPEBRIDGE_N_FLUSHES_PER_FILE;
}
}
//------------------------------------------------------------------------------
// determineMaxBytesBeforeFlush
//------------------------------------------------------------------------------
void castor::tape::tapebridge::TapeFlushConfigParams::
determineMaxBytesBeforeFlush() throw(castor::exception::Exception) {
const std::string envVarName = m_maxBytesBeforeFlush.category + "_" +
m_maxBytesBeforeFlush.name;
const char *paramCStr = NULL;
// Try to get the value from the environment variables, else try to get it
// from castor.conf
if(NULL != (paramCStr = getenv(envVarName.c_str()))) {
m_maxBytesBeforeFlush.source = "environment variable";
} else if(NULL != (paramCStr = getconfent(
m_maxBytesBeforeFlush.category.c_str(), m_maxBytesBeforeFlush.name.c_str(),
0))) {
m_maxBytesBeforeFlush.source = "castor.conf";
}
// If we got the value, then try to convert it to a uint32_t, else use the
// compile-time default
if(NULL != paramCStr) {
if(!utils::isValidUInt(paramCStr)) {
castor::exception::InvalidArgument ex;
ex.getMessage() <<
"Configuration parameter is not a valid unsigned integer"
": category=" << m_maxBytesBeforeFlush.category <<
" name=" << m_maxBytesBeforeFlush.name <<
" value=" << paramCStr <<
" source=" << m_maxBytesBeforeFlush.source;
throw(ex);
}
m_maxBytesBeforeFlush.value = strtou64(paramCStr);
} else {
m_maxBytesBeforeFlush.source = "compile-time default";
m_maxBytesBeforeFlush.value = TAPEBRIDGE_MAXBYTESBEFOREFLUSH;
}
}
//------------------------------------------------------------------------------
// determineMaxFilesBeforeFlush
//------------------------------------------------------------------------------
void castor::tape::tapebridge::TapeFlushConfigParams::
determineMaxFilesBeforeFlush() throw(castor::exception::Exception) {
const std::string envVarName = m_maxFilesBeforeFlush.category + "_" +
m_maxFilesBeforeFlush.name;
const char *paramCStr = NULL;
// Try to get the value from the environment variables, else try to get it
// from castor.conf
if(NULL != (paramCStr = getenv(envVarName.c_str()))) {
m_maxFilesBeforeFlush.source = "environment variable";
} else if(NULL != (paramCStr = getconfent(
m_maxFilesBeforeFlush.category.c_str(), m_maxFilesBeforeFlush.name.c_str(),
0))) {
m_maxFilesBeforeFlush.source = "castor.conf";
}
// If we got the value, then try to convert it to a uint32_t, else use the
// compile-time default