Aude has uploaded a new change for review.
https://gerrit.wikimedia.org/r/58674
Change subject: Add more verbosity to dispatch changes
......................................................................
Add more verbosity to dispatch changes
Change-Id: I21a03f3d7f59fbb43f60de0b9a9ff964eb8ff0de
---
M lib/maintenance/dispatchChanges.php
1 file changed, 27 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/74/58674/1
diff --git a/lib/maintenance/dispatchChanges.php
b/lib/maintenance/dispatchChanges.php
index 599cd86..09c2a00 100644
--- a/lib/maintenance/dispatchChanges.php
+++ b/lib/maintenance/dispatchChanges.php
@@ -524,6 +524,8 @@
try {
+ $this->trace( 'Loaded repo db master' );
+
// get client state
$state = $db->selectRow(
$this->stateTable,
@@ -533,12 +535,16 @@
array( 'FOR UPDATE' )
);
+ $this->trace( "Loaded dispatch changes row for $siteID"
);
+
if ( !$state ) {
+ $this->trace( "$siteID is not in the dispatch
table" );
$this->log( "ERROR: $siteID is not in the
dispatch table." );
wfProfileOut( __METHOD__ );
return false;
} else {
+ $this->trace( "Loading state for $siteID" );
// turn the row object into an array
$state = get_object_vars( $state );
}
@@ -558,7 +564,11 @@
}
}
+ $this->trace( "Trying to lock client $wikiDB" );
+
$lock = $this->getClientLock( $wikiDB );
+
+ $this->trace( "Locking client $siteID" );
if ( $lock === false ) {
// This really shouldn't happen, since we
already checked if another process has a lock.
@@ -567,6 +577,7 @@
// However, another process may still hold the
lock if it grabbed it without locking
// wb_changes_dispatch, or if it didn't record
the lock in wb_changes_dispatch.
+ $this->trace( "Failed to acquire lock for
$siteID" );
$this->log( "Warning: Failed to acquire lock on
$wikiDB for site $siteID!" );
$db->rollback( __METHOD__ );
@@ -575,6 +586,8 @@
wfProfileOut( __METHOD__ );
return false;
}
+
+ $this->trace( "Locked client $siteID" );
$state['chd_lock'] = $lock;
$state['chd_touched'] = wfTimestamp( TS_MW ); // XXX:
use DB time
@@ -677,19 +690,25 @@
*
* @return String|bool The lock name if the lock was acquired, false
otherwise.
*/
- protected function getClientLock( $wikiDB, $lock = null ) {
+ protected function getClientLock( $wikiDB, $lockName = null ) {
wfProfileIn( __METHOD__ );
- if ( $lock === null ) {
- $lock = $this->getClientLockName( $wikiDB );
+ if ( $lockName === null ) {
+ $lockName = $this->getClientLockName( $wikiDB );
+ $this->trace( "Lock name not defined for $wikiDB. Got
lock name $lockName." );
}
$db = $this->getClientMaster( $wikiDB );
- $ok = $db->lock( $lock, __METHOD__ );
+ $this->trace( "Got client master for $wikiDB" );
+
+ $ok = $db->lock( $lockName, __METHOD__ );
$this->releaseClientMaster( $wikiDB, $db );
+ $msg = $ok ? "Set lock for $wikiDB" : "Failed to set lock for
$wikiDB";
+ $this->trace( $msg );
+
wfProfileOut( __METHOD__ );
- return $ok ? $lock : false;
+ return $ok ? $lockName : false;
}
/**
@@ -893,7 +912,7 @@
}
}
- $this->trace( "checking sitelinks to $siteID for " . count(
$itemSet ) . " items." );
+ $this->trace( "Checking sitelinks to $siteID for " . count(
$itemSet ) . " items." );
// find all sitelinks from those items to $siteID
// TODO: allow mock SiteLinkTable for testing!
@@ -910,7 +929,7 @@
$linkedItems[ $item ] = true;
}
- $this->trace( "retaining changes for " . count( $linkedItems )
. " relevant items." );
+ $this->trace( "Retaining changes for " . count( $linkedItems )
. " relevant items." );
// find all changes that relate to an item that has a sitelink
to $siteID.
$keep = array();
@@ -929,7 +948,7 @@
$changes = $keep;
- $this->trace( "found " . count( $changes ) . " changes for
items with relevant sitelinks." );
+ $this->trace( "Found " . count( $changes ) . " changes for
items with relevant sitelinks." );
wfProfileOut( __METHOD__ );
return $changes;
--
To view, visit https://gerrit.wikimedia.org/r/58674
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I21a03f3d7f59fbb43f60de0b9a9ff964eb8ff0de
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits