Commit Graph

1772 Commits

Author SHA1 Message Date
Daniele Alessandri b996b005cf Fix cluster strategy to handle variadic EXISTS (Redis >= 3.0.3). 2016-05-24 15:26:35 +02:00
Daniele Alessandri 82116b0366 Fix prefix processor to handle variadic EXISTS (Redis >= 3.0.3).
Backported from master.

Conflicts:
	src/Command/Processor/KeyPrefixProcessor.php
2016-05-24 15:26:01 +02:00
Daniele Alessandri 5c1ddc9cfa Add missing @method tag for HSTRLEN in phpdocs.
[ci skip]
2016-05-24 12:26:50 +02:00
Daniele Alessandri ea2fd9700d [tests] Missing @requiresRedisVersion for HSTRLEN. 2016-05-24 11:50:15 +02:00
Daniele Alessandri b2ec264ff9 Update description in package.ini. 2016-05-24 10:27:37 +02:00
Daniele Alessandri bf7a70d6f0 Update phpunit.xml.* 2016-05-22 20:21:52 +02:00
Daniele Alessandri 4ecc44e1ee Update description in composer.json. 2016-05-22 20:05:31 +02:00
Daniele Alessandri 52d5b23db7 Fix README.
[ci skip]
2016-05-22 15:32:08 +02:00
Daniele Alessandri d31a4c71ba Update CHANGELOG.
[ci skip]
2016-05-22 15:24:39 +02:00
Daniele Alessandri c92e305852 Update README.
Blame copy&paste practices for the noise (or just blame me).

[ci skip]
2016-05-22 15:21:09 +02:00
Daniele Alessandri b075564278 Update and improve README.
[ci skip]
2016-05-22 15:12:14 +02:00
Daniele Alessandri f9e817f14c Run php-cs-fixer. 2016-05-21 15:49:25 +02:00
Daniele Alessandri 9e568396c6 Remove old references about HHVM being unstable. 2016-05-20 20:35:58 +02:00
Daniele Alessandri 2a91ebaba9 [tests] Rename old branch for exclusion.
[ci skip]
2016-05-20 20:15:12 +02:00
Daniele Alessandri ce15bd22b9 Update badges in CHANGELOG.
[ci skip]
2016-05-20 18:33:28 +02:00
Daniele Alessandri b0439e503e Update CHANGELOG. 2016-05-20 16:28:19 +02:00
Daniele Alessandri ffc1c25baa Try again on connection failure to node in cluster.
When the connection to a node in the cluster fails in the attempt to
execute a command, Predis now removes the failed connection from the
cluster pool and contacts a random node to ask for a fresh slots map
and tries to execute the command once again.

When the cluster is configured to have each master replicated to one
or more slaves, one the slaves is automatically promoted to the role
of master by redis-cluster with this change being reflected in the
output of CLUSTER SLOTS, so the next execution should run just fine.

Our current approach is relatively naive as CLUSTER SLOTS is executed
against a random master node, meaning that the client must open a new
connection and execute one more roundtrip only to fetch the new slots
map. For now it is enough, it is still better than having the client
fail when you actually have somes slaves in your redis-cluster setup,
but one improvement could consist in caching the list of slaves for
each master returned in the response of CLUSTER SLOTS so that when a
connection fails the client can try to guess which connection should
use for the next attempt.

This commit closes #173, closes #215, and closes #314.
2016-05-20 13:18:25 +02:00
Daniele Alessandri ac165194f5 Evict connection from slots cache when removed. 2016-05-20 11:43:15 +02:00
Daniele Alessandri 18ae294864 [tests] Fix assertion.
PHPUnit_Util_Type::export() has been removed a while ago...
2016-05-19 11:46:56 +02:00
Daniele Alessandri 47de667aea Bump min. version of PHPUnit (require-dev). 2016-05-19 11:46:52 +02:00
Daniele Alessandri 588940c5cb Update CHANGELOG. 2016-05-18 21:27:37 +02:00
Daniele Alessandri a1fe4013e1 Improve handling of slots mapping via parameters.
When using redis-cluster it is now also possible to pass one slot or
non-contiguous ranges of slots via connection parameters in order to
improve the ability to pre-configure the slots map on the client.

Here is an example:

  $parameters = [
    'tcp://10.0.0.1:6379?slots=0-5460,5500-5600,11000',
    'tcp://10.0.0.2:6379?slots=5461-5499,5600-10921',
    'tcp://10.0.0.3:6379?slots=10922-10999,11001-16383',
  ];

This commit fixes #312 (props to @kenotr0n for the original PR).
2016-05-18 21:16:42 +02:00
Daniele Alessandri 3328ad76be [tests] Fix wrong method in mock. 2016-05-16 15:38:42 +02:00
Daniele Alessandri 17b717a8f5 Fix CHANGELOG. 2016-05-15 21:42:00 +02:00
Daniele Alessandri 95dbc2bb34 Bump year in LICENSE. 2016-05-15 21:40:46 +02:00
Daniele Alessandri 9bb5a1c71f Apply minor styling fix. 2016-05-15 21:40:14 +02:00
Daniele Alessandri 8eb4804a5c Move member variable initialization. 2016-05-15 21:39:51 +02:00
Daniele Alessandri 5d99914939 Prevent warnings picking slave from empty pool. 2016-05-15 21:39:34 +02:00
Ante Lucic c45bb15767 add docblocks to MasterSlaveReplication 2016-05-13 17:00:27 +02:00
Ante Braovic e0329d6c74 added zrevrangebylex in the list of available methods 2016-05-13 16:43:50 +02:00
Daniele Alessandri 2175d87a96 [tests] Fix test executed on current Redis unstable. 2016-05-10 10:59:40 +02:00
Daniele Alessandri ce85fdadd1 [tests] Fix test executed on current Redis unstable. 2016-05-10 10:59:24 +02:00
Daniele Alessandri b15c0a02de [tests] Fix wrong @group annotation 2016-05-09 17:50:22 +02:00
Daniele Alessandri d2fbcc6b8c Prevent failures serializing commands with "holes" in arguments array.
This could be triggered when passing an array with "holes" to variadic commands.
Connection classes based on the protocol serialized exposed by phpiredis were
not affected by this bug.

Fixes #316.
2016-05-08 18:35:06 +02:00
Daniele Alessandri 6596460a57 Merge branch 'issue-tests' into v1.0 2016-05-08 16:50:28 +02:00
Daniele Alessandri 9ab0e31a75 Merge branch 'v1.0-fix-phpDoc-in-ClientInterface' into v1.0 2016-05-08 16:45:49 +02:00
John Maguire 11adccdaeb Update useClusterNodes() docs to indicate default 2016-05-08 15:21:01 +02:00
Daniele Alessandri f465792b27 Update CHANGELOG. 2016-05-08 15:15:48 +02:00
Daniele Alessandri 1399d3863c Fix bug in HSCAN-based iterator when hash have integer fields.
When iterating a hash containing integer fields our iterator abstraction
based on HSCAN was always returning "0" as a field name after the first
$field => $value pair due to a wrong assumption on how the PHP function
array_shift() (which is used internally to advance to the next pair in
our buffered response to HSCAN) works.

The ZSCAN-based iterator had this very same bug which was already fixed
in 24e19a9 so I am not sure how this one went unnoticed until now.
2016-05-08 15:10:09 +02:00
Daniele Alessandri 1f1c9cf1a4 Run php-cs-fixer. 2016-05-08 14:54:29 +02:00
Daniele Alessandri dae2df0ae9 Merge remote-tracking branch 'marvin255/fix_namespace_typo' into v1.0 2016-05-08 14:49:06 +02:00
postbox433@gmail.com 9338eaf573 Fix namespace typo in StreamConnection.php 2016-04-12 15:20:26 +05:00
Remi Collet f378faaf22 fix tests, list of allowed commands have changed (redis 3.0.6) 2015-12-28 10:34:24 +01:00
Alexander Cheprasov 8b150fcbf5 Update ClientInterface.php 2015-10-27 16:37:58 +00:00
Daniele Alessandri 84060b9034 Update CHANGELOG and bump VERSION.
Hotfix release targeting a severe regression on HHVM, see commit d4a7bd5.
v1.0.3
2015-07-30 20:34:15 +02:00
Daniele Alessandri d4a7bd52be Fix severe regression on HHVM.
Apparently HHVM is more strict than PHP in stream_socket_client() and does not
like at all IPv4 addresses and hostnames eclosed in square brackets. Note that
it is not that weird as square brackets are mandatory only when IPv6 addresses
are embedded in URI strings, so it is more like a weird incompatiblity of HHVM
with the behaviour of the standard PHP interpreter. The connect() attempt fails
but not due to the server being unavailable or some connectivity issue.

The important lesson is: never rely on undocumented behaviours especially when
targeting different runtimes, and do not forget to run the test suite on every
platform right before release like I unfortunately did.

This commit fixes #269.
2015-07-30 20:23:45 +02:00
Daniele Alessandri 16a9d4e041 Back to development.
[ci skip]
2015-07-30 19:41:27 +02:00
Daniele Alessandri 0b92e8d156 Update CHANGELOG and bump VERSION. v1.0.2 2015-07-30 11:20:39 +02:00
Daniele Alessandri 1f7b534072 Preserve remainder of path in URI after database (redis scheme). 2015-07-30 11:13:42 +02:00
Daniele Alessandri 0c0cbbafff Use PHP_VERSION_ID constant. 2015-07-30 10:56:54 +02:00