-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-27172: Add the HMS client connection timeout config #4150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| public static void setUp() throws Exception { | ||
| @Before | ||
| public void setUp() throws Exception { | ||
| HMSHandler.testTimeoutEnabled = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This test code hacks HMSHandler class, I will refactor this in a new PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to repeat the whole setup for every test or it's possible to extract just the HMSHandler part?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed! Have separated the start of MetaStore Server into a BeforeClass method.
|
A similar PR #3379 for JDBC thrift client, IMO the connection timeout is quite important, please help reopen the closed PR if any committer think it's useful. |
| "has an infinite lifetime."), | ||
| CLIENT_SOCKET_TIMEOUT("metastore.client.socket.timeout", "hive.metastore.client.socket.timeout", 600, | ||
| TimeUnit.SECONDS, "MetaStore Client socket timeout in seconds"), | ||
| CLIENT_CONNECTION_TIMEOUT("metastore.client.connection.timeout", "hive.metastore.client.connection.timeout", 10, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense to set connection timeout a small value, because generally, establish the connection is quick, and small timeout make it quick failover if one HMS is down, but it silent changes the default behavior, I'm not sure if such change is acceptable in Hive community
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, if there is any concern I will keep the default connection timeout value same as socket timeout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wecharyu, won't be socketTimeout = connectTimeout if not explicitly set?
public TSocket(TConfiguration config, String host, int port, int timeout) {
this(config, host, port, timeout, timeout);
}
public TSocket(TConfiguration config, String host, int port, int socketTimeout, int connectTimeout) {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have changed the default connectionTimeout to be the same as socketTimeout. But IMHO it's not a good practice because if we set socketTimeout and not set connectionTimeout, the default long time will be gained for connection, I think we should change the behavior by default where socketTimeout = connectionTimeout.
|
Kudos, SonarCloud Quality Gate passed! |
|
@ayushtkn @deniskuzZ @kasakrisz: Could you help review this PR? |
|
@zabetak @dengzhhu653: Could you also take a look? |
| try { | ||
| client.createDatabase(db); | ||
| } catch (MetaException e) { | ||
| } catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we have changed to use the remote MetaStore server in this test class, so the timeout exception was wrapped in TTransportException rather than MetaException.
deniskuzZ
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, some minor comments
|
Kudos, SonarCloud Quality Gate passed! |
deniskuzZ
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
…reviewed by Cheng Pan, Denys Kuzmenko) Closes apache#4150
…reviewed by Cheng Pan, Denys Kuzmenko) Closes apache#4150








What changes were proposed in this pull request?
Currently
HiveMetaStoreClientuseCLIENT_SOCKET_TIMEOUTas both socket timeout and connection timeout, we want to introduce a new HiveMetaStoreClient config for connection timeout:Why are the changes needed?
Does this PR introduce any user-facing change?
Yes, user can set the client connection timeout by this conf.
How was this patch tested?
Add a unit test.