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

Commit

Permalink
Fix: Remove obsolete code in database partitioning functions (#11839)
Browse files Browse the repository at this point in the history
  • Loading branch information
emabassi-ext authored Sep 23, 2022
1 parent 5c1daf8 commit 0fa8175
Showing 1 changed file with 0 additions and 38 deletions.
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

0 comments on commit 0fa8175

Please sign in to comment.