+ $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(