Skip to content
Snippets Groups Projects
Commit 9400e6bc authored by Edward Moyse's avatar Edward Moyse
Browse files

Merge branch 'AthenaSharedIO_MaxBufferLimit' into 'master'

Adding two new attributes for specifying basket size maximum and minimum.

See merge request !46619
parents 4e433227 2d7e4d43
No related branches found
No related tags found
7 merge requests!69091Fix correlated smearing bug in JER in JetUncertainties in 22.0,!58791DataQualityConfigurations: Modify L1Calo config for web display,!51674Fixing hotSpotInHIST for Run3 HIST,!50012RecExConfig: Adjust log message levels from GetRunNumber and GetLBNumber,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!46619Adding two new attributes for specifying basket size maximum and minimum.
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
#include "TFile.h" #include "TFile.h"
#include "TFileCacheWrite.h" #include "TFileCacheWrite.h"
#include "TTree.h" #include "TTree.h"
#include "TSystem.h"
#include "TTreeCache.h" #include "TTreeCache.h"
#include "TSystem.h"
using namespace pool; using namespace pool;
using namespace std; using namespace std;
...@@ -44,6 +44,8 @@ RootDatabase::RootDatabase() : ...@@ -44,6 +44,8 @@ RootDatabase::RootDatabase() :
m_defSplitLevel(99), m_defSplitLevel(99),
m_defAutoSave(16*1024*1024), m_defAutoSave(16*1024*1024),
m_defBufferSize(16*1024), m_defBufferSize(16*1024),
m_maxBufferSize(16*1024*1024),
m_minBufferEntries(-1),
m_defWritePolicy(TObject::kOverwrite), // On write create new versions m_defWritePolicy(TObject::kOverwrite), // On write create new versions
m_branchOffsetTabLen(0), m_branchOffsetTabLen(0),
m_defTreeCacheLearnEvents(-1), m_defTreeCacheLearnEvents(-1),
...@@ -422,14 +424,6 @@ DbStatus RootDatabase::getOption(DbOption& opt) const { ...@@ -422,14 +424,6 @@ DbStatus RootDatabase::getOption(DbOption& opt) const {
else if ( !strcasecmp(n, "DEFAULT_WRITEPOLICY") ) // int else if ( !strcasecmp(n, "DEFAULT_WRITEPOLICY") ) // int
return opt._setValue(int(m_defWritePolicy)); return opt._setValue(int(m_defWritePolicy));
break; break;
case 'N':
//if ( !strcasecmp(n,"NFREE") ) // int
// return opt._setValue(int(m_file->GetNfree()));
if ( !m_file )
return Error;
else if ( !strcasecmp(n,"NKEYS") ) // int
return opt._setValue(int(m_file->GetNkeys()));
break;
case 'F': case 'F':
if ( !m_file ) if ( !m_file )
return Error; return Error;
...@@ -455,28 +449,40 @@ DbStatus RootDatabase::getOption(DbOption& opt) const { ...@@ -455,28 +449,40 @@ DbStatus RootDatabase::getOption(DbOption& opt) const {
case 'G': case 'G':
if ( !m_file ) if ( !m_file )
return Error; return Error;
else if ( !strcasecmp(n,"GET_OBJECT") ) { // void* else if ( !strcasecmp(n,"GET_OBJECT") ) { // void*
const char* key = ""; const char* key = "";
opt._getValue(key); opt._getValue(key);
return opt._setValue((void*)m_file->Get(key)); return opt._setValue((void*)m_file->Get(key));
} }
break; break;
case 'I': case 'I':
if ( !strcasecmp(n,"IOBYTES_WRITTEN") ) // int if ( !strcasecmp(n,"IOBYTES_WRITTEN") ) // int
return opt._setValue((long long int)(byteCount(WRITE_COUNTER))); return opt._setValue((long long int)(byteCount(WRITE_COUNTER)));
else if ( !strcasecmp(n,"IOBYTES_READ") ) // int else if ( !strcasecmp(n,"IOBYTES_READ") ) // int
return opt._setValue((long long int)(byteCount(READ_COUNTER))); return opt._setValue((long long int)(byteCount(READ_COUNTER)));
break; break;
case 'M':
if ( !strcasecmp(n, "MAXIMUM_BUFFERSIZE") ) // int
return opt._setValue(int(m_maxBufferSize));
else if ( !strcasecmp(n, "MINIMUM_BUFFERENTRIES") ) // int
return opt._setValue(int(m_minBufferEntries));
break;
case 'N':
if ( !m_file )
return Error;
else if ( !strcasecmp(n,"NKEYS") ) // int
return opt._setValue(int(m_file->GetNkeys()));
break;
case 'R': case 'R':
if ( !m_file ) if ( !m_file )
return Error; return Error;
else if ( !strcasecmp(n,"READ_CALLS") ) // int else if ( !strcasecmp(n,"READ_CALLS") ) // int
return opt._setValue(int(m_file->GetReadCalls())); return opt._setValue(int(m_file->GetReadCalls()));
break; break;
case 'T': case 'T':
if( !strcasecmp(n+5,"BRANCH_OFFSETTAB_LEN") ) { if( !strcasecmp(n+5,"BRANCH_OFFSETTAB_LEN") ) {
return opt._setValue(int(m_branchOffsetTabLen)); return opt._setValue(int(m_branchOffsetTabLen));
} else if( !strcasecmp(n,"TFILE") ) { // void* } else if( !strcasecmp(n,"TFILE") ) { // void*
return opt._setValue((void*)m_file); return opt._setValue((void*)m_file);
} else if( !strcasecmp(n+5,"MAX_SIZE") ) { } else if( !strcasecmp(n+5,"MAX_SIZE") ) {
return opt._setValue((long long int)TTree::GetMaxTreeSize()); return opt._setValue((long long int)TTree::GetMaxTreeSize());
...@@ -584,6 +590,12 @@ DbStatus RootDatabase::setOption(const DbOption& opt) { ...@@ -584,6 +590,12 @@ DbStatus RootDatabase::setOption(const DbOption& opt) {
return Success; return Success;
} }
break; break;
case 'M':
if ( !strcasecmp(n, "MAXIMUM_BUFFERSIZE") ) // int
return opt._getValue(m_maxBufferSize);
else if ( !strcasecmp(n, "MINIMUM_BUFFERENTRIES") ) // int
return opt._getValue(m_minBufferEntries);
break;
case 'P': case 'P':
if ( !m_file ) if ( !m_file )
return Error; return Error;
...@@ -803,7 +815,25 @@ void RootDatabase::registerBranchContainer(RootTreeContainer* cont) ...@@ -803,7 +815,25 @@ void RootDatabase::registerBranchContainer(RootTreeContainer* cont)
DbStatus RootDatabase::transAct(Transaction::Action action) DbStatus RootDatabase::transAct(Transaction::Action action)
{ {
// process flush to write file // process flush to write file
if( action == Transaction::TRANSACT_FLUSH && m_file != nullptr && m_file->IsWritable()) m_file->Write(); if( action == Transaction::TRANSACT_FLUSH && m_file != nullptr && m_file->IsWritable()) {
m_file->Write();
// check all TTrees, if Branch baskets are below max
for( map< TTree*, ContainerSet_t >::iterator treeIt = m_containersInTree.begin(),
mapEnd = m_containersInTree.end(); treeIt != mapEnd; ++treeIt ) {
TTree *tree = treeIt->first;
TIter next(tree->GetListOfBranches());
TBranch * b = nullptr;
while((b = (TBranch*)next())){
if (b->GetBasketSize() > m_maxBufferSize) {
DbPrint log( m_file->GetName() );
log << DbPrintLvl::Debug << b->GetName() << " Basket size = " << b->GetBasketSize()
<< " reduced to " << m_maxBufferSize
<< DbPrint::endmsg;
b->SetBasketSize(m_maxBufferSize);
}
}
}
}
// process commits only // process commits only
if( action != Transaction::TRANSACT_COMMIT ) if( action != Transaction::TRANSACT_COMMIT )
return Success; return Success;
...@@ -850,6 +880,24 @@ DbStatus RootDatabase::transAct(Transaction::Action action) ...@@ -850,6 +880,24 @@ DbStatus RootDatabase::transAct(Transaction::Action action)
} }
} }
} }
for( map< TTree*, ContainerSet_t >::iterator treeIt = m_containersInTree.begin(),
mapEnd = m_containersInTree.end(); treeIt != mapEnd; ++treeIt ) {
TTree *tree = treeIt->first;
if( tree->GetEntries() == m_minBufferEntries ) {
TIter next(tree->GetListOfBranches());
TBranch * b = nullptr;
while((b = (TBranch*)next())){
if (b->GetBasketSize() < b->GetTotalSize()) {
DbPrint log( m_file->GetName() );
log << DbPrintLvl::Debug << b->GetName() << " Initial basket size = " << b->GetBasketSize()
<< " increased to " << b->GetBasketSize() * (1 + int(b->GetTotalSize()/b->GetBasketSize()))
<< DbPrint::endmsg;
b->SetBasketSize(b->GetBasketSize() * (1 + int(b->GetTotalSize()/b->GetBasketSize())));
}
}
}
}
return Success; return Success;
} }
......
...@@ -60,6 +60,10 @@ namespace pool { ...@@ -60,6 +60,10 @@ namespace pool {
int m_defAutoSave; int m_defAutoSave;
/// Default buffer size parameter for Branches /// Default buffer size parameter for Branches
int m_defBufferSize; int m_defBufferSize;
/// Maximum buffer size parameter for Branches
int m_maxBufferSize;
/// Minimum buffer entries parameter for Branches
int m_minBufferEntries;
/// Default policy mode for keyed objects /// Default policy mode for keyed objects
int m_defWritePolicy; int m_defWritePolicy;
/// Offset table length for branches /// Offset table length for branches
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment