: DB_REPLICA; // T154554
$edit->popts->setSpeculativeRevIdCallback( function () use ( $dbIndex ) {
- return 1 + (int)wfGetDB( $dbIndex )->selectField(
+ $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
+ // Use a fresh connection in order to see the latest data, by avoiding
+ // stale data from REPEATABLE-READ snapshots.
+ $db = $lb->getConnectionRef( $dbIndex, [], false, $lb::CONN_TRX_AUTO );
+
+ return 1 + (int)$db->selectField(
'revision',
'MAX(rev_id)',
[],
'ar_rev_id' => $row->rev_id,
'ar_parent_id' => $row->rev_parent_id,
'ar_text_id' => $row->rev_text_id,
- 'ar_text' => '',
- 'ar_flags' => '',
'ar_len' => $row->rev_len,
'ar_page_id' => $id,
'ar_deleted' => $suppress ? $bitfield : $row->rev_deleted,