mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-06 11:58:30 +01:00
Correctly disinguish between "0 seconds behind master" and "not replicating"
Summary: Fixes T11159. We get two different values here (`NULL` and `0`) with different meanings. Test Plan: - Ran `STOP SLAVE;`. - Saw this: {F1710181} - Ran `START SLAVE;`. - Back to normal. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11159 Differential Revision: https://secure.phabricator.com/D16225
This commit is contained in:
parent
fa6d3e2de3
commit
01040e4573
1 changed files with 20 additions and 9 deletions
|
@ -12,6 +12,7 @@ final class PhabricatorDatabaseRef
|
||||||
const REPLICATION_MASTER_REPLICA = 'master-replica';
|
const REPLICATION_MASTER_REPLICA = 'master-replica';
|
||||||
const REPLICATION_REPLICA_NONE = 'replica-none';
|
const REPLICATION_REPLICA_NONE = 'replica-none';
|
||||||
const REPLICATION_SLOW = 'replica-slow';
|
const REPLICATION_SLOW = 'replica-slow';
|
||||||
|
const REPLICATION_NOT_REPLICATING = 'not-replicating';
|
||||||
|
|
||||||
const KEY_REFS = 'cluster.db.refs';
|
const KEY_REFS = 'cluster.db.refs';
|
||||||
const KEY_INDIVIDUAL = 'cluster.db.individual';
|
const KEY_INDIVIDUAL = 'cluster.db.individual';
|
||||||
|
@ -196,13 +197,18 @@ final class PhabricatorDatabaseRef
|
||||||
self::REPLICATION_REPLICA_NONE => array(
|
self::REPLICATION_REPLICA_NONE => array(
|
||||||
'icon' => 'fa-download',
|
'icon' => 'fa-download',
|
||||||
'color' => 'red',
|
'color' => 'red',
|
||||||
'label' => pht('Not Replicating'),
|
'label' => pht('Not A Replica'),
|
||||||
),
|
),
|
||||||
self::REPLICATION_SLOW => array(
|
self::REPLICATION_SLOW => array(
|
||||||
'icon' => 'fa-hourglass',
|
'icon' => 'fa-hourglass',
|
||||||
'color' => 'red',
|
'color' => 'red',
|
||||||
'label' => pht('Slow Replication'),
|
'label' => pht('Slow Replication'),
|
||||||
),
|
),
|
||||||
|
self::REPLICATION_NOT_REPLICATING => array(
|
||||||
|
'icon' => 'fa-exclamation-triangle',
|
||||||
|
'color' => 'red',
|
||||||
|
'label' => pht('Not Replicating'),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +336,11 @@ final class PhabricatorDatabaseRef
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($is_replica) {
|
if ($is_replica) {
|
||||||
$latency = (int)idx($replica_status, 'Seconds_Behind_Master');
|
$latency = idx($replica_status, 'Seconds_Behind_Master');
|
||||||
|
if (!strlen($latency)) {
|
||||||
|
$ref->setReplicaStatus(self::REPLICATION_NOT_REPLICATING);
|
||||||
|
} else {
|
||||||
|
$latency = (int)$latency;
|
||||||
$ref->setReplicaDelay($latency);
|
$ref->setReplicaDelay($latency);
|
||||||
if ($latency > 30) {
|
if ($latency > 30) {
|
||||||
$ref->setReplicaStatus(self::REPLICATION_SLOW);
|
$ref->setReplicaStatus(self::REPLICATION_SLOW);
|
||||||
|
@ -342,6 +352,7 @@ final class PhabricatorDatabaseRef
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $refs;
|
return $refs;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue