You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-02 17:22:27 +03:00
MCOL-3557: add config change listeners.
This commit is contained in:
@ -63,18 +63,9 @@ Synchronizer::Synchronizer() : maxUploads(0)
|
||||
flushesTriggeredBySize = flushesTriggeredByTimer = journalsMerged =
|
||||
objectsSyncedWithNoJournal = bytesReadBySync = bytesReadBySyncWithJournal = 0;
|
||||
|
||||
string stmp = config->getValue("ObjectStorage", "max_concurrent_uploads");
|
||||
try
|
||||
{
|
||||
maxUploads = stoul(stmp);
|
||||
}
|
||||
catch(invalid_argument)
|
||||
{
|
||||
logger->log(LOG_WARNING, "Downloader: Invalid arg for ObjectStorage/max_concurrent_uploads, using default of 20");
|
||||
}
|
||||
if (maxUploads == 0)
|
||||
maxUploads = 20;
|
||||
|
||||
configListener();
|
||||
config->addConfigListener(this);
|
||||
|
||||
journalPath = cache->getJournalPath();
|
||||
cachePath = cache->getCachePath();
|
||||
threadPool.reset(new ThreadPool());
|
||||
@ -91,6 +82,7 @@ Synchronizer::~Synchronizer()
|
||||
or save the list it's working on.....
|
||||
For milestone 2, this will do the safe thing and finish working first.
|
||||
Later we can get fancy. */
|
||||
Config::get()->removeConfigListener(this);
|
||||
forceFlush();
|
||||
die = true;
|
||||
syncThread.join();
|
||||
@ -772,4 +764,29 @@ void Synchronizer::Job::operator()()
|
||||
sync->process(it);
|
||||
}
|
||||
|
||||
void Synchronizer::configListener()
|
||||
{
|
||||
// Uploader threads
|
||||
string stmp = Config::get()->getValue("ObjectStorage", "max_concurrent_uploads");
|
||||
if (maxUploads == 0)
|
||||
maxUploads = 20;
|
||||
if (stmp.empty())
|
||||
{
|
||||
logger->log(LOG_CRIT, "max_concurrent_uploads is not set. Using current value = %u",maxUploads);
|
||||
}
|
||||
try
|
||||
{
|
||||
uint newValue = stoul(stmp);
|
||||
if (newValue != maxUploads)
|
||||
{
|
||||
maxUploads = newValue;
|
||||
threadPool->setMaxThreads(maxUploads);
|
||||
logger->log(LOG_INFO, "max_concurrent_uploads = %u",maxUploads);
|
||||
}
|
||||
}
|
||||
catch (invalid_argument &)
|
||||
{
|
||||
logger->log(LOG_CRIT, "max_concurrent_uploads is not a number. Using current value = %u",maxUploads);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user