Fix TextPassDumperDatabaseTest::testPrefetchPlain postgres failures
The insertId() method was returning a string, which caused the returnValueMap not to trigger due to int/string mismatches. Also add sanity integer cast to WikiPage::insertOn(). Added a few more type docs. Bug: T75174 Change-Id: Id1090f3e3d0481272a3d13c3af8f2588f06dc912
This commit is contained in:
parent
121e95dec9
commit
6fb5844fec
5 changed files with 10 additions and 5 deletions
|
|
@ -776,7 +776,7 @@ __INDEXATTR__;
|
|||
$safeseq = str_replace( "'", "''", $seqName );
|
||||
$res = $this->query( "SELECT nextval('$safeseq')" );
|
||||
$row = $this->fetchRow( $res );
|
||||
$this->mInsertId = $row[0];
|
||||
$this->mInsertId = is_null( $row[0] ) ? null : (int)$row[0];
|
||||
|
||||
return $this->mInsertId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1177,7 +1177,7 @@ class WikiPage implements Page, IDBAccessObject {
|
|||
);
|
||||
|
||||
if ( $dbw->affectedRows() > 0 ) {
|
||||
$newid = $pageId ?: $dbw->insertId();
|
||||
$newid = $pageId ? (int)$pageId : $dbw->insertId();
|
||||
$this->mId = $newid;
|
||||
$this->mTitle->resetArticleID( $newid );
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
* @ingroup Maintenance
|
||||
*/
|
||||
class BaseDump {
|
||||
/** @var XMLReader */
|
||||
protected $reader = null;
|
||||
protected $atEnd = false;
|
||||
protected $atPageEnd = false;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,12 @@ use Wikimedia\Rdbms\IMaintainableDatabase;
|
|||
* @ingroup Maintenance
|
||||
*/
|
||||
class TextPassDumper extends BackupDumper {
|
||||
/** @var BaseDump */
|
||||
public $prefetch = null;
|
||||
/** @var string|bool */
|
||||
private $thisPage;
|
||||
/** @var string|bool */
|
||||
private $thisRev;
|
||||
|
||||
// when we spend more than maxTimeAllowed seconds on this run, we continue
|
||||
// processing until we write out the next complete page, then save output file(s),
|
||||
|
|
@ -583,8 +588,7 @@ TEXT
|
|||
if ( $text === false && isset( $this->prefetch ) && $prefetchNotTried ) {
|
||||
$prefetchNotTried = false;
|
||||
$tryIsPrefetch = true;
|
||||
$text = $this->prefetch->prefetch( intval( $this->thisPage ),
|
||||
intval( $this->thisRev ) );
|
||||
$text = $this->prefetch->prefetch( (int)$this->thisPage, (int)$this->thisRev );
|
||||
|
||||
if ( $text === null ) {
|
||||
$text = false;
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ class TextPassDumperDatabaseTest extends DumpTestCase {
|
|||
// increasing
|
||||
$this->assertEquals(
|
||||
[ $this->pageId2, $this->pageId3, $this->pageId4 ],
|
||||
[ $this->pageId1 + 1, $this->pageId2 + 1, $this->pageId3 + 1 ],
|
||||
[ $this->pageId1 + 1, $this->pageId1 + 2, $this->pageId1 + 3 ],
|
||||
"Page ids increasing without holes" );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue