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

Revamped/simplified the Sync impl. Won't build yet.

This commit is contained in:
Patrick LeBlanc
2019-03-18 14:49:25 -05:00
parent 6f294b8c07
commit 6366a54bbc
3 changed files with 106 additions and 88 deletions

View File

@@ -35,29 +35,31 @@ class Synchronizer : public boost::noncopyable
void synchronize(const std::string &key, bool isFlush);
void synchronizeDelete(const std::string &key);
void synchronizeWithJournal(const std::string &key, bool isFlush);
void rename(const std::string &oldkey, const std::string &newkey);
void makeJob(const std::string &key);
struct FlushListener
{
FlushListener(boost::mutex *m, boost::condvar *c);
boost::mutex *mutex;
boost::condition *condvar;
void flushed();
}
// this struct kind of got sloppy. Need to clean it at some point.
struct PendingOps
{
PendingOps(int flags, std::list<std::string>::iterator pos);
PendingOps(int flags);
int opFlags;
bool finished;
std::list<std::string>::iterator queueEntry;
boost::condition condvar;
void wait();
void notify();
void wait(boost::mutex *);
void notify(boost::mutex *);
};
struct Job : public ThreadPool::Job
{
Job(Synchronizer *s, const std::string &k) : sync(s), key(k) { }
void operator()() { sync->process(key); }
Synchronizer *sync;
std::string key;
};
ThreadPool threadPool;
std::map<std::string, boost::shared_ptr<PendingOps> > pendingOps;
std::list<std::string> workQueue;
std::map<std::string, boost::shared_ptr<PendingOps> > opsInProgress;
SMLogging *logger;
Cache *cache;
Replicator *replicator;