1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-12-15 12:09:09 +03:00

Parameterized the journal size threshold to trigger a flush.

This commit is contained in:
Patrick LeBlanc
2019-07-05 14:20:39 -05:00
parent 46265585ed
commit d0c457a068
2 changed files with 4 additions and 3 deletions

View File

@@ -59,6 +59,7 @@ Synchronizer::Synchronizer() : maxUploads(0)
threadPool.setMaxThreads(maxUploads); threadPool.setMaxThreads(maxUploads);
die = false; die = false;
uncommittedJournalSize = 0; uncommittedJournalSize = 0;
journalSizeThreshold = cache->getMaxCacheSize() / 2;
syncThread = boost::thread([this] () { this->periodicSync(); }); syncThread = boost::thread([this] () { this->periodicSync(); });
} }
@@ -100,7 +101,7 @@ void Synchronizer::newJournalEntry(const string &key, size_t size)
{ {
boost::unique_lock<boost::mutex> s(mutex); boost::unique_lock<boost::mutex> s(mutex);
_newJournalEntry(key, size); _newJournalEntry(key, size);
if (uncommittedJournalSize > 50000000) if (uncommittedJournalSize > journalSizeThreshold)
{ {
uncommittedJournalSize = 0; uncommittedJournalSize = 0;
s.unlock(); s.unlock();
@@ -113,7 +114,7 @@ void Synchronizer::newJournalEntries(const vector<pair<string, size_t> > &keys)
boost::unique_lock<boost::mutex> s(mutex); boost::unique_lock<boost::mutex> s(mutex);
for (auto &keysize : keys) for (auto &keysize : keys)
_newJournalEntry(keysize.first, keysize.second); _newJournalEntry(keysize.first, keysize.second);
if (uncommittedJournalSize > 50000000) if (uncommittedJournalSize > journalSizeThreshold)
{ {
uncommittedJournalSize = 0; uncommittedJournalSize = 0;
s.unlock(); s.unlock();

View File

@@ -87,7 +87,7 @@ class Synchronizer : public boost::noncopyable
boost::thread syncThread; boost::thread syncThread;
const boost::chrono::seconds syncInterval = boost::chrono::seconds(10); const boost::chrono::seconds syncInterval = boost::chrono::seconds(10);
void periodicSync(); void periodicSync();
size_t uncommittedJournalSize; size_t uncommittedJournalSize, journalSizeThreshold;
SMLogging *logger; SMLogging *logger;
Cache *cache; Cache *cache;