Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Fix: Remove obsolete code in database partitioning functions dev-21.10.x #11839

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions www/class/centreon-partition/partEngine.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,44 +426,6 @@ public function updateParts($table, $db)
}
}

/**
* optimize all partitions for a table
*
* @param MysqlTable $table
*/
public function optimizeTablePartitions($table, $db)
{
$tableName = "`" . $table->getSchema() . "`." . $table->getName();
if (!$table->exists()) {
throw new Exception("Optimize error: Table " . $tableName . " does not exists\n");
}

$request = "SELECT PARTITION_NAME FROM information_schema.`PARTITIONS` ";
$request .= "WHERE `TABLE_NAME`='" . $table->getName() . "' ";
$request .= "AND TABLE_SCHEMA='" . $table->getSchema() . "' ";
try {
$dbResult = $db->query($request);
} catch (\PDOException $e) {
throw new Exception(
"Error : Cannot get table schema information for "
. $tableName . ", " . $e->getMessage() . "\n"
);
}

while ($row = $dbResult->fetch()) {
$request = "ALTER TABLE " . $tableName . " OPTIMIZE PARTITION `" . $row["PARTITION_NAME"] . "`;";
try {
$dbResult2 = $db->query($request);
} catch (\PDOException $e) {
throw new Exception(
"Optimize error : Cannot optimize partition " . $row["PARTITION_NAME"]
. " of table " . $tableName . ", " . $e->getMessage() . "\n"
);
}
}

$dbResult->closeCursor();
}

/**
* list all partitions for a table
Expand Down