CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Macros | Functions | Variables
XrdRequestManager.cc File Reference
#include <assert.h>
#include <iostream>
#include <algorithm>
#include <netdb.h>
#include "XrdCl/XrdClFile.hh"
#include "XrdCl/XrdClDefaultEnv.hh"
#include "FWCore/Utilities/interface/CPUTimer.h"
#include "FWCore/Utilities/interface/EDMException.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "Utilities/StorageFactory/interface/StatisticsSenderService.h"
#include "XrdStatistics.h"
#include "Utilities/XrdAdaptor/src/XrdRequestManager.h"
#include "Utilities/XrdAdaptor/src/XrdHostHandler.hh"

Go to the source code of this file.

Classes

class  SendMonitoringInfoHandler
 

Macros

#define GET_CLOCK_MONOTONIC(ts)   clock_gettime(CLOCK_MONOTONIC, &ts);
 
#define XRD_ADAPTOR_LONG_OPEN_DELAY   2*60
 
#define XRD_ADAPTOR_OPEN_PROBE_PERCENT   10
 
#define XRD_ADAPTOR_SHORT_OPEN_DELAY   5
 
#define XRD_ADAPTOR_SOURCE_QUALITY_FUDGE   100
 
#define XRD_CL_MAX_CHUNK   512*1024
 

Functions

static void consumeChunkBack (size_t front, std::vector< IOPosBuffer > &input, std::vector< IOPosBuffer > &output, IOSize chunksize)
 
static void consumeChunkFront (size_t &front, std::vector< IOPosBuffer > &input, std::vector< IOPosBuffer > &output, IOSize chunksize)
 
static void SendMonitoringInfo (XrdCl::File &file)
 
long long timeDiffMS (const timespec &a, const timespec &b)
 
static IOSize validateList (const std::vector< IOPosBuffer > req)
 

Variables

SendMonitoringInfoHandler nullHandler
 

Macro Definition Documentation

#define GET_CLOCK_MONOTONIC (   ts)    clock_gettime(CLOCK_MONOTONIC, &ts);
#define XRD_ADAPTOR_LONG_OPEN_DELAY   2*60
#define XRD_ADAPTOR_OPEN_PROBE_PERCENT   10

Definition at line 30 of file XrdRequestManager.cc.

Referenced by XrdAdaptor::RequestManager::checkSourcesImpl().

#define XRD_ADAPTOR_SHORT_OPEN_DELAY   5
#define XRD_ADAPTOR_SOURCE_QUALITY_FUDGE   100

Definition at line 32 of file XrdRequestManager.cc.

Referenced by XrdAdaptor::RequestManager::checkSourcesImpl().

#define XRD_CL_MAX_CHUNK   512*1024

Function Documentation

static void consumeChunkBack ( size_t  front,
std::vector< IOPosBuffer > &  input,
std::vector< IOPosBuffer > &  output,
IOSize  chunksize 
)
static

Definition at line 791 of file XrdRequestManager.cc.

References IOPosBuffer::data(), IOPosBuffer::offset(), IOPosBuffer::set_data(), IOPosBuffer::set_offset(), IOPosBuffer::set_size(), IOPosBuffer::size(), and XRD_CL_MAX_CHUNK.

Referenced by XrdAdaptor::RequestManager::splitClientRequest().

792 {
793  while ((chunksize > 0) && (front < input.size()))
794  {
795  IOPosBuffer &io = input.back();
796  IOPosBuffer &outio = output.back();
797  if (io.size() > chunksize)
798  {
799  IOSize consumed;
800  if (output.size() && (outio.size() < XRD_CL_MAX_CHUNK) && (outio.offset() + static_cast<IOOffset>(outio.size()) == io.offset()))
801  {
802  if (outio.size() + chunksize > XRD_CL_MAX_CHUNK)
803  {
804  consumed = (XRD_CL_MAX_CHUNK - outio.size());
805  outio.set_size(XRD_CL_MAX_CHUNK);
806  }
807  else
808  {
809  consumed = chunksize;
810  outio.set_size(outio.size() + consumed);
811  }
812  }
813  else
814  {
815  consumed = chunksize;
816  output.emplace_back(IOPosBuffer(io.offset(), io.data(), chunksize));
817  }
818  chunksize -= consumed;
819  IOSize newsize = io.size() - consumed;
820  IOOffset newoffset = io.offset() + consumed;
821  void* newdata = static_cast<char*>(io.data()) + consumed;
822  io.set_offset(newoffset);
823  io.set_data(newdata);
824  io.set_size(newsize);
825  }
826  else if (io.size() == 0)
827  {
828  input.pop_back();
829  }
830  else
831  {
832  output.push_back(io);
833  chunksize -= io.size();
834  input.pop_back();
835  }
836  }
837 }
#define XRD_CL_MAX_CHUNK
static std::string const input
Definition: EdmProvDump.cc:43
void set_data(void *new_buffer)
Definition: IOPosBuffer.h:74
void set_size(IOSize new_size)
Definition: IOPosBuffer.h:79
void set_offset(IOOffset new_offset)
Definition: IOPosBuffer.h:69
IOOffset offset(void) const
Definition: IOPosBuffer.h:54
void * data(void) const
Definition: IOPosBuffer.h:59
IOSize size(void) const
Definition: IOPosBuffer.h:64
int64_t IOOffset
Definition: IOTypes.h:19
size_t IOSize
Definition: IOTypes.h:14
static void consumeChunkFront ( size_t &  front,
std::vector< IOPosBuffer > &  input,
std::vector< IOPosBuffer > &  output,
IOSize  chunksize 
)
static

Definition at line 742 of file XrdRequestManager.cc.

References IOPosBuffer::data(), prof2calltree::front, IOPosBuffer::offset(), IOPosBuffer::set_data(), IOPosBuffer::set_offset(), IOPosBuffer::set_size(), IOPosBuffer::size(), and XRD_CL_MAX_CHUNK.

Referenced by XrdAdaptor::RequestManager::splitClientRequest().

743 {
744  while ((chunksize > 0) && (front < input.size()))
745  {
746  IOPosBuffer &io = input[front];
747  IOPosBuffer &outio = output.back();
748  if (io.size() > chunksize)
749  {
750  IOSize consumed;
751  if (output.size() && (outio.size() < XRD_CL_MAX_CHUNK) && (outio.offset() + static_cast<IOOffset>(outio.size()) == io.offset()))
752  {
753  if (outio.size() + chunksize > XRD_CL_MAX_CHUNK)
754  {
755  consumed = (XRD_CL_MAX_CHUNK - outio.size());
756  outio.set_size(XRD_CL_MAX_CHUNK);
757  }
758  else
759  {
760  consumed = chunksize;
761  outio.set_size(outio.size() + consumed);
762  }
763  }
764  else
765  {
766  consumed = chunksize;
767  output.emplace_back(IOPosBuffer(io.offset(), io.data(), chunksize));
768  }
769  chunksize -= consumed;
770  IOSize newsize = io.size() - consumed;
771  IOOffset newoffset = io.offset() + consumed;
772  void* newdata = static_cast<char*>(io.data()) + consumed;
773  io.set_offset(newoffset);
774  io.set_data(newdata);
775  io.set_size(newsize);
776  }
777  else if (io.size() == 0)
778  {
779  front++;
780  }
781  else
782  {
783  output.push_back(io);
784  chunksize -= io.size();
785  front++;
786  }
787  }
788 }
#define XRD_CL_MAX_CHUNK
static std::string const input
Definition: EdmProvDump.cc:43
void set_data(void *new_buffer)
Definition: IOPosBuffer.h:74
void set_size(IOSize new_size)
Definition: IOPosBuffer.h:79
void set_offset(IOOffset new_offset)
Definition: IOPosBuffer.h:69
IOOffset offset(void) const
Definition: IOPosBuffer.h:54
void * data(void) const
Definition: IOPosBuffer.h:59
IOSize size(void) const
Definition: IOPosBuffer.h:64
int64_t IOOffset
Definition: IOTypes.h:19
size_t IOSize
Definition: IOTypes.h:14
static void SendMonitoringInfo ( XrdCl::File &  file)
static

Definition at line 83 of file XrdRequestManager.cc.

References edm::storage::StatisticsSenderService::getJobID(), XrdAdaptor::Source::isDCachePool(), nullHandler, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by XrdAdaptor::RequestManager::OpenHandler::HandleResponseWithHosts(), and XrdAdaptor::RequestManager::initialize().

84 {
85  // Do not send this to a dCache data server as they return an error.
86  // In some versions of dCache, sending the monitoring information causes
87  // the server to close the connection - resulting in failures.
88  if (Source::isDCachePool(file)) {return;}
89 
90  // Send the monitoring info, if available.
92  std::string lastUrl;
93  file.GetProperty("LastURL", lastUrl);
94  if (jobId && lastUrl.size())
95  {
96  XrdCl::FileSystem fs = XrdCl::FileSystem(XrdCl::URL(lastUrl));
97  fs.SendInfo(jobId, &nullHandler, 30);
98  edm::LogInfo("XrdAdaptorInternal") << "Set monitoring ID to " << jobId << ".";
99  }
100 }
SendMonitoringInfoHandler nullHandler
long long timeDiffMS ( const timespec &  a,
const timespec &  b 
)

Definition at line 55 of file XrdRequestManager.cc.

References diffTreeTool::diff.

Referenced by XrdAdaptor::RequestManager::checkSources(), and XrdAdaptor::RequestManager::checkSourcesImpl().

56 {
57  long long diff = (a.tv_sec - b.tv_sec) * 1000;
58  diff += (a.tv_nsec - b.tv_nsec) / 1e6;
59  return diff;
60 }
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
static IOSize validateList ( const std::vector< IOPosBuffer req)
static

Definition at line 839 of file XrdRequestManager.cc.

References assert(), pileupDistInMC::total, and XRD_CL_MAX_CHUNK.

Referenced by XrdAdaptor::RequestManager::splitClientRequest().

840 {
841  IOSize total = 0;
842  off_t last_offset = -1;
843  for (const auto & it : req)
844  {
845  total += it.size();
846  assert(it.offset() > last_offset);
847  last_offset = it.offset();
848  assert(it.size() <= XRD_CL_MAX_CHUNK);
849  assert(it.offset() < 0x1ffffffffff);
850  }
851  assert(req.size() <= 1024);
852  return total;
853 }
assert(m_qm.get())
#define XRD_CL_MAX_CHUNK
size_t IOSize
Definition: IOTypes.h:14

Variable Documentation

Definition at line 79 of file XrdRequestManager.cc.

Referenced by SendMonitoringInfo().