Skip to content

Commit

Permalink
remove SHORT_CIRCUIT replication type
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenSammi committed Dec 2, 2024
1 parent ce8b05e commit a6bea06
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,15 @@ protected XceiverClientSpi newClient(Pipeline pipeline, DatanodeDetails dn) thro
client = XceiverClientRatis.newXceiverClientRatis(pipeline, conf, trustManager, errorInjector);
break;
case STAND_ALONE:
client = new XceiverClientGrpc(pipeline, conf, trustManager);
if (dn != null) {
client = new XceiverClientShortCircuit(pipeline, conf, dn);
} else {
client = new XceiverClientGrpc(pipeline, conf, trustManager);
}
break;
case EC:
client = new ECXceiverClientGrpc(pipeline, conf, trustManager);
break;
case SHORT_CIRCUIT:
client = new XceiverClientShortCircuit(pipeline, conf, dn);
break;
case CHAINED:
default:
throw new IOException("not implemented " + pipeline.getType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,9 @@ public void releaseClient(XceiverClientSpi client, boolean invalidateClient,
protected XceiverClientSpi getClient(Pipeline pipeline, boolean topologyAware, boolean allowShortCircuit)
throws IOException {
try {
// create different client different pipeline node based on
// network topology
// create different client different pipeline node based on network topology
String key = getPipelineCacheKey(pipeline, topologyAware, allowShortCircuit);
if (key.endsWith(DomainSocketFactory.FEATURE_FLAG)) {
final Pipeline newPipeline = Pipeline.newBuilder(pipeline).setReplicationConfig(
ReplicationConfig.fromTypeAndFactor(ReplicationType.SHORT_CIRCUIT,
ReplicationFactor.valueOf(pipeline.getReplicationConfig().getReplication()))).build();
return clientCache.get(key, () -> newClient(newPipeline, localDNCache.get(key)));
} else {
return clientCache.get(key, () -> newClient(pipeline));
}
return clientCache.get(key, () -> newClient(pipeline, localDNCache.get(key)));
} catch (Exception e) {
throw new IOException(
"Exception getting XceiverClient: " + e, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ static ReplicationConfig fromProtoTypeAndFactor(
return RatisReplicationConfig.getInstance(factor);
case STAND_ALONE:
return StandaloneReplicationConfig.getInstance(factor);
case SHORT_CIRCUIT:
return ShortCircuitReplicationConfig.getInstance(factor);
default:
throw new UnsupportedOperationException(
"Not supported replication: " + type);
Expand Down Expand Up @@ -104,7 +102,6 @@ static ReplicationConfig fromProto(
return new ECReplicationConfig(ecConfig);
case RATIS:
case STAND_ALONE:
case SHORT_CIRCUIT:
return fromProtoTypeAndFactor(type, factor);
default:
throw new UnsupportedOperationException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public enum ReplicationType {
RATIS,
STAND_ALONE,
CHAINED,
EC,
SHORT_CIRCUIT;
EC;

public static ReplicationType fromProto(
HddsProtos.ReplicationType replicationType) {
Expand All @@ -44,8 +43,6 @@ public static ReplicationType fromProto(
return ReplicationType.CHAINED;
case EC:
return ReplicationType.EC;
case SHORT_CIRCUIT:
return ReplicationType.SHORT_CIRCUIT;
default:
throw new IllegalArgumentException(
"Unsupported ProtoBuf replication type: " + replicationType);
Expand All @@ -66,8 +63,6 @@ public static HddsProtos.ReplicationType toProto(
return HddsProtos.ReplicationType.CHAINED;
case EC:
return HddsProtos.ReplicationType.EC;
case SHORT_CIRCUIT:
return HddsProtos.ReplicationType.SHORT_CIRCUIT;
default:
throw new IllegalArgumentException(
"Unsupported replication type: " + replicationType);
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion hadoop-hdds/interface-client/src/main/proto/hdds.proto
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ enum ReplicationType {
STAND_ALONE = 2;
CHAINED = 3;
EC = 4;
SHORT_CIRCUIT = 5;
NONE = -1; // Invalid Type
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ public void testAllocateShortCircuitClient() throws IOException {
assertEquals(client1, client2);
clientManager.releaseClient(client1, true);
clientManager.releaseClient(client2, true);
// client is still kept in the cache, for create a domain socket connection is expensive.
assertEquals(1, clientManager.getClientCache().size());
assertEquals(0, clientManager.getClientCache().size());

XceiverClientSpi client3 = clientManager.acquireClientForReadData(container1.getPipeline(), false);
assertTrue(client3 instanceof XceiverClientGrpc);
Expand Down

0 comments on commit a6bea06

Please sign in to comment.