/** * Move an orphan text_id to the new cluster */ function doOrphanList($textIds) { // Finish incomplete moves if (!$this->copyOnly) { $this->finishIncompleteMoves(array('bt_text_id' => $textIds)); $this->syncDBs(); } $trx = new CgzCopyTransaction($this, $this->orphanBlobClass); $res = wfGetDB(DB_SLAVE)->select(array('text', 'blob_tracking'), array('old_id', 'old_text', 'old_flags'), array('old_id' => $textIds, 'bt_text_id=old_id', 'bt_moved' => 0), __METHOD__, array('DISTINCT')); foreach ($res as $row) { $text = Revision::getRevisionText($row); if ($text === false) { $this->critical("Error: cannot load revision text for old_id={$row->old_id}"); continue; } if (!$trx->addItem($text, $row->old_id)) { $this->debug("[orphan]: committing blob with " . $trx->getSize() . " rows"); $trx->commit(); $trx = new CgzCopyTransaction($this, $this->orphanBlobClass); $this->waitForSlaves(); } } $this->debug("[orphan]: committing blob with " . $trx->getSize() . " rows"); $trx->commit(); }
/** * Move an orphan text_id to the new cluster * * @param array $textIds */ function doOrphanList($textIds) { // Finish incomplete moves if (!$this->copyOnly) { $this->finishIncompleteMoves(['bt_text_id' => $textIds]); $this->syncDBs(); } $trx = new CgzCopyTransaction($this, $this->orphanBlobClass); $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); $res = wfGetDB(DB_REPLICA)->select(['text', 'blob_tracking'], ['old_id', 'old_text', 'old_flags'], ['old_id' => $textIds, 'bt_text_id=old_id', 'bt_moved' => 0], __METHOD__, ['DISTINCT']); foreach ($res as $row) { $text = Revision::getRevisionText($row); if ($text === false) { $this->critical("Error: cannot load revision text for old_id={$row->old_id}"); continue; } if (!$trx->addItem($text, $row->old_id)) { $this->debug("[orphan]: committing blob with " . $trx->getSize() . " rows"); $trx->commit(); $trx = new CgzCopyTransaction($this, $this->orphanBlobClass); $lbFactory->waitForReplication(); } } $this->debug("[orphan]: committing blob with " . $trx->getSize() . " rows"); $trx->commit(); }