1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-11-03 17:13:17 +03:00

feat: add vacuum_partition functionality with initialization and execution logic

This commit is contained in:
Amr Elmohamady
2025-09-27 23:55:14 +03:00
committed by drrtuy
parent 899f0f6aae
commit 3d2e61a637
18 changed files with 832 additions and 11 deletions

View File

@@ -1230,6 +1230,67 @@ extern "C"
{
}
my_bool vacuum_partition_init(UDF_INIT* initid, UDF_ARGS* args, char* message, const char* funcname)
{
if (args->arg_count != 3 ||
args->arg_type[0] != STRING_RESULT ||
args->arg_type[1] != STRING_RESULT ||
args->arg_type[2] != STRING_RESULT)
{
sprintf(message, "%s() requires three string arguments", funcname);
return 1;
}
initid->maybe_null = 0;
initid->max_length = 255;
return 0;
}
my_bool mcs_vacuum_partition_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
{
return vacuum_partition_init(initid, args, message, "MCSVACUUMPARTITION");
}
const char* mcs_vacuum_partition(UDF_INIT* /*initid*/, UDF_ARGS* args, char* result,
unsigned long* length, char* /*is_null*/, char* /*error*/)
{
THD* thd = current_thd;
if (get_fe_conn_info_ptr() == NULL)
{
set_fe_conn_info_ptr((void*)new cal_connection_info());
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
}
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(get_fe_conn_info_ptr());
execplan::CalpontSystemCatalog::TableName tableName;
tableName.schema = args->args[0];
tableName.table = args->args[1];
std::string partition = args->args[2];
if (lower_case_table_names) {
boost::algorithm::to_lower(tableName.schema);
boost::algorithm::to_lower(tableName.table);
}
if (!ci->dmlProc)
{
ci->dmlProc = new MessageQueueClient("DMLProc");
}
std::string vacuumResult = ha_mcs_impl_vacuum_partition(*ci, tableName, partition);
memcpy(result, vacuumResult.c_str(), vacuumResult.length());
*length = vacuumResult.length();
return result;
}
void mcs_vacuum_partition_deinit(UDF_INIT* /*initid*/)
{
}
my_bool analyze_table_bloat_init(UDF_INIT* initid, UDF_ARGS* args, char* message, const char* funcname)
{
if (args->arg_count != 2 ||