Add ability to disable batch fetch tables and views from HMS#18274
Add ability to disable batch fetch tables and views from HMS#18274kokosing merged 2 commits intotrinodb:masterfrom
Conversation
|
Not sure where should I add a test to verify if setting new config property make an effect + if current place is the right place. |
5ee36fd to
ef8d13d
Compare
ef8d13d to
db3c754
Compare
db3c754 to
1884958
Compare
Added |
|
Apart from disabling it - can we have a fallback mechanism if the query failed during bulkload api ? |
@Praveen2112 on specific exception or all? Also there should be some recovery after some time? |
ffc0105 to
c9cd823
Compare
|
@Praveen2112 @findepi @kokosing I moved config property, add a tests and in case of thrift transport error I do a fallback to old mechanism. Please review |
There was a problem hiding this comment.
I don't like this test. You are testing the mock here.
How about using some TestHiveWithDisabledBatchFecthConnectorSmokeTest for this?
There was a problem hiding this comment.
I don't like this test. You are testing the mock here.
I'm only provide fake ThriftMetastoreClient (I saw this pattern in few tests) to get the expected behavior so I can test (ThriftHiveMetastore) if new added config property works.
I like new name, I will apply it.
There was a problem hiding this comment.
I could write test which runs real HMS and create more than 100 schemas/tables but this test would be slow + I have to run HMS in specific version which has a mentioned bug.
c9cd823 to
387c22a
Compare
There was a problem hiding this comment.
Can we use io.trino.plugin.hive.metastore.thrift.ThriftHiveMetastoreClient#alternativeCall for that?
Please mention in the message that there will be a fallback to a different method to retrieve the information.
I guess HMS is not going to change so we should not repeat calling wrong API for the next request again.
There was a problem hiding this comment.
Not sure if that easy, in that case I have to recreate and duplicate logic from:
io.trino.plugin.hive.HiveMetadata#listTables
io.trino.plugin.hive.HiveMetadata#listViews
io.trino.plugin.hive.HiveMetadata#listSchemaNames
Edit: hold on, I need to very this ^
I guess HMS is not going to change so we should not repeat calling wrong API for the next request again.
From https://issues.apache.org/jira/browse/HIVE-21028 it looks like particular problem was related to race condition, this is how author of the fix reproduce it locally:
I have manually tested this by slowing down the get_table_meta call and then dropping the database from another HMS.
So even with old version of HMS this should work in most of the cases.
There was a problem hiding this comment.
Or should we retry on a specific exception type ?
There was a problem hiding this comment.
The issue looks like a transient one so we could retry the next time
There was a problem hiding this comment.
Or should we retry on a specific exception type ?
I think there is not specific exception, just network related error:
Caused by: org.apache.thrift.transport.TTransportException: ip-10-210-216-228.ap-northeast-2.compute.internal:9083: Socket is closed by peer.
There was a problem hiding this comment.
@kokosing @Praveen2112 I try to implement this using alternativeCall. The implementation itself is trivial, but writing a tests for that is challenging. In that case I have to refactor ThriftHiveMetastoreClient so ThriftHiveMetastore.Iface(client) could be provided from outside but later creating test implementation of ThriftHiveMetastore.Iface with 211 methods is not easy to read.
|
@huberty89 Is this ready for merging? |
There was a problem hiding this comment.
Or should we retry on a specific exception type ?
There was a problem hiding this comment.
The issue looks like a transient one so we could retry the next time
387c22a to
8da5e17
Compare
For older versions of HMS fetching all tables and all views may end up in failure. https://issues.apache.org/jira/browse/HIVE-21028 In such case we need to use previous mechanism and fetch tables/views from each schema separately
8da5e17 to
4979b15
Compare
|
Thank you! |
|
Added docs in #18870 - but in the future, please make sure new configuration properties are documented when you add them @huberty89 |
Description
Look like previously introducing batching is not supported well by old versions of HMS, more in a linked issue
Additional context and related issues
Fixes #18111 introduced after #17127
Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
(x) Release notes are required, with the following suggested text: