You've already forked mariadb-columnstore-engine
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:
@ -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();
|
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
|
} // namespace ddlpackageprocessor
|
||||||
|
|
||||||
#undef EXPORT
|
#undef EXPORT
|
||||||
|
@ -119,7 +119,8 @@ DropPartitionProcessor::DDLResult DropPartitionProcessor::processPackageInternal
|
|||||||
return result;
|
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);
|
SQLLogger logger(stmt, fDDLLoggingId, sessionID, txnID.id);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -33,7 +33,7 @@ namespace ddlpackageprocessor
|
|||||||
* for interacting with the Write Engine to process
|
* for interacting with the Write Engine to process
|
||||||
* drop table ddl statements.
|
* drop table ddl statements.
|
||||||
*/
|
*/
|
||||||
class DropPartitionProcessor : public DDLPackageProcessor
|
class DropPartitionProcessor : public DDLPackageProcessor, FormatStatementString
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DropPartitionProcessor(BRM::DBRM* aDbrm) : DDLPackageProcessor(aDbrm)
|
DropPartitionProcessor(BRM::DBRM* aDbrm) : DDLPackageProcessor(aDbrm)
|
||||||
|
@ -81,7 +81,8 @@ MarkPartitionProcessor::DDLResult MarkPartitionProcessor::processPackageInternal
|
|||||||
CalpontSystemCatalog::DictOIDList dictOIDList;
|
CalpontSystemCatalog::DictOIDList dictOIDList;
|
||||||
std::string processName("DDLProc");
|
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);
|
SQLLogger logger(stmt, fDDLLoggingId, markPartitionStmt->fSessionID, txnID.id);
|
||||||
|
|
||||||
uint32_t processID = 0;
|
uint32_t processID = 0;
|
||||||
|
@ -33,7 +33,7 @@ namespace ddlpackageprocessor
|
|||||||
* for interacting with the Write Engine
|
* for interacting with the Write Engine
|
||||||
* to process create table ddl statements.
|
* to process create table ddl statements.
|
||||||
*/
|
*/
|
||||||
class MarkPartitionProcessor : public DDLPackageProcessor
|
class MarkPartitionProcessor : public DDLPackageProcessor, FormatStatementString
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MarkPartitionProcessor(BRM::DBRM* aDbrm) : DDLPackageProcessor(aDbrm)
|
MarkPartitionProcessor(BRM::DBRM* aDbrm) : DDLPackageProcessor(aDbrm)
|
||||||
|
@ -82,7 +82,8 @@ RestorePartitionProcessor::DDLResult RestorePartitionProcessor::processPackageIn
|
|||||||
CalpontSystemCatalog::DictOIDList dictOIDList;
|
CalpontSystemCatalog::DictOIDList dictOIDList;
|
||||||
std::string processName("DDLProc");
|
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);
|
SQLLogger logger(stmt, fDDLLoggingId, restorePartitionStmt->fSessionID, txnID.id);
|
||||||
|
|
||||||
uint32_t processID = 0;
|
uint32_t processID = 0;
|
||||||
|
@ -33,7 +33,7 @@ namespace ddlpackageprocessor
|
|||||||
* for interacting with the Write Engine to process
|
* for interacting with the Write Engine to process
|
||||||
* drop table ddl statements.
|
* drop table ddl statements.
|
||||||
*/
|
*/
|
||||||
class RestorePartitionProcessor : public DDLPackageProcessor
|
class RestorePartitionProcessor : public DDLPackageProcessor, FormatStatementString
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RestorePartitionProcessor(BRM::DBRM* aDbrm) : DDLPackageProcessor(aDbrm)
|
RestorePartitionProcessor(BRM::DBRM* aDbrm) : DDLPackageProcessor(aDbrm)
|
||||||
|
Reference in New Issue
Block a user