You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-10-31 18:30:33 +03:00
feat(MCOL-6082) Cluster with read-only nodes should correctly work with DML
This patch changes logic from counting all nodes to counting only read-write nodes when messaging about DML operations. feat(MCOL-6082): Multiple readers of dbroots using OamCache logic This patch introduces centralized logic of selecting what dbroot is accessible in PrimProc on what node. The logic is in OamCache for time being and can be moved later. Fix build
This commit is contained in:
committed by
Leonid Fedorov
parent
1616b32101
commit
a9f23729a9
@@ -154,6 +154,21 @@ struct QueueShutdown
|
||||
x.shutdown();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function checks if the WriteEngineServer (WES) is configured
|
||||
* for the specified node in the configuration.
|
||||
* @param config Pointer to the configuration object
|
||||
* @param fOtherEnd The name of the node to check
|
||||
* @return true if WES is configured, false otherwise
|
||||
*/
|
||||
bool isWESConfigured(config::Config* config, const std::string& fOtherEnd)
|
||||
{
|
||||
// Check if WES IP address record exists in the config (if not, this is a read-only node)
|
||||
std::string otherEndDnOrIPStr = config->getConfig(fOtherEnd, "IPAddr");
|
||||
return !(otherEndDnOrIPStr.empty() || otherEndDnOrIPStr == "unassigned");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace WriteEngine
|
||||
@@ -224,6 +239,13 @@ void WEClients::Setup()
|
||||
snprintf(buff, sizeof(buff), "pm%u_WriteEngineServer", moduleID);
|
||||
string fServer(buff);
|
||||
|
||||
// Check if WES is configured for this module
|
||||
if (!isWESConfigured(rm->getConfig(), fServer))
|
||||
{
|
||||
writeToLog(__FILE__, __LINE__, "Skipping WriteEngineServer client creation for " + fServer + " as the node is read-only", LOG_TYPE_INFO);
|
||||
continue;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MessageQueueClient> cl(new MessageQueueClient(fServer, rm->getConfig()));
|
||||
boost::shared_ptr<boost::mutex> nl(new boost::mutex());
|
||||
|
||||
@@ -287,6 +309,11 @@ void WEClients::Setup()
|
||||
}
|
||||
}
|
||||
|
||||
bool WEClients::isConnectionReadonly(uint32_t connection)
|
||||
{
|
||||
return fPmConnections[connection] == nullptr;
|
||||
}
|
||||
|
||||
int WEClients::Close()
|
||||
{
|
||||
makeBusy(false);
|
||||
@@ -478,8 +505,9 @@ void WEClients::write(const messageqcpp::ByteStream& msg, uint32_t connection)
|
||||
fPmConnections[connection]->write(msg);
|
||||
else
|
||||
{
|
||||
// new behavior: connection client is nullptr means it is read-only.
|
||||
ostringstream os;
|
||||
os << "Lost connection to WriteEngineServer on pm" << connection;
|
||||
os << "Connection to readonly pm" << connection;
|
||||
throw runtime_error(os.str());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user