classMaintainPartitions
final class MaintainPartitions
implements StandaloneCommand
uses Snapshot
@visibility public.REBUILD | OPTIMIZE | ANALYZE | CHECK | REPAIR | TRUNCATE PARTITION ALL | p, …: a maintenance operation on partitions.
Mirrors PT_alter_table_rebuild_partition, …_optimize_partition, …_analyze_partition, …_check_partition, …_repair_partition and …_truncate_partition. LOCAL and NO_WRITE_TO_BINLOG are synonyms. The grammar of 5.6 and 5.7 reads NO_WRITE_TO_BINLOG a second time after the partitions of OPTIMIZE; the server ignores that second one, but it is part of the statement as written and is kept. Source: https://dev.mysql.com/doc/refman/8.4/en/partitioning-maintenance.html, https://github.com/mysql/mysql-server/blob/mysql-5.7.44/sql/sql_yacc.yy (OPTIMIZE PARTITION_SYM).
$alter = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('ALTER TABLE t REBUILD PARTITION ALL');
[$alter->statement->commands[0]->kind, $alter->toString()] // => [\SqlSemantics\Platform\MySql\Statement\Alter\Partition\MaintenanceKind::Rebuild, 'ALTER TABLE t REBUILD PARTITION ALL']Properties§
public list<CheckOption>|list<RepairOption> $optionspublic MaintenanceKind $kindpublic bool $localpublic PartitionSelection $partitionspublic bool $ignoredLocal = falseMethods§
public function __construct(
public MaintenanceKind $kind,
public bool $local,
public PartitionSelection $partitions,
list<CheckOption>|list<RepairOption> $options = [],
public bool $ignoredLocal = false,
)Parameters
$kind | MaintenanceKind | The operation |
$local | bool | Whether NO_WRITE_TO_BINLOG or LOCAL is written before the partitions |
$partitions | PartitionSelection | The partitions |
$options | list<CheckOption>|list<RepairOption> | The options of CHECK or REPAIR in order |
$ignoredLocal | bool | Whether NO_WRITE_TO_BINLOG or LOCAL is written after the partitions of OPTIMIZE (5.6, 5.7) |
Calls 8
- static-call Check::input() line 56
- method-call MaintenanceKind::logged() line 56
- class-const MaintenanceKind::Optimize() line 57
- class-const MaintenanceKind::Check() line 58
- class-const MaintenanceKind::Repair() line 58
- static-call Check::listOf() line 60
- class-const RepairOption::class() line 60
- class-const CheckOption::class() line 61
public function deriveCommand(Derivation $derivation, Environment $scope): voidDerives nothing: the action holds no expression.
Parameters
$derivation | Derivation | |
$scope | Environment |
public function render(Output $out): voidWrites the action.
Parameters
$out | Output |
Calls 3
- method-call Output::keyword() line 76
- method-call Output::node() line 80
- function-call
explodeline 82
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
MaintainPartitionsTestcalls