1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

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.
This commit is contained in:
Serguey Zefirov
2025-07-10 11:31:32 +00:00
parent 2753743762
commit 5aa2a824c2
33 changed files with 232 additions and 194 deletions

View File

@ -505,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());
}
}

View File

@ -37,6 +37,7 @@ namespace WriteEngine
WE_DDLCommandClient::WE_DDLCommandClient()
{
fWEClient = new WEClients(WEClients::DDLPROC);
fOamCache = oam::OamCache::makeOamCache();
}
WE_DDLCommandClient::~WE_DDLCommandClient()
@ -64,7 +65,7 @@ uint8_t WE_DDLCommandClient::UpdateSyscolumnNextval(uint32_t columnOid, uint64_t
try
{
fOam.getDbrootPmConfig(dbRoot, pmNum);
pmNum = fOamCache->getOwnerPM(dbRoot);
fWEClient->write(command, pmNum);
while (1)

View File

@ -26,6 +26,7 @@
#include "dbrm.h"
#include "liboamcpp.h"
#include "writeengine.h"
#include "oamcache.h"
#define EXPORT
@ -50,7 +51,7 @@ class WE_DDLCommandClient
private:
BRM::DBRM fDbrm;
WEClients* fWEClient;
oam::Oam fOam;
oam::OamCache* fOamCache;
};
} // namespace WriteEngine

View File

@ -758,8 +758,7 @@ int RedistributeControlThread::executeRedistributePlan()
int RedistributeControlThread::connectToWes(int dbroot)
{
int ret = 0;
OamCache::dbRootPMMap_t dbrootToPM = fOamCache->getDBRootToPMMap();
int pmId = (*dbrootToPM)[dbroot];
int pmId = fOamCache->getOwnerPM(dbroot);
ostringstream oss;
oss << "pm" << pmId << "_WriteEngineServer";

View File

@ -134,11 +134,10 @@ void RedistributeWorkerThread::handleRequest()
{
memcpy(&fPlanEntry, fBs.buf(), sizeof(RedistributePlanEntry));
fBs.advance(sizeof(RedistributePlanEntry));
OamCache::dbRootPMMap_t dbrootToPM = fOamCache->getDBRootToPMMap();
fMyId.first = fPlanEntry.source;
fMyId.second = (*dbrootToPM)[fMyId.first];
fMyId.second = fOamCache->getOwnerPM(fMyId.first);
fPeerId.first = fPlanEntry.destination;
fPeerId.second = (*dbrootToPM)[fPeerId.first];
fPeerId.second = fOamCache->getOwnerPM(fPeerId.first);
if (grabTableLock() == 0)
{

View File

@ -154,7 +154,7 @@ WErrorCodes::WErrorCodes() : fErrorCodes()
fErrorCodes[ERR_BULK_SEND_MSG_ERR] = " in a bulk load send msg";
fErrorCodes[ERR_BULK_MISSING_EXTENT_ENTRY] = " missing Extent Entry when trying to save LBID info for CP";
fErrorCodes[ERR_BULK_MISSING_EXTENT_ROW] = " missing Extent Row when trying to save LBID info for CP";
fErrorCodes[ERR_BULK_ROW_FILL_BUFFER] = " Single row fills read buffer; try larger read buffer via -c flag in cpimport";
fErrorCodes[ERR_BULK_ROW_FILL_BUFFER] = " Single row fills read buffer; try larger read buffer.";
fErrorCodes[ERR_BULK_DBROOT_CHANGE] = " Local PM DBRoot settings changed during bulk load.";
fErrorCodes[ERR_BULK_ROLLBACK_MISS_ROOT] = " Mode3 automatic rollback not performed. DBRoot missing.";
fErrorCodes[ERR_BULK_ROLLBACK_SEG_LIST] = " Error building segment file list in a directory.";
@ -284,7 +284,8 @@ std::string WErrorCodes::errorString(int code)
case ERR_FILE_DISK_SPACE:
{
logging::Message::Args args;
args.add("configured by WriteEngine.MaxFileSystemDiskUsagePct in Columnstore.xml");
std::string msgArg; // empty str arg; no extra info in this context
args.add(msgArg);
return logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_EXTENT_DISK_SPACE, args);
break;
}