classReplicaRule
final class ReplicaRule
Lowers START SLAVE, START REPLICA, STOP SLAVE and STOP REPLICA of every release.
Rule: MYSQL-REPLICA-001. Scope: slave, slave_start, start_slave_opts, slave_connection_opts, slave_user_name_opt, slave_user_pass_opt, slave_plugin_auth_opt, slave_plugin_dir_opt (5.6, 5.7), start_replica_stmt, stop_replica_stmt, replica, opt_user_option, opt_password_option, opt_default_auth_option, opt_plugin_dir_option (8.0 and later), and the thread lists opt_slave_thread_option_list, slave_thread_option_list, slave_thread_option, opt_replica_thread_option_list, replica_thread_option_list, replica_thread_option. The spelling SLAVE or REPLICA is kept; the UNTIL clause is lowered by MYSQL-REPLICA-UNTIL-002. Constructs: StartReplica, StopReplica. Terminates: the thread lists are flattened iteratively. Source: https://dev.mysql.com/doc/refman/8.4/en/start-replica.html, https://dev.mysql.com/doc/refman/8.4/en/stop-replica.html, https://dev.mysql.com/doc/refman/5.7/en/start-slave.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Lowers one START or STOP statement.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 10
- method-call ReplicaRule::start() line 86
- class-const Terminology::Legacy() line 87
- method-call Form::node() line 89
- method-call ReplicaRule::connection() line 89
- method-call ReplicaRule::legacyStart() line 91
- new StopReplica line 92
- method-call ReplicaRule::threads() line 92
- class-const Terminology::Current() line 100
- function-call
array_sliceline 101 - static-call ImplementationGap::production() line 118
public function legacyStart(Form $form): StartReplicaLowers the START SLAVE of 5.7, whose parts are split over slave_start and start_slave_opts.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 6
- method-call Lowering::form() line 129
- method-call Form::node() line 129
- static-call ImplementationGap::production() line 132
- method-call ReplicaRule::start() line 138
- class-const Terminology::Legacy() line 138
- method-call ReplicaRule::connection() line 138
public function start(
Terminology $terminology,
Terminology $positions,
list<Node|Token> $parts,
): StartReplicaLowers the parts of a START statement: threads, UNTIL, the four connection options and, from 5.7, the channel.
Parameters
$terminology | Terminology | |
$positions | Terminology | |
$parts | list<Node|Token> |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 4
- method-call SqlSemantics\Platform\MySql\Lowering\Replication\ReplicaRule::statement() packages/sql-semantics-mysql/src/Lowering/Replication/ReplicaRule.php:86
- method-call SqlSemantics\Platform\MySql\Lowering\Replication\ReplicaRule::statement() packages/sql-semantics-mysql/src/Lowering/Replication/ReplicaRule.php:98
- method-call SqlSemantics\Platform\MySql\Lowering\Replication\ReplicaRule::statement() packages/sql-semantics-mysql/src/Lowering/Replication/ReplicaRule.php:103
- method-call SqlSemantics\Platform\MySql\Lowering\Replication\ReplicaRule::legacyStart() packages/sql-semantics-mysql/src/Lowering/Replication/ReplicaRule.php:138
Calls 6
- method-call ReplicaRule::option() line 151
- method-call ReplicaRule::node() line 151
- new StartReplica line 155
- method-call ReplicaRule::threads() line 157
- method-call UntilRule::until() line 158
- new UntilRule line 158
Answers the four connection option nodes of the 5.x rule slave_connection_opts.
Parameters
$options | Node |
Returns
list<Node>Throws
ImplementationGap When the production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Replication\ReplicaRule::statement() packages/sql-semantics-mysql/src/Lowering/Replication/ReplicaRule.php:89
- method-call SqlSemantics\Platform\MySql\Lowering\Replication\ReplicaRule::legacyStart() packages/sql-semantics-mysql/src/Lowering/Replication/ReplicaRule.php:138
Calls 2
- method-call Lowering::form() line 175
- static-call ImplementationGap::production() line 177
Lowers one connection option; an absent option is null.
Parameters
$option | Node |
Returns
?TextThrows
ImplementationGap When the production has no ruleCalled from 1
Calls 4
- method-call Lowering::form() line 190
- function-call
array_key_existsline 191 - class-const ReplicaRule::CONNECTION() line 191
- static-call ImplementationGap::production() line 192
public function threads(Node $list): list<ReplicaThread>Lowers a thread list; an absent list is empty.
Parameters
$list | Node |
Returns
list<ReplicaThread>Throws
ImplementationGap When a production has no ruleCalled from 5
- method-call SqlSemantics\Platform\MySql\Lowering\Replication\ReplicaRule::statement() packages/sql-semantics-mysql/src/Lowering/Replication/ReplicaRule.php:92
- method-call SqlSemantics\Platform\MySql\Lowering\Replication\ReplicaRule::statement() packages/sql-semantics-mysql/src/Lowering/Replication/ReplicaRule.php:95
- method-call SqlSemantics\Platform\MySql\Lowering\Replication\ReplicaRule::statement() packages/sql-semantics-mysql/src/Lowering/Replication/ReplicaRule.php:110
- method-call SqlSemantics\Platform\MySql\Lowering\Replication\ReplicaRule::statement() packages/sql-semantics-mysql/src/Lowering/Replication/ReplicaRule.php:115
- method-call SqlSemantics\Platform\MySql\Lowering\Replication\ReplicaRule::start() packages/sql-semantics-mysql/src/Lowering/Replication/ReplicaRule.php:157
Calls 6
- method-call Lowering::form() line 206
- class-const ReplicaRule::THREAD_LISTS() line 210
- static-call ImplementationGap::production() line 210
- method-call Spine::items() line 212
- new Spine line 212
- class-const ReplicaRule::THREADS() line 214
Narrows a statement part to the nonterminal the grammar places there.
Returns
Throws
ImplementationGap When the part is not a nonterminalTest cases 1
Called from 4
- method-call SqlSemantics\Platform\MySql\Lowering\Replication\ReplicaRule::start() packages/sql-semantics-mysql/src/Lowering/Replication/ReplicaRule.php:151
- method-call SqlSemantics\Platform\MySql\Lowering\Replication\ReplicaRule::start() packages/sql-semantics-mysql/src/Lowering/Replication/ReplicaRule.php:153
- method-call SqlSemantics\Platform\MySql\Lowering\Replication\ReplicaRule::start() packages/sql-semantics-mysql/src/Lowering/Replication/ReplicaRule.php:157
- method-call SqlSemantics\Platform\MySql\Lowering\Replication\ReplicaRule::start() packages/sql-semantics-mysql/src/Lowering/Replication/ReplicaRule.php:158
Calls 1
- static-call ImplementationGap::rule() line 227
Private surface 4§
Implementation details, listed for orientation only.
private const THREADS = ['slave_thread_option: SQL_THREAD' => \SqlSemantics\Platform\MySql\Statement\Re…private const THREAD_LISTS = ['opt_slave_thread_option_list: slave_thread_option_list' => ['slave_thread_opt…private const CONNECTION = ['slave_user_name_opt:' => null, 'slave_user_name_opt: USER EQ TEXT_STRING_sys'…private Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.