Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2940 resubscribe ignoring sshardchannels backport to 6.4.x #3025

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
dee8020
[#2341] Initialize slots with empty BitSet in RedisClusterNode's cons…
zeze1004 Jul 12, 2024
666b4d7
Support the command (#2920)
tishun Jul 29, 2024
ec1dd41
Add badges to the README.md file (#2939)
tishun Aug 7, 2024
53ba22b
Suspected change in ubuntu (#2949)
tishun Aug 8, 2024
103636c
Add support for CLIENT TRACKINGINFO (#2862)
tishun Aug 8, 2024
7164552
Bump org.jacoco:jacoco-maven-plugin from 0.8.9 to 0.8.12 (#2921)
dependabot[bot] Aug 8, 2024
cb73980
Bump org.apache.maven.plugins:maven-surefire-plugin from 3.2.5 to 3.3…
dependabot[bot] Aug 8, 2024
cce1aee
Bump org.apache.maven.plugins:maven-failsafe-plugin from 3.2.5 to 3.3…
dependabot[bot] Aug 15, 2024
9495478
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.7.0 to 3.8.…
dependabot[bot] Aug 15, 2024
c0e6993
Convert wiki to markdown docs (#2944)
uglide Aug 21, 2024
c33cea9
fix(2971): spublish typo fix (#2972)
jkrauze Aug 25, 2024
3399252
Bump org.apache.maven.plugins:maven-surefire-plugin from 3.3.1 to 3.4…
dependabot[bot] Aug 26, 2024
d3c8149
Bump org.hdrhistogram:HdrHistogram from 2.1.12 to 2.2.2 (#2966)
dependabot[bot] Aug 26, 2024
c266570
Update completeExceptionally on ClusterCommand using super (#2980)
thachlp Sep 9, 2024
bfbb85f
Bump org.apache.maven.plugins:maven-compiler-plugin (#2978)
dependabot[bot] Sep 9, 2024
bc84058
fix:deadlock when reentrant exclusive lock #2905 #2879 (#2961)
Roiocam Sep 13, 2024
cf215de
Default ClientOptions.timeoutOptions to TimeoutOptions.enabled() (#2927)
thachlp Sep 13, 2024
c05da9e
Add support clusterlinks command (#2986)
thachlp Sep 13, 2024
acc94f8
Bump org.apache.logging.log4j:log4j-bom from 2.17.2 to 2.24.0 (#2988)
dependabot[bot] Sep 16, 2024
bf5bd75
Add defensive copy for Futures allOf() method (#2943)
jinkshower Sep 16, 2024
2267bfe
Bump io.netty:netty-bom from 4.1.107.Final to 4.1.113.Final (#2990)
dependabot[bot] Sep 24, 2024
547271c
Introducing JSON to Lettuce (#2933) (#2992)
tishun Sep 25, 2024
41b2b1f
Bits and pieces to clean up (#2995)
tishun Sep 30, 2024
9185a49
add the github repo url to the doc config (#3008)
joshrotenberg Oct 10, 2024
542b6a5
Propagate database number, user, and RedisURI into Tracing (#3005)
thachlp Oct 11, 2024
d255b1a
ClassNotFoundException: com.fasterxml.jackson.core.JsonProcessingExce…
tishun Oct 11, 2024
8fc5a3f
Add support for creating regex and subnet-based ReadFrom instances fr…
nosan Oct 18, 2024
f467212
Add hasNoSlots() method to RedisClusterNode (#3015)
wmxl Oct 18, 2024
aec0887
Initialize with -1 to avoid hitting the sizing issue (#3020)
tishun Oct 18, 2024
1de2116
Improvements to the testing bits (#3012)
tishun Oct 18, 2024
459d4ea
document update regarding addressResolverGroup settings (#3007)
winguse Oct 18, 2024
3702373
fix: Lcs response parse (#2970)
jabolina Oct 18, 2024
29afe13
Add CodeCov configuration, enable test analytics (#3022) (#3023)
tishun Oct 23, 2024
f4e7242
Closes #2940 Sharded PubSub subscriptions not recovered after disconn…
ggivo Oct 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Introducing JSON to Lettuce (#2933) (#2992)
* Most of the API layer

* Add the JSON.TYPE command

* Kotlin coroutines added;
Started JSON README.md;
Parser registry is now part of the Connection;
formatting;
chained all commands;
extracted commands in their own unit RedisJsonCommandBuilder;

* Implemented 90% of commands from top 10

* All but SET are implemented

* Integrated Jackson, finished up the SET command

* Left out a few files by mistake

* Adding some JavaDoc

* Formatting

* Implemented all JSON commands

* Introducing test containers to the testing fw

* Complete coverage with integration tests, straight scenarios

* Added Pathv1 tests

* Added RedisCE cluster support for the JSON.MGET and JSON.MSET commands

* Handle null values

* No longer using K for the JSON object keys

* Polishing

* JsonType introduced to help typization

* Remove the RedisCodec from the JsonValue/JsonParser abstraction, add configuration for custom parsers

* Extend API surface with methods that reduce the amount of required arguments

* Adding unit tests, addressing changes to README.md

* Implemented object-mapping functionality

* Addresses Ali's comments

* Addressed last bunch of comments from Ali, changed ports to not colide with existing infra

* Forgot to change ports and stop debug log

* Polishing touches
  • Loading branch information
tishun authored Sep 25, 2024
commit 547271c6ee6cde742cdf873542f53c50722e65f1
23 changes: 23 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<brave.version>5.13.11</brave.version>
<commons-lang3.version>3.13.0</commons-lang3.version>
<commons-pool.version>2.12.0</commons-pool.version>
<jackson-version>2.17.0</jackson-version>
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
<javax.servlet-api.version>4.0.1</javax.servlet-api.version>
<junit5.version>5.10.2</junit5.version>
Expand Down Expand Up @@ -238,6 +239,13 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-version}</version>
<optional>true</optional>
</dependency>

<!-- OS-native transports -->

<dependency>
Expand Down Expand Up @@ -523,6 +531,21 @@
<scope>test</scope>
</dependency>

<!-- TEST CONTAINERS -->

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.20.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>1.20.1</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down
193 changes: 191 additions & 2 deletions src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
import io.lettuce.core.codec.Base16;
import io.lettuce.core.codec.RedisCodec;
import io.lettuce.core.internal.LettuceAssert;
import io.lettuce.core.json.JsonParser;
import io.lettuce.core.json.JsonType;
import io.lettuce.core.json.JsonValue;
import io.lettuce.core.json.arguments.JsonGetArgs;
import io.lettuce.core.json.arguments.JsonMsetArgs;
import io.lettuce.core.json.JsonPath;
import io.lettuce.core.json.arguments.JsonRangeArgs;
import io.lettuce.core.json.arguments.JsonSetArgs;
import io.lettuce.core.models.stream.ClaimedMessages;
import io.lettuce.core.models.stream.PendingMessage;
import io.lettuce.core.models.stream.PendingMessages;
Expand Down Expand Up @@ -71,21 +79,27 @@ public abstract class AbstractRedisAsyncCommands<K, V> implements RedisAclAsyncC
RedisKeyAsyncCommands<K, V>, RedisStringAsyncCommands<K, V>, RedisListAsyncCommands<K, V>, RedisSetAsyncCommands<K, V>,
RedisSortedSetAsyncCommands<K, V>, RedisScriptingAsyncCommands<K, V>, RedisServerAsyncCommands<K, V>,
RedisHLLAsyncCommands<K, V>, BaseRedisAsyncCommands<K, V>, RedisTransactionalAsyncCommands<K, V>,
RedisGeoAsyncCommands<K, V>, RedisClusterAsyncCommands<K, V> {
RedisGeoAsyncCommands<K, V>, RedisClusterAsyncCommands<K, V>, RedisJsonAsyncCommands<K, V> {

private final StatefulConnection<K, V> connection;

private final RedisCommandBuilder<K, V> commandBuilder;

private final RedisJsonCommandBuilder<K, V> jsonCommandBuilder;

private final JsonParser parser;

/**
* Initialize a new instance.
*
* @param connection the connection to operate on
* @param codec the codec for command encoding
*/
public AbstractRedisAsyncCommands(StatefulConnection<K, V> connection, RedisCodec<K, V> codec) {
public AbstractRedisAsyncCommands(StatefulConnection<K, V> connection, RedisCodec<K, V> codec, JsonParser parser) {
this.parser = parser;
this.connection = connection;
this.commandBuilder = new RedisCommandBuilder<>(codec);
this.jsonCommandBuilder = new RedisJsonCommandBuilder<>(codec, parser);
}

@Override
Expand Down Expand Up @@ -1453,6 +1467,176 @@ public boolean isOpen() {
return connection.isOpen();
}

@Override
public RedisFuture<List<Long>> jsonArrappend(K key, JsonPath jsonPath, JsonValue... values) {
return dispatch(jsonCommandBuilder.jsonArrappend(key, jsonPath, values));
}

@Override
public RedisFuture<List<Long>> jsonArrappend(K key, JsonValue... values) {
return dispatch(jsonCommandBuilder.jsonArrappend(key, JsonPath.ROOT_PATH, values));
}

@Override
public RedisFuture<List<Long>> jsonArrindex(K key, JsonPath jsonPath, JsonValue value, JsonRangeArgs range) {
return dispatch(jsonCommandBuilder.jsonArrindex(key, jsonPath, value, range));
}

@Override
public RedisFuture<List<Long>> jsonArrindex(K key, JsonPath jsonPath, JsonValue value) {
return dispatch(jsonCommandBuilder.jsonArrindex(key, jsonPath, value, JsonRangeArgs.Builder.defaults()));
}

@Override
public RedisFuture<List<Long>> jsonArrinsert(K key, JsonPath jsonPath, int index, JsonValue... values) {
return dispatch(jsonCommandBuilder.jsonArrinsert(key, jsonPath, index, values));
}

@Override
public RedisFuture<List<Long>> jsonArrlen(K key, JsonPath jsonPath) {
return dispatch(jsonCommandBuilder.jsonArrlen(key, jsonPath));
}

@Override
public RedisFuture<List<Long>> jsonArrlen(K key) {
return dispatch(jsonCommandBuilder.jsonArrlen(key, JsonPath.ROOT_PATH));
}

@Override
public RedisFuture<List<JsonValue>> jsonArrpop(K key, JsonPath jsonPath, int index) {
return dispatch(jsonCommandBuilder.jsonArrpop(key, jsonPath, index));
}

@Override
public RedisFuture<List<JsonValue>> jsonArrpop(K key, JsonPath jsonPath) {
return dispatch(jsonCommandBuilder.jsonArrpop(key, jsonPath, -1));
}

@Override
public RedisFuture<List<JsonValue>> jsonArrpop(K key) {
return dispatch(jsonCommandBuilder.jsonArrpop(key, JsonPath.ROOT_PATH, -1));
}

@Override
public RedisFuture<List<Long>> jsonArrtrim(K key, JsonPath jsonPath, JsonRangeArgs range) {
return dispatch(jsonCommandBuilder.jsonArrtrim(key, jsonPath, range));
}

@Override
public RedisFuture<Long> jsonClear(K key, JsonPath jsonPath) {
return dispatch(jsonCommandBuilder.jsonClear(key, jsonPath));
}

@Override
public RedisFuture<Long> jsonClear(K key) {
return dispatch(jsonCommandBuilder.jsonClear(key, JsonPath.ROOT_PATH));
}

@Override
public RedisFuture<Long> jsonDel(K key, JsonPath jsonPath) {
return dispatch(jsonCommandBuilder.jsonDel(key, jsonPath));
}

@Override
public RedisFuture<Long> jsonDel(K key) {
return dispatch(jsonCommandBuilder.jsonDel(key, JsonPath.ROOT_PATH));
}

@Override
public RedisFuture<List<JsonValue>> jsonGet(K key, JsonGetArgs options, JsonPath... jsonPaths) {
return dispatch(jsonCommandBuilder.jsonGet(key, options, jsonPaths));
}

@Override
public RedisFuture<List<JsonValue>> jsonGet(K key, JsonPath... jsonPaths) {
return dispatch(jsonCommandBuilder.jsonGet(key, JsonGetArgs.Builder.defaults(), jsonPaths));
}

@Override
public RedisFuture<String> jsonMerge(K key, JsonPath jsonPath, JsonValue value) {
return dispatch(jsonCommandBuilder.jsonMerge(key, jsonPath, value));
}

@Override
public RedisFuture<List<JsonValue>> jsonMGet(JsonPath jsonPath, K... keys) {
return dispatch(jsonCommandBuilder.jsonMGet(jsonPath, keys));
}

@Override
public RedisFuture<String> jsonMSet(List<JsonMsetArgs<K, V>> arguments) {
return dispatch(jsonCommandBuilder.jsonMSet(arguments));
}

@Override
public RedisFuture<List<Number>> jsonNumincrby(K key, JsonPath jsonPath, Number number) {
return dispatch(jsonCommandBuilder.jsonNumincrby(key, jsonPath, number));
}

@Override
public RedisFuture<List<V>> jsonObjkeys(K key, JsonPath jsonPath) {
return dispatch(jsonCommandBuilder.jsonObjkeys(key, jsonPath));
}

@Override
public RedisFuture<List<V>> jsonObjkeys(K key) {
return dispatch(jsonCommandBuilder.jsonObjkeys(key, JsonPath.ROOT_PATH));
}

@Override
public RedisFuture<List<Long>> jsonObjlen(K key, JsonPath jsonPath) {
return dispatch(jsonCommandBuilder.jsonObjlen(key, jsonPath));
}

@Override
public RedisFuture<List<Long>> jsonObjlen(K key) {
return dispatch(jsonCommandBuilder.jsonObjlen(key, JsonPath.ROOT_PATH));
}

@Override
public RedisFuture<String> jsonSet(K key, JsonPath jsonPath, JsonValue value, JsonSetArgs options) {
return dispatch(jsonCommandBuilder.jsonSet(key, jsonPath, value, options));
}

@Override
public RedisFuture<String> jsonSet(K key, JsonPath jsonPath, JsonValue value) {
return dispatch(jsonCommandBuilder.jsonSet(key, jsonPath, value, JsonSetArgs.Builder.defaults()));
}

@Override
public RedisFuture<List<Long>> jsonStrappend(K key, JsonPath jsonPath, JsonValue value) {
return dispatch(jsonCommandBuilder.jsonStrappend(key, jsonPath, value));
}

@Override
public RedisFuture<List<Long>> jsonStrappend(K key, JsonValue value) {
return dispatch(jsonCommandBuilder.jsonStrappend(key, JsonPath.ROOT_PATH, value));
}

@Override
public RedisFuture<List<Long>> jsonStrlen(K key, JsonPath jsonPath) {
return dispatch(jsonCommandBuilder.jsonStrlen(key, jsonPath));
}

@Override
public RedisFuture<List<Long>> jsonStrlen(K key) {
return dispatch(jsonCommandBuilder.jsonStrlen(key, JsonPath.ROOT_PATH));
}

@Override
public RedisFuture<List<Long>> jsonToggle(K key, JsonPath jsonPath) {
return dispatch(jsonCommandBuilder.jsonToggle(key, jsonPath));
}

@Override
public RedisFuture<List<JsonType>> jsonType(K key, JsonPath jsonPath) {
return dispatch(jsonCommandBuilder.jsonType(key, jsonPath));
}

@Override
public RedisFuture<List<JsonType>> jsonType(K key) {
return dispatch(jsonCommandBuilder.jsonType(key, JsonPath.ROOT_PATH));
}

@Override
public RedisFuture<List<K>> keys(K pattern) {
return dispatch(commandBuilder.keys(pattern));
Expand Down Expand Up @@ -3194,6 +3378,11 @@ public RedisFuture<List<Map<String, Object>>> clusterLinks() {
return dispatch(commandBuilder.clusterLinks());
}

@Override
public JsonParser getJsonParser() {
return this.parser;
}

private byte[] encodeFunction(String functionCode) {
LettuceAssert.notNull(functionCode, "Function code must not be null");
LettuceAssert.notEmpty(functionCode, "Function code script must not be empty");
Expand Down
Loading
Loading