diff options
-rw-r--r-- | PHPINFO | 11 | ||||
-rw-r--r-- | REFLECTION | 252 | ||||
-rw-r--r-- | RedisSentinelTest.php | 113 | ||||
-rw-r--r-- | php-pecl-redis5.spec | 31 |
4 files changed, 307 insertions, 100 deletions
@@ -2,7 +2,8 @@ redis Redis Support => enabled -Redis Version => 5.1.1 +Redis Version => 5.2.0RC1 +Redis Sentinel Version => 0.1RC1 Available serializers => php, json, igbinary, msgpack Available compression => lzf, zstd @@ -11,7 +12,6 @@ redis.arrays.algorithm => no value => no value redis.arrays.auth => no value => no value redis.arrays.autorehash => 0 => 0 redis.arrays.connecttimeout => 0 => 0 -redis.arrays.consistent => 0 => 0 redis.arrays.distributor => no value => no value redis.arrays.functions => no value => no value redis.arrays.hosts => no value => no value @@ -22,15 +22,16 @@ redis.arrays.pconnect => 0 => 0 redis.arrays.previous => no value => no value redis.arrays.readtimeout => 0 => 0 redis.arrays.retryinterval => 0 => 0 -redis.clusters.auth => no value => no value +redis.arrays.consistent => 0 => 0 redis.clusters.cache_slots => 0 => 0 +redis.clusters.auth => no value => no value redis.clusters.persistent => 0 => 0 redis.clusters.read_timeout => 0 => 0 redis.clusters.seeds => no value => no value redis.clusters.timeout => 0 => 0 -redis.pconnect.connection_limit => 0 => 0 redis.pconnect.pooling_enabled => 1 => 1 +redis.pconnect.connection_limit => 0 => 0 +redis.session.locking_enabled => 0 => 0 redis.session.lock_expire => 0 => 0 redis.session.lock_retries => 10 => 10 redis.session.lock_wait_time => 2000 => 2000 -redis.session.locking_enabled => 0 => 0 @@ -1,4 +1,4 @@ -Extension [ <persistent> extension #197 redis version 5.1.1 ] { +Extension [ <persistent> extension #109 redis version 5.2.0RC1 ] { - Dependencies { Dependency [ igbinary (Required) ] @@ -20,9 +20,6 @@ Extension [ <persistent> extension #197 redis version 5.1.1 ] { Entry [ redis.arrays.connecttimeout <ALL> ] Current = '0' } - Entry [ redis.arrays.consistent <ALL> ] - Current = '0' - } Entry [ redis.arrays.distributor <ALL> ] Current = '' } @@ -53,12 +50,15 @@ Extension [ <persistent> extension #197 redis version 5.1.1 ] { Entry [ redis.arrays.retryinterval <ALL> ] Current = '0' } - Entry [ redis.clusters.auth <ALL> ] - Current = '' + Entry [ redis.arrays.consistent <ALL> ] + Current = '0' } Entry [ redis.clusters.cache_slots <ALL> ] Current = '0' } + Entry [ redis.clusters.auth <ALL> ] + Current = '' + } Entry [ redis.clusters.persistent <ALL> ] Current = '0' } @@ -71,11 +71,14 @@ Extension [ <persistent> extension #197 redis version 5.1.1 ] { Entry [ redis.clusters.timeout <ALL> ] Current = '0' } + Entry [ redis.pconnect.pooling_enabled <ALL> ] + Current = '1' + } Entry [ redis.pconnect.connection_limit <ALL> ] Current = '0' } - Entry [ redis.pconnect.pooling_enabled <ALL> ] - Current = '1' + Entry [ redis.session.locking_enabled <ALL> ] + Current = '0' } Entry [ redis.session.lock_expire <ALL> ] Current = '0' @@ -86,46 +89,43 @@ Extension [ <persistent> extension #197 redis version 5.1.1 ] { Entry [ redis.session.lock_wait_time <ALL> ] Current = '2000' } - Entry [ redis.session.locking_enabled <ALL> ] - Current = '0' - } } - - Classes [5] { + - Classes [6] { Class [ <internal:redis> class Redis ] { - Constants [33] { - Constant [ public integer REDIS_NOT_FOUND ] { 0 } - Constant [ public integer REDIS_STRING ] { 1 } - Constant [ public integer REDIS_SET ] { 2 } - Constant [ public integer REDIS_LIST ] { 3 } - Constant [ public integer REDIS_ZSET ] { 4 } - Constant [ public integer REDIS_HASH ] { 5 } - Constant [ public integer REDIS_STREAM ] { 6 } - Constant [ public integer PIPELINE ] { 2 } - Constant [ public integer ATOMIC ] { 0 } - Constant [ public integer MULTI ] { 1 } - Constant [ public integer OPT_SERIALIZER ] { 1 } - Constant [ public integer OPT_PREFIX ] { 2 } - Constant [ public integer OPT_READ_TIMEOUT ] { 3 } - Constant [ public integer OPT_TCP_KEEPALIVE ] { 6 } - Constant [ public integer OPT_COMPRESSION ] { 7 } - Constant [ public integer OPT_REPLY_LITERAL ] { 8 } - Constant [ public integer OPT_COMPRESSION_LEVEL ] { 9 } - Constant [ public integer SERIALIZER_NONE ] { 0 } - Constant [ public integer SERIALIZER_PHP ] { 1 } - Constant [ public integer SERIALIZER_IGBINARY ] { 2 } - Constant [ public integer SERIALIZER_MSGPACK ] { 3 } - Constant [ public integer SERIALIZER_JSON ] { 4 } - Constant [ public integer COMPRESSION_NONE ] { 0 } - Constant [ public integer COMPRESSION_LZF ] { 1 } - Constant [ public integer COMPRESSION_ZSTD ] { 2 } - Constant [ public integer COMPRESSION_ZSTD_MIN ] { 1 } - Constant [ public integer COMPRESSION_ZSTD_DEFAULT ] { 3 } - Constant [ public integer COMPRESSION_ZSTD_MAX ] { 22 } - Constant [ public integer OPT_SCAN ] { 4 } - Constant [ public integer SCAN_RETRY ] { 1 } - Constant [ public integer SCAN_NORETRY ] { 0 } + Constant [ public int REDIS_NOT_FOUND ] { 0 } + Constant [ public int REDIS_STRING ] { 1 } + Constant [ public int REDIS_SET ] { 2 } + Constant [ public int REDIS_LIST ] { 3 } + Constant [ public int REDIS_ZSET ] { 4 } + Constant [ public int REDIS_HASH ] { 5 } + Constant [ public int REDIS_STREAM ] { 6 } + Constant [ public int PIPELINE ] { 2 } + Constant [ public int ATOMIC ] { 0 } + Constant [ public int MULTI ] { 1 } + Constant [ public int OPT_SERIALIZER ] { 1 } + Constant [ public int OPT_PREFIX ] { 2 } + Constant [ public int OPT_READ_TIMEOUT ] { 3 } + Constant [ public int OPT_TCP_KEEPALIVE ] { 6 } + Constant [ public int OPT_COMPRESSION ] { 7 } + Constant [ public int OPT_REPLY_LITERAL ] { 8 } + Constant [ public int OPT_COMPRESSION_LEVEL ] { 9 } + Constant [ public int SERIALIZER_NONE ] { 0 } + Constant [ public int SERIALIZER_PHP ] { 1 } + Constant [ public int SERIALIZER_IGBINARY ] { 2 } + Constant [ public int SERIALIZER_MSGPACK ] { 3 } + Constant [ public int SERIALIZER_JSON ] { 4 } + Constant [ public int COMPRESSION_NONE ] { 0 } + Constant [ public int COMPRESSION_LZF ] { 1 } + Constant [ public int COMPRESSION_ZSTD ] { 2 } + Constant [ public int COMPRESSION_ZSTD_MIN ] { 1 } + Constant [ public int COMPRESSION_ZSTD_DEFAULT ] { 3 } + Constant [ public int COMPRESSION_ZSTD_MAX ] { 22 } + Constant [ public int OPT_SCAN ] { 4 } + Constant [ public int SCAN_RETRY ] { 1 } + Constant [ public int SCAN_NORETRY ] { 0 } Constant [ public string AFTER ] { after } Constant [ public string BEFORE ] { before } } @@ -2285,41 +2285,41 @@ Extension [ <persistent> extension #197 redis version 5.1.1 ] { Class [ <internal:redis> class RedisCluster ] { - Constants [37] { - Constant [ public integer REDIS_NOT_FOUND ] { 0 } - Constant [ public integer REDIS_STRING ] { 1 } - Constant [ public integer REDIS_SET ] { 2 } - Constant [ public integer REDIS_LIST ] { 3 } - Constant [ public integer REDIS_ZSET ] { 4 } - Constant [ public integer REDIS_HASH ] { 5 } - Constant [ public integer REDIS_STREAM ] { 6 } - Constant [ public integer ATOMIC ] { 0 } - Constant [ public integer MULTI ] { 1 } - Constant [ public integer OPT_SERIALIZER ] { 1 } - Constant [ public integer OPT_PREFIX ] { 2 } - Constant [ public integer OPT_READ_TIMEOUT ] { 3 } - Constant [ public integer OPT_TCP_KEEPALIVE ] { 6 } - Constant [ public integer OPT_COMPRESSION ] { 7 } - Constant [ public integer OPT_REPLY_LITERAL ] { 8 } - Constant [ public integer OPT_COMPRESSION_LEVEL ] { 9 } - Constant [ public integer SERIALIZER_NONE ] { 0 } - Constant [ public integer SERIALIZER_PHP ] { 1 } - Constant [ public integer SERIALIZER_IGBINARY ] { 2 } - Constant [ public integer SERIALIZER_MSGPACK ] { 3 } - Constant [ public integer SERIALIZER_JSON ] { 4 } - Constant [ public integer COMPRESSION_NONE ] { 0 } - Constant [ public integer COMPRESSION_LZF ] { 1 } - Constant [ public integer COMPRESSION_ZSTD ] { 2 } - Constant [ public integer COMPRESSION_ZSTD_MIN ] { 1 } - Constant [ public integer COMPRESSION_ZSTD_DEFAULT ] { 3 } - Constant [ public integer COMPRESSION_ZSTD_MAX ] { 22 } - Constant [ public integer OPT_SCAN ] { 4 } - Constant [ public integer SCAN_RETRY ] { 1 } - Constant [ public integer SCAN_NORETRY ] { 0 } - Constant [ public integer OPT_SLAVE_FAILOVER ] { 5 } - Constant [ public integer FAILOVER_NONE ] { 0 } - Constant [ public integer FAILOVER_ERROR ] { 1 } - Constant [ public integer FAILOVER_DISTRIBUTE ] { 2 } - Constant [ public integer FAILOVER_DISTRIBUTE_SLAVES ] { 3 } + Constant [ public int REDIS_NOT_FOUND ] { 0 } + Constant [ public int REDIS_STRING ] { 1 } + Constant [ public int REDIS_SET ] { 2 } + Constant [ public int REDIS_LIST ] { 3 } + Constant [ public int REDIS_ZSET ] { 4 } + Constant [ public int REDIS_HASH ] { 5 } + Constant [ public int REDIS_STREAM ] { 6 } + Constant [ public int ATOMIC ] { 0 } + Constant [ public int MULTI ] { 1 } + Constant [ public int OPT_SERIALIZER ] { 1 } + Constant [ public int OPT_PREFIX ] { 2 } + Constant [ public int OPT_READ_TIMEOUT ] { 3 } + Constant [ public int OPT_TCP_KEEPALIVE ] { 6 } + Constant [ public int OPT_COMPRESSION ] { 7 } + Constant [ public int OPT_REPLY_LITERAL ] { 8 } + Constant [ public int OPT_COMPRESSION_LEVEL ] { 9 } + Constant [ public int SERIALIZER_NONE ] { 0 } + Constant [ public int SERIALIZER_PHP ] { 1 } + Constant [ public int SERIALIZER_IGBINARY ] { 2 } + Constant [ public int SERIALIZER_MSGPACK ] { 3 } + Constant [ public int SERIALIZER_JSON ] { 4 } + Constant [ public int COMPRESSION_NONE ] { 0 } + Constant [ public int COMPRESSION_LZF ] { 1 } + Constant [ public int COMPRESSION_ZSTD ] { 2 } + Constant [ public int COMPRESSION_ZSTD_MIN ] { 1 } + Constant [ public int COMPRESSION_ZSTD_DEFAULT ] { 3 } + Constant [ public int COMPRESSION_ZSTD_MAX ] { 22 } + Constant [ public int OPT_SCAN ] { 4 } + Constant [ public int SCAN_RETRY ] { 1 } + Constant [ public int SCAN_NORETRY ] { 0 } + Constant [ public int OPT_SLAVE_FAILOVER ] { 5 } + Constant [ public int FAILOVER_NONE ] { 0 } + Constant [ public int FAILOVER_ERROR ] { 1 } + Constant [ public int FAILOVER_DISTRIBUTE ] { 2 } + Constant [ public int FAILOVER_DISTRIBUTE_SLAVES ] { 3 } Constant [ public string AFTER ] { after } Constant [ public string BEFORE ] { before } } @@ -3871,6 +3871,102 @@ Extension [ <persistent> extension #197 redis version 5.1.1 ] { } } + Class [ <internal:redis> class RedisSentinel ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [11] { + Method [ <internal:redis, ctor> public method __construct ] { + + - Parameters [6] { + Parameter #0 [ <required> $host ] + Parameter #1 [ <optional> $port ] + Parameter #2 [ <optional> $timeout ] + Parameter #3 [ <optional> $persistent ] + Parameter #4 [ <optional> $retry_interval ] + Parameter #5 [ <optional> $read_timeout ] + } + } + + Method [ <internal:redis> public method ckquorum ] { + + - Parameters [1] { + Parameter #0 [ <required> $value ] + } + } + + Method [ <internal:redis> public method failover ] { + + - Parameters [1] { + Parameter #0 [ <required> $value ] + } + } + + Method [ <internal:redis> public method flushconfig ] { + + - Parameters [0] { + } + } + + Method [ <internal:redis> public method getMasterAddrByName ] { + + - Parameters [1] { + Parameter #0 [ <required> $value ] + } + } + + Method [ <internal:redis> public method master ] { + + - Parameters [1] { + Parameter #0 [ <required> $value ] + } + } + + Method [ <internal:redis> public method masters ] { + + - Parameters [0] { + } + } + + Method [ <internal:redis> public method ping ] { + + - Parameters [0] { + } + } + + Method [ <internal:redis> public method reset ] { + + - Parameters [1] { + Parameter #0 [ <required> $value ] + } + } + + Method [ <internal:redis> public method sentinels ] { + + - Parameters [1] { + Parameter #0 [ <required> $value ] + } + } + + Method [ <internal:redis> public method slaves ] { + + - Parameters [1] { + Parameter #0 [ <required> $value ] + } + } + } + } + Class [ <internal:redis> class RedisException extends Exception implements Throwable ] { - Constants [0] { diff --git a/RedisSentinelTest.php b/RedisSentinelTest.php new file mode 100644 index 0000000..b88e006 --- /dev/null +++ b/RedisSentinelTest.php @@ -0,0 +1,113 @@ +<?php defined('PHPREDIS_TESTRUN') or die("Use TestRedis.php to run tests!\n"); + +require_once(dirname($_SERVER['PHP_SELF'])."/TestSuite.php"); + +class Redis_Sentinel_Test extends TestSuite +{ + const NAME = 'mymaster'; + + /** + * @var RedisSentinel + */ + public $sentinel; + + /** + * Common fields + */ + protected $fields = [ + 'name', + 'ip', + 'port', + 'runid', + 'flags', + 'link-pending-commands', + 'link-refcount', + 'last-ping-sent', + 'last-ok-ping-reply', + 'last-ping-reply', + 'down-after-milliseconds', + ]; + + protected function newInstance() + { + return new RedisSentinel($this->getHost()); + } + + public function setUp() + { + $this->sentinel = $this->newInstance(); + } + + public function testCkquorum() + { + $this->assertTrue($this->sentinel->ckquorum(self::NAME)); + } + + public function testFailover() + { + $this->assertFalse($this->sentinel->failover(self::NAME)); + } + + public function testFlushconfig() + { + $this->assertTrue($this->sentinel->flushconfig()); + } + + public function testGetMasterAddrByName() + { + $result = $this->sentinel->getMasterAddrByName(self::NAME); + $this->assertTrue(is_array($result)); + $this->assertEquals(2, count($result)); + } + + protected function checkFields(array $fields) + { + foreach ($this->fields as $k) { + $this->assertTrue(array_key_exists($k, $fields)); + } + } + + public function testMaster() + { + $result = $this->sentinel->master(self::NAME); + $this->assertTrue(is_array($result)); + $this->checkFields($result); + } + + public function testMasters() + { + $result = $this->sentinel->masters(); + $this->assertTrue(is_array($result)); + foreach ($result as $master) { + $this->checkFields($master); + } + } + + public function testPing() + { + $this->assertTrue($this->sentinel->ping()); + } + + public function testReset() + { + $this->assertFalse($this->sentinel->reset('*')); + } + + public function testSentinels() + { + $result = $this->sentinel->sentinels(self::NAME); + $this->assertTrue(is_array($result)); + foreach ($result as $sentinel) { + $this->checkFields($sentinel); + } + } + + public function testSlaves() + { + $result = $this->sentinel->slaves(self::NAME); + $this->assertTrue(is_array($result)); + foreach ($result as $slave) { + $this->checkFields($slave); + } + } +} diff --git a/php-pecl-redis5.spec b/php-pecl-redis5.spec index 79df468..c1b1875 100644 --- a/php-pecl-redis5.spec +++ b/php-pecl-redis5.spec @@ -1,6 +1,6 @@ # remirepo spec file for php-pecl-redis5 # -# Copyright (c) 2012-2019 Remi Collet +# Copyright (c) 2012-2020 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -24,16 +24,18 @@ # after 20-json, 40-igbinary and 40-msgpack %global ini_name 50-%{pecl_name}.ini -%global upstream_version 5.1.1 -#global upstream_prever RC2 +%global upstream_version 5.2.0 +%global upstream_prever RC1 Summary: Extension for communicating with the Redis key-value store Name: %{?sub_prefix}php-pecl-redis5 Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} -Source0: http://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz +Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz License: PHP -URL: http://pecl.php.net/package/redis +URL: https://pecl.php.net/package/redis + +Source1: https://raw.githubusercontent.com/phpredis/phpredis/c58fb7316a82a6c5fceaaba83f3598f4212f8582/tests/RedisSentinelTest.php BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel > 7 @@ -42,9 +44,7 @@ BuildRequires: %{?scl_prefix}php-json %if %{with_igbin} BuildRequires: %{?scl_prefix}php-pecl-igbinary-devel %endif -%ifnarch ppc64 BuildRequires: %{?scl_prefix}php-pecl-msgpack-devel >= 2.0.3 -%endif BuildRequires: liblzf-devel BuildRequires: libzstd-devel >= 1.3.0 # to run Test suite @@ -58,9 +58,7 @@ Requires: %{?scl_prefix}php-json%{?_isa} %if %{with_igbin} Requires: %{?scl_prefix}php-pecl(igbinary)%{?_isa} %endif -%ifnarch ppc64 Requires: %{?scl_prefix}php-pecl-msgpack%{?_isa} -%endif %{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} Obsoletes: %{?scl_prefix}php-%{pecl_name} < 3 @@ -132,6 +130,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +cp %{SOURCE1} tests/ + # Use system library rm -r liblzf @@ -205,9 +205,7 @@ cd NTS %if %{with_igbin} --enable-redis-igbinary \ %endif -%ifnarch ppc64 --enable-redis-msgpack \ -%endif --enable-redis-lzf \ --with-liblzf \ --enable-redis-zstd \ @@ -224,9 +222,7 @@ cd ../ZTS %if %{with_igbin} --enable-redis-igbinary \ %endif -%ifnarch ppc64 --enable-redis-msgpack \ -%endif --enable-redis-lzf \ --with-liblzf \ --enable-redis-zstd \ @@ -263,11 +259,9 @@ done # simple module load test DEPS="--no-php-ini --define extension=json.so" %if %{with_igbin} - DEPS="$DEPS --define extension=igbinary.so" -%endif -%ifnarch ppc64 - DEPS="$DEPS --define extension=msgpack.so" +DEPS="$DEPS --define extension=igbinary.so" %endif +DEPS="$DEPS --define extension=msgpack.so" %{__php} $DEPS \ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ @@ -351,6 +345,9 @@ fi %changelog +* Mon Feb 17 2020 Remi Collet <remi@remirepo.net> - 5.2.0~RC1-1 +- update to 5.2.0RC1 + * Mon Nov 11 2019 Remi Collet <remi@remirepo.net> - 5.1.1-1 - update to 5.1.1 |