1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01:00

Record which cluster host received a push

Summary: Ref T4292. When we write a push log, also log which node received the request.

Test Plan: {F1230467}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T4292

Differential Revision: https://secure.phabricator.com/D15759
This commit is contained in:
epriestley 2016-04-19 10:10:12 -07:00
parent d87c500002
commit 6edf181a7e
5 changed files with 39 additions and 1 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_repository.repository_pushlog
ADD devicePHID VARBINARY(64);

View file

@ -1058,8 +1058,16 @@ final class DiffusionCommitHookEngine extends Phobject {
// up.
$phid = id(new PhabricatorRepositoryPushLog())->generatePHID();
$device = AlmanacKeys::getLiveDevice();
if ($device) {
$device_phid = $device->getPHID();
} else {
$device_phid = null;
}
return PhabricatorRepositoryPushLog::initializeNewLog($this->getViewer())
->setPHID($phid)
->setDevicePHID($device_phid)
->setRepositoryPHID($this->getRepository()->getPHID())
->attachRepository($this->getRepository())
->setEpoch(time());

View file

@ -38,6 +38,7 @@ final class DiffusionPushLogListView extends AphrontView {
}
$rows = array();
$any_host = false;
foreach ($logs as $log) {
$repository = $log->getRepository();
@ -59,6 +60,14 @@ final class DiffusionPushLogListView extends AphrontView {
$log->getRefOldShort());
}
$device_phid = $log->getDevicePHID();
if ($device_phid) {
$device = $handles[$device_phid]->renderLink();
$any_host = true;
} else {
$device = null;
}
$rows[] = array(
phutil_tag(
'a',
@ -75,6 +84,7 @@ final class DiffusionPushLogListView extends AphrontView {
$handles[$log->getPusherPHID()]->renderLink(),
$remote_address,
$log->getPushEvent()->getRemoteProtocol(),
$device,
$log->getRefType(),
$log->getRefName(),
$old_ref_link,
@ -100,6 +110,7 @@ final class DiffusionPushLogListView extends AphrontView {
pht('Pusher'),
pht('From'),
pht('Via'),
pht('Host'),
pht('Type'),
pht('Name'),
pht('Old'),
@ -116,10 +127,20 @@ final class DiffusionPushLogListView extends AphrontView {
'',
'',
'',
'',
'wide',
'n',
'n',
'right',
))
->setColumnVisibility(
array(
true,
true,
true,
true,
true,
$any_host,
));
return $table;

View file

@ -95,7 +95,12 @@ final class PhabricatorRepositoryPushLogSearchEngine
protected function getRequiredHandlePHIDsForResultList(
array $logs,
PhabricatorSavedQuery $query) {
return mpull($logs, 'getPusherPHID');
$phids = array();
$phids[] = mpull($logs, 'getPusherPHID');
$phids[] = mpull($logs, 'getDevicePHID');
$phids = array_mergev($phids);
$phids = array_filter($phids);
return $phids;
}
protected function renderResultList(

View file

@ -34,6 +34,7 @@ final class PhabricatorRepositoryPushLog
protected $epoch;
protected $pusherPHID;
protected $pushEventPHID;
protected $devicePHID;
protected $refType;
protected $refNameHash;
protected $refNameRaw;
@ -81,6 +82,7 @@ final class PhabricatorRepositoryPushLog
'refNew' => 'text40',
'mergeBase' => 'text40?',
'changeFlags' => 'uint32',
'devicePHID' => 'phid?',
),
self::CONFIG_KEY_SCHEMA => array(
'key_repository' => array(