Commit Graph

579 Commits

Author SHA1 Message Date
Jonathan Leibiusky
01842e4731 Merge branch 'fix-eval-argument-in-binary-jedis' of github.com:HeartSaVioR/jedis into HeartSaVioR-fix-eval-argument-in-binary-jedis 2014-01-18 11:39:31 -05:00
Marcos Nils
37f629765e Improve performance in MOVED and ASK response parsing 2014-01-17 12:06:20 -03:00
Darren Shepherd
f11c1622de Allow safe multi-threaded access to JedisPubSub
If Thread A calls a subscribe method on Jedis it will block on a socket read
call waiting for messages or subscription notifications.  Thread B is now free
to call additional methods on JedisPubSub to change the current subscriptions
that thread A is waiting for.  Essentially Thread A will do reads on the
socket and Thread B will do writes.

An issue occurs in that while Thread A is doing reads, in the
getObjectMultiBulkReply() method there is an implicit flush() call.  This
means both Thread A and Thread B may do a write to the socket.  Under this
situation if Thread A does a flush while Thread B is writing the internal
buffer will be corrupted.  The fix is to make thread A never call flush().
This allows Thread A to be solely reads and Thread B to be solely writes.

Additionally since Thread B is sending commands, the internal pipeline count
is incremented and never decremented.  So when Thread A terminates it's read
it resets the pipeline count.
2014-01-16 23:48:08 -07:00
Jonathan Leibiusky
23b54c2cef Fix sentinel test not to be so sensitive to time 2014-01-16 20:37:47 -05:00
Jonathan Leibiusky
842dcd2a95 Merge branch 'cluster' of github.com:marcosnils/jedis into marcosnils-cluster
Conflicts:
	src/main/java/redis/clients/jedis/BinaryClient.java
	src/main/java/redis/clients/jedis/Client.java
	src/main/java/redis/clients/jedis/Jedis.java
	src/main/java/redis/clients/jedis/Protocol.java
2014-01-16 16:35:04 -05:00
Marcos Nils
6c8d7a5045 Add fail in case test doesn't throw any exception 2014-01-16 18:14:55 -03:00
Marcos Nils
46733c5d5a Add test for redis cluster max redirections and refactor JedisClusterCommand exception handling 2014-01-16 18:04:27 -03:00
Marcos Nils
2f9564e1d3 Variable refactor in JedisClusterTest 2014-01-14 21:20:33 -03:00
Marcos Nils
ccf93714e6 Fix ClusterCommand tearDown as gossip may take some time to send data to nodes 2014-01-14 17:58:21 -03:00
Marcos Nils
a09a682f09 Remove sysout prints from test 2014-01-14 16:00:22 -03:00
Marcos Nils
4ab8ea2ef7 Move Jedis CRC16 util as it's being used in the project.
Changed Makefile to cleanup redis cluster node configuration before running tests
Add cleanup to ClusterCommandTest.
2014-01-14 15:57:53 -03:00
Marcos Nils
33716e237c Add JedisClusterException file 2014-01-03 16:45:22 -03:00
Marcos Nils
dd0bbdaf91 Several changes have been added to this commit:
- Add asking to cluster commands
- Make jedis cluster return connection to original pool
- Add tests for MOVED and ASK cluster responses
- Refactor connection handler to recalculate connections based on slots

This commit makes the first usable version of Jedis along with Redis Cluster
2014-01-03 16:42:21 -03:00
Marcos Nils
1b26815799 Add functionality to recalculate slots when receiving MOVED response from node.
Add test to check for ASK responses (implementation missing)
2014-01-02 20:52:17 -03:00
Marcos Nils
b2d22e2060 Add slot based connection which routes requests according to key slot 2013-12-28 00:59:35 -03:00
Marcos Nils
9f767a0848 Add automatic discovery of cluster nodes 2013-12-27 23:09:44 -03:00
Jungtaek Lim
53b3e041f3 Fix BinaryJedis.eval() method bug (argument)
* append unit test for BinaryJedis
2013-12-23 14:19:28 +09:00
Marcos Nils
af72248c22 Implement all Jedis cluster commands and rename RedisSlot class 2013-12-20 16:56:29 -03:00
Marcos Nils
0bc27ac3a2 Refactor redis cluster connection handler and add JedisAskDataException handling 2013-12-20 15:28:32 -03:00
Jungtaek Lim
3073f778b4 JedisPool / JedisSentinelPool resets returning object's state (watched,
multi)

* BinaryClient / BinaryJedis : added feature to reset its state
(watched, multi)
* JedisPool / JedisSentinelPool : calls new feature (reset state) when
Jedis object returns to pool
* Unit Test included
2013-12-21 01:33:46 +09:00
Marcos Nils
c008070045 Add JedisClusterCommand and updated code to use it respectively 2013-12-10 10:25:41 -03:00
Marcos Nils
0ebbf02c94 Change Moved cluster test and add confirmation for jedis cluster tests 2013-12-09 15:17:13 -03:00
Jungtaek Lim
10c131bbf0 BinaryJedis.multi(TransactionBlock) should not call discard when exception occurred
* In BinaryJedis.multi(TransactionBlock), multi & exec already fired before exception occured, so sending discard has no effect, and made another error
** add unit test (error inside TransactionBlock)
*** Transaction with error - Redis discards transaction automatically (execabort)
*** Transaction with error - Redis doesn't roll back (force to execute all)
2013-12-09 10:54:53 +09:00
Marcos Nils
726c3151b6 Add RedisSlot helper to calculate key slot 2013-12-08 01:08:14 -03:00
Marcos Nils
a8987ed865 Add first test to thorw MovedDataException when receiving MOVED from a cluster node 2013-12-07 17:55:17 -03:00
Jonathan Leibiusky
46734e646a add WAIT command 2013-12-05 09:35:13 -05:00
Jonathan Leibiusky
0c00108f96 Merge pull request #490 from xetorthio/speedup_tests
Speedup tests
2013-12-03 16:51:04 -08:00
Jonathan Leibiusky
8624d1695d make JedisSentinelPool fast 2013-12-03 19:47:15 -05:00
Jonathan Leibiusky
3b7127c811 make JedisTest fast 2013-12-03 19:06:53 -05:00
Jonathan Leibiusky
4a4768b1d2 speed up JedisSentinelTest 2013-12-03 19:03:19 -05:00
Jonathan Leibiusky
20d686ec94 make list command tests even faster 2013-12-03 18:43:34 -05:00
Jonathan Leibiusky
ce3497e341 make object command tests fast 2013-12-03 18:28:31 -05:00
Jonathan Leibiusky
e17d24c710 make list command tests fast 2013-12-03 18:20:49 -05:00
Jonathan Leibiusky
ceac8123d6 make control command tests fast 2013-12-03 17:54:35 -05:00
Jonathan Leibiusky
58123034f5 make pubsub test fast 2013-12-03 17:43:15 -05:00
Jonathan Leibiusky
a27c67de66 add SCAN, HSCAN, SSCAN and ZSCAN 2013-12-03 16:55:52 -05:00
Jonathan Leibiusky
efbb710343 Change string size to make test fail faster 2013-12-03 08:31:24 -05:00
Jonathan Leibiusky
fa614bd2b8 Merge branch 'handles-client-output-buffer-limit' of github.com:HeartSaVioR/jedis into HeartSaVioR-handles-client-output-buffer-limit 2013-12-03 07:41:07 -05:00
Jonathan Leibiusky
46966fb89f Prepare redis cluster for testing. The cluster will always be in a deterministic state to be able to reproduce -MOVED and -ASK 2013-12-02 19:27:12 -05:00
Jonathan Leibiusky
5b15d48803 Refactor to have interfaces.
Add cluster pipeline commands.
2013-12-02 14:34:05 -05:00
Jonathan Leibiusky
77d244b96a Add CLUSTER INFO, CLUSTER SETSLOT and CLUSTER GETKEYSINSLOT commands 2013-12-02 14:05:35 -05:00
Jonathan Leibiusky
dde278152f Add CLUSTER ADDSLOTS and CLUSTER DELSLOTS commands 2013-12-02 11:36:55 -05:00
Jonathan Leibiusky
403f2b292c Add CLUSTER MEET command 2013-12-02 10:01:19 -05:00
Jonathan Leibiusky
e7e2bfaedf Launch 3 nodes on ports 7379 to 7381 with cluster enabled.
Add command CLUSTER NODES
2013-12-02 09:53:40 -05:00
Jungtaek Lim
15891c4117 make jedis unit tests pass to Redis 2.8.1
* increase sentinel instance to test JedisSentinelTest
** clear() called, slave promoted to master (slave of no one), New
Sentinel force to restore it (demote) -> slave is not reusable
* ipv6 applied at Redis 2.8 -> localhost / 127.0.0.1 / ::1 is now all same

* Makefile: sleep some time for launch each sentinel (workaround to sentinel's issue)
** issue to sentinel leader vote: https://github.com/antirez/redis/issues/1419
*** sentinel may confused to vote with sentinels launched approximately same time
2013-12-02 22:11:52 +09:00
Jonathan Leibiusky
18652b906b Merge branch 'speed-up-unit-test' of github.com:HeartSaVioR/jedis into upgrade_libs
Conflicts:
	src/test/java/redis/clients/jedis/tests/JedisPoolTest.java
	src/test/java/redis/clients/jedis/tests/JedisSentinelPoolTest.java
	src/test/java/redis/clients/jedis/tests/JedisSentinelTest.java
	src/test/java/redis/clients/jedis/tests/ShardedJedisPipelineTest.java
	src/test/java/redis/clients/jedis/tests/ShardedJedisPoolTest.java
	src/test/java/redis/clients/jedis/tests/benchmark/PoolBenchmark.java
	src/test/java/redis/clients/jedis/tests/commands/TransactionCommandsTest.java
2013-11-29 12:12:30 -05:00
Jonathan Leibiusky
bbb867781d upgrade to commons-pool 2 2013-11-28 08:13:57 -05:00
Daniel Josefsson
4fb85d0d60 Fixed the ordering of arguments in assertions for a couple of older tests. 2013-11-08 22:54:27 +00:00
Daniel Josefsson
17f6ee63dc Added support for nested lists, and longs in lists. 2013-11-08 22:25:37 +00:00
임정택
52bb245203 * fix bug: test expects JedisConnectionException
** I have mistaken while verifying seeing Exception's message
* remove huge print messages
2013-10-16 19:42:29 +09:00