Skip to content

Commit 6f063df

Browse files
authored
HIVE-29429: Support multiple parent classes in HMSHander (#6377)
1 parent 3dec709 commit 6f063df

File tree

16 files changed

+3711
-3317
lines changed

16 files changed

+3711
-3317
lines changed

itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestMetastoreVersion.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.apache.hadoop.hive.conf.HiveConf;
2626
import org.apache.hadoop.hive.conf.HiveConfForTest;
2727
import org.apache.hadoop.hive.metastore.api.MetaException;
28+
import org.apache.hadoop.hive.metastore.handler.BaseHandler;
2829
import org.apache.hadoop.hive.ql.DriverFactory;
2930
import org.apache.hadoop.hive.ql.IDriver;
3031
import org.apache.hadoop.hive.ql.metadata.Hive;
@@ -55,8 +56,7 @@ public class TestMetastoreVersion {
5556

5657
@Before
5758
public void setUp() throws Exception {
58-
59-
Field defDb = HMSHandler.class.getDeclaredField("currentUrl");
59+
Field defDb = BaseHandler.class.getDeclaredField("currentUrl");
6060
defDb.setAccessible(true);
6161
defDb.set(null, null);
6262
// reset defaults

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java

Lines changed: 160 additions & 3304 deletions
Large diffs are not rendered by default.

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandlerContext.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.util.Optional;
2323

2424
import org.apache.hadoop.conf.Configuration;
25+
import org.apache.hadoop.hive.metastore.handler.BaseHandler;
2526
import org.apache.hadoop.hive.metastore.txn.TxnStore;
2627
import org.apache.hadoop.hive.metastore.txn.TxnUtils;
2728

@@ -38,7 +39,7 @@ public final class HMSHandlerContext {
3839
private TxnStore txnStore;
3940

4041
// Thread local HMSHandler used during shutdown to notify meta listeners
41-
private HMSHandler hmsHandler;
42+
private BaseHandler hmsHandler;
4243

4344
// Thread local configuration is needed as many threads could make changes
4445
// to the conf using the connection hook
@@ -61,7 +62,7 @@ public static Optional<RawStore> getRawStore() {
6162
return Optional.ofNullable(context.get().rawStore);
6263
}
6364

64-
public static Optional<HMSHandler> getHMSHandler() {
65+
public static Optional<BaseHandler> getHMSHandler() {
6566
return Optional.ofNullable(context.get().hmsHandler);
6667
}
6768

@@ -96,7 +97,7 @@ public static void setTxnStore(TxnStore txnStore) {
9697
context.get().txnStore = txnStore;
9798
}
9899

99-
public static void setHMSHandler(HMSHandler hmsHandler) {
100+
public static void setHMSHandler(BaseHandler hmsHandler) {
100101
context.get().hmsHandler = hmsHandler;
101102
}
102103

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreInit.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static boolean updateConnectionURL(Configuration originalConf, Configuration act
8383
return false;
8484
}
8585

86-
static String getConnectionURL(Configuration conf) {
86+
public static String getConnectionURL(Configuration conf) {
8787
return MetastoreConf.getVar(conf, ConfVars.CONNECT_URL_KEY, "");
8888
}
8989

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/TSetIpAddressProcessor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore;
2525
import org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface;
26+
import org.apache.hadoop.hive.metastore.handler.BaseHandler;
2627
import org.apache.thrift.TException;
2728
import org.apache.thrift.protocol.TProtocol;
2829
import org.apache.thrift.transport.TSocket;
@@ -56,6 +57,6 @@ protected void setIpAddress(final TProtocol in) {
5657
}
5758

5859
protected void setIpAddress(final Socket inSocket) {
59-
HMSHandler.setThreadLocalIpAddress(inSocket.getInetAddress().getHostAddress());
60+
BaseHandler.setThreadLocalIpAddress(inSocket.getInetAddress().getHostAddress());
6061
}
6162
}

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/TransactionalValidationListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public final class TransactionalValidationListener extends MetaStorePreEventList
6060

6161
private final Set<String> supportedCatalogs = new HashSet<String>();
6262

63-
TransactionalValidationListener(Configuration conf) {
63+
public TransactionalValidationListener(Configuration conf) {
6464
super(conf);
6565
supportedCatalogs.add("hive");
6666
}

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@
7878

7979
import com.google.common.annotations.VisibleForTesting;
8080

81-
import static org.apache.hadoop.hive.metastore.HMSHandler.getPartValsFromName;
8281
import static org.apache.hadoop.hive.metastore.utils.MetaStoreServerUtils.findStaleColumns;
82+
import static org.apache.hadoop.hive.metastore.utils.MetaStoreServerUtils.getPartValsFromName;
8383
import static org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.getDefaultCatalog;
8484
import static org.apache.hadoop.hive.metastore.utils.StringUtils.normalizeIdentifier;
8585

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/directsql/DirectSqlUpdatePart.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@
7373
import java.util.stream.Collectors;
7474

7575
import static org.apache.hadoop.hive.common.StatsSetupConst.COLUMN_STATS_ACCURATE;
76-
import static org.apache.hadoop.hive.metastore.HMSHandler.getPartValsFromName;
7776
import static org.apache.hadoop.hive.metastore.directsql.MetastoreDirectSqlUtils.extractSqlClob;
7877
import static org.apache.hadoop.hive.metastore.directsql.MetastoreDirectSqlUtils.extractSqlInt;
7978
import static org.apache.hadoop.hive.metastore.directsql.MetastoreDirectSqlUtils.extractSqlLong;
8079
import static org.apache.hadoop.hive.metastore.directsql.MetastoreDirectSqlUtils.getModelIdentity;
80+
import static org.apache.hadoop.hive.metastore.utils.MetaStoreServerUtils.getPartValsFromName;
8181

8282
/**
8383
* This class contains the optimizations for MetaStore that rely on direct SQL access to

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/AppendPartitionHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
import org.slf4j.Logger;
4848
import org.slf4j.LoggerFactory;
4949

50-
import static org.apache.hadoop.hive.metastore.HMSHandler.getPartValsFromName;
5150
import static org.apache.hadoop.hive.metastore.utils.MetaStoreServerUtils.canUpdateStats;
51+
import static org.apache.hadoop.hive.metastore.utils.MetaStoreServerUtils.getPartValsFromName;
5252
import static org.apache.hadoop.hive.metastore.utils.MetaStoreServerUtils.updatePartitionStatsFast;
5353
import static org.apache.hadoop.hive.metastore.utils.MetaStoreServerUtils.validatePartitionNameCharacters;
5454
import static org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.getDefaultCatalog;

0 commit comments

Comments
 (0)