1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-02 17:22:27 +03:00

MCOL-3577: Add functionality to sync S3 storage for suspendDatabaseWrites.

This commit is contained in:
benthompson15
2019-11-20 11:57:55 -06:00
parent dbb9b21d26
commit 5bbd21b8e0
13 changed files with 189 additions and 4 deletions

View File

@ -185,6 +185,10 @@ void Synchronizer::deletedObjects(const bf::path &prefix, const vector<string> &
void Synchronizer::flushObject(const bf::path &prefix, const string &_key)
{
string key = (prefix/_key).string();
while (blockNewJobs)
boost::this_thread::sleep_for(boost::chrono::seconds(1));
boost::unique_lock<boost::mutex> s(mutex);
// if there is something to do on key, it should be either in pendingOps or opsInProgress
@ -307,13 +311,45 @@ void Synchronizer::syncNow(const bf::path &prefix)
if (job.first.find(prefix.string()) == 0)
makeJob(job.first);
uncommittedJournalSize[prefix] = 0;
lock.unlock();
threadPool.reset(new ThreadPool());
threadPool->setMaxThreads(maxUploads);
lock.lock();
blockNewJobs = false;
}
void Synchronizer::syncNow()
{
boost::unique_lock<boost::mutex> lock(mutex);
// this is pretty hacky. when time permits, implement something better.
//
// Issue all of the pendingOps for the given prefix
// recreate the threadpool (dtor returns once all jobs have finished)
// resume normal operation
blockNewJobs = true;
while (pendingOps.size() != 0)
{
for (auto &job : pendingOps)
makeJob(job.first);
for (auto it = uncommittedJournalSize.begin(); it != uncommittedJournalSize.end(); ++it)
it->second = 0;
lock.unlock();
while (opsInProgress.size() > 0)
boost::this_thread::sleep_for(boost::chrono::seconds(1));
if (pendingOps.size() != 0)
logger->log(LOG_DEBUG,"Synchronizer syncNow pendingOps not empty.");
lock.lock();
}
blockNewJobs = false;
}
void Synchronizer::forceFlush()
{
boost::unique_lock<boost::mutex> lock(mutex);
syncThread.interrupt();
}