Skip to content

Commit f1d528f

Browse files
mp911dechristophstrobl
authored andcommitted
Remove usage of oppressive language.
The API exposes now the renamed command terminology (replica) only and no longer the deprecated one. Closes: #2195 See: #2274 Original Pull Request: #2276
1 parent 69205c5 commit f1d528f

File tree

47 files changed

+210
-239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+210
-239
lines changed

src/main/asciidoc/appendix/appendix-command-reference.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
|RANDOMKEY |X
116116
|RENAME |X
117117
|RENAMENX |X
118+
|REPLICAOF |X
118119
|RESTORE |X
119120
|ROLE |-
120121
|RPOP |X

src/main/java/org/springframework/data/redis/connection/ClusterTopology.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public Set<RedisClusterNode> getNodes() {
5555
}
5656

5757
/**
58-
* Get all nodes (master and slave) in cluster where {@code link-state} is {@literal connected} and {@code flags} does
59-
* not contain {@literal fail} or {@literal fail?}.
58+
* Get all nodes (master and replica) in cluster where {@code link-state} is {@literal connected} and {@code flags}
59+
* does not contain {@literal fail} or {@literal fail?}.
6060
*
6161
* @return never {@literal null}.
6262
*/
@@ -105,7 +105,7 @@ public Set<RedisClusterNode> getMasterNodes() {
105105
}
106106

107107
/**
108-
* Get the {@link RedisClusterNode}s (master and slave) serving s specific slot.
108+
* Get the {@link RedisClusterNode}s (master and replica) serving s specific slot.
109109
*
110110
* @param slot
111111
* @return never {@literal null}.

src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,13 +2444,13 @@ public List<RedisClientInfo> getClientList() {
24442444
}
24452445

24462446
@Override
2447-
public void slaveOf(String host, int port) {
2448-
this.delegate.slaveOf(host, port);
2447+
public void replicaOf(String host, int port) {
2448+
this.delegate.replicaOf(host, port);
24492449
}
24502450

24512451
@Override
2452-
public void slaveOfNoOne() {
2453-
this.delegate.slaveOfNoOne();
2452+
public void replicaOfNoOne() {
2453+
this.delegate.replicaOfNoOne();
24542454
}
24552455

24562456
@Override

src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,15 +1755,15 @@ default List<RedisClientInfo> getClientList() {
17551755
/** @deprecated in favor of {@link RedisConnection#serverCommands()}. */
17561756
@Override
17571757
@Deprecated
1758-
default void slaveOf(String host, int port) {
1759-
serverCommands().slaveOf(host, port);
1758+
default void replicaOf(String host, int port) {
1759+
serverCommands().replicaOf(host, port);
17601760
}
17611761

17621762
/** @deprecated in favor of {@link RedisConnection#serverCommands()}. */
17631763
@Override
17641764
@Deprecated
1765-
default void slaveOfNoOne() {
1766-
serverCommands().slaveOfNoOne();
1765+
default void replicaOfNoOne() {
1766+
serverCommands().replicaOfNoOne();
17671767
}
17681768

17691769
/** @deprecated in favor of {@link RedisConnection#serverCommands()}. */

src/main/java/org/springframework/data/redis/connection/ReactiveClusterCommands.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,22 @@ public interface ReactiveClusterCommands {
4646
Flux<RedisClusterNode> clusterGetNodes();
4747

4848
/**
49-
* Retrieve information about connected slaves for given master node.
49+
* Retrieve information about connected replicas for given master node.
5050
*
5151
* @param master must not be {@literal null}.
5252
* @return a {@link Flux} emitting {@link RedisClusterNode cluster nodes}, an {@link Flux#empty() empty one} if none
5353
* found.
54-
* @see <a href="https://redis.io/commands/cluster-slaves">Redis Documentation: CLUSTER SLAVES</a>
54+
* @see <a href="https://redis.io/commands/cluster-replicas">Redis Documentation: CLUSTER REPLICAS</a>
5555
*/
56-
Flux<RedisClusterNode> clusterGetSlaves(RedisClusterNode master);
56+
Flux<RedisClusterNode> clusterGetReplicas(RedisClusterNode master);
5757

5858
/**
59-
* Retrieve information about masters and their connected slaves.
59+
* Retrieve information about masters and their connected replicas.
6060
*
6161
* @return never {@literal null}.
62-
* @see <a href="https://redis.io/commands/cluster-slaves">Redis Documentation: CLUSTER SLAVES</a>
62+
* @see <a href="https://redis.io/commands/cluster-replicas">Redis Documentation: CLUSTER REPLICAS</a>
6363
*/
64-
Mono<Map<RedisClusterNode, Collection<RedisClusterNode>>> clusterGetMasterSlaveMap();
64+
Mono<Map<RedisClusterNode, Collection<RedisClusterNode>>> clusterGetMasterReplicaMap();
6565

6666
/**
6767
* Find the slot for a given {@code key}.
@@ -184,7 +184,7 @@ public interface ReactiveClusterCommands {
184184
Flux<ByteBuffer> clusterGetKeysInSlot(int slot, int count);
185185

186186
/**
187-
* Assign a {@literal slave} to given {@literal master}.
187+
* Assign a {@literal replica} to given {@literal master}.
188188
*
189189
* @param master must not be {@literal null}.
190190
* @param replica must not be {@literal null}.

src/main/java/org/springframework/data/redis/connection/RedisClusterCommands.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,21 @@ public interface RedisClusterCommands {
4141
Iterable<RedisClusterNode> clusterGetNodes();
4242

4343
/**
44-
* Retrieve information about connected slaves for given master node.
44+
* Retrieve information about connected replicas for given master node.
4545
*
4646
* @param master must not be {@literal null}.
4747
* @return never {@literal null}.
48-
* @see <a href="https://redis.io/commands/cluster-slaves">Redis Documentation: CLUSTER SLAVES</a>
48+
* @see <a href="https://redis.io/commands/cluster-replicas">Redis Documentation: CLUSTER REPLICAS</a>
4949
*/
50-
Collection<RedisClusterNode> clusterGetSlaves(RedisClusterNode master);
50+
Collection<RedisClusterNode> clusterGetReplicas(RedisClusterNode master);
5151

5252
/**
53-
* Retrieve information about masters and their connected slaves.
53+
* Retrieve information about masters and their connected replicas.
5454
*
5555
* @return never {@literal null}.
56-
* @see <a href="https://redis.io/commands/cluster-slaves">Redis Documentation: CLUSTER SLAVES</a>
56+
* @see <a href="https://redis.io/commands/cluster-replicas">Redis Documentation: CLUSTER REPLICAS</a>
5757
*/
58-
Map<RedisClusterNode, Collection<RedisClusterNode>> clusterGetMasterSlaveMap();
58+
Map<RedisClusterNode, Collection<RedisClusterNode>> clusterGetMasterReplicaMap();
5959

6060
/**
6161
* Find the slot for a given {@code key}.
@@ -171,7 +171,7 @@ public interface RedisClusterCommands {
171171
List<byte[]> clusterGetKeysInSlot(int slot, Integer count);
172172

173173
/**
174-
* Assign a {@literal slave} to given {@literal master}.
174+
* Assign a {@literal replica} to given {@literal master}.
175175
*
176176
* @param master must not be {@literal null}.
177177
* @param replica must not be {@literal null}.

src/main/java/org/springframework/data/redis/connection/RedisClusterNode.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ public enum LinkState {
242242
*/
243243
public static enum Flag {
244244

245-
MYSELF("myself"), MASTER("master"), SLAVE("slave"), FAIL("fail"), PFAIL("fail?"), HANDSHAKE("handshake"), NOADDR(
245+
MYSELF("myself"), MASTER("master"), REPLICA("slave"), FAIL("fail"), PFAIL("fail?"), HANDSHAKE("handshake"), NOADDR(
246246
"noaddr"), NOFLAGS("noflags");
247247

248248
private String raw;
@@ -297,11 +297,6 @@ public RedisClusterNodeBuilder promotedAs(NodeType nodeType) {
297297
return this;
298298
}
299299

300-
public RedisClusterNodeBuilder slaveOf(String masterId) {
301-
super.slaveOf(masterId);
302-
return this;
303-
}
304-
305300
@Override
306301
public RedisClusterNodeBuilder replicaOf(String masterId) {
307302
super.replicaOf(masterId);

src/main/java/org/springframework/data/redis/connection/RedisConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,7 @@ interface ClusterConfiguration extends WithPassword {
482482
}
483483

484484
/**
485-
* Configuration interface suitable for Redis master/slave environments with fixed hosts. <br/>
486-
* Redis is undergoing a nomenclature change where the term replica is used synonymously to slave.
485+
* Configuration interface suitable for Redis master/replica environments with fixed hosts.
487486
*
488487
* @author Christoph Strobl
489488
* @author Mark Paluch

src/main/java/org/springframework/data/redis/connection/RedisNode.java

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,12 @@ public boolean isMaster() {
142142
return ObjectUtils.nullSafeEquals(NodeType.MASTER, getType());
143143
}
144144

145-
/**
146-
* @return
147-
* @since 1.7
148-
*/
149-
public boolean isSlave() {
150-
return isReplica();
151-
}
152-
153145
/**
154146
* @return
155147
* @since 2.1
156148
*/
157149
public boolean isReplica() {
158-
return ObjectUtils.nullSafeEquals(NodeType.SLAVE, getType());
150+
return ObjectUtils.nullSafeEquals(NodeType.REPLICA, getType());
159151
}
160152

161153
/**
@@ -214,7 +206,7 @@ public boolean equals(Object obj) {
214206
* @since 1.7
215207
*/
216208
public enum NodeType {
217-
MASTER, SLAVE
209+
MASTER, REPLICA
218210
}
219211

220212
/**
@@ -279,17 +271,6 @@ public RedisNodeBuilder promotedAs(NodeType type) {
279271
return this;
280272
}
281273

282-
/**
283-
* Set the id of the master node.
284-
*
285-
* @param masterId
286-
* @return
287-
* @since 1.7
288-
*/
289-
public RedisNodeBuilder slaveOf(String masterId) {
290-
return replicaOf(masterId);
291-
}
292-
293274
/**
294275
* Set the id of the master node.
295276
*

src/main/java/org/springframework/data/redis/connection/RedisSentinelCommands.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ public interface RedisSentinelCommands {
4242
Collection<RedisServer> masters();
4343

4444
/**
45-
* Show list of slaves for given {@literal master}.
45+
* Show list of replicas for given {@literal master}.
4646
*
4747
* @param master must not be {@literal null}.
4848
* @return Collection of {@link RedisServer}s. Never {@literal null}.
4949
*/
50-
Collection<RedisServer> slaves(NamedNode master);
50+
Collection<RedisServer> replicas(NamedNode master);
5151

5252
/**
5353
* Removes given {@literal master}. The server will no longer be monitored and will no longer be returned by

src/main/java/org/springframework/data/redis/connection/RedisServer.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,6 @@ public Long getConfigEpoch() {
165165
return getLongValueOf(INFO.CONFIG_EPOCH);
166166
}
167167

168-
public Long getNumberSlaves() {
169-
return getNumberReplicas();
170-
}
171-
172168
/**
173169
* Get the number of connected replicas.
174170
*

src/main/java/org/springframework/data/redis/connection/RedisServerCommands.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,18 +274,18 @@ default Long time() {
274274
*
275275
* @param host must not be {@literal null}.
276276
* @param port
277-
* @since 1.3
278-
* @see <a href="https://redis.io/commands/slaveof">Redis Documentation: SLAVEOF</a>
277+
* @since 3.0
278+
* @see <a href="https://redis.io/commands/replicaof">Redis Documentation: REPLICAOF</a>
279279
*/
280-
void slaveOf(String host, int port);
280+
void replicaOf(String host, int port);
281281

282282
/**
283283
* Change server into master.
284284
*
285285
* @since 1.3
286-
* @see <a href="https://redis.io/commands/slaveof">Redis Documentation: SLAVEOF</a>
286+
* @see <a href="https://redis.io/commands/replicaof">Redis Documentation: REPLICAOF</a>
287287
*/
288-
void slaveOfNoOne();
288+
void replicaOfNoOne();
289289

290290
/**
291291
* Atomically transfer a key from a source Redis instance to a destination Redis instance. On success the key is

src/main/java/org/springframework/data/redis/connection/RedisStaticMasterReplicaConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
* Configuration class used for setting up {@link RedisConnection} via {@link RedisConnectionFactory} using the provided
2929
* Master / Replica configuration to nodes know to not change address. Eg. when connecting to
3030
* <a href="https://aws.amazon.com/documentation/elasticache/">AWS ElastiCache with Read Replicas</a>. <br/>
31-
* Note: Redis is undergoing a nomenclature change where the term replica is used synonymously to slave. Please also
32-
* note that a Master/Replica connection cannot be used for Pub/Sub operations.
31+
* Please also note that a Master/Replica connection cannot be used for Pub/Sub operations.
3332
*
3433
* @author Mark Paluch
3534
* @author Christoph Strobl

src/main/java/org/springframework/data/redis/connection/convert/Converters.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,13 +570,13 @@ public RedisClusterNode convert(String source) {
570570
RedisClusterNodeBuilder nodeBuilder = RedisClusterNode.newRedisClusterNode()
571571
.listeningAt(hostAndPort[0], Integer.valueOf(portPart)) //
572572
.withId(args[ID_INDEX]) //
573-
.promotedAs(flags.contains(Flag.MASTER) ? NodeType.MASTER : NodeType.SLAVE) //
573+
.promotedAs(flags.contains(Flag.MASTER) ? NodeType.MASTER : NodeType.REPLICA) //
574574
.serving(range) //
575575
.withFlags(flags) //
576576
.linkState(parseLinkState(args));
577577

578578
if (!args[MASTER_ID_INDEX].isEmpty() && !args[MASTER_ID_INDEX].startsWith("-")) {
579-
nodeBuilder.slaveOf(args[MASTER_ID_INDEX]);
579+
nodeBuilder.replicaOf(args[MASTER_ID_INDEX]);
580580
}
581581

582582
return nodeBuilder.build();

src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ public Set<RedisClusterNode> clusterGetNodes() {
563563
}
564564

565565
@Override
566-
public Set<RedisClusterNode> clusterGetSlaves(RedisClusterNode master) {
566+
public Set<RedisClusterNode> clusterGetReplicas(RedisClusterNode master) {
567567

568568
Assert.notNull(master, "Master cannot be null!");
569569

@@ -576,7 +576,7 @@ public Set<RedisClusterNode> clusterGetSlaves(RedisClusterNode master) {
576576
}
577577

578578
@Override
579-
public Map<RedisClusterNode, Collection<RedisClusterNode>> clusterGetMasterSlaveMap() {
579+
public Map<RedisClusterNode, Collection<RedisClusterNode>> clusterGetMasterReplicaMap() {
580580

581581
List<NodeResult<Collection<RedisClusterNode>>> nodeResults = clusterCommandExecutor.executeCommandAsyncOnNodes(
582582
(JedisClusterCommandCallback<Collection<RedisClusterNode>>) client -> JedisConverters

src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterServerCommands.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,15 +375,15 @@ public List<RedisClientInfo> getClientList(RedisClusterNode node) {
375375
}
376376

377377
@Override
378-
public void slaveOf(String host, int port) {
378+
public void replicaOf(String host, int port) {
379379
throw new InvalidDataAccessApiUsageException(
380-
"SlaveOf is not supported in cluster environment. Please use CLUSTER REPLICATE.");
380+
"REPLICAOF is not supported in cluster environment. Please use CLUSTER REPLICATE.");
381381
}
382382

383383
@Override
384-
public void slaveOfNoOne() {
384+
public void replicaOfNoOne() {
385385
throw new InvalidDataAccessApiUsageException(
386-
"SlaveOf is not supported in cluster environment. Please use CLUSTER REPLICATE.");
386+
"REPLICAOF is not supported in cluster environment. Please use CLUSTER REPLICATE.");
387387
}
388388

389389
@Override

src/main/java/org/springframework/data/redis/connection/jedis/JedisSentinelConnection.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,21 @@ public List<RedisServer> masters() {
6464
}
6565

6666
@Override
67-
public List<RedisServer> slaves(NamedNode master) {
67+
public List<RedisServer> replicas(NamedNode master) {
6868

69-
Assert.notNull(master, "Master node cannot be 'null' when loading slaves.");
70-
return slaves(master.getName());
69+
Assert.notNull(master, "Master node cannot be 'null' when loading replicas.");
70+
return replicas(master.getName());
7171
}
7272

7373
/**
7474
* @param masterName
75-
* @see RedisSentinelCommands#slaves(NamedNode)
75+
* @see RedisSentinelCommands#replicas(NamedNode)
7676
* @return
7777
*/
78-
public List<RedisServer> slaves(String masterName) {
78+
public List<RedisServer> replicas(String masterName) {
7979

80-
Assert.hasText(masterName, "Name of redis master cannot be 'null' or empty when loading slaves.");
81-
return JedisConverters.toListOfRedisServer(jedis.sentinelSlaves(masterName));
80+
Assert.hasText(masterName, "Name of redis master cannot be 'null' or empty when loading replicas.");
81+
return JedisConverters.toListOfRedisServer(jedis.sentinelReplicas(masterName));
8282
}
8383

8484
@Override

src/main/java/org/springframework/data/redis/connection/jedis/JedisServerCommands.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,22 +205,22 @@ public List<RedisClientInfo> getClientList() {
205205
}
206206

207207
@Override
208-
public void slaveOf(String host, int port) {
208+
public void replicaOf(String host, int port) {
209209

210-
Assert.hasText(host, "Host must not be null for 'SLAVEOF' command.");
210+
Assert.hasText(host, "Host must not be null for 'REPLICAOF' command.");
211211

212212
if (isQueueing() || isPipelined()) {
213-
throw new UnsupportedOperationException("'SLAVEOF' cannot be called in pipline / transaction mode.");
213+
throw new UnsupportedOperationException("'REPLICAOF' cannot be called in pipeline / transaction mode.");
214214
}
215215

216216
connection.invokeStatus().just(it -> it.slaveof(host, port));
217217
}
218218

219219
@Override
220-
public void slaveOfNoOne() {
220+
public void replicaOfNoOne() {
221221

222222
if (isQueueing() || isPipelined()) {
223-
throw new UnsupportedOperationException("'SLAVEOF' cannot be called in pipline / transaction mode.");
223+
throw new UnsupportedOperationException("'REPLICAOF' cannot be called in pipeline / transaction mode.");
224224
}
225225

226226
connection.invokeStatus().just(BinaryJedis::slaveofNoOne);

0 commit comments

Comments
 (0)