[
https://issues.apache.org/jira/browse/HDFS-15757?focusedWorklogId=599009&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-599009
]
ASF GitHub Bot logged work on HDFS-15757:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 19/May/21 05:45
Start Date: 19/May/21 05:45
Worklog Time Spent: 10m
Work Description: fengnanli commented on a change in pull request #2651:
URL: https://github.com/apache/hadoop/pull/2651#discussion_r634928450
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/ConnectionContext.java
##########
@@ -83,30 +98,38 @@ public synchronized boolean isUsable() {
*/
public synchronized ProxyAndInfo<?> getClient() {
this.numThreads++;
+ this.lastActiveTs = Time.monotonicNow();
return this.client;
}
/**
- * Release this connection. If the connection was closed, close the proxy.
- * Otherwise, mark the connection as not used by us anymore.
+ * Release this connection.
*/
public synchronized void release() {
- if (--this.numThreads == 0 && this.closed) {
- close();
+ if (this.numThreads > 0) {
+ this.numThreads--;
}
}
/**
- * We will not use this connection anymore. If it's not being used, we close
- * it. Otherwise, we let release() do it once we are done with it.
+ * Close a connection. Only idle connections can be closed since
+ * the RPC proxy would be shut down immediately.
+ *
+ * @param force whether the connection should be closed anyway.
+ * @throws IllegalStateException when the connection is not idle
*/
- public synchronized void close() {
- this.closed = true;
- if (this.numThreads == 0) {
- Object proxy = this.client.getProxy();
- // Nobody should be using this anymore so it should close right away
- RPC.stopProxy(proxy);
+ public synchronized void close(boolean force) throws IllegalStateException {
+ if (!force && this.numThreads > 0) {
+ throw new IllegalStateException("Active connection cannot be closed");
Review comment:
Good point @DazhuangSu I made the change accordingly to replace the
exception with an error log (since there is not much we can do even we catch
the exception).
@Hexiaoqiao @goiri Can we consider merging this one since it is there for a
long time and there is no issue from some users' experience (except for the
this suggestion which will be fixed.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 599009)
Time Spent: 3h 40m (was: 3.5h)
> RBF: Improving Router Connection Management
> -------------------------------------------
>
> Key: HDFS-15757
> URL: https://issues.apache.org/jira/browse/HDFS-15757
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: rbf
> Reporter: Fengnan Li
> Assignee: Fengnan Li
> Priority: Major
> Labels: pull-request-available
> Attachments: RBF_ Improving Router Connection Management_v2.pdf, RBF_
> Improving Router Connection Management_v3.pdf, RBF_ Router Connection
> Management.pdf
>
> Time Spent: 3h 40m
> Remaining Estimate: 0h
>
> We have seen high number of connections from Router to namenodes, leaving
> namenodes unstable.
> This ticket is trying to reduce connections through some changes. Please take
> a look at the design and leave comments.
> Thanks!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]