27 if ( $this->numShards ) {
28 $shard = mt_rand( 0, $this->numShards - 1 );
33 $dbw = $this->
getDB();
35 $dbw->startAtomic( __METHOD__ );
39 'uas_shard' => $shard,
43 [
'uas_value=uas_value+1' ],
46 $value = $dbw->newSelectQueryBuilder()
47 ->select(
'uas_value' )
49 ->where( [
'uas_shard' => $shard ] )
50 ->caller( __METHOD__ )
52 $dbw->endAtomic( __METHOD__ );
53 return $value * $this->numShards + $shard;