1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +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

@ -230,6 +230,15 @@ void BatchInsertProc::buildLastPkg(messageqcpp::ByteStream& bs)
bs << rt;
}
uint32_t BatchInsertProc::selectNextPM()
{
uint32_t pm;
do
{
pm = fBatchLoader->selectNextPM();
} while (pm != 0 && fWEClient->isConnectionReadonly(pm));
return pm;
}
void BatchInsertProc::sendFirstBatch()
{
uint32_t firstPmId = 0;
@ -237,7 +246,7 @@ void BatchInsertProc::sendFirstBatch()
try
{
firstPmId = fBatchLoader->selectNextPM();
firstPmId = selectNextPM();
}
catch (std::exception& ex)
{
@ -268,7 +277,7 @@ void BatchInsertProc::sendNextBatch()
try
{
fCurrentPMid = fBatchLoader->selectNextPM();
fCurrentPMid = selectNextPM();
}
catch (std::exception& ex)
{

View File

@ -68,6 +68,7 @@ class BatchInsertProc
void setHwm();
void receiveAllMsg();
void receiveOutstandingMsg();
uint32_t selectNextPM();
private:
SP_PKG fInsertPkgQueue;

View File

@ -253,7 +253,6 @@ void rollbackAll(DBRM* dbrm)
message5.format(args5);
ml.logInfoMessage(message5);
OamCache* oamcache = OamCache::makeOamCache();
OamCache::dbRootPMMap_t dbRootPMMap = oamcache->getDBRootToPMMap();
int errorTxn = 0;
for (i = 0; i < tableLocks.size(); i++)
@ -393,7 +392,7 @@ void rollbackAll(DBRM* dbrm)
try
{
rollbackProcessor.processBulkRollback(tableLocks[i], dbrm, uniqueId, dbRootPMMap, lockReleased);
rollbackProcessor.processBulkRollback(tableLocks[i], dbrm, uniqueId, oamcache, lockReleased);
ostringstream oss;
oss << "DMLProc started bulkrollback on table OID " << tableLocks[i].tableOID << " and table lock id "
<< tableLocks[i].id << " finished and tablelock is released.";

View File

@ -1155,8 +1155,6 @@ void PackageHandler::run()
logging::Message message(1);
args.add("dmlprocessor.cpp PackageHandler::run() package type");
args.add((uint64_t)fPackageType);
args.add(" ,transaction ID: ");
args.add(fTxnid);
args.add(e.what());
message.format(args);
ml.logErrorMessage(message);
@ -1404,7 +1402,9 @@ void DMLProcessor::operator()()
messageqcpp::ByteStream::byte status = 255;
messageqcpp::ByteStream::octbyte rowCount = 0;
if (fDbrm->getSystemState(stateFlags) >
int rr = fDbrm->getSystemState(stateFlags);
if (rr >
0) // > 0 implies succesful retrieval. It doesn't imply anything about the contents
{
messageqcpp::ByteStream results;
@ -1845,7 +1845,7 @@ void DMLProcessor::operator()()
void RollbackTransactionProcessor::processBulkRollback(BRM::TableLockInfo lockInfo, BRM::DBRM* dbrm,
uint64_t uniqueId,
OamCache::dbRootPMMap_t& dbRootPMMap,
OamCache* oamcache,
bool& lockReleased)
{
// Take over ownership of stale lock.
@ -1884,7 +1884,7 @@ void RollbackTransactionProcessor::processBulkRollback(BRM::TableLockInfo lockIn
for (uint32_t i = 0; i < lockInfo.dbrootList.size(); i++)
{
pmId = (*dbRootPMMap)[lockInfo.dbrootList[i]];
pmId = oamcache->getOwnerPM(lockInfo.dbrootList[i]);
pmSet.insert(pmId);
}

View File

@ -321,7 +321,7 @@ class RollbackTransactionProcessor : public dmlpackageprocessor::DMLPackageProce
}
void processBulkRollback(BRM::TableLockInfo lockInfo, BRM::DBRM* dbrm, uint64_t uniqueId,
oam::OamCache::dbRootPMMap_t& dbRootPMMap, bool& lockReleased);
oam::OamCache* oamcache, bool& lockReleased);
protected:
private: