1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-5555 Add support for startreadonly command.

This patch adds support for `startreadonly` command which waits
until all active cpimport jobs are done and then puts controller node to readonly
mode.
This commit is contained in:
Denis Khalikov
2023-10-02 23:46:53 +03:00
committed by Leonid Fedorov
parent 2b20e1de25
commit 3fcb9b66f5
11 changed files with 403 additions and 18 deletions

View File

@ -186,6 +186,7 @@ class MasterDBRMNode
void doReload(messageqcpp::IOSocket* sock);
void doSetReadOnly(messageqcpp::IOSocket* sock, bool b);
void doGetReadOnly(messageqcpp::IOSocket* sock);
void doStartReadOnly(messageqcpp::IOSocket* sock);
/* SessionManager interface */
SessionManagerServer sm;
@ -193,6 +194,9 @@ class MasterDBRMNode
void doGetSystemCatalog(messageqcpp::ByteStream& msg, ThreadParams* p);
void doSysCatVerID(messageqcpp::ByteStream& msg, ThreadParams* p);
void doNewTxnID(messageqcpp::ByteStream& msg, ThreadParams* p);
void doNewCpimportJob(ThreadParams* p);
void doFinishCpimportJob(messageqcpp::ByteStream& msg, ThreadParams* p);
void doForceClearAllCpimportJobs(messageqcpp::IOSocket* sock);
void doCommitted(messageqcpp::ByteStream& msg, ThreadParams* p);
void doRolledBack(messageqcpp::ByteStream& msg, ThreadParams* p);
void doGetTxnID(messageqcpp::ByteStream& msg, ThreadParams* p);
@ -247,11 +251,14 @@ class MasterDBRMNode
boost::mutex mutex2; // protects params and the hand-off TODO: simplify
boost::mutex slaveLock; // syncs communication with the slaves
boost::mutex serverLock; // kludge to synchronize reloading
std::mutex cpimportMutex;
std::condition_variable cpimportJobsCond;
int runners, NumWorkers;
ThreadParams* params;
volatile bool die, halting;
bool reloadCmd;
mutable bool readOnly;
mutable bool waitToFinishJobs{false};
struct timespec MSG_TIMEOUT;
};