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

feat(ddl,partitions): better partition-related commands logging

This commit is contained in:
drrtuy
2024-08-23 18:24:48 +00:00
committed by Leonid Fedorov
parent 7979c8b0ca
commit 148063e07a
7 changed files with 35 additions and 6 deletions

View File

@ -863,6 +863,32 @@ bool from_string(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&)
return !(iss >> f >> t).fail();
}
class FormatStatementString
{
public:
FormatStatementString() = default;
~FormatStatementString() = default;
std::string formatStatementString(const std::string& cmd, const std::string& schema,
const std::string& table,
const std::set<BRM::LogicalPartition>& partitions)
{
std::ostringstream stmt;
stmt << cmd << "(" << schema << "," << table << ",";
// There must be at least one partition to drop.
for (auto& p : partitions)
{
stmt << p << ",";
}
auto res = stmt.str();
res.back() = ')';
return res;
}
};
} // namespace ddlpackageprocessor
#undef EXPORT

View File

@ -119,7 +119,8 @@ DropPartitionProcessor::DDLResult DropPartitionProcessor::processPackageInternal
return result;
}
string stmt = dropPartitionStmt->fSql + "|" + dropPartitionStmt->fTableName->fSchema + "|";
auto stmt = formatStatementString(dropPartitionStmt->fSql, dropPartitionStmt->fTableName->fSchema,
dropPartitionStmt->fTableName->fName, dropPartitionStmt->fPartitions);
SQLLogger logger(stmt, fDDLLoggingId, sessionID, txnID.id);
try

View File

@ -33,7 +33,7 @@ namespace ddlpackageprocessor
* for interacting with the Write Engine to process
* drop table ddl statements.
*/
class DropPartitionProcessor : public DDLPackageProcessor
class DropPartitionProcessor : public DDLPackageProcessor, FormatStatementString
{
public:
DropPartitionProcessor(BRM::DBRM* aDbrm) : DDLPackageProcessor(aDbrm)

View File

@ -81,7 +81,8 @@ MarkPartitionProcessor::DDLResult MarkPartitionProcessor::processPackageInternal
CalpontSystemCatalog::DictOIDList dictOIDList;
std::string processName("DDLProc");
string stmt = markPartitionStmt->fSql + "|" + markPartitionStmt->fTableName->fSchema + "|";
auto stmt = formatStatementString(markPartitionStmt->fSql, markPartitionStmt->fTableName->fSchema,
markPartitionStmt->fTableName->fName, markPartitionStmt->fPartitions);
SQLLogger logger(stmt, fDDLLoggingId, markPartitionStmt->fSessionID, txnID.id);
uint32_t processID = 0;

View File

@ -33,7 +33,7 @@ namespace ddlpackageprocessor
* for interacting with the Write Engine
* to process create table ddl statements.
*/
class MarkPartitionProcessor : public DDLPackageProcessor
class MarkPartitionProcessor : public DDLPackageProcessor, FormatStatementString
{
public:
MarkPartitionProcessor(BRM::DBRM* aDbrm) : DDLPackageProcessor(aDbrm)

View File

@ -82,7 +82,8 @@ RestorePartitionProcessor::DDLResult RestorePartitionProcessor::processPackageIn
CalpontSystemCatalog::DictOIDList dictOIDList;
std::string processName("DDLProc");
string stmt = restorePartitionStmt->fSql + "|" + restorePartitionStmt->fTableName->fSchema + "|";
auto stmt = formatStatementString(restorePartitionStmt->fSql, restorePartitionStmt->fTableName->fSchema,
restorePartitionStmt->fTableName->fName, restorePartitionStmt->fPartitions);
SQLLogger logger(stmt, fDDLLoggingId, restorePartitionStmt->fSessionID, txnID.id);
uint32_t processID = 0;

View File

@ -33,7 +33,7 @@ namespace ddlpackageprocessor
* for interacting with the Write Engine to process
* drop table ddl statements.
*/
class RestorePartitionProcessor : public DDLPackageProcessor
class RestorePartitionProcessor : public DDLPackageProcessor, FormatStatementString
{
public:
RestorePartitionProcessor(BRM::DBRM* aDbrm) : DDLPackageProcessor(aDbrm)