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:
		
							
								
								
									
										2
									
								
								resources/sql/autopatches/20160419.pushlog.1.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								resources/sql/autopatches/20160419.pushlog.1.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | |||||||
|  | ALTER TABLE {$NAMESPACE}_repository.repository_pushlog | ||||||
|  |   ADD devicePHID VARBINARY(64); | ||||||
| @@ -1058,8 +1058,16 @@ final class DiffusionCommitHookEngine extends Phobject { | |||||||
|     // up. |     // up. | ||||||
|     $phid = id(new PhabricatorRepositoryPushLog())->generatePHID(); |     $phid = id(new PhabricatorRepositoryPushLog())->generatePHID(); | ||||||
|  |  | ||||||
|  |     $device = AlmanacKeys::getLiveDevice(); | ||||||
|  |     if ($device) { | ||||||
|  |       $device_phid = $device->getPHID(); | ||||||
|  |     } else { | ||||||
|  |       $device_phid = null; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     return PhabricatorRepositoryPushLog::initializeNewLog($this->getViewer()) |     return PhabricatorRepositoryPushLog::initializeNewLog($this->getViewer()) | ||||||
|       ->setPHID($phid) |       ->setPHID($phid) | ||||||
|  |       ->setDevicePHID($device_phid) | ||||||
|       ->setRepositoryPHID($this->getRepository()->getPHID()) |       ->setRepositoryPHID($this->getRepository()->getPHID()) | ||||||
|       ->attachRepository($this->getRepository()) |       ->attachRepository($this->getRepository()) | ||||||
|       ->setEpoch(time()); |       ->setEpoch(time()); | ||||||
|   | |||||||
| @@ -38,6 +38,7 @@ final class DiffusionPushLogListView extends AphrontView { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     $rows = array(); |     $rows = array(); | ||||||
|  |     $any_host = false; | ||||||
|     foreach ($logs as $log) { |     foreach ($logs as $log) { | ||||||
|       $repository = $log->getRepository(); |       $repository = $log->getRepository(); | ||||||
|  |  | ||||||
| @@ -59,6 +60,14 @@ final class DiffusionPushLogListView extends AphrontView { | |||||||
|           $log->getRefOldShort()); |           $log->getRefOldShort()); | ||||||
|       } |       } | ||||||
|  |  | ||||||
|  |       $device_phid = $log->getDevicePHID(); | ||||||
|  |       if ($device_phid) { | ||||||
|  |         $device = $handles[$device_phid]->renderLink(); | ||||||
|  |         $any_host = true; | ||||||
|  |       } else { | ||||||
|  |         $device = null; | ||||||
|  |       } | ||||||
|  |  | ||||||
|       $rows[] = array( |       $rows[] = array( | ||||||
|         phutil_tag( |         phutil_tag( | ||||||
|           'a', |           'a', | ||||||
| @@ -75,6 +84,7 @@ final class DiffusionPushLogListView extends AphrontView { | |||||||
|         $handles[$log->getPusherPHID()]->renderLink(), |         $handles[$log->getPusherPHID()]->renderLink(), | ||||||
|         $remote_address, |         $remote_address, | ||||||
|         $log->getPushEvent()->getRemoteProtocol(), |         $log->getPushEvent()->getRemoteProtocol(), | ||||||
|  |         $device, | ||||||
|         $log->getRefType(), |         $log->getRefType(), | ||||||
|         $log->getRefName(), |         $log->getRefName(), | ||||||
|         $old_ref_link, |         $old_ref_link, | ||||||
| @@ -100,6 +110,7 @@ final class DiffusionPushLogListView extends AphrontView { | |||||||
|           pht('Pusher'), |           pht('Pusher'), | ||||||
|           pht('From'), |           pht('From'), | ||||||
|           pht('Via'), |           pht('Via'), | ||||||
|  |           pht('Host'), | ||||||
|           pht('Type'), |           pht('Type'), | ||||||
|           pht('Name'), |           pht('Name'), | ||||||
|           pht('Old'), |           pht('Old'), | ||||||
| @@ -116,10 +127,20 @@ final class DiffusionPushLogListView extends AphrontView { | |||||||
|           '', |           '', | ||||||
|           '', |           '', | ||||||
|           '', |           '', | ||||||
|  |           '', | ||||||
|           'wide', |           'wide', | ||||||
|           'n', |           'n', | ||||||
|           'n', |           'n', | ||||||
|           'right', |           'right', | ||||||
|  |         )) | ||||||
|  |       ->setColumnVisibility( | ||||||
|  |         array( | ||||||
|  |           true, | ||||||
|  |           true, | ||||||
|  |           true, | ||||||
|  |           true, | ||||||
|  |           true, | ||||||
|  |           $any_host, | ||||||
|         )); |         )); | ||||||
|  |  | ||||||
|     return $table; |     return $table; | ||||||
|   | |||||||
| @@ -95,7 +95,12 @@ final class PhabricatorRepositoryPushLogSearchEngine | |||||||
|   protected function getRequiredHandlePHIDsForResultList( |   protected function getRequiredHandlePHIDsForResultList( | ||||||
|     array $logs, |     array $logs, | ||||||
|     PhabricatorSavedQuery $query) { |     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( |   protected function renderResultList( | ||||||
|   | |||||||
| @@ -34,6 +34,7 @@ final class PhabricatorRepositoryPushLog | |||||||
|   protected $epoch; |   protected $epoch; | ||||||
|   protected $pusherPHID; |   protected $pusherPHID; | ||||||
|   protected $pushEventPHID; |   protected $pushEventPHID; | ||||||
|  |   protected $devicePHID; | ||||||
|   protected $refType; |   protected $refType; | ||||||
|   protected $refNameHash; |   protected $refNameHash; | ||||||
|   protected $refNameRaw; |   protected $refNameRaw; | ||||||
| @@ -81,6 +82,7 @@ final class PhabricatorRepositoryPushLog | |||||||
|         'refNew' => 'text40', |         'refNew' => 'text40', | ||||||
|         'mergeBase' => 'text40?', |         'mergeBase' => 'text40?', | ||||||
|         'changeFlags' => 'uint32', |         'changeFlags' => 'uint32', | ||||||
|  |         'devicePHID' => 'phid?', | ||||||
|       ), |       ), | ||||||
|       self::CONFIG_KEY_SCHEMA => array( |       self::CONFIG_KEY_SCHEMA => array( | ||||||
|         'key_repository' => array( |         'key_repository' => array( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 epriestley
					epriestley