GitLab unavailability on July 18, 22, 23 due to hypervisor security updates: http://cern.ch/go/BP7D

...
 
Commits (5)
......@@ -110,91 +110,6 @@ extern "C"
EOSFSTNAMESPACE_BEGIN
//------------------------------------------------------------------------------
// Constructor
//------------------------------------------------------------------------------
XrdFstOfs::XrdFstOfs() :
eos::common::LogId(), mHostName(NULL), mMqOnQdb(false),
mHttpd(0),
Simulate_IO_read_error(false), Simulate_IO_write_error(false),
Simulate_XS_read_error(false), Simulate_XS_write_error(false),
Simulate_FMD_open_error(false)
{
Eroute = 0;
Messaging = 0;
Storage = 0;
TransferScheduler = 0;
TpcMap.resize(2);
TpcMap[0].set_deleted_key(""); // readers
TpcMap[1].set_deleted_key(""); // writers
if (!getenv("EOS_NO_SHUTDOWN")) {
// Add shutdown handler
(void) signal(SIGINT, xrdfstofs_shutdown);
(void) signal(SIGTERM, xrdfstofs_shutdown);
(void) signal(SIGQUIT, xrdfstofs_shutdown);
// Add graceful shutdown handler
(void) signal(SIGUSR1, xrdfstofs_graceful_shutdown);
}
// Initialize the google sparse hash maps
gOFS.WNoDeleteOnCloseFid.clear_deleted_key();
gOFS.WNoDeleteOnCloseFid.set_deleted_key(0);
if (getenv("EOS_FST_CALL_MANAGER_XRD_POOL")) {
int max_size = 10;
const char* csize {nullptr};
if ((csize = getenv("EOS_FST_CALL_MANAGER_XRD_POOL_SIZE"))) {
try {
max_size = std::stoi(csize);
if (max_size < 1) {
max_size = 1;
}
if (max_size > 32) {
max_size = 32;
}
} catch (...) {
// ignore
}
}
mMgmXrdPool.reset(new eos::common::XrdConnPool(true, max_size));
fprintf(stderr, "Config Enabled CallManager xrootd connection pool with "
"size=%i\n", max_size);
}
}
//------------------------------------------------------------------------------
// Destructor
//------------------------------------------------------------------------------
XrdFstOfs::~XrdFstOfs()
{
if (mHttpd) {
delete mHttpd;
}
}
//------------------------------------------------------------------------------
// Get a new OFS directory object - not implemented
//-----------------------------------------------------------------------------
XrdSfsDirectory*
XrdFstOfs::newDir(char* user, int MonID)
{
return (XrdSfsDirectory*)(0);
}
//------------------------------------------------------------------------------
// Get a new OFS file object
//-----------------------------------------------------------------------------
XrdSfsFile*
XrdFstOfs::newFile(char* user, int MonID)
{
return static_cast<XrdSfsFile*>(new XrdFstOfsFile(user, MonID));
}
//------------------------------------------------------------------------------
// Get stacktrace from crashing process
//------------------------------------------------------------------------------
......@@ -361,6 +276,82 @@ XrdFstOfs::xrdfstofs_graceful_shutdown(int sig)
kill(getpid(), 9);
}
//------------------------------------------------------------------------------
// Constructor
//------------------------------------------------------------------------------
XrdFstOfs::XrdFstOfs() :
eos::common::LogId(), mHostName(NULL), mMqOnQdb(false),
mCloseThreadPool(8, 64, 5, 6, 5, "async_close"),
mMgmXrdPool(nullptr), mHttpd(nullptr),
Simulate_IO_read_error(false), Simulate_IO_write_error(false),
Simulate_XS_read_error(false), Simulate_XS_write_error(false),
Simulate_FMD_open_error(false)
{
Eroute = 0;
Messaging = 0;
Storage = 0;
TransferScheduler = 0;
TpcMap.resize(2);
TpcMap[0].set_deleted_key(""); // readers
TpcMap[1].set_deleted_key(""); // writers
if (!getenv("EOS_NO_SHUTDOWN")) {
// Add shutdown handler
(void) signal(SIGINT, xrdfstofs_shutdown);
(void) signal(SIGTERM, xrdfstofs_shutdown);
(void) signal(SIGQUIT, xrdfstofs_shutdown);
// Add graceful shutdown handler
(void) signal(SIGUSR1, xrdfstofs_graceful_shutdown);
}
// Initialize the google sparse hash maps
gOFS.WNoDeleteOnCloseFid.clear_deleted_key();
gOFS.WNoDeleteOnCloseFid.set_deleted_key(0);
if (getenv("EOS_FST_CALL_MANAGER_XRD_POOL")) {
int max_size = 10;
const char* csize {nullptr};
if ((csize = getenv("EOS_FST_CALL_MANAGER_XRD_POOL_SIZE"))) {
try {
max_size = std::stoi(csize);
if (max_size < 1) {
max_size = 1;
}
if (max_size > 32) {
max_size = 32;
}
} catch (...) {
// ignore
}
}
mMgmXrdPool.reset(new eos::common::XrdConnPool(true, max_size));
fprintf(stderr, "Config Enabled CallManager xrootd connection pool with "
"size=%i\n", max_size);
}
}
//------------------------------------------------------------------------------
// Get a new OFS directory object - not implemented
//-----------------------------------------------------------------------------
XrdSfsDirectory*
XrdFstOfs::newDir(char* user, int MonID)
{
return (XrdSfsDirectory*)(0);
}
//------------------------------------------------------------------------------
// Get a new OFS file object
//-----------------------------------------------------------------------------
XrdSfsFile*
XrdFstOfs::newFile(char* user, int MonID)
{
return static_cast<XrdSfsFile*>(new XrdFstOfsFile(user, MonID));
}
//------------------------------------------------------------------------------
// OFS layer configuration
//------------------------------------------------------------------------------
......@@ -832,14 +823,15 @@ XrdFstOfs::Configure(XrdSysError& Eroute, XrdOucEnv* envP)
mHttpdPort = strtol(getenv("EOS_FST_HTTP_PORT"), 0, 10);
}
mHttpd = new HttpServer(mHttpdPort);
mHttpd.reset(new HttpServer(mHttpdPort));
if (mHttpd) {
mHttpd->Start();
}
eos_notice("FST_HOST=%s FST_PORT=%ld FST_HTTP_PORT=%d VERSION=%s RELEASE=%s KEYTABADLER=%s",
mHostName, myPort, mHttpdPort, VERSION, RELEASE, kt_cks.c_str());
eos_notice("FST_HOST=%s FST_PORT=%ld FST_HTTP_PORT=%d VERSION=%s RELEASE=%s "
"KEYTABADLER=%s", mHostName, myPort, mHttpdPort, VERSION, RELEASE,
kt_cks.c_str());
return 0;
}
......
......@@ -30,6 +30,7 @@
#include "fst/utils/OpenFileTracker.hh"
#include "common/Logging.hh"
#include "common/XrdConnPool.hh"
#include "common/ThreadPool.hh"
#include "mq/XrdMqMessaging.hh"
#include "mq/XrdMqSharedObject.hh"
#include "XrdOfs/XrdOfs.hh"
......@@ -42,7 +43,6 @@
#include <memory>
#include <chrono>
//------------------------------------------------------------------------------
//! Apple does not know these errnos
//------------------------------------------------------------------------------
......@@ -114,7 +114,7 @@ public:
//----------------------------------------------------------------------------
//! Destructor
//----------------------------------------------------------------------------
virtual ~XrdFstOfs();
virtual ~XrdFstOfs() = default;
//----------------------------------------------------------------------------
//! Get new OFS directory object
......@@ -380,10 +380,13 @@ public:
QdbContactDetails mQdbContactDetails; ///< QDB contact details
bool mMqOnQdb; ///< Are we using QDB as an MQ?
int mHttpdPort; ///< listening port of the http server
private:
//! Thread pool for async file close operations
eos::common::ThreadPool mCloseThreadPool;
//! Xrd connection pool for interaction with the MGM, used from CallManager
std::unique_ptr<eos::common::XrdConnPool> mMgmXrdPool;
HttpServer* mHttpd; ///< Embedded http server
std::unique_ptr<HttpServer> mHttpd; ///< Embedded http server
bool Simulate_IO_read_error; ///< simulate an IO error on read
bool Simulate_IO_write_error; ///< simulate an IO error on write
bool Simulate_XS_read_error; ///< simulate a checksum error on read
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -139,8 +139,8 @@ HttpHandler::HandleRequest(eos::common::HttpRequest* request)
&mClient,
query.c_str());
}
mFileSize = mFile->getOpenSize();
mFileId = mFile->getFileId();
mFileSize = mFile->GetOpenSize();
mFileId = mFile->GetFileId();
mLogId = mFile->logId;
// check for range requests
......@@ -173,7 +173,7 @@ HttpHandler::HandleRequest(eos::common::HttpRequest* request)
if (!mRangeRequest) {
// we put the file size as request size if this is not a range request
// aka full file download
mRangeRequestSize = mFile->getOpenSize();
mRangeRequestSize = mFile->GetOpenSize();
}
}
......@@ -299,8 +299,8 @@ HttpHandler::Get(eos::common::HttpRequest* request)
// successful http open
char clength[16];
snprintf(clength, sizeof(clength) - 1, "%llu",
(unsigned long long) mFile->getOpenSize());
mRequestSize = mFile->getOpenSize();
(unsigned long long) mFile->GetOpenSize());
mRequestSize = mFile->GetOpenSize();
response->mResponseLength = mRequestSize;
response->AddHeader("Content-Type", gMime.Match(request->GetUrl()));
response->AddHeader("Content-Length", clength);
......@@ -600,10 +600,9 @@ HttpHandler::Put(eos::common::HttpRequest* request)
if (mFile->GetChecksum()) {
// retrieve a checksum when file is still open
eos_static_debug("enabled checksum lastchunk=%d checksum=%x", mLastChunk,
mFile->GetChecksum());
mFile->GetChecksum());
// Call explicitly the checksum verification
mFile->verifychecksum();
mFile->VerifyChecksum();
if (mFile->GetChecksum()) {
std::string checksum_name = mFile->GetChecksum()->GetName();
......@@ -614,12 +613,12 @@ HttpHandler::Put(eos::common::HttpRequest* request)
}
eos::common::OwnCloud::checksum_t checksum = std::make_pair(
checksum_name,
checksum_val);
checksum_name,
checksum_val);
// inspect if there is checksum provided
eos::common::OwnCloud::checksum_t client_checksum =
eos::common::OwnCloud::GetChecksum(request,
header.count("x-upload-checksum") ? "x-upload-checksum" : "oc-checksum");
eos::common::OwnCloud::GetChecksum(request,
header.count("x-upload-checksum") ? "x-upload-checksum" : "oc-checksum");
eos_static_debug("client-checksum-type=%s client-checksum-value=%s "
"server-checksum-type=%s server-checksum-value=%s",
client_checksum.first.c_str(),
......
......@@ -80,8 +80,8 @@ S3Handler::HandleRequest(eos::common::HttpRequest* request)
create_mode,
&mClient,
request->GetQuery().c_str());
mFileSize = mFile->getOpenSize();
mFileId = mFile->getFileId();
mFileSize = mFile->GetOpenSize();
mFileId = mFile->GetFileId();
mLogId = mFile->logId;
// check for range requests
......@@ -100,7 +100,7 @@ S3Handler::HandleRequest(eos::common::HttpRequest* request)
if (!mRangeRequest) {
// we put the file size as request size if this is not a range request
// aka full file download
mRangeRequestSize = mFile->getOpenSize();
mRangeRequestSize = mFile->GetOpenSize();
}
}
......@@ -185,8 +185,8 @@ S3Handler::Get(eos::common::HttpRequest* request)
// successful http open
char clength[16];
snprintf(clength, sizeof(clength) - 1, "%llu",
(unsigned long long) mFile->getOpenSize());
mRequestSize = mFile->getOpenSize();
(unsigned long long) mFile->GetOpenSize());
mRequestSize = mFile->GetOpenSize();
response->mResponseLength = mRequestSize;
responseheader["Content-Type"] = response->ContentType(GetPath());
responseheader["Content-Length"] = clength;
......
......@@ -60,7 +60,7 @@ FileIoPlugin::GetIoObject(std::string path,
// Attempt to retrieve S3 credentials from the filesystem
if (file) {
FileSystem* fileSystem =
gOFS.Storage->GetFileSystemById(file->getFileSystemId());
gOFS.Storage->GetFileSystemById(file->GetFileSystemId());
s3credentials = fileSystem->GetString("s3credentials");
}
......
......@@ -846,11 +846,11 @@ RaidDpLayout::Truncate(XrdSfsFileOffset offset)
}
}
// *!!!* Reset the maxOffsetWritten from XrdFstOfsFile to logical offset
// *!!!* Reset the mMaxOffsetWritten from XrdFstOfsFile to logical offset
mFileSize = offset;
if (!mIsPio) {
mOfsFile->maxOffsetWritten = offset;
mOfsFile->mMaxOffsetWritten = offset;
}
return rc;
......
......@@ -238,7 +238,7 @@ RaidMetaLayout::Open(XrdSfsFileOpenMode flags, mode_t mode, const char* opaque)
stripetag += static_cast<int>(i);
const char* stripe = mOfsFile->mCapOpaque->Get(stripetag.c_str());
if (mOfsFile->isRW && (!stripe)) {
if (mOfsFile->mIsRW && (!stripe)) {
eos_err("failed to open stripe - missing url for %s", stripetag.c_str());
errno = EINVAL;
return SFS_ERROR;
......
......@@ -458,11 +458,11 @@ ReedSLayout::Truncate(XrdSfsFileOffset offset)
}
}
// *!!!* Reset the maxOffsetWritten from XrdFstOfsFile to logical offset
// *!!!* Reset the mMaxOffsetWritten from XrdFstOfsFile to logical offset
mFileSize = offset;
if (!mIsPio) {
mOfsFile->maxOffsetWritten = offset;
mOfsFile->mMaxOffsetWritten = offset;
}
return rc;
......
......@@ -127,7 +127,7 @@ ReplicaParLayout::Open(XrdSfsFileOpenMode flags, mode_t mode,
const char* rep = mOfsFile->mCapOpaque->Get(reptag.c_str());
if (!rep) {
if (mOfsFile->isRW) {
if (mOfsFile->mIsRW) {
eos_err("Failed to open replica - missing url for replica %s",
reptag.c_str());
return gOFS.Emsg("ReplicaParOpen", *mError, EINVAL,
......@@ -194,7 +194,7 @@ ReplicaParLayout::Open(XrdSfsFileOpenMode flags, mode_t mode,
// Gateway contacts the head, head contacts all
if ((is_gateway && (i == replica_head)) ||
(is_head_server && (i != replica_index))) {
if (mOfsFile->isRW) {
if (mOfsFile->mIsRW) {
XrdOucString maskUrl = mReplicaUrl[i].c_str() ? mReplicaUrl[i].c_str() : "";
// Mask some opaque parameters to shorten the logging
eos::common::StringConversion::MaskTag(maskUrl, "cap.sym");
......