diff options
-rw-r--r-- | Changelog.md | 105 | ||||
-rw-r--r-- | README.markdown | 5 | ||||
-rw-r--r-- | library.c | 8 | ||||
-rw-r--r-- | package.xml | 184 | ||||
-rw-r--r-- | php_redis.h | 2 | ||||
-rw-r--r-- | redis.c | 1 | ||||
-rw-r--r-- | redis_sentinel.h | 2 | ||||
-rw-r--r-- | tests/RedisClusterTest.php | 15 |
8 files changed, 274 insertions, 48 deletions
diff --git a/Changelog.md b/Changelog.md index 4659a1a5..053953af 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,18 +5,103 @@ All changes to phpredis will be documented in this file. We're basing this format on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and PhpRedis adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [5.2.0] - 2020-03-02 ([GitHub](https://github.com/phpredis/phpredis/releases/tag/5.2.0), [PECL](https://pecl.php.net/package/redis/5.2.0)) -### Changed +*There were no changes between 5.2.0RC2 and 5.2.0* + +## [5.2.0RC2] - 2020-02-21 ([GitHub](https://github.com/phpredis/phpredis/releases/tag/5.2.0RC2), [PECL](https://pecl.php.net/package/redis/5.2.0RC2)) + +### Sponsors :sparkling_heart: + +- [Audiomack.com](https://audiomack.com) +- [Till Krüss](https://github.com/tillkruss) + +### Fixed + +- Include RedisSentinelTest.php in package.xml! + [eddbfc8f](https://github.com/phpredis/phpredis/commit/eddbfc8f) + ([Michel Grunder](https://github.com/michael-grunder)) + +- Fix -Wmaybe-uninitialized warning + [740b8c87](https://github.com/phpredis/phpredis/commit/740b8c87) + ([Remi Collet](https://github.com/remicollet)) + +- Fix improper destructor when zipping values and scores + [371ae7ae](https://github.com/phpredis/phpredis/commit/371ae7ae) + +- Use php_rand instead of php_mt_rand for liveness challenge string + [9ef2ed89](https://github.com/phpredis/phpredis/commit/9ef2ed89) + ([Michael Grunder](https://github.com/michael-grunder)) + +## [5.2.0RC1] - 2020-02-15 ([GitHub](https://github.com/phpredis/phpredis/releases/tag/5.2.0RC1), [PECL](https://pecl.php.net/package/redis/5.2.0RC1)) + +### Sponsors :sparkling_heart: + +- [Till Krüss](https://github.com/tillkruss) + +### Added -- Use ECHO to check liveness of connection +- Added challenge/response mechanism to ensure persistent connections are not in a bad state + [a5f95925](https://github.com/phpredis/phpredis/commit/a5f95925), + [25cdaee6](https://github.com/phpredis/phpredis/commit/25cdaee6), + [7b6072e0](https://github.com/phpredis/phpredis/commit/7b6072e0), [99ebd0cc](https://github.com/phpredis/phpredis/commit/99ebd0cc), - [3243f426](https://github.com/phpredis/phpredis/commit/3243f426), - [a5f95925](https://github.com/phpredis/phpredis/commit/a5f95925) + [3243f426](https://github.com/phpredis/phpredis/commit/3243f426) ([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko), [Michael Grunder](https://github.com/michael-grunder)) -- Enable slot caching for session cluster - [23b1a9d8](https://github.com/phpredis/phpredis/commit/23b1a9d84) - ([Michael03](https://github.com/Michael03)) + +- Experimental support for RedisSentinel + [90cb69f3](https://github.com/phpredis/phpredis/commit/90cb69f3), + [c94e28f1](https://github.com/phpredis/phpredis/commit/c94e28f1), + [46da22b0](https://github.com/phpredis/phpredis/commit/46da22b0), + [5a609fa4](https://github.com/phpredis/phpredis/commit/5a609fa4), + [383779ed](https://github.com/phpredis/phpredis/commit/383779ed) + ([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko)) + +### Fixed + +- Fixed ASK redirection logic + [ba73fbee](https://github.com/phpredis/phpredis/commit/ba73fbee) + ([Michael Grunder](https://github.com/michael-grunder)) + +- Create specific 'test skipped' exception + [c3d83d44](https://github.com/phpredis/phpredis/commit/c3d83d44) + ([Michael Grunder](https://github.com/michael-grunder)) + +- Fixed memory leaks in RedisCluster + [a107c9fc](https://github.com/phpredis/phpredis/commit/a107c9fc) + ([Michael Grunder](https://github.com/michael-grunder)) + +- Fixes for session lifetime values that underflow or overflow + [7a79ad9c](https://github.com/phpredis/phpredis/commit/7a79ad9c), + [3c48a332](https://github.com/phpredis/phpredis/commit/3c48a332) + ([Michael Grunder](https://github.com/michael-grunder)) + +- Enables slot caching for Redis Cluster + [23b1a9d8](https://github.com/phpredis/phpredis/commit/23b1a9d8) + ([Michael Booth](https://github.com/Michael03)) + +- Housekeeping (spelling, doc changes, etc) + [23f9de30](https://github.com/phpredis/phpredis/commit/23f9de30), + [d07a8df6](https://github.com/phpredis/phpredis/commit/d07a8df6), + [2d39b48d](https://github.com/phpredis/phpredis/commit/2d39b48d), + [0ef488fc](https://github.com/phpredis/phpredis/commit/0ef488fc), + [2c35e435](https://github.com/phpredis/phpredis/commit/2c35e435), + [f52bd8a8](https://github.com/phpredis/phpredis/commit/f52bd8a8), + [2ddc5f21](https://github.com/phpredis/phpredis/commit/2ddc5f21), + [1ff7dfb7](https://github.com/phpredis/phpredis/commit/1ff7dfb7), + [db446138](https://github.com/phpredis/phpredis/commit/db446138) + ([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko), + [Tyson Andre](https://github.com/TysonAndre), [Michael Grunder](https://github.com/michael-grunder), + [Paul DelRe](https://github.com/pdelre), [Tyson Andre](https://github.com/TysonAndre)) + +### Changed + +- Support TYPE argument for SCAN + [8eb39a26](https://github.com/phpredis/phpredis/commit/8eb39a26) + [b1724b84](https://github.com/phpredis/phpredis/commit/b1724b84) + [53fb36c9](https://github.com/phpredis/phpredis/commit/53fb36c9) + [544e641b](https://github.com/phpredis/phpredis/commit/544e641b) + ([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko)) --- @@ -109,7 +194,7 @@ and PhpRedis adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm [1f41da64](https://github.com/phpredis/phpredis/commit/1f41da64), ([Owen Smith](https://github.com/orls)) - RedisCluster segfaults after second connection with cache_slots enabled - [f52cd237](https://github.com/phpredis/phpredis/commit/f52cd237), + [f52cd237](https://github.com/phpredis/phpredis/commit/f52cd237), [cb5d6b94](https://github.com/phpredis/phpredis/commit/cb5d6b94) ([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko), [Michael Grunder](https://github.com/michael-grunder)) @@ -463,7 +548,7 @@ Also many small improvements and bug fixes were made. - Fix zval_get_string impl for PHP5 [4e56ba](https://www.github.com/phpredis/phpredis/commit/4e56ba) ([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko)) - Fix Redis/RedisArray segfaults [be5c1f](https://www.github.com/phpredis/phpredis/commit/be5c1f), [635c3a](https://www.github.com/phpredis/phpredis/commit/635c3a), [1f8dde](https://www.github.com/phpredis/phpredis/commit/1f8dde), [43e1e0](https://www.github.com/phpredis/phpredis/commit/43e1e0) - ([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko)) -- Fix memory leak and potential segfault [aa6ff7](https://www.github.com/phpredis/phpredis/commit/aa6ff7), [88efaa](https://www.github.com/phpredis/phpredis/commit/88efaa) ([Michael Grunder](https://github.com/michael-grunder)) +- Fix memory leak and potential segfault [aa6ff77a](https://www.github.com/phpredis/phpredis/commit/aa6ff77a), [88efaa](https://www.github.com/phpredis/phpredis/commit/88efaa) ([Michael Grunder](https://github.com/michael-grunder)) - Assume "NULL bulk" reply as success (empty session data) [4a81e1](https://www.github.com/phpredis/phpredis/commit/4a81e1) ([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko)) - Refactoring ([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko), [Michael Grunder](https://github.com/michael-grunder)) diff --git a/README.markdown b/README.markdown index 8e4440b7..949f1837 100644 --- a/README.markdown +++ b/README.markdown @@ -19,6 +19,11 @@ You can also make a one-time contribution with one of the links below. [![Bitcoin](https://en.cryptobadges.io/badge/micro/1FXkYHBo5uoaztxFbajiPfbnkgKCbF3ykG)](https://en.cryptobadges.io/donate/1FXkYHBo5uoaztxFbajiPfbnkgKCbF3ykG) [![Ethereum](https://en.cryptobadges.io/badge/micro/0x43D54E32357B96f68dFF0a6B46976d014Bd603E1)](https://en.cryptobadges.io/donate/0x43D54E32357B96f68dFF0a6B46976d014Bd603E1) +## Sponsors + +<a href="https://audiomack.com"> + <img src="https://styleguide.audiomack.com/styleguide/assets/dl/inline-orange-large.png" alt="Audiomack.com" width="150"> +</a> # Table of contents ----- @@ -1166,8 +1166,7 @@ static void array_zip_values_and_scores(RedisSock *redis_sock, zval *z_tab, /* replace */ zval_dtor(z_tab); - ZVAL_ZVAL(z_tab, &z_ret, 1, 0); - zval_dtor(&z_ret); + ZVAL_ZVAL(z_tab, &z_ret, 0, 0); } static int @@ -1476,7 +1475,7 @@ PHP_REDIS_API int redis_read_xinfo_response(RedisSock *redis_sock, zval *z_ret, int elements) { zval zv; - int i, len; + int i, len = 0; char *key = NULL, *data; REDIS_REPLY_TYPE type; long li; @@ -1812,8 +1811,9 @@ redis_sock_check_liveness(RedisSock *redis_sock) redis_cmd_init_sstr(&cmd, 1, "AUTH", sizeof("AUTH") - 1); redis_cmd_append_sstr(&cmd, ZSTR_VAL(redis_sock->auth), ZSTR_LEN(redis_sock->auth)); } + gettimeofday(&tv, NULL); - uniqid_len = snprintf(uniqid, sizeof(uniqid), "phpredis_pool:%08lx%05lx:%08" PRIx32, (long)tv.tv_sec, (long)tv.tv_usec, php_mt_rand()); + uniqid_len = snprintf(uniqid, sizeof(uniqid), "phpredis_pool:%08lx%05lx:%08lx", (long)tv.tv_sec, (long)tv.tv_usec, (long)php_rand()); redis_cmd_init_sstr(&cmd, 1, "ECHO", sizeof("ECHO") - 1); redis_cmd_append_sstr(&cmd, uniqid, uniqid_len); smart_string_0(&cmd); diff --git a/package.xml b/package.xml index b2668e6f..190567f8 100644 --- a/package.xml +++ b/package.xml @@ -27,10 +27,10 @@ http://pear.php.net/dtd/package-2.0.xsd"> <email>n.favrefelix@gmail.com</email> <active>no</active> </lead> - <date>2019-07-02</date> + <date>2020-03-02</date> <version> - <release>5.0.0</release> - <api>5.0.0</api> + <release>5.2.0</release> + <api>5.2.0</api> </version> <stability> <release>stable</release> @@ -38,42 +38,54 @@ http://pear.php.net/dtd/package-2.0.xsd"> </stability> <license uri="http://www.php.net/license">PHP</license> <notes> - This release contains important improvements and breaking changes. - The most interesting are: drop PHP5 support, RedisCluster slots caching, - JSON and msgpack serializers, soft deprecation of non-Redis commands. + phpredis 5.2.0 - phpredis 5.0.0 + - There were no changes between 5.2.0RC2 and 5.2.0. - * Remove HAVE_SPL [55c5586c] (@petk) - * Update Fedora installation instructions [90aa067c] (@remicollet) + phpredis 5.2.0RC2 - phpredis 5.0.0RC2 + * Include RedisSentinelTest.php in package.xml! [eddbfc8f] (Michael Grunder) + * Fix -Wmaybe-uninitialized warning [740b8c87] (Remi Collet) + * Fix improper destructor when zipping values and scores [371ae7ae] + (Michael Grunder) + * Use php_rand instead of php_mt_rand for liveness challenge string + [9ef2ed89] (Michael Grunder) - * Allow compilation without JSON serialization enabled and fixes for deprecated - helper methods. [235a27] (Pavlo Yatsukhnenko) - * Fix php msgpack >= 2.0.3 version requirement. [6973478..a537df8] (Michael Grunder) + phpredis 5.2.0RC1 - phpredis 5.0.0RC1 + This release contains initial support for Redis Sentinel as well as many + smaller bug fixes and improvements. It is especially of interest if you + use persistent connections, as we've added logic to make sure they are in + a good state when retreving them from the pool. - * Enable connection pooling by default [8206b147] (Pavlo Yatsukhnenko) - * Soft deprecate methods that aren't actually Redis commands [a81b4f2d, 95c8aab9] (Pavlo Yatsukhnenko, Michael Grunder) - * Enable pooling for cluster slave nodes [17600dd1] (Michael Grunder) - * xInfo response format [4852a510, ac9dca0a] (Pavlo Yatsukhnenko) - * Make the XREADGROUP optional COUNT and BLOCK arguments nullable [0c17bd27] (Michael Grunder) - * Allow PING to take an optional argument [6e494170] (Michael Grunder) - * Allow ZRANGE to be called either with `true` or `['withscores' => true]` [19f3efcf] (Michael Grunder) - * Allow to specify server address as schema://host [418428fa] (Pavlo Yatsukhnenko) - * Allow persistent_id to be passed as NULL with strict_types enabled [60223762] (Michael Grunder) - * Add server address to exception message [e8fb49be, 34d6403d] (Pavlo Yatsukhnenko) - * Adds OPT_REPLY_LITERAL for rawCommand and EVAL [5cb30fb2] (Michael Grunder) - * JSON serializer [98bd2886, 96c57139] (Pavlo Yatsukhnenko, Michael Grunder) - * Add support for STREAM to the type command [d7450b2f, 068ce978, 8a45d18c] (Michael Grunder, Pavlo Yatsukhnenko) - * Fix TypeError when using built-in constants in `setOption` [4c7643ee] (@JoyceBabu) - * Handle references in MGET [60d8b679] (Michael Grunder) - * msgpack serializer [d5b8f833, 545250f3, 52bae8ab] (@bgort, Pavlo Yatsukhnenko, Michael Grunder) - * Add Cluster slots caching [9f0d7bc0, ea081e05] (Michael Grunder) - * Drop PHP5 support [f9928642, 46a50c12, 4601887d, 6ebb36ce, fdbe9d29] (Michael Grunder) - * Documentation improvements (@alexander-schranz, @cookieguru, Pavlo Yatsukhnenko, Michael Grunder) + IMPORTANT: Sentinel support is considered experimental and the API + will likely change based on user feedback. + + * Sponsors + ~ Audiomack.com - https://audiomack.com + ~ Till Kruss - https://github.com/tillkruss + + --- + + * Initial support for RedisSentinel [90cb69f3, c94e28f1, 46da22b0, 5a609fa4, + 383779ed] (Pavlo Yatsukhnenko) + + * Houskeeping (spelling, doc changes, etc) [23f9de30, d07a8df6, 2d39b48d, + 0ef488fc, 2c35e435, f52bd8a8, 2ddc5f21, 1ff7dfb7, db446138] (Tyson Andre, + Pavlo Yatsukhnenko, Michael Grunder, Tyson Andre) + + * Fix for ASK redirections [ba73fbee] (Michael Grunder) + * Create specific 'test skipped' exception [c3d83d44] (Michael Grunder) + * Fixed memory leaks in RedisCluster [a107c9fc] (Michael Grunder) + * Fixes for session lifetime values that underflow or overflow [7a79ad9c, + 3c48a332] (Michael Grunder) + * Enables slot caching for Redis Cluster [23b1a9d8] (Michael Booth) + + * Support TYPE argument for SCAN [8eb39a26, b1724b84, 53fb36c9, 544e641b] + (Pavlo Yatsukhnenko) + + * Added challenge/response mechanism for persistent connections [a5f95925, + 25cdaee6, 7b6072e0, 99ebd0cc, 3243f426] (Pavlo Yatsukhnenko, Michael Grunder) </notes> <contents> <dir name="/"> @@ -83,6 +95,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> <file role='src' name='INSTALL.markdown'/> <file role='doc' name='arrays.markdown'/> <file role='doc' name='cluster.markdown'/> + <file role='doc' name='sentinel.markdown'/> <file role='src' name='cluster_library.c'/> <file role='src' name='cluster_library.h'/> <file role='src' name='common.h'/> @@ -103,6 +116,10 @@ http://pear.php.net/dtd/package-2.0.xsd"> <file role='src' name='redis_commands.h'/> <file role='src' name='redis_session.c'/> <file role='src' name='redis_session.h'/> + <file role='src' name='redis_sentinel.c'/> + <file role='src' name='redis_sentinel.h'/> + <file role='src' name='sentinel_library.c'/> + <file role='src' name='sentinel_library.h'/> <dir name='liblzf'> <file role='doc' name='LICENSE'/> <file role='doc' name='README'/> @@ -114,6 +131,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> <dir name='tests'> <file role='test' name='RedisArrayTest.php'/> <file role='test' name='RedisClusterTest.php'/> + <file role='test' name='RedisSentinelTest.php'/> <file role='test' name='RedisTest.php'/> <file role='test' name='TestRedis.php'/> <file role='test' name='TestSuite.php'/> @@ -140,9 +158,109 @@ http://pear.php.net/dtd/package-2.0.xsd"> <extsrcrelease> <configureoption name="enable-redis-igbinary" prompt="enable igbinary serializer support?" default="no"/> <configureoption name="enable-redis-lzf" prompt="enable lzf compression support?" default="no"/> + <configureoption name="enable-redis-zstd" prompt="enable zstd compression support?" default="no"/> </extsrcrelease> <changelog> <release> + <stability><release>alpha</release><api>alpha</api></stability> + <version><release>5.2.0RC2</release><api>5.2.0RC2</api></version> + <date>2020-02-21</date> + <notes> + phpredis 5.2.0RC2 + + * Include RedisSentinelTest.php in package.xml! [eddbfc8f] (Michael Grunder) + * Fix -Wmaybe-uninitialized warning [740b8c87] (Remi Collet) + * Fix improper destructor when zipping values and scores [371ae7ae] + (Michael Grunder) + * Use php_rand instead of php_mt_rand for liveness challenge string + [9ef2ed89] (Michael Grunder) + + phpredis 5.2.0RC1 + + This release contains initial support for Redis Sentinel as well as many + smaller bug fixes and improvements. It is especially of interest if you + use persistent connections, as we've added logic to make sure they are in + a good state when retreving them from the pool. + + IMPORTANT: Sentinel support is considered experimental and the API + will likely change based on user feedback. + + * Sponsors + ~ Audiomack.com - https://audiomack.com + ~ Till Kruss - https://github.com/tillkruss + + --- + + * Initial support for RedisSentinel [90cb69f3, c94e28f1, 46da22b0, 5a609fa4, + 383779ed] (Pavlo Yatsukhnenko) + + * Houskeeping (spelling, doc changes, etc) [23f9de30, d07a8df6, 2d39b48d, + 0ef488fc, 2c35e435, f52bd8a8, 2ddc5f21, 1ff7dfb7, db446138] (Tyson Andre, + Pavlo Yatsukhnenko, Michael Grunder, Tyson Andre) + + * Fix for ASK redirections [ba73fbee] (Michael Grunder) + * Create specific 'test skipped' exception [c3d83d44] (Michael Grunder) + * Fixed memory leaks in RedisCluster [a107c9fc] (Michael Grunder) + * Fixes for session lifetime values that underflow or overflow [7a79ad9c, + 3c48a332] (Michael Grunder) + * Enables slot caching for Redis Cluster [23b1a9d8] (Michael Booth) + + * Support TYPE argument for SCAN [8eb39a26, b1724b84, 53fb36c9, 544e641b] + (Pavlo Yatsukhnenko) + + * Added challenge/response mechanism for persistent connections [a5f95925, + 25cdaee6, 7b6072e0, 99ebd0cc, 3243f426] (Pavlo Yatsukhnenko, Michael Grunder) + </notes> + </release> + <release> + <stability><release>stable</release><api>stable</api></stability> + <version><release>5.1.1</release><api>5.1.0</api></version> + <date>2019-11-11</date> + <notes> + phpredis 5.1.1 + + This release contains only bugfix for unix-socket connection. + + * Fix fail to connect to redis through unix socket [2bae8010, 9f4ededa] (Pavlo Yatsukhnenko, Michael Grunder) + * Documentation improvements (@fitztrev) + </notes> + </release> + + <release> + <stability><release>stable</release><api>stable</api></stability> + <version><release>5.1.0</release><api>5.1.0</api></version> + <date>2019-10-31</date> + <notes> + This release contains important bugfixes and improvements. + + phpredis 5.1.0 + + * Allow to specify scheme for session handler [53a8bcc7] (Pavlo Yatsukhnenko) + * Add documentation for hyperloglog [75a6f3fa, 96a0f0c3, 9686757a] (@rlunar) + + phpredis 5.1.0RC2 + + * Fix missing null byte in PHP_MINFO_FUNCTION [8bc2240c] (Remi Collet) + * Remove dead code generic_unsubscribe_cmd [8ee4abbc] (Pavlo Yatsukhnenko) + * Add documentation for zpopmin and zpopmax [99ec24b3, 4ab1f940] (@alexander-schranz) + + phpredis 5.1.0RC1 + + * Fix regression for multihost_distribute_call added in 112c77e3 [fbe0f804] (Pavlo Yatsukhnenko) + * Fix regression for conntecting to unix sockets with relative path added in 1f41da64 [17b139d8, 7ef17ce1] (Pavlo Yatsukhnenko) + * Fix unix-socket detection logic broken in 418428fa [a080b73f] (Pavlo Yatsukhnenko) + * Fix memory leak and bug with getLastError for redis_mbulk_reply_assoc and redis_mbulk_reply_zipped. [7f42d628, 3a622a07] (Pavlo Yatsukhnenko), (Michael Grunder) + * Fix bug with password contain "#" for redis_session [2bb08680] (Pavlo Yatsukhnenko) + * Add optional support for Zstd compression, using --enable-redis-ztsd. This requires libzstd version >= 1.3.0 [2abc61da] (Remi Collet) + * Fix overallocation in RedisCluster directed node commands [cf93649] (Michael Grunder) + * Also attach slaves when caching cluster slots [0d6d3fdd, b114fc26] (Michael Grunder) + * Use zend_register_persistent_resource_ex for connection pooling [fdada7ae, 7c6c43a6] (Pavlo Yatsukhnenko) + * Refactor redis_session [91a8e734, 978c3074] (Pavlo Yatsukhnenko) + * Documentation improvements (@Steveb-p, @tangix, @ljack-adista, @jdreesen, Michael Grunder) + </notes> + </release> + + <release> <stability><release>stable</release><api>stable</api></stability> <version><release>5.0.0</release><api>5.0.0</api></version> <date>2019-07-02</date> diff --git a/php_redis.h b/php_redis.h index c86ac2b4..af77ea00 100644 --- a/php_redis.h +++ b/php_redis.h @@ -23,7 +23,7 @@ #define PHP_REDIS_H /* phpredis version */ -#define PHP_REDIS_VERSION "5.2.0-dev" +#define PHP_REDIS_VERSION "5.2.0" PHP_METHOD(Redis, __construct); PHP_METHOD(Redis, __destruct); @@ -879,6 +879,7 @@ PHP_MINFO_FUNCTION(redis) php_info_print_table_start(); php_info_print_table_header(2, "Redis Support", "enabled"); php_info_print_table_row(2, "Redis Version", PHP_REDIS_VERSION); + php_info_print_table_row(2, "Redis Sentinel Version", PHP_REDIS_SENTINEL_VERSION); #ifdef GIT_REVISION php_info_print_table_row(2, "Git revision", "$Id: " GIT_REVISION " $"); #endif diff --git a/redis_sentinel.h b/redis_sentinel.h index 986a63ba..651cc1b8 100644 --- a/redis_sentinel.h +++ b/redis_sentinel.h @@ -3,6 +3,8 @@ #include "sentinel_library.h" +#define PHP_REDIS_SENTINEL_VERSION "0.1" + PHP_METHOD(RedisSentinel, __construct); PHP_METHOD(RedisSentinel, ckquorum); PHP_METHOD(RedisSentinel, failover); diff --git a/tests/RedisClusterTest.php b/tests/RedisClusterTest.php index eb9e4278..4d7ba730 100644 --- a/tests/RedisClusterTest.php +++ b/tests/RedisClusterTest.php @@ -665,6 +665,21 @@ class Redis_Cluster_Test extends Redis_Test { ini_set('redis.clusters.cache_slots', 0); } + /* Regression test for connection pool liveness checks */ + public function testConnectionPool() { + $prev_value = ini_get('redis.pconnect.pooling_enabled'); + ini_set('redis.pconnect.pooling_enabled', 1); + + $pong = 0; + for ($i = 0; $i < 10; $i++) { + $obj_rc = new RedisCluster(NULL, self::$_arr_node_map, 30, 30, true); + $pong += $obj_rc->ping("key:$i"); + } + + $this->assertEquals($pong, $i); + ini_set('redis.pconnect.pooling_enabled', $prev_value); + } + /** * @inheritdoc */ |