Commit Graph

728 Commits

Author SHA1 Message Date
Mark Paluch
8cb0dd339a DATAREDIS-759 - Fix line endings to LF. 2018-01-24 13:04:40 +01:00
Mark Paluch
c20d9ca742 DATAREDIS-756 - Order results of partitioned multi-key commands by positional keys.
We now order and assemble results of multi-key commands (e.g. MGET with cross-slot keys) that are executed on different nodes by positional keys to retain duplicate keys in the requested order and retain the server response.

Previously duplicate keys were treated as set of keys and the response didn't match the requested keys.

Original Pull Request: #303
2018-01-23 09:47:25 +01:00
Christoph Strobl
e148e1439d DATAREDIS-714 - Polishing.
Add unit tests.

Original Pull Request: #291
2018-01-12 10:01:13 +01:00
Mark Paluch
aa4d784df0 DATAREDIS-714 - Use Jedis API for database selection.
We now rely more on Jedis to select the appropriate Redis database and we no longer select the database when opening/closing a connection. Previously, we always reset the database if a database index greater zero was configured.
A properly configured Jedis pool ensures that the appropriate database is selected even if the database was selected during connection interaction.

Relying on Jedis reduces the number of issued SELECT commands and improves that way overall performance when executing commands via the Template API.

Original Pull Request: #291
2018-01-12 10:00:12 +01:00
Christoph Strobl
d8ec35f48b DATAREDIS-744 - Polishing
Move binary lookup methods to ByteUtils, update license headers and restore altered tests by creating additional ones.

Original Pull Request: #298
2018-01-12 07:50:53 +01:00
Mark Paluch
5de73903c1 DATAREDIS-744 - Support Redis hashes with colon in their id.
We now support Redis hashes via Repository support that contain colon in their id. We're using colons to split a composite id string into keyspace and id parts. Previously, we partially rejected processing of id's that don't exactly match the number of parts delimited by colon. This caused leftovers in secondary indexes.

Original Pull Request: #298
2018-01-12 07:50:21 +01:00
Christoph Strobl
323cb32861 DATAREDIS-605 - Polishing
Some minor code and documentation changes. More interestingly obtain the RedisConverter instead of the KeyValueAdapter for IndexResolver resolution in  QueryByExampleRedisExecutor and stick to findOne contract by throwing IncorrectResultSizeDataAccessException for queries returning non unique results.

Original Pull Request: #301
2018-01-10 15:01:26 +01:00
Mark Paluch
a3f876f926 DATAREDIS-605 - Query by Example for Redis Repositories.
We now support query by example via Redis repositories. We allow case-sensitive, exact matching of singular simple and nested properties, using any/all match modes, value transformation of the criteria value for indexed properties.

We do not support findAll with sorting, case-insensitive properties or string matchers other than exact.

interface PersonRepository extends QueryByExampleExecutor<Person> {
}

class PersonService {

  @Autowired PersonRepository personRepository;

  List<Person> findPeople(Person probe) {
    return personRepository.findAll(Example.of(probe));
  }
}

Original Pull Request: #301
2018-01-10 15:00:23 +01:00
Mark Paluch
2be6a3b3f7 DATAREDIS-751 - Update copyright years to 2018. 2018-01-08 16:39:32 +01:00
Christoph Strobl
fe2bacda92 DATAREDIS-580 - Polishing.
Fix tests not closing connections properly. Remove usage of Optional in constructors, avoid recreating DirectFieldAccessor on every getConnection call and update documentation.

Original Pull Request: #287
2017-11-21 14:37:39 +01:00
Mark Paluch
b414fdf6f1 DATAREDIS-580 - Support Master/Slave connections with ReadFrom settings using Lettuce.
We now allow configuration of ReadFrom settings using the Lettuce driver to enable slave reads. If ReadFrom is configured, we opt-in to Master/Slave connections instead of plain connections. Master/Slave connections route commands to the configured type of node depending on whether the command is a read or write command.

LettuceClientConfiguration configuration = LettuceClientConfiguration.builder().readFrom(ReadFrom.SLAVE).build();

ReadFrom is available for:

* Static Master/Slave Redis without Redis Sentinel
* Sentinel-Managed Master/Slave Redis
* Redis Cluster

ReadFrom is not configured for Pub/Sub connections or connections to the actual Sentinel servers.

Original Pull Request: #287
2017-11-21 14:36:46 +01:00
Mark Paluch
9775734f6f DATAREDIS-693 - Polishing.
Add Template methods for unlink(…). Align unlink with del/mDel methods on reactive API using concatMap to retain order and provide batching/streaming. Reword Javadoc. Extend tests.

Replace blocking calls with StepVerifier in LettuceReactiveKeyCommandsTests.

Original pull request: #294.
2017-11-20 13:37:39 +01:00
Christoph Strobl
c11b8d89ea DATAREDIS-693 - Add support for UNLINK.
We now support UNLINK for both Jedis & Lettuce throughout the single node and cluster connection. Reactive support is only available for Lettuce.

Original pull request: #294.
2017-11-20 13:23:36 +01:00
Christoph Strobl
3ec25eebb8 DATAREDIS-682 - Polishing.
Enforce nullability constraints and update documentation.

Original Pull Request: #286
2017-11-17 17:26:07 +01:00
Mark Paluch
d08ab93421 DATAREDIS-682 - Connect to Redis using unix domain sockets.
We now support Redis connections using OS-native transports through unix domain sockets when using the Lettuce driver. Domain sockets do not require a roundtrip through the networking layer but directly use native epoll or kqueue interfaces.

LettuceConnectionFactory factory = new LettuceConnectionFactory(new RedisSocketConfiguration("/var/run/redis.sock"));

Unix domain socket support requires netty's native epoll/kqueue dependencies matching the runtime environment:

<dependency>
	<groupId>io.netty</groupId>
	<artifactId>netty-transport-native-epoll</artifactId>
	<classifier>linux-x86_64</classifier>
	<version>${netty}</version>
</dependency>

<dependency>
	<groupId>io.netty</groupId>
	<artifactId>netty-transport-native-kqueue</artifactId>
	<classifier>osx-x86_64</classifier>
	<version>${netty}</version>
</dependency>

Original Pull Request: #286
2017-11-17 17:13:41 +01:00
Mark Paluch
1a6f51a7f9 DATAREDIS-728 - Polishing.
Add tests. Add author tag.

Original pull request: #293.
2017-11-16 12:39:37 +01:00
Mark Paluch
941b448072 DATAREDIS-694 - Polishing.
Adapt Lettuce implementation to use async commands in transaction mode. Adapt tests to changed behavior of returning status responses. Extend Javadoc.

Original pull request: #284.
2017-11-02 13:14:44 +01:00
Christoph Strobl
8a640a29b6 DATAREDIS-694 - Add support for TOUCH.
We now support TOUCH for both Lettuce and Jedis in imperative and reactive (Lettuce only) KeyCommands.

Original pull request: #284.
2017-11-02 13:14:28 +01:00
Mark Paluch
ca5f9ee2d6 DATAREDIS-720 - Reuse shared connection across reactive connection wrappers.
We now reuse a shared Lettuce connection across our reactive connection wrappers if LettuceConnectionFactory is configured to provide a shared connection instance. Reactive connections can either operate with a shared connection or with a connection provider only.

We also now execute blocking Redis commands (BLPOP, BRPOP, BRPOPLPUSH) on dedicated connection.

Original Pull Request: #290
2017-10-24 15:10:48 +02:00
Christoph Strobl
435ace8f55 DATAREDIS-719 - Rework FutureResult and implementations for Jedis/Lettuce.
We now encapsulate deferred results for pipelining and transactions entirely within FutureResult and its subtypes. FutureResult accepts a Supplier<T> for default values, if operations return null and reports whether its result requires conversion. JedisResult and LettuceResult are now top-level classes and no longer inner classes of their connection factories.

Original pull request: #289.
2017-10-23 13:38:12 +02:00
Christoph Strobl
6ea78c77dd DATAREDIS-643 - Polishing.
Update Javadoc and remove trailing whitespaces.

Original Pull Request: #288
2017-10-20 10:25:30 +02:00
Mark Paluch
0396923d50 DATAREDIS-643 - Provide ReactiveStringRedisTemplate.
Provide a String-focused convenience class for simpler bootstrapping and to provide a dedicated bean type for the application context when using auto-configuration.

Original Pull Request: #288
2017-10-20 10:25:09 +02:00
Christoph Strobl
4d41beff31 DATAREDIS-713 - Polishing.
Added static methods for common serializers (string, json, java) to RedisSerializer.

Original Pull Request: #288
2017-10-20 10:12:59 +02:00
Mark Paluch
841d8ef447 DATAREDIS-713 - Introduce constants for commonly used StringSerializers.
We now provide constant StringSerializers for US-ASCII, ISO 8859-1 and UTF-8 encoding.

Original Pull Request: #288
2017-10-20 10:08:14 +02:00
Christoph Strobl
1e2a0f858f DATAREDIS-576 - Polishing.
Update Javadoc, apply missing @Nullable annotations, add tests and alter makefile to use Redis 4.0.2.

Original Pull Request: #285
2017-10-19 10:31:46 +02:00
Mark Paluch
5059887a76 DATAREDIS-576 - Support client name for Redis connections using Lettuce.
We now allow configuration of the client name that is applied to connections using the Lettuce driver.

LettuceClientConfiguration configuration = LettuceClientConfiguration.builder().clientName("foo-bar").build();
LettuceConnectionFactory factory = new LettuceConnectionFactory(new RedisStandaloneConfiguration(), configuration);

Fixed some typos, javadoc and method visibility along the way.

Original Pull Request: #285
2017-10-19 10:22:15 +02:00
Mark Paluch
0cfd473cd4 DATAREDIS-529 - Polishing.
Accept varargs byte arrays instead of Collection of byte arrays. Bypass own routing for exists single-slot execution in Redis Cluster. Replace parallel stream execution of exists(…) with sequential ClusterCommandExecutor dispatch.

Reorder methods in ClusterConnectionTests by name. Adapt Javadoc.

Original pull request: #281.
2017-10-11 11:47:20 +02:00
Christoph Strobl
c843269804 DATAREDIS-529 - Add support for EXISTS taking multiple keys.
Original pull request: #281.
2017-10-11 11:38:52 +02:00
Christoph Strobl
143c452313 DATAREDIS-711 - Polishing.
Retain publisher sequence by using concatMap, remove trailing whitespace, flush script cache in tests.

Original Pull Request: #282
2017-10-11 11:09:32 +02:00
Mark Paluch
a99a738314 DATAREDIS-711 - Polishing.
Strengthen non-null requirements when obtaining the native connection from LettuceReactiveRedisConnection. Guard close against multiple calls and use concatMap instead of flatMap to retain publisher sequence.

Original Pull Request: #282
2017-10-11 11:08:41 +02:00
Mark Paluch
ebc0c5e0b4 DATAREDIS-711 - Emit Lua array responses as List.
We now emit array responses from Lua script execution as complete List instead of emitting the individual elements through the Publisher.

Lua scripts may return nil (null) elements that would be not emitted through a Publisher. Skipping null values would garble up the response – and in several cases, the response array is required as List. Emitting the whole List aligns the response to the signatures imposed by generics and aligns the behavior with the imperative API.

Original Pull Request: #282
2017-10-11 11:07:52 +02:00
Mark Paluch
8adea79e67 DATAREDIS-698 - Polishing.
Eagerly initialize known commands. Preallocate Jedis response builder. Replace list concatenation with array copy. Reject null arguments in execute(). Remove inversion through collections with direct byte array creation. Reorder arguments in signatures, visibility modifiers, Javadoc.

Original pull request: #283.
2017-10-10 11:13:19 +02:00
Christoph Strobl
f6a17fb268 DATAREDIS-698 - Add support for HSTRLEN.
We now support HSTRLEN command throug RedisHashCommands for Lettuce and Jedis in both an imperative and reactive manner.

However, Jedis not natively supporting HSTRLEN via its API we’ve come up with some more reflective invocation allowing to execute commands currently not known by Jedis. We also added this behavior to the cluster implementation which as of now also supports RedisClusterConnection#execute.

Original pull request: #283.
2017-10-10 11:06:19 +02:00
Mark Paluch
30e531dc6e DATAREDIS-705 - Polishing.
Change return type for mset from void to Boolean. Add missing Nullable annotations. Add Javadoc.

Disable flakey tests for now.

Related pull request: #279.
2017-10-02 10:14:04 +02:00
Christoph Strobl
d002445d98 DATAREDIS-705 - Change return type for set commands from void to Boolean.
Related pull request: #279.
2017-10-02 10:03:25 +02:00
Mark Paluch
f5c9e75d97 DATAREDIS-603 - Fall back to RedisSystemException for non translateable exceptions during cluster execution.
We now use a fallback exception translation strategy in JedisClusterConnection to map all non-mapped exceptions to RedisSystemException. This change prevents null pointer exceptions caused by potentially throwing null.

Original Pull Request: #275
2017-10-02 09:28:47 +02:00
Mark Paluch
6cc383b10a DATAREDIS-692 - Polishing.
Add NonNullFields to packages. Add missing Nullable annotations. Extend Javadoc. Replace simple equals/hashCode methods using Lomboks EqualsAndHashCode annotation. Use RequiredArgsConstructor for private classes in favor of own constructors. Replace null-checks with qualified access whether objects are empty/applicable. Rearrange methods according to interface ordering.

Remove demo code from KeyspaceConfiguration.

Original pull request: #277.
2017-09-21 08:16:43 +02:00
Christoph Strobl
1b2e74c82f DATAREDIS-692 - Introduce usage of nullable annotations for API validation.
Mark all packages with Spring Frameworks @NonNullApi. Add Spring's @Nullable to methods, parameters and fields that take or produce null values. Adapted using code to make sure the IDE can evaluate the null flow properly. Fix Javadoc in places where an invalid null handling policy was advertised. Strengthened null requirements for types that expose null-instances.

Resolve some of the inherited null invariants, align Converters to null contract.

Original pull request: #277.
2017-09-21 08:14:37 +02:00
Mark Paluch
ddb5ca7c28 DATAREDIS-700 - Polishing.
Fix line endings.
2017-09-18 15:29:50 +02:00
Mark Paluch
15535cb48a DATAREDIS-700 - Upgrade to OpenWebBeans 2.0.1. 2017-09-18 15:29:34 +02:00
Christoph Strobl
39c67515d3 DATAREDIS-688 - Polishing.
Remove whitespaces and add issue references.

Original Pull Request: #276
2017-09-08 14:53:58 +02:00
Mark Paluch
e3b41ffd5d DATAREDIS-688 - Polishing.
Adjust formatting for delete and sort test methods.

Original Pull Request: #276
2017-09-08 14:53:29 +02:00
Mark Paluch
1e96b8efa9 DATAREDIS-688 - Return delete result via RedisOperations.delete(…).
We now return the deletion count for multi-key deletes and whether a single key was deleted for RedisOperations.delete(…).

Original Pull Request: #276
2017-09-08 14:52:35 +02:00
Mark Paluch
0dfeb365c9 DATAREDIS-681 - Fix spelling in MultiNodeResult and ResultByReferenceKeyPositionComparator.
Fix type and method names.

Original Pull Request: #267
2017-09-08 14:08:58 +02:00
Christoph Strobl
575296be9d DATAREDIS-614 - Polishing.
Remove whitespaces and update tests to use non deprecated API.

Original Pull Request: #274
2017-09-08 10:25:46 +02:00
Mark Paluch
3ea6083c93 DATAREDIS-614 - Rename GeoOperations methods to better names.
We removed the geo prefix from the imperative and reactive GeoOperations interfaces and our methods to match a more expressive scheme:

geoAdd(…) -> add(…)
geoDist(…) -> distance(…)
geoHash(…) -> hash(…)
geoPos(…) -> position(…)
geoRadius(…) -> radius(…)
geoRadiusByMember(…) -> radius(…)
geoRemove(…) -> remove(…)

Methods on the imperative API remain as deprecated default methods to retain compatibility and not enforce changes in the client code.

Original Pull Request: #274
2017-09-08 10:25:15 +02:00
Mark Paluch
b1aef2717e DATAREDIS-684 - Release Jedis cluster node connections with close().
We now release Jedis cluster node connections with Jedis.close() to the pool instead of Pool.returnResource(…). The close() method itself checks whether the connection was broken and if so, the connection gets destroyed. Destroying broken connections prevents the pool from supplying broken connections on borrow when testOnBorrow is disabled.

The only case where we return broken resources ourselves to the Pool is when we discover a broken connection ourselves: If we run into a NullPointerException or RedisConnectionFailureException, then we consider a connection is broken.

Original Pull Request: #271
2017-09-07 14:11:19 +02:00
Christoph Strobl
f5ffa33f7e DATAREDIS-667 - Polishing.
Remove builder interfaces and aim for classes instead.
Also use delegation for builders avoiding constructors with too many arguments.
Alter ConnectionProvider#getConnection(Class) to return a typed connection as this is is the expected return type given the input parameters used.
Remove LettuceConnectionProvider.getConnection() method as it makes no longer sense for the non-lambda enabled interface. Remove unnecessary casts.
Add connection factory to cleanup-tracker on test class instantiation instead within the parameter supplier method to prevent shutdown by other cleanup calls that may happen in between. Reuse client resources.

Original Pull Request: #262
2017-09-07 13:31:50 +02:00
Mark Paluch
d731dfcf81 DATAREDIS-667 - Align Lettuce connection-pooling with LettuceClientConfiguration.
We now support Lettuce connection pooling by configuring a specialized client configuration via LettucePoolingClientConfiguration.builder(). Pooling settings can be configured through the builder and used with LettuceConnectionFactory.

Connection pooling is supported with Standalone and Sentinel-managed connections.

LettucePoolingClientConfiguration.builder()
   .poolConfig(poolConfig)
   .and() // allows configuration of further settings.

Original Pull Request: #262
2017-09-07 13:20:34 +02:00
Mark Paluch
5ac7f8eb19 DATAREDIS-667 - Introduce LettuceConnectionProvider.
We now create and release Lettuce connections using LettuceConnectionProvider. Connection providers encapsulate the underlying client and expose only creation and release methods. A connection provider can provide connections for Standalone or Cluster connections or wrap a LettucePool.

Previously we used RedisClient and RedisClusterClient directly which required context propagation (pooling/non-pooling) conditional code to obtain the appropriate connection type.

Original Pull Request: #262
2017-09-07 13:19:55 +02:00