1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-26 10:01:05 +03:00

MCOL-529 Pool DBRM connections

DBRM connections are reused so that we don't have a huge amount of
TIME_WAIT sockets when there are large amounts of DML. Also applied to
i_s.columnstore_files
This commit is contained in:
Andrew Hutchings
2017-04-14 14:13:15 +01:00
parent 3e85b6ef07
commit 830b24c1fa
11 changed files with 349 additions and 56 deletions

View File

@ -32,7 +32,7 @@
#include "liboamcpp.h"
#include "stopwatch.h"
#include "masterdbrmnode.h"
#include "messagequeuepool.h"
// #define BRM_VERBOSE
// minor improvement to code clarity...
@ -163,7 +163,8 @@ void MasterDBRMNode::initMsgQueues(config::Config *config)
serverLock.unlock();
for (i = 1; i <= NumWorkers; i++) {
snprintf(ctmp, 50, "DBRM_Worker%d", i);
slaves.push_back(new MessageQueueClient(ctmp, config));
std::string module(ctmp);
slaves.push_back(MessageQueueClientPool::getInstance(module));
}
}
@ -882,8 +883,8 @@ void MasterDBRMNode::finalCleanup()
cerr << "Closing connections" << endl;
#endif
for (sIt = slaves.begin(); sIt != slaves.end(); sIt++) {
(*sIt)->shutdown();
delete *sIt;
MessageQueueClientPool::releaseInstance(*sIt);
*sIt = NULL;
}
slaves.clear();
@ -1036,8 +1037,8 @@ void MasterDBRMNode::doReload(messageqcpp::IOSocket *sock)
}
for (i = 0; i < (int) slaves.size(); i++) {
slaves[i]->shutdown();
delete slaves[i];
MessageQueueClientPool::releaseInstance(slaves[i]);
slaves[i] = NULL;
}
slaves.clear();
@ -1045,7 +1046,8 @@ void MasterDBRMNode::doReload(messageqcpp::IOSocket *sock)
for (i = 1; i <= NumWorkers; i++) {
snprintf(ctmp, 50, "DBRM_Worker%d", i);
slaves.push_back(new MessageQueueClient(ctmp, config));
std::string module(ctmp);
slaves.push_back(MessageQueueClientPool::getInstance(module));
}
iSlave = slaves.end();