Fix #16863 - replication issues when setting up a replica
Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
parent
34f8295b94
commit
d3f7411f76
@ -45,7 +45,7 @@ class Replication
|
||||
*
|
||||
* @return mixed|int output of DatabaseInterface::tryQuery
|
||||
*/
|
||||
public function slaveControl(string $action, ?string $control, $link = null)
|
||||
public function slaveControl(string $action, ?string $control, int $link)
|
||||
{
|
||||
global $dbi;
|
||||
|
||||
@ -73,7 +73,7 @@ class Replication
|
||||
* array should contain fields File and Position
|
||||
* @param bool $stop shall we stop slave?
|
||||
* @param bool $start shall we start slave?
|
||||
* @param mixed $link mysql link
|
||||
* @param int $link mysql link
|
||||
*
|
||||
* @return string output of CHANGE MASTER mysql command
|
||||
*/
|
||||
@ -83,9 +83,9 @@ class Replication
|
||||
$host,
|
||||
$port,
|
||||
array $pos,
|
||||
$stop = true,
|
||||
$start = true,
|
||||
$link = null
|
||||
bool $stop,
|
||||
bool $start,
|
||||
int $link
|
||||
) {
|
||||
global $dbi;
|
||||
|
||||
@ -146,12 +146,14 @@ class Replication
|
||||
/**
|
||||
* Fetches position and file of current binary log on master
|
||||
*
|
||||
* @param mixed $link mysql link
|
||||
* @param int $link mysql link
|
||||
*
|
||||
* @return array an array containing File and Position in MySQL replication
|
||||
* on master server, useful for slaveChangeMaster()
|
||||
*
|
||||
* @phpstan-return array{'File'?: string, 'Position'?: string}
|
||||
*/
|
||||
public function slaveBinLogMaster($link = null)
|
||||
public function slaveBinLogMaster(int $link): array
|
||||
{
|
||||
global $dbi;
|
||||
|
||||
|
||||
@ -538,7 +538,7 @@ class ReplicationGui
|
||||
);
|
||||
} else {
|
||||
// Read the current master position
|
||||
$position = $this->replication->slaveBinLogMaster($link_to_master);
|
||||
$position = $this->replication->slaveBinLogMaster(DatabaseInterface::CONNECT_AUXILIARY);
|
||||
|
||||
if (empty($position)) {
|
||||
$_SESSION['replication']['sr_action_status'] = 'error';
|
||||
@ -557,7 +557,8 @@ class ReplicationGui
|
||||
$sr['port'],
|
||||
$position,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
DatabaseInterface::CONNECT_USER
|
||||
)
|
||||
) {
|
||||
$_SESSION['replication']['sr_action_status'] = 'error';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user