242 Commits

Author SHA1 Message Date
Pavlo Yatsukhnenko
b0b9dd78ef [WIP] Issue #1894
Add GET option to SET command
2021-04-10 21:26:29 +03:00
Adam Olley
ccd142fa44 Pass compression flag when performing HMGET (#1945)
Without this, performing a HMGET call fails to decompress the data before
returning it to php.
2021-03-10 14:11:19 +10:30
Michael Grunder
950e8de807 Issue.1847 cluster segfault (#1850)
Fix for #1847 when dealing with NULL multi bulk replies in RedisCluster.

Adds `Redis::OPT_NULL_MULTIBULK_AS_NULL` setting to have PhpRedis
treat NULL multi bulk replies as `NULL` instead of `[]`.

Co-authored-by: Alex Offshore <offshore@aopdg.ru>
2020-09-28 11:07:46 -07:00
Pavlo Yatsukhnenko
a7662da792 Don't use zend_fcall_info.no_separation 2020-07-09 13:01:34 +03:00
Pavlo Yatsukhnenko
f771ea16b7 Issue #1607 (#1806) 2020-07-07 13:18:01 -07:00
Michael Grunder
a311cc4ec3 Support for Redis 6 ACLs (#1791)
Add support for Redis 6 ACLs in the `Redis`, `RedisCluster`, and `RedisArray` classes.

On a related note, it adds a mechanism for users to customize how we generate persistent connection IDs such that they can be grouped in different ways depending on the specific use case required (e.g. it would allow connections to be grouped by username, or by user-defined persistent_id, or both).
2020-06-24 17:00:01 -07:00
Michael Grunder
5ca4141c72 Issue.1765 (#1774)
Various improvements and fixes to cluster slot caching.

* Improves slot caching so any unique set of seeds all hash to the same key

* Fix a couple of memory leaks.

* Fixes a segfault when executing a multiple key command such as `MGET` or `MSET` while the cluster is resharding.
2020-06-07 13:50:22 -07:00
Pavlo Yatsukhnenko
58dab5649f Store auth information in cluster->flags->auth 2020-06-05 10:27:48 +03:00
Remi Collet
b9b383f499 fix [-Wformat=] warning on 32-bit (#1750)
Use the portable `ZEND_LONG_FORMAT` family instead of C format specifiers
2020-05-06 09:46:43 -07:00
Pavlo Yatsukhnenko
35372a1f64 Authenticate in redis_sock_server_open 2020-03-30 22:34:12 +03:00
Pavlo Yatsukhnenko
460c8f2923 Various small changes in cluster_library 2020-03-10 23:16:35 +02:00
michael-grunder
ba73fbee74 Initial commit of ASK redirection fix
See #1693
2020-01-31 09:14:22 -08:00
michael-grunder
a107c9fc08 Fix a couple of memory leaks in Redis/RedisCluster
Addresses #1701
2020-01-19 09:35:24 -08:00
Tyson Andre
f52bd8a853 Fix typos detected by codespell 2020-01-06 09:08:36 -05:00
Michael Booth
23b1a9d84c Enable slot caching for session cluster 2019-12-02 09:00:12 +00:00
michael-grunder
b114fc26f1 Use pecalloc for consistency 2019-08-27 12:05:58 -07:00
michael-grunder
0d6d3fdde3 Also attach slaves when caching cluster slots
Addresses #1613
2019-08-27 12:05:58 -07:00
michael-grunder
cf93649ec1 Fix overallocation in directed cluster MULTIBULK handling.
Addresses #1611
2019-07-31 13:41:06 -07:00
Remi Collet
b4eb158a00 ulong => zend_ulong for 7.4 2019-07-18 10:37:02 +02:00
michael-grunder
cb5d6b9486 Don't double free the cache key
Addresses #1591
2019-07-16 17:28:30 -07:00
Remi Collet
943802272a cleanup TSRMLS_* usage 2019-07-09 15:26:44 +02:00
Pavlo Yatsukhnenko
5276474812 Issue #1591 (#1592)
* Issue #1591

* Add notes to Changelog
2019-07-05 09:44:00 -07:00
michael-grunder
17600dd131 WIP: Enable pooling for cluster slave nodes.
Connections are stashed via redis_sock_disconnect so if RedisCluster
doesn't explicitly call that for slaves then pooling is never used for
those connections.

Addresses #1568
2019-06-15 10:42:44 -07:00
Pavlo Yatsukhnenko
ac9dca0a92 Fix xInfo ro RedisCluster 2019-06-12 13:50:50 +03:00
michael-grunder
5cb30fb2a6 Adds OPT_REPLY_LITERAL for rawCommand and EVAL
Adds an option to process the actual strings in simple string replies as
opposed to translating them to `true`.  This only applies to
`rawCommand` and `eval` because as far as I know know vanilla Redis
command attaches any information besides `OK` to simple string replies.

Addresses #1550
2019-05-13 09:38:18 -07:00
Pavlo Yatsukhnenko
8a45d18c38 Fix copy-paste typo 2019-05-11 13:10:20 +03:00
Pavlo Yatsukhnenko
068ce978e1 Fix support for STREAM to the RedisCluster::type command 2019-05-11 13:04:13 +03:00
michael-grunder
a08d51fa3e Attach slot cache key and mechanism for invalidation 2019-02-09 17:02:15 -08:00
michael-grunder
2593df150f Merge exception fixes into cluster-slot-cache 2019-02-09 10:07:33 -08:00
michael-grunder
fa130a4bd4 PHP 7 exception and compiler warning fixes
PHP 7 removed TSRMLS_CC from zend_throw_exception* routines.
Additionally this commit creates two simple wrapper macros for throwing
Redis or RedisCluster exceptions so we don't duplicate as much code.

Additionally there were a couple of minor compiler warnings printf type
correctness fixed in this commit.
2019-02-08 21:31:47 -08:00
michael-grunder
9f0d7bc0a4 WIP: Reimplementation of cluster slot caching
RedisCluster currently has a high construction overhead because
every request has to issue a CLUSTER SLOTS command to map the
keyspace.  The issue is especially evident when a request only
does a few commands.
2019-02-08 18:08:17 -08:00
michael-grunder
f9928642b5 PHP 5 is dead, long live PHP 7
This commit removes support for PHP 5 by getting rid of all of our Zend
compatibility layer methods, as well as any call checking against
PHP_MAJOR_VERSION or ZEND_MODULE_API_NO.

Unit tests are all passing for Redis, RedisCluster, and RedisArray but
this should still be considered a work in progress until more testing
can be done.

Addresses issue #1448
2019-01-26 20:57:16 -08:00
Pavlo Yatsukhnenko
c5994f2a42 RedisCluster auth 2019-01-17 23:05:52 +02:00
Pavlo Yatsukhnenko
6e455e2e17 Fix build warning for PHP 5 2018-11-22 23:12:35 +02:00
Pavlo Yatsukhnenko
7274991614 Issue #1464 2018-11-22 22:52:39 +02:00
Michael Grunder
91bd7426d5 Masters info leakfix (#1462)
Fix for memory leaks in `RedisCluster->_masters()` and `RedisCluster->info()`
2018-11-22 11:37:18 -08:00
Pavlo Yatsukhnenko
c0793e8be4 Remove unused parameter lazy_connect from redis_sock_create 2018-11-21 13:39:50 +02:00
michael-grunder
d11724260f Simplify short-circuit logic 2018-10-17 05:14:02 -07:00
michael-grunder
07ef7f4e65 Make our timeout or response error handling more explicit.
Although a -1 return value from cluster_check_response is likely
a timeout, it is not the only possibility, so handle the loop
timeout and error response in distinct ways.
2018-10-16 21:31:52 -07:00
michael-grunder
27df92208a Treat a -1 response from cluster_check_response as a timeout.
When cluster_check_response returns -1 this can be treated as a
timeout.

Note that there is one non-timout condition which can
cause a -1 response, but that is a corrupted MOVE/ASK reply
which can *probably* be treated as a timeout as well,
because it means that something has gone horribly wrong
with the connection.

Addresses #1425
2018-10-14 11:50:47 -07:00
Marc de Jonge
cd6ebc6d7f Reset the socket after a timeout to make sure no wrong data is received (#1417)
* Reset the socket after a timeout to make sure no wrong data is received

* Remove the lazy_connect completely

* Missing TSRMLS_CC

* Remove redundant check if the stream exists

* Add the redis_sock_server_open to the CLUSTER_SEND_PAYLOAD macro
2018-10-08 08:57:51 +03:00
Michael Grunder
2c9e057236 Streams (#1413)
Streams API
2018-09-29 11:59:01 -07:00
Pavlo Yatsukhnenko
dcde933167 Issue #1399
Fix printf format warnings
2018-09-05 23:24:13 +03:00
Pavlo Yatsukhnenko
1d99787375 Change connect/reconnect logic
Persistant connections can be closed via close method.
Connection marked as failed only after reconnection attempts.
2018-08-22 09:02:31 +03:00
Pavlo Yatsukhnenko
a53e1a3400 Issue #1370 2018-07-04 09:15:24 +03:00
Pavlo Yatsukhnenko
28ec432247 Issue #1358
Use `cluster_free` in `free_cluster_context` to free cluster object.
Call `cluster_disconnect` before destroying cluster object.
2018-05-31 11:24:28 +03:00
michael-grunder
97bb6bd85e Bulk strings can be zero length
Addresses #1349
2018-05-17 07:38:26 -07:00
michael-grunder
74ca5adbd7 Don't leak a ZVAL 2018-04-08 06:50:49 -07:00
michael-grunder
a4afe91909 Some style normalization 2018-02-17 09:47:28 -08:00
Pavlo Yatsukhnenko
4cf34143c4 Merge pull request #1280 from janic716/dev
the element of z_seeds may be a reference on php7
2017-12-06 22:34:17 +02:00