Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.apache.hadoop.hive.metastore.annotation.NoReconnect;
import org.apache.hadoop.hive.metastore.api.*;
import org.apache.hadoop.hive.metastore.api.Package;
import org.apache.hadoop.hive.metastore.client.ThriftHiveMetaStoreClient;
import org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy;
import org.apache.thrift.TException;

Expand All @@ -47,6 +48,16 @@
@InterfaceStability.Evolving
public interface IMetaStoreClient extends AutoCloseable {

/**
* Returns the underlying Thrift client used to communicate with the Hive
* Metastore server, if this implementation exposes one. Default
* implementation throws {@link UnsupportedOperationException}.
*/
default ThriftHiveMetaStoreClient getThriftClient() {
throw new UnsupportedOperationException(
"MetaStore client does not expose a Thrift client");
}

/**
* Returns whether current client is compatible with conf argument or not
* @return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,15 @@ public static AtomicInteger getConnCount() {
return connCount;
}

/**
* Returns the underlying generated Thrift {@link ThriftHiveMetastore.Iface} that this
* client delegates to. Exposed for callers (such as Impala's CatalogMetastoreServer)
* that need to forward requests to the underlying snake_case Thrift API directly.
*/
public ThriftHiveMetastore.Iface getClient() {
return client;
}

@Override
public boolean isLocalMetaStore() {
return localMetaStore;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.hive.metastore;

import java.net.SocketException;
import org.apache.thrift.transport.TServerSocket;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransportException;

/**
* Wraps a {@link TServerSocket} and enables TCP keepalive on every accepted
* client connection. Useful for long-lived Metastore RPCs where idle
* connections might otherwise be dropped by intermediate firewalls/load
* balancers without notifying the application.
*/
public class TServerSocketKeepAlive extends TServerSocket {

public TServerSocketKeepAlive(TServerSocket serverSocket) throws TTransportException {
super(serverSocket.getServerSocket());
}

@Override
public TSocket accept() throws TTransportException {
TSocket ts = super.accept();
try {
ts.getSocket().setKeepAlive(true);
} catch (SocketException se) {
throw new TTransportException(se);
}
return ts;
}
}
2 changes: 1 addition & 1 deletion standalone-metastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
<httpcomponents.client.version>4.5.13</httpcomponents.client.version>
<pac4j-core.version>4.5.8</pac4j-core.version>
<nimbus-oauth.version>11.28</nimbus-oauth.version>
<jetty.version>9.4.57.v20241219</jetty.version>
<jetty.version>9.4.58.v20250814</jetty.version>
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
<keycloak.version>26.0.6</keycloak.version>
<!-- If upgrading, upgrade atlas as well in ql/pom.xml, which brings in some springframework dependencies transitively -->
Expand Down
Loading