forked from apache/ozone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into HDDS-10239-container-reconciliation
* master: (50 commits) HDDS-11331. Fix Datanode unable to report for a long time (apache#7090) HDDS-11346. FS CLI gives incorrect recursive volume deletion prompt (apache#7102) HDDS-11349. Add NullPointer handling when volume/bucket tables are not initialized (apache#7103) HDDS-11209. Avoid insufficient EC pipelines in the container pipeline cache (apache#6974) HDDS-11284. refactor quota repair non-blocking while upgrade (apache#7035) HDDS-9790. Add tests for Overview page (apache#6983) HDDS-10904. [hsync] Enable PutBlock piggybacking and incremental chunk list by default (apache#7074) HDDS-11322. [hsync] Block ECKeyOutputStream from calling hsync and hflush (apache#7098) HDDS-11325. Intermittent failure in TestBlockOutputStreamWithFailures#testContainerClose (apache#7099) HDDS-11340. Avoid extra PubBlock call when a full block is closed (apache#7094) HDDS-11155. Improve Volumes page UI (apache#7048) HDDS-11324. Negative value preOpLatencyMs in DN audit log (apache#7093) HDDS-11246. [Recon] Use optional chaining instead of explicit undefined check for Objects in Container and Pipeline Module. (apache#7037) HDDS-11323. Mark TestLeaseRecovery as flaky HDDS-11338. Bump zstd-jni to 1.5.6-4 (apache#7085) HDDS-11337. Bump Spring Framework to 5.3.39 (apache#7084) HDDS-11327. [hsync] Revert config default ozone.fs.hsync.enabled to false (apache#7079) HDDS-11325. Mark testWriteMoreThanMaxFlushSize as flaky HDDS-11336. Bump slf4j to 2.0.16 (apache#7086) HDDS-11335. Bump exec-maven-plugin to 3.4.1 (apache#7087) ... Conflicts: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeConfiguration.java hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/OzoneContainer.java
- Loading branch information
Showing
204 changed files
with
9,277 additions
and
2,073 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientCreator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.hadoop.hdds.scm; | ||
|
||
import com.google.common.base.Preconditions; | ||
import org.apache.hadoop.hdds.conf.ConfigurationSource; | ||
import org.apache.hadoop.hdds.scm.client.ClientTrustManager; | ||
import org.apache.hadoop.hdds.scm.pipeline.Pipeline; | ||
import org.apache.hadoop.hdds.utils.IOUtils; | ||
import org.apache.hadoop.ozone.OzoneConfigKeys; | ||
import org.apache.hadoop.ozone.OzoneSecurityUtil; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Factory for XceiverClientSpi implementations. Client instances are not cached. | ||
*/ | ||
public class XceiverClientCreator implements XceiverClientFactory { | ||
private final ConfigurationSource conf; | ||
private final boolean topologyAwareRead; | ||
private final ClientTrustManager trustManager; | ||
private final boolean securityEnabled; | ||
|
||
public XceiverClientCreator(ConfigurationSource conf) { | ||
this(conf, null); | ||
} | ||
|
||
public XceiverClientCreator(ConfigurationSource conf, ClientTrustManager trustManager) { | ||
this.conf = conf; | ||
this.securityEnabled = OzoneSecurityUtil.isSecurityEnabled(conf); | ||
topologyAwareRead = conf.getBoolean( | ||
OzoneConfigKeys.OZONE_NETWORK_TOPOLOGY_AWARE_READ_KEY, | ||
OzoneConfigKeys.OZONE_NETWORK_TOPOLOGY_AWARE_READ_DEFAULT); | ||
this.trustManager = trustManager; | ||
if (securityEnabled) { | ||
Preconditions.checkNotNull(trustManager); | ||
} | ||
} | ||
|
||
public boolean isSecurityEnabled() { | ||
return securityEnabled; | ||
} | ||
|
||
protected XceiverClientSpi newClient(Pipeline pipeline) throws IOException { | ||
XceiverClientSpi client; | ||
switch (pipeline.getType()) { | ||
case RATIS: | ||
client = XceiverClientRatis.newXceiverClientRatis(pipeline, conf, trustManager); | ||
break; | ||
case STAND_ALONE: | ||
client = new XceiverClientGrpc(pipeline, conf, trustManager); | ||
break; | ||
case EC: | ||
client = new ECXceiverClientGrpc(pipeline, conf, trustManager); | ||
break; | ||
case CHAINED: | ||
default: | ||
throw new IOException("not implemented " + pipeline.getType()); | ||
} | ||
try { | ||
client.connect(); | ||
} catch (Exception e) { | ||
throw new IOException(e); | ||
} | ||
return client; | ||
} | ||
|
||
@Override | ||
public XceiverClientSpi acquireClient(Pipeline pipeline) throws IOException { | ||
return acquireClient(pipeline, false); | ||
} | ||
|
||
@Override | ||
public void releaseClient(XceiverClientSpi xceiverClient, boolean invalidateClient) { | ||
releaseClient(xceiverClient, invalidateClient, false); | ||
} | ||
|
||
@Override | ||
public XceiverClientSpi acquireClientForReadData(Pipeline pipeline) throws IOException { | ||
return acquireClient(pipeline); | ||
} | ||
|
||
@Override | ||
public void releaseClientForReadData(XceiverClientSpi xceiverClient, boolean invalidateClient) { | ||
releaseClient(xceiverClient, invalidateClient, topologyAwareRead); | ||
} | ||
|
||
@Override | ||
public XceiverClientSpi acquireClient(Pipeline pipeline, boolean topologyAware) throws IOException { | ||
return newClient(pipeline); | ||
} | ||
|
||
@Override | ||
public void releaseClient(XceiverClientSpi xceiverClient, boolean invalidateClient, boolean topologyAware) { | ||
IOUtils.closeQuietly(xceiverClient); | ||
} | ||
|
||
@Override | ||
public void close() throws Exception { | ||
// clients are not tracked, closing each client is the responsibility of users of this class | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.