Merge "Remove arbitrary newSequentialPerNodeIDs() $count limit"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 23 Dec 2015 20:57:29 +0000 (20:57 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 23 Dec 2015 20:57:29 +0000 (20:57 +0000)
1  2 
includes/utils/UIDGenerator.php

@@@ -334,7 -334,7 +334,7 @@@ class UIDGenerator 
         * @see UIDGenerator::newSequentialPerNodeID()
         * @param string $bucket Arbitrary bucket name (should be ASCII)
         * @param int $bits Bit size (16 to 48) of resulting numbers before wrap-around
-        * @param int $count Number of IDs to return (1 to 10000)
+        * @param int $count Number of IDs to return
         * @param int $flags (supports UIDGenerator::QUICK_VOLATILE)
         * @return array Ordered list of float integer values
         * @since 1.23
         * @see UIDGenerator::newSequentialPerNodeID()
         * @param string $bucket Arbitrary bucket name (should be ASCII)
         * @param int $bits Bit size (16 to 48) of resulting numbers before wrap-around
-        * @param int $count Number of IDs to return (1 to 10000)
+        * @param int $count Number of IDs to return
         * @param int $flags (supports UIDGenerator::QUICK_VOLATILE)
         * @return array Ordered list of float integer values
         * @throws RuntimeException
        protected function getSequentialPerNodeIDs( $bucket, $bits, $count, $flags ) {
                if ( $count <= 0 ) {
                        return array(); // nothing to do
-               } elseif ( $count > 10000 ) {
-                       throw new RuntimeException( "Number of requested IDs ($count) is too high." );
                } elseif ( $bits < 16 || $bits > 48 ) {
                        throw new RuntimeException( "Requested bit size ($bits) is out of range." );
                }
                        $cache = ObjectCache::getLocalServerInstance();
                }
                if ( $cache ) {
 -                      $counter = $cache->incr( $bucket, $count );
 +                      $counter = $cache->incrWithInit( $bucket, $cache::TTL_INDEFINITE, $count, $count );
                        if ( $counter === false ) {
 -                              if ( !$cache->add( $bucket, (int)$count ) ) {
 -                                      throw new RuntimeException( 'Unable to set value to ' . get_class( $cache ) );
 -                              }
 -                              $counter = $count;
 +                              throw new RuntimeException( 'Unable to set value to ' . get_class( $cache ) );
                        }
                }