diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 81898c72da..15dd2ac0eb 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -3,17 +3,16 @@ Lettuce 6.1.0 RELEASE NOTES The Lettuce team is delighted to announce general availability of Lettuce 6.1. -This is a massive release thanks to all the community contributions. This release ships mostly with command updates to support Redis 6.2. - +This is a massive release thanks to all the community contributions. Most notable changes that ship with this release are: -* Support for Redis 6.2 commands and command changes +* Support for Redis 6.2 commands and modifier/argument updates * Micrometer integration * `CommandListeners` API to intercept Redis commands * extended Keep-Alive options * Coroutine variant of `ScanStream` * TCP NoDelay enabled by default -* Experimental support for io_uring +* Experimental support for `io_uring` * Java Flight Recorder Integration for Connection and Cluster Events Lettuce 6 supports Redis 2.6+ up to Redis 6.x. In terms of Java runtime, Lettuce requires at least Java 8 and works with Java 16. diff --git a/src/assembly/bin.xml b/src/assembly/bin.xml index 2365757bfb..fd21720a45 100644 --- a/src/assembly/bin.xml +++ b/src/assembly/bin.xml @@ -26,6 +26,7 @@ org.apache.commons:* org.latencyutils:* org.hdrhistogram:* + io.micrometer:* dependencies false diff --git a/src/main/asciidoc/new-features.adoc b/src/main/asciidoc/new-features.adoc index d555a160c4..dd27c44542 100644 --- a/src/main/asciidoc/new-features.adoc +++ b/src/main/asciidoc/new-features.adoc @@ -12,7 +12,7 @@ * Configuration of netty's `AddressResolverGroup` through `ClientResources`. Uses `DnsAddressResolverGroup` when `netty-resolver-dns` is on the classpath. * Add support for Redis ACL commands. -* Java Flight Recorder Events +* <> [[new-features.6-0-0]] == What's new in Lettuce 6.0 diff --git a/src/main/java/io/lettuce/core/GetExArgs.java b/src/main/java/io/lettuce/core/GetExArgs.java index 88ed42d617..ac0939bc05 100644 --- a/src/main/java/io/lettuce/core/GetExArgs.java +++ b/src/main/java/io/lettuce/core/GetExArgs.java @@ -175,7 +175,7 @@ public static GetExArgs pxAt(Instant timestamp) { * Creates new {@link GetExArgs} and enable {@literal PERSIST}. * * @return new {@link GetExArgs} with {@literal PERSIST} enabled. - * @see GetExArgs#nx() + * @see GetExArgs#persist() */ public static GetExArgs persist() { return new GetExArgs().persist(); diff --git a/src/main/java/io/lettuce/core/KillArgs.java b/src/main/java/io/lettuce/core/KillArgs.java index ef6c9496fc..969d09d405 100644 --- a/src/main/java/io/lettuce/core/KillArgs.java +++ b/src/main/java/io/lettuce/core/KillArgs.java @@ -222,7 +222,7 @@ public KillArgs id(long id) { } /** - * This closes the connections of all the clients in the specified {@link Type class}. Note that clients blocked into the + * This closes the connections of all the clients in the specified {@link KillArgs.Type}. Note that clients blocked into the * {@literal MONITOR} command are considered to belong to the normal class. * * @param type must not be {@code null}. diff --git a/src/main/java/io/lettuce/core/RedisURI.java b/src/main/java/io/lettuce/core/RedisURI.java index 401143ba27..86dc5e7d71 100644 --- a/src/main/java/io/lettuce/core/RedisURI.java +++ b/src/main/java/io/lettuce/core/RedisURI.java @@ -237,7 +237,6 @@ public RedisURI() { * @param host the host * @param port the port * @param timeout timeout value - * @param timeout unit of the timeout value */ public RedisURI(String host, int port, Duration timeout) { @@ -505,7 +504,7 @@ public void setTimeout(Duration timeout) { /** * Returns the Redis database number. Databases are only available for Redis Standalone and Redis Master/Slave. * - * @return + * @return the Redis database number */ public int getDatabase() { return database; @@ -526,7 +525,7 @@ public void setDatabase(int database) { /** * Returns the client name. * - * @return + * @return the client name. * @since 4.4 */ public String getClientName() { diff --git a/src/main/java/io/lettuce/core/XAutoClaimArgs.java b/src/main/java/io/lettuce/core/XAutoClaimArgs.java index df54a2d662..303072ed4b 100644 --- a/src/main/java/io/lettuce/core/XAutoClaimArgs.java +++ b/src/main/java/io/lettuce/core/XAutoClaimArgs.java @@ -61,7 +61,7 @@ private Builder() { * @param minIdleTime * @param startId * @param - * @return + * @return new {@link XAutoClaimArgs} with {@code minIdleTime} and {@code startId} configured. */ public static XAutoClaimArgs justid(Consumer consumer, long minIdleTime, String startId) { return new XAutoClaimArgs().justid().consumer(consumer).minIdleTime(minIdleTime).startId(startId); @@ -75,7 +75,7 @@ public static XAutoClaimArgs justid(Consumer consumer, long minIdleTim * @param minIdleTime * @param startId * @param - * @return + * @return new {@link XAutoClaimArgs} with {@code minIdleTime} and {@code startId} configured. */ public static XAutoClaimArgs justid(Consumer consumer, Duration minIdleTime, String startId) { return new XAutoClaimArgs().justid().consumer(consumer).minIdleTime(minIdleTime).startId(startId); @@ -88,7 +88,7 @@ public static XAutoClaimArgs justid(Consumer consumer, Duration minIdl * @param minIdleTime * @param startId * @param - * @return + * @return new {@link XAutoClaimArgs} with {@code minIdleTime} and {@code startId} configured. */ public static XAutoClaimArgs xautoclaim(Consumer consumer, long minIdleTime, String startId) { return new XAutoClaimArgs().consumer(consumer).minIdleTime(minIdleTime).startId(startId); @@ -101,7 +101,7 @@ public static XAutoClaimArgs xautoclaim(Consumer consumer, long minIdl * @param minIdleTime * @param startId * @param - * @return + * @return new {@link XAutoClaimArgs} with {@code minIdleTime} and {@code startId} configured. */ public static XAutoClaimArgs xautoclaim(Consumer consumer, Duration minIdleTime, String startId) { return new XAutoClaimArgs().consumer(consumer).minIdleTime(minIdleTime).startId(startId); diff --git a/src/main/java/io/lettuce/core/XPendingArgs.java b/src/main/java/io/lettuce/core/XPendingArgs.java index ede414335a..a334754636 100644 --- a/src/main/java/io/lettuce/core/XPendingArgs.java +++ b/src/main/java/io/lettuce/core/XPendingArgs.java @@ -30,7 +30,7 @@ * @author dengliming * @since 6.1 */ -public class XPendingArgs { +public class XPendingArgs implements CompositeArgument { private Consumer consumer; @@ -54,9 +54,10 @@ private Builder() { /** * Create a new {@link XPendingArgs} . * - * @param consumer - * @param range - * @param limit + * @param consumer the consumer + * @param range the range of message Id's + * @param limit limit {@code COUNT} + * @return a new {@link XPendingArgs} with {@link Range} and {@link Limit} applied. */ public static XPendingArgs xpending(Consumer consumer, Range range, Limit limit) { return new XPendingArgs().consumer(consumer).range(range).limit(limit); @@ -64,6 +65,7 @@ public static XPendingArgs xpending(Consumer consumer, Range r } public XPendingArgs range(Range range) { + LettuceAssert.notNull(range, "Range must not be null"); this.range = range; @@ -71,6 +73,7 @@ public XPendingArgs range(Range range) { } public XPendingArgs consumer(Consumer consumer) { + LettuceAssert.notNull(consumer, "Consumer must not be null"); this.consumer = consumer; @@ -78,6 +81,7 @@ public XPendingArgs consumer(Consumer consumer) { } public XPendingArgs limit(Limit limit) { + LettuceAssert.notNull(limit, "Limit must not be null"); this.limit = limit; @@ -88,10 +92,12 @@ public XPendingArgs limit(Limit limit) { * Include only entries that are idle for {@link Duration}. * * @param timeout - * @return + * @return {@code this} {@link XPendingArgs}. */ public XPendingArgs idle(Duration timeout) { + LettuceAssert.notNull(timeout, "Timeout must not be null"); + return idle(timeout.toMillis()); } @@ -99,16 +105,17 @@ public XPendingArgs idle(Duration timeout) { * Include only entries that are idle for {@code milliseconds}. * * @param milliseconds - * @return + * @return {@code this} {@link XPendingArgs}. */ public XPendingArgs idle(long milliseconds) { this.idle = milliseconds; return this; } - public void build(CommandArgs args) { + @Override + public void build(CommandArgs args) { - args.addKey(consumer.group); + args.addKey((K) consumer.group); if (idle != null) { args.add(CommandKeyword.IDLE).add(idle); @@ -127,6 +134,6 @@ public void build(CommandArgs args) { } args.add(limit.isLimited() ? limit.getCount() : Long.MAX_VALUE); - args.addKey(consumer.name); + args.addKey((K) consumer.name); } } diff --git a/src/main/java/io/lettuce/core/api/async/RedisGeoAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisGeoAsyncCommands.java index 070a235de6..73267a9e1b 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisGeoAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisGeoAsyncCommands.java @@ -74,7 +74,7 @@ public interface RedisGeoAsyncCommands { * Multi geo add. * * @param key the key of the geo set. - * @param lngLatMember triplets of double longitude, double latitude and V member. + * @param values {@link io.lettuce.core.GeoValue} values to add. * @return Long integer-reply the number of elements that were added to the set. * @since 6.1 */ @@ -85,7 +85,7 @@ public interface RedisGeoAsyncCommands { * * @param key the key of the geo set. * @param args additional arguments. - * @param values {@link io.lettuce.core.GeoValue} values to add. + * @param lngLatMember triplets of double longitude, double latitude and V member. * @return Long integer-reply the number of elements that were added to the set. * @since 6.1 */ diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisGeoReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisGeoReactiveCommands.java index f13be3828d..179b011539 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisGeoReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisGeoReactiveCommands.java @@ -72,7 +72,7 @@ public interface RedisGeoReactiveCommands { * Multi geo add. * * @param key the key of the geo set. - * @param lngLatMember triplets of double longitude, double latitude and V member. + * @param values {@link io.lettuce.core.GeoValue} values to add. * @return Long integer-reply the number of elements that were added to the set. * @since 6.1 */ @@ -83,7 +83,7 @@ public interface RedisGeoReactiveCommands { * * @param key the key of the geo set. * @param args additional arguments. - * @param values {@link io.lettuce.core.GeoValue} values to add. + * @param lngLatMember triplets of double longitude, double latitude and V member. * @return Long integer-reply the number of elements that were added to the set. * @since 6.1 */ diff --git a/src/main/java/io/lettuce/core/api/sync/RedisGeoCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisGeoCommands.java index f565f58c04..9cc4c38cde 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisGeoCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisGeoCommands.java @@ -73,7 +73,7 @@ public interface RedisGeoCommands { * Multi geo add. * * @param key the key of the geo set. - * @param lngLatMember triplets of double longitude, double latitude and V member. + * @param values {@link io.lettuce.core.GeoValue} values to add. * @return Long integer-reply the number of elements that were added to the set. * @since 6.1 */ @@ -84,7 +84,7 @@ public interface RedisGeoCommands { * * @param key the key of the geo set. * @param args additional arguments. - * @param values {@link io.lettuce.core.GeoValue} values to add. + * @param lngLatMember triplets of double longitude, double latitude and V member. * @return Long integer-reply the number of elements that were added to the set. * @since 6.1 */ diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionGeoAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionGeoAsyncCommands.java index 175ddadbaf..bb0ee2cda7 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionGeoAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionGeoAsyncCommands.java @@ -73,7 +73,7 @@ public interface NodeSelectionGeoAsyncCommands { * Multi geo add. * * @param key the key of the geo set. - * @param lngLatMember triplets of double longitude, double latitude and V member. + * @param values {@link io.lettuce.core.GeoValue} values to add. * @return Long integer-reply the number of elements that were added to the set. * @since 6.1 */ @@ -84,7 +84,7 @@ public interface NodeSelectionGeoAsyncCommands { * * @param key the key of the geo set. * @param args additional arguments. - * @param values {@link io.lettuce.core.GeoValue} values to add. + * @param lngLatMember triplets of double longitude, double latitude and V member. * @return Long integer-reply the number of elements that were added to the set. * @since 6.1 */ diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionGeoCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionGeoCommands.java index feba48d3ae..948396fb7e 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionGeoCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionGeoCommands.java @@ -73,7 +73,7 @@ public interface NodeSelectionGeoCommands { * Multi geo add. * * @param key the key of the geo set. - * @param lngLatMember triplets of double longitude, double latitude and V member. + * @param values {@link io.lettuce.core.GeoValue} values to add. * @return Long integer-reply the number of elements that were added to the set. * @since 6.1 */ @@ -84,7 +84,7 @@ public interface NodeSelectionGeoCommands { * * @param key the key of the geo set. * @param args additional arguments. - * @param values {@link io.lettuce.core.GeoValue} values to add. + * @param lngLatMember triplets of double longitude, double latitude and V member. * @return Long integer-reply the number of elements that were added to the set. * @since 6.1 */ diff --git a/src/main/java/io/lettuce/core/cluster/models/partitions/RedisClusterNode.java b/src/main/java/io/lettuce/core/cluster/models/partitions/RedisClusterNode.java index 32080f077b..5fa64dbafb 100644 --- a/src/main/java/io/lettuce/core/cluster/models/partitions/RedisClusterNode.java +++ b/src/main/java/io/lettuce/core/cluster/models/partitions/RedisClusterNode.java @@ -16,12 +16,18 @@ package io.lettuce.core.cluster.models.partitions; import java.io.Serializable; -import java.util.*; +import java.util.ArrayList; +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumSet; +import java.util.List; +import java.util.Set; import java.util.function.IntConsumer; import io.lettuce.core.RedisURI; import io.lettuce.core.cluster.SlotHash; import io.lettuce.core.internal.LettuceAssert; +import io.lettuce.core.models.role.RedisInstance; import io.lettuce.core.models.role.RedisNodeDescription; /** @@ -393,7 +399,7 @@ public boolean hasSlot(int slot) { } /** - * Returns the {@link Role} of the Redis Cluster node based on the {@link #getFlags() flags}. + * Returns the {@link RedisInstance.Role} of the Redis Cluster node based on the {@link #getFlags() flags}. * * @return the Redis Cluster node role */ diff --git a/src/main/java/io/lettuce/core/cluster/topology/ClusterTopologyRefresh.java b/src/main/java/io/lettuce/core/cluster/topology/ClusterTopologyRefresh.java index a05edaa9dd..e29c9a2a27 100644 --- a/src/main/java/io/lettuce/core/cluster/topology/ClusterTopologyRefresh.java +++ b/src/main/java/io/lettuce/core/cluster/topology/ClusterTopologyRefresh.java @@ -34,9 +34,9 @@ public interface ClusterTopologyRefresh { /** * Create a new {@link ClusterTopologyRefresh} instance. * - * @param nodeConnectionFactory - * @param clientResources - * @return + * @param nodeConnectionFactory the connection factory to open connections to specific cluster nodes + * @param clientResources shared client resources + * @return a new {@link ClusterTopologyRefresh} instance. */ static ClusterTopologyRefresh create(NodeConnectionFactory nodeConnectionFactory, ClientResources clientResources) { return new DefaultClusterTopologyRefresh(nodeConnectionFactory, clientResources); diff --git a/src/main/java/io/lettuce/core/cluster/topology/DefaultClusterTopologyRefresh.java b/src/main/java/io/lettuce/core/cluster/topology/DefaultClusterTopologyRefresh.java index d741268586..4b7ff01be9 100644 --- a/src/main/java/io/lettuce/core/cluster/topology/DefaultClusterTopologyRefresh.java +++ b/src/main/java/io/lettuce/core/cluster/topology/DefaultClusterTopologyRefresh.java @@ -18,8 +18,21 @@ import java.io.IOException; import java.net.SocketAddress; import java.time.Duration; -import java.util.*; -import java.util.concurrent.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.StringJoiner; +import java.util.TreeSet; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; import java.util.stream.Collectors; @@ -73,6 +86,7 @@ public DefaultClusterTopologyRefresh(NodeConnectionFactory nodeConnectionFactory * @param discovery {@code true} to discover additional nodes * @return mapping between {@link RedisURI} and {@link Partitions} */ + @Override public CompletionStage> loadViews(Iterable seed, Duration connectTimeout, boolean discovery) { diff --git a/src/main/java/io/lettuce/core/metrics/CommandLatencyRecorder.java b/src/main/java/io/lettuce/core/metrics/CommandLatencyRecorder.java index 89b8631246..f17a2b823b 100644 --- a/src/main/java/io/lettuce/core/metrics/CommandLatencyRecorder.java +++ b/src/main/java/io/lettuce/core/metrics/CommandLatencyRecorder.java @@ -33,7 +33,7 @@ public interface CommandLatencyRecorder { /** * Returns a disabled no-op {@link CommandLatencyRecorder}. * - * @return + * @return a disabled {@link CommandLatencyRecorder}. */ static CommandLatencyRecorder disabled() { diff --git a/src/main/java/io/lettuce/core/metrics/DefaultCommandLatencyCollector.java b/src/main/java/io/lettuce/core/metrics/DefaultCommandLatencyCollector.java index d374149545..deff7fa4d9 100644 --- a/src/main/java/io/lettuce/core/metrics/DefaultCommandLatencyCollector.java +++ b/src/main/java/io/lettuce/core/metrics/DefaultCommandLatencyCollector.java @@ -89,6 +89,7 @@ public DefaultCommandLatencyCollector(CommandLatencyCollectorOptions options) { * @param firstResponseLatency latency value in {@link TimeUnit#NANOSECONDS} from send to the first response * @param completionLatency latency value in {@link TimeUnit#NANOSECONDS} from send to the command completion */ + @Override public void recordCommandLatency(SocketAddress local, SocketAddress remote, ProtocolKeyword commandType, long firstResponseLatency, long completionLatency) { diff --git a/src/main/java/io/lettuce/core/tracing/Tracer.java b/src/main/java/io/lettuce/core/tracing/Tracer.java index 1019ea724e..4b044eeb49 100644 --- a/src/main/java/io/lettuce/core/tracing/Tracer.java +++ b/src/main/java/io/lettuce/core/tracing/Tracer.java @@ -83,7 +83,7 @@ public abstract static class Span { * Associate an {@link Throwable error} with this {@link Span}. * * @param throwable must not be {@code null}. - * @return + * @return {@literal this} {@link Span}. */ public abstract Span error(Throwable throwable); @@ -91,7 +91,7 @@ public abstract static class Span { * Associates an {@link Tracing.Endpoint} with this {@link Span}. * * @param endpoint must not be {@code null}. - * @return + * @return {@literal this} {@link Span}. */ public abstract Span remoteEndpoint(Tracing.Endpoint endpoint); diff --git a/src/main/kotlin/io/lettuce/core/api/coroutines/RedisGeoCoroutinesCommands.kt b/src/main/kotlin/io/lettuce/core/api/coroutines/RedisGeoCoroutinesCommands.kt index 70f0d038a8..968f468d01 100644 --- a/src/main/kotlin/io/lettuce/core/api/coroutines/RedisGeoCoroutinesCommands.kt +++ b/src/main/kotlin/io/lettuce/core/api/coroutines/RedisGeoCoroutinesCommands.kt @@ -72,7 +72,7 @@ interface RedisGeoCoroutinesCommands { * Multi geo add. * * @param key the key of the geo set. - * @param lngLatMember triplets of Double longitude, Double latitude and V member. + * @param values @link io.lettuce.core.GeoValue} values to add. * @return Long integer-reply the number of elements that were added to the set. * @since 6.1 */ @@ -83,7 +83,7 @@ interface RedisGeoCoroutinesCommands { * * @param key the key of the geo set. * @param args additional arguments. - * @param values @link io.lettuce.core.GeoValue} values to add. + * @param lngLatMember triplets of Double longitude, Double latitude and V member. * @return Long integer-reply the number of elements that were added to the set. * @since 6.1 */ diff --git a/src/main/templates/io/lettuce/core/api/RedisGeoCommands.java b/src/main/templates/io/lettuce/core/api/RedisGeoCommands.java index ed96b065a3..5e3e6383c5 100644 --- a/src/main/templates/io/lettuce/core/api/RedisGeoCommands.java +++ b/src/main/templates/io/lettuce/core/api/RedisGeoCommands.java @@ -64,7 +64,7 @@ public interface RedisGeoCommands { * Multi geo add. * * @param key the key of the geo set. - * @param lngLatMember triplets of double longitude, double latitude and V member. + * @param values {@link io.lettuce.core.GeoValue} values to add. * @return Long integer-reply the number of elements that were added to the set. * @since 6.1 */ @@ -75,7 +75,7 @@ public interface RedisGeoCommands { * * @param key the key of the geo set. * @param args additional arguments. - * @param values {@link io.lettuce.core.GeoValue} values to add. + * @param lngLatMember triplets of double longitude, double latitude and V member. * @return Long integer-reply the number of elements that were added to the set. * @since 6.1 */