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

fix(writeengine) MCOL-4202: use schema name when renaming table and change it's fields in syscat

This commit is contained in:
Leonid Fedorov
2023-12-06 21:05:51 +00:00
committed by Leonid Fedorov
parent 74c1a38f2c
commit fadb102712
12 changed files with 214 additions and 657 deletions

View File

@ -1127,148 +1127,6 @@ void DDLPackageProcessor::createWriteTruncateTableLogFile(
throw std::runtime_error(errorMsg);
}
#if 0
void DDLPackageProcessor::createOpenTruncateTableLogFile(execplan::CalpontSystemCatalog::OID tableOid, execplan::CalpontSystemCatalog::TableName tableName)
{
SUMMARY_INFO("DDLPackageProcessor::createOpenTruncateTableLogFile");
//Build file name with tableOid. Currently, table oid is not returned and therefore not reused
string prefix, error;
config::Config* config = config::Config::makeConfig();
prefix = config->getConfig("SystemConfig", "DBRMRoot");
if (prefix.length() == 0)
{
error = "Need a valid DBRMRoot entry in Calpont configuation file";
throw std::runtime_error(error);
}
uint64_t pos = prefix.find_last_of ("/") ;
if (pos != string::npos)
{
fDDLLogFileName = prefix.substr(0, pos + 1); //Get the file path
}
else
{
error = "Cannot find the dbrm directory for the DDL log file";
throw std::runtime_error(error);
}
std::ostringstream oss;
oss << tableOid;
fDDLLogFileName += "DDL_TRUNCATETABLE_Log_" + oss.str();
fDDLLogFile.open(fDDLLogFileName.c_str(), ios::out);
if (!fDDLLogFile)
{
error = "DDL truncate table log file cannot be created";
throw std::runtime_error(error);
}
}
void DDLPackageProcessor::removeIndexFiles(execplan::CalpontSystemCatalog::SCN txnID,
DDLResult& result,
execplan::CalpontSystemCatalog::IndexOIDList& idxOIDList)
{
/* SUMMARY_INFO("DDLPackageProcessor::removeIndexFiles");
if (result.result != NO_ERROR)
return;
int err = 0;
CalpontSystemCatalog::IndexOID idxOID;
CalpontSystemCatalog::IndexOIDList::const_iterator iter = idxOIDList.begin();
std::string error;
try
{
while(iter != idxOIDList.end())
{
idxOID = *iter;
if (idxOID.objnum < 3000 || idxOID.listOID < 3000)
{
++iter;
continue;
}
err = -1;
if (err)
{
WErrorCodes ec;
error = "WE: Error removing index files: " + getFileName(idxOID.objnum) + ", " + getFileName(idxOID.listOID) + ". error = " + ec.errorString(err);
throw std::runtime_error(error);
}
++iter;
}
}
catch (std::exception& ex)
{
error = ex.what();
throw std::runtime_error(error);
}
catch (...)
{
error = "Unknown exception caught";
throw std::runtime_error(error);
}
*/
}
void DDLPackageProcessor::updateSyscolumns(execplan::CalpontSystemCatalog::SCN txnID,
DDLResult& result, WriteEngine::RIDList& ridList,
WriteEngine::ColValueList& colValuesList,
WriteEngine::ColValueList& colOldValuesList)
{
SUMMARY_INFO("DDLPackageProcessor::updateSyscolumns");
if (result.result != NO_ERROR)
return;
WriteEngine::ColStructList colStructs;
WriteEngine::CSCTypesList cscColTypeList;
//std::vector<ColStruct> colStructs;
WriteEngine::ColStruct colStruct;
execplan::CalpontSystemCatalog::ColType colType;
WriteEngine::DctnryStructList dctnryStructList;
WriteEngine::DctnryValueList dctnryValueList;
//Build column structure for COLUMNPOS_COL
colType.columnOID = colStruct.dataOid = OID_SYSCOLUMN_COLUMNPOS;
colType.colWidth = colStruct.colWidth = 4;
colStruct.tokenFlag = false;
colType.colDataType = colStruct.colDataType = CalpontSystemCatalog::INT;
colStructs.push_back(colStruct);
cscColTypeList.push_back(colType);
int error;
std::string err;
std::vector<void*> colOldValuesList1;
try
{
//@Bug 3051 use updateColumnRecs instead of updateColumnRec to use different value for diffrent rows.
if (NO_ERROR != (error = fWriteEngine.updateColumnRecs( txnID, cscColTypeList, colStructs, colValuesList, ridList )))
{
// build the logging message
WErrorCodes ec;
err = "WE: Failed on update SYSCOLUMN table. " + ec.errorString(error);
throw std::runtime_error(err);
}
}
catch (std::exception& ex)
{
err = ex.what();
throw std::runtime_error(err);
}
catch (...)
{
err = "updateSyscolumns:Unknown exception caught";
throw std::runtime_error(err);
}
}
#endif
void DDLPackageProcessor::returnOIDs(execplan::CalpontSystemCatalog::RIDList& ridList,
execplan::CalpontSystemCatalog::DictOIDList& dictOIDList)
{