From 4c4325e98cc7e8b7c4321e36fa03975ed8ec4265 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 1 Oct 2015 17:18:46 -0700 Subject: [PATCH] Modernized slave wait checks in recompressTracked.php Change-Id: I5771af8135530677dc8223389f572896918c6b72 --- maintenance/storage/recompressTracked.php | 24 +++++------------------ 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/maintenance/storage/recompressTracked.php b/maintenance/storage/recompressTracked.php index b21392949a..120ccb6cb6 100644 --- a/maintenance/storage/recompressTracked.php +++ b/maintenance/storage/recompressTracked.php @@ -365,7 +365,7 @@ class RecompressTracked { if ( $current == $end || $this->numBatches >= $this->reportingInterval ) { $this->numBatches = 0; $this->info( "$label: $current / $end" ); - $this->waitForSlaves(); + wfWaitForSlaves(); } } @@ -463,7 +463,7 @@ class RecompressTracked { case 'quit': return; } - $this->waitForSlaves(); + wfWaitForSlaves(); } } @@ -530,7 +530,7 @@ class RecompressTracked { $this->debug( "$titleText: committing blob with " . $trx->getSize() . " items" ); $trx->commit(); $trx = new CgzCopyTransaction( $this, $this->pageBlobClass ); - $this->waitForSlaves(); + wfWaitForSlaves(); } } $startId = $row->bt_text_id; @@ -613,7 +613,7 @@ class RecompressTracked { foreach ( $res as $row ) { $this->moveTextRow( $row->bt_text_id, $row->bt_new_url ); if ( $row->bt_text_id % 10 == 0 ) { - $this->waitForSlaves(); + wfWaitForSlaves(); } } $startId = $row->bt_text_id; @@ -681,26 +681,12 @@ class RecompressTracked { $this->debug( "[orphan]: committing blob with " . $trx->getSize() . " rows" ); $trx->commit(); $trx = new CgzCopyTransaction( $this, $this->orphanBlobClass ); - $this->waitForSlaves(); + wfWaitForSlaves(); } } $this->debug( "[orphan]: committing blob with " . $trx->getSize() . " rows" ); $trx->commit(); } - - /** - * Wait for slaves (quietly) - */ - function waitForSlaves() { - $lb = wfGetLB(); - while ( true ) { - list( $host, $maxLag ) = $lb->getMaxLag(); - if ( $maxLag < 2 ) { - break; - } - sleep( 5 ); - } - } } /** -- 2.20.1