Skip to content

Commit

Permalink
Merge branch 'redis:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
stillerrr authored Aug 3, 2024
2 parents 4404bbd + e14b899 commit f1b4ee7
Show file tree
Hide file tree
Showing 366 changed files with 58,505 additions and 3,105 deletions.
20 changes: 1 addition & 19 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,10 @@ jobs:
mvn javadoc:jar
- name: Run tests
run: |
TEST="" make test
make test
env:
JVM_OPTS: -Xmx3200m
TERM: dumb
- name: sleep 10s
run: sleep 10s
- name: Make - start
run: |
make start
sleep 2s
- name: Docker - mod or stack
run: docker run -p 52567:6379 -d redis/redis-stack-server:edge
- name: Test commands - default protocol
run: mvn -Dtest="redis.clients.jedis.commands.**" test
- name: Test commands - RESP3 protocol
run: mvn -DjedisProtocol=3 -Dtest="redis.clients.jedis.commands.**" test
- name: Test module commands - default protocol
run: mvn -DmodulesDocker="localhost:52567" -Dtest="redis.clients.jedis.modules.**" test
- name: Test module commands - RESP3 protocol
run: mvn -DjedisProtocol=3 -DmodulesDocker="localhost:52567" -Dtest="redis.clients.jedis.modules.**" test
- name: Make - stop
run: make stop
- name: Codecov
run: |
bash <(curl -s https://codecov.io/bash)
84 changes: 73 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,50 @@ cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node5.conf
endef

# STABLE CLUSTER REDIS NODES
# The structure of this cluster is not changed by the tests!
define REDIS_STABLE_CLUSTER_NODE1_CONF
daemonize yes
protected-mode no
requirepass cluster
port 7479
cluster-node-timeout 15000
pidfile /tmp/redis_stable_cluster_node1.pid
logfile /tmp/redis_stable_cluster_node1.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_stable_cluster_node1.conf
endef

define REDIS_STABLE_CLUSTER_NODE2_CONF
daemonize yes
protected-mode no
requirepass cluster
port 7480
cluster-node-timeout 15000
pidfile /tmp/redis_stable_cluster_node2.pid
logfile /tmp/redis_stable_cluster_node2.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_stable_cluster_node2.conf
endef

define REDIS_STABLE_CLUSTER_NODE3_CONF
daemonize yes
protected-mode no
requirepass cluster
port 7481
cluster-node-timeout 15000
pidfile /tmp/redis_stable_cluster_node3.pid
logfile /tmp/redis_stable_cluster_node3.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_stable_cluster_node3.conf
endef

# UDS REDIS NODES
define REDIS_UDS
daemonize yes
Expand Down Expand Up @@ -355,6 +399,9 @@ export REDIS_CLUSTER_NODE2_CONF
export REDIS_CLUSTER_NODE3_CONF
export REDIS_CLUSTER_NODE4_CONF
export REDIS_CLUSTER_NODE5_CONF
export REDIS_STABLE_CLUSTER_NODE1_CONF
export REDIS_STABLE_CLUSTER_NODE2_CONF
export REDIS_STABLE_CLUSTER_NODE3_CONF
export REDIS_UDS
export REDIS_UNAVAILABLE_CONF
export STUNNEL_CONF
Expand All @@ -366,7 +413,7 @@ ifndef STUNNEL_BIN
endif
export SKIP_SSL

start: stunnel cleanup
start: stunnel cleanup compile-module
echo "$$REDIS1_CONF" | redis-server -
echo "$$REDIS2_CONF" | redis-server -
echo "$$REDIS3_CONF" | redis-server -
Expand All @@ -393,8 +440,13 @@ start: stunnel cleanup
echo "$$REDIS_CLUSTER_NODE3_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE4_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE5_CONF" | redis-server -
echo "$$REDIS_STABLE_CLUSTER_NODE1_CONF" | redis-server -
echo "$$REDIS_STABLE_CLUSTER_NODE2_CONF" | redis-server -
echo "$$REDIS_STABLE_CLUSTER_NODE3_CONF" | redis-server -
echo "$$REDIS_UDS" | redis-server -
echo "$$REDIS_UNAVAILABLE_CONF" | redis-server -
redis-cli -a cluster --cluster create 127.0.0.1:7479 127.0.0.1:7480 127.0.0.1:7481 --cluster-yes
docker run -p 6479:6379 --name jedis-stack -d redis/redis-stack-server:edge

cleanup:
- rm -vf /tmp/redis_cluster_node*.conf 2>/dev/null
Expand All @@ -404,6 +456,7 @@ stunnel:
@if [ -e "$$STUNNEL_BIN" ]; then\
echo "$$STUNNEL_CONF" | stunnel -fd 0;\
fi

stop:
kill `cat /tmp/redis1.pid`
kill `cat /tmp/redis2.pid`
Expand All @@ -426,6 +479,9 @@ stop:
kill `cat /tmp/redis_cluster_node3.pid` || true
kill `cat /tmp/redis_cluster_node4.pid` || true
kill `cat /tmp/redis_cluster_node5.pid` || true
kill `cat /tmp/redis_stable_cluster_node1.pid`
kill `cat /tmp/redis_stable_cluster_node2.pid`
kill `cat /tmp/redis_stable_cluster_node3.pid`
kill `cat /tmp/redis_uds.pid` || true
kill `cat /tmp/stunnel.pid` || true
[ -f /tmp/redis_unavailable.pid ] && kill `cat /tmp/redis_unavailable.pid` || true
Expand All @@ -439,29 +495,35 @@ stop:
rm -f /tmp/redis_cluster_node3.conf
rm -f /tmp/redis_cluster_node4.conf
rm -f /tmp/redis_cluster_node5.conf
rm -f /tmp/redis_stable_cluster_node1.conf
rm -f /tmp/redis_stable_cluster_node2.conf
rm -f /tmp/redis_stable_cluster_node3.conf
docker rm -f jedis-stack

test: compile-module start
sleep 2
test: | start mvn-test stop

mvn-test:
mvn -Dtest=${SKIP_SSL}${TEST} clean compile test
make stop

package: start
package: | start mvn-package stop

mvn-package:
mvn clean package
make stop

deploy: start
deploy: | start mvn-deploy stop

mvn-deploy:
mvn clean deploy
make stop

format:
mvn java-formatter:format

release:
make start
release: | start mvn-release stop

mvn-release:
mvn release:clean
mvn release:prepare
mvn release:perform -DskipTests
make stop

system-setup:
sudo apt install -y gcc g++
Expand Down
34 changes: 23 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<jedis.module.name>redis.clients.jedis</jedis.module.name>
<slf4j.version>1.7.36</slf4j.version>
<resilience4j.version>1.7.1</resilience4j.version>
<jackson.version>2.16.1</jackson.version>
<jackson.version>2.17.2</jackson.version>
<maven.surefire.version>3.2.5</maven.surefire.version>
</properties>

Expand All @@ -67,19 +67,19 @@
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20231013</version>
<version>20240303</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<version>2.11.0</version>
</dependency>

<!-- UNIX socket connection support -->
<dependency>
<groupId>com.kohlschutter.junixsocket</groupId>
<artifactId>junixsocket-core</artifactId>
<version>2.8.3</version>
<version>2.10.0</version>
<type>pom</type>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -127,6 +127,18 @@
<version>${jackson.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.javacrumbs.json-unit</groupId>
<artifactId>json-unit</artifactId>
<version>2.38.0</version> <!-- 3.x requires Java 17 -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5-fluent</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>

<!-- circuit breaker / failover -->
<dependency>
Expand Down Expand Up @@ -171,7 +183,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<version>0.8.12</version>
<executions>
<execution>
<goals>
Expand All @@ -189,7 +201,7 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<version>3.13.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
Expand All @@ -210,7 +222,7 @@
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
<configuration>
<attach>true</attach>
</configuration>
Expand All @@ -225,7 +237,7 @@
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<version>3.7.0</version>
<configuration>
<source>8</source><!-- Until JDK 11+ -->
<detectJavaApiLink>false</detectJavaApiLink><!-- Until JDK 11+ -->
Expand All @@ -248,7 +260,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<version>1.7.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand All @@ -266,7 +278,7 @@
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<version>3.4.2</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
Expand Down Expand Up @@ -300,7 +312,7 @@
<!--Sign the components - this is required by maven central for releases -->
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.4</version>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/redis/clients/jedis/AbstractTransaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ protected AbstractTransaction() {
super(new CommandObjects());
}

protected AbstractTransaction(CommandObjects commandObjects) {
super(commandObjects);
}

public abstract void multi();

/**
Expand All @@ -32,4 +36,12 @@ protected AbstractTransaction() {
public Response<Long> waitReplicas(int replicas, long timeout) {
return appendCommand(commandObjects.waitReplicas(replicas, timeout));
}

public Response<Long> publish(String channel, String message) {
return appendCommand(commandObjects.publish(channel, message));
}

public Response<Long> publish(byte[] channel, byte[] message) {
return appendCommand(commandObjects.publish(channel, message));
}
}
Loading

0 comments on commit f1b4ee7

Please sign in to comment.