This is an automated email from the ASF dual-hosted git repository.
dengzh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new bbe6ec3 HIVE-25896: Remove getThreadId from IHMSHandler (#3017)
(Zhihua Deng, reviewed by Peter Vary and Karen Coppage)
bbe6ec3 is described below
commit bbe6ec3568ca0cb3deb880a0df3f27c8a69822dc
Author: dengzh <[email protected]>
AuthorDate: Wed Mar 9 10:12:41 2022 +0800
HIVE-25896: Remove getThreadId from IHMSHandler (#3017) (Zhihua Deng,
reviewed by Peter Vary and Karen Coppage)
---
.../hcatalog/listener/DbNotificationListener.java | 2 +-
.../TestPartitionExpressionProxyDefault.java | 3 ++-
.../cache/TestCachedStoreUpdateUsingEvents.java | 3 ++-
.../hive/metastore/security/TestDBTokenStore.java | 5 +++-
.../hive/ql/txn/compactor/CompactorTestUtil.java | 2 --
.../hive/ql/txn/compactor/TestCompactor.java | 3 ---
.../hadoop/hive/ql/stats/StatsUpdaterThread.java | 7 +-----
.../hive/ql/txn/compactor/CompactorThread.java | 10 --------
.../ql/txn/compactor/MetaStoreCompactorThread.java | 6 -----
.../hadoop/hive/ql/TxnCommandsBaseForTests.java | 1 -
.../metastore/TestHiveMetaStoreAuthorizer.java | 3 ++-
.../hive/ql/txn/compactor/CompactorTest.java | 1 -
.../hive/ql/txn/compactor/TestInitiator.java | 3 ---
.../hadoop/hive/ql/txn/compactor/TestWorker.java | 2 --
.../apache/hadoop/hive/metastore/HMSHandler.java | 29 ++--------------------
.../hadoop/hive/metastore/HMSHandlerContext.java | 8 ------
.../hadoop/hive/metastore/HiveMetaStore.java | 7 ++----
.../apache/hadoop/hive/metastore/IHMSHandler.java | 6 -----
.../hadoop/hive/metastore/MetaStoreThread.java | 9 +------
.../hadoop/hive/metastore/RawStoreProxy.java | 8 +++---
.../hadoop/hive/metastore/RetryingHMSHandler.java | 3 +--
.../hadoop/hive/metastore/TestAdminUser.java | 4 ++-
.../hadoop/hive/metastore/TestHiveMetaStore.java | 2 +-
.../hive/metastore/TestHiveMetaStoreMethods.java | 1 +
.../metastore/TestMetaStoreConnectionUrlHook.java | 1 +
.../hadoop/hive/metastore/TestRawStoreProxy.java | 2 +-
.../org/apache/hive/streaming/TestStreaming.java | 1 -
27 files changed, 29 insertions(+), 103 deletions(-)
diff --git
a/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java
b/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java
index fba6827..85a94a7 100644
---
a/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java
+++
b/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java
@@ -177,7 +177,7 @@ public class DbNotificationListener extends
TransactionalMetaStoreEventListener
if (cleaner == null) {
cleaner =
new CleanerThread(conf, RawStoreProxy.getProxy(conf, conf,
- MetastoreConf.getVar(conf, ConfVars.RAW_STORE_IMPL), 999999));
+ MetastoreConf.getVar(conf, ConfVars.RAW_STORE_IMPL)));
cleaner.start();
}
}
diff --git
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestPartitionExpressionProxyDefault.java
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestPartitionExpressionProxyDefault.java
index 729d6fb..dcb0828 100644
---
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestPartitionExpressionProxyDefault.java
+++
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestPartitionExpressionProxyDefault.java
@@ -33,7 +33,8 @@ public class TestPartitionExpressionProxyDefault {
@Test
public void checkPartitionExpressionProxy() throws MetaException {
Configuration conf = MetastoreConf.newMetastoreConf();
- HMSHandler hms = new HMSHandler("for testing", conf, true);
+ HMSHandler hms = new HMSHandler("for testing", conf);
+ hms.init();
Assert.assertEquals(PartitionExpressionForMetastore.class,
hms.getExpressionProxy().getClass());
}
diff --git
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/cache/TestCachedStoreUpdateUsingEvents.java
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/cache/TestCachedStoreUpdateUsingEvents.java
index 90de8ca..93b4f1d 100644
---
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/cache/TestCachedStoreUpdateUsingEvents.java
+++
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/cache/TestCachedStoreUpdateUsingEvents.java
@@ -68,7 +68,8 @@ public class TestCachedStoreUpdateUsingEvents {
TestTxnDbUtil.prepDb(conf);
- hmsHandler = new HMSHandler("testCachedStore", conf, true);
+ hmsHandler = new HMSHandler("testCachedStore", conf);
+ hmsHandler.init();
rawStore = new ObjectStore();
rawStore.setConf(hmsHandler.getConf());
diff --git
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/security/TestDBTokenStore.java
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/security/TestDBTokenStore.java
index 61451bb..156b2cd 100644
---
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/security/TestDBTokenStore.java
+++
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/security/TestDBTokenStore.java
@@ -26,6 +26,7 @@ import java.util.List;
import org.apache.hadoop.hive.metastore.HMSHandler;
import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;
+import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
import org.apache.hadoop.hive.metastore.security.DBTokenStore;
import
org.apache.hadoop.hive.metastore.security.DelegationTokenStore.TokenStoreException;
import org.apache.hadoop.io.Text;
@@ -49,7 +50,9 @@ public class TestDBTokenStore {
public void testDBTokenStore() throws TokenStoreException, MetaException,
IOException {
DelegationTokenStore ts = new DBTokenStore();
- ts.init(new HMSHandler("Test handler"),
HadoopThriftAuthBridge.Server.ServerMode.METASTORE);
+ HMSHandler hms = new HMSHandler("Test handler",
MetastoreConf.newMetastoreConf());
+ hms.init();
+ ts.init(hms, HadoopThriftAuthBridge.Server.ServerMode.METASTORE);
assertEquals(0, ts.getMasterKeys().length);
assertEquals(false,ts.removeMasterKey(-1));
try{
diff --git
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorTestUtil.java
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorTestUtil.java
index 99d17a2..899d7b4 100644
---
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorTestUtil.java
+++
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorTestUtil.java
@@ -150,7 +150,6 @@ class CompactorTestUtil {
hiveConf.setBoolVar(HiveConf.ConfVars.COMPACTOR_CRUD_QUERY_BASED,
isQueryBased);
TxnStore txnHandler = TxnUtils.getTxnStore(hiveConf);
Worker t = new Worker();
- t.setThreadId((int) t.getId());
t.setConf(hiveConf);
t.init(new AtomicBoolean(true));
CompactionRequest cr = new CompactionRequest(dbName, tblName,
compactionType);
@@ -195,7 +194,6 @@ class CompactorTestUtil {
HiveConf hiveConf = new HiveConf(hConf);
Cleaner t = new Cleaner();
- t.setThreadId((int) t.getId());
t.setConf(hiveConf);
t.init(new AtomicBoolean(true));
t.run();
diff --git
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestCompactor.java
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestCompactor.java
index 8e2a31c..f2da316 100644
---
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestCompactor.java
+++
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestCompactor.java
@@ -233,7 +233,6 @@ public class TestCompactor {
txnHandler.compact(rqst);
Worker worker = Mockito.spy(new Worker());
- worker.setThreadId((int) worker.getId());
worker.setConf(conf);
worker.init(new AtomicBoolean(true));
FieldSetter.setField(worker,
RemoteCompactorThread.class.getDeclaredField("msc"), mockedClient);
@@ -1830,7 +1829,6 @@ public class TestCompactor {
String dbName, String tblName, String... partNames) throws Exception {
TxnStore txnHandler = TxnUtils.getTxnStore(conf);
Worker t = new Worker();
- t.setThreadId((int) t.getId());
t.setConf(conf);
t.init(new AtomicBoolean(true));
if (partNames.length == 0) {
@@ -2057,7 +2055,6 @@ public class TestCompactor {
//Run MajorCompaction
TxnStore txnHandler = TxnUtils.getTxnStore(conf);
Worker t = new Worker();
- t.setThreadId((int) t.getId());
t.setConf(conf);
t.init(new AtomicBoolean(true));
CompactionRequest Cr = new CompactionRequest(dbName, tblName,
CompactionType.MAJOR);
diff --git
a/ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUpdaterThread.java
b/ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUpdaterThread.java
index f30cd8f..d69383e 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUpdaterThread.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUpdaterThread.java
@@ -125,11 +125,6 @@ public class StatsUpdaterThread extends Thread implements
MetaStoreThread {
}
@Override
- public void setThreadId(int threadId) {
- this.threadId = threadId;
- }
-
- @Override
public void init(AtomicBoolean stop) throws MetaException {
this.stop = stop;
setPriority(MIN_PRIORITY);
@@ -142,7 +137,7 @@ public class StatsUpdaterThread extends Thread implements
MetaStoreThread {
}
txnHandler = TxnUtils.getTxnStore(conf);
rs = RawStoreProxy.getProxy(conf, conf,
- MetastoreConf.getVar(conf, MetastoreConf.ConfVars.RAW_STORE_IMPL),
threadId);
+ MetastoreConf.getVar(conf, MetastoreConf.ConfVars.RAW_STORE_IMPL));
for (int i = 0; i < workers.length; ++i) {
workers[i] = new Thread(new WorkerRunnable(conf, user));
workers[i].setDaemon(true);
diff --git
a/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorThread.java
b/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorThread.java
index 9e825eb..796ef72 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorThread.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorThread.java
@@ -46,8 +46,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
/**
* Superclass for all threads in the compactor.
@@ -60,14 +58,9 @@ public abstract class CompactorThread extends Thread
implements Configurable {
protected AtomicBoolean stop;
- protected int threadId;
protected String hostName;
protected String runtimeVersion;
- public void setThreadId(int threadId) {
- this.threadId = threadId;
- }
-
@Override
public void setConf(Configuration configuration) {
// TODO MS-SPLIT for now, keep a copy of HiveConf around as we need to
call other methods with
@@ -182,13 +175,10 @@ public abstract class CompactorThread extends Thread
implements Configurable {
return Warehouse.getQualifiedName(t);
}
- private static AtomicInteger nextThreadId = new AtomicInteger(1000000);
-
public static void initializeAndStartThread(CompactorThread thread,
Configuration conf) throws Exception {
LOG.info("Starting compactor thread of type " +
thread.getClass().getName());
thread.setConf(conf);
- thread.setThreadId(nextThreadId.incrementAndGet());
thread.init(new AtomicBoolean());
thread.start();
}
diff --git
a/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/MetaStoreCompactorThread.java
b/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/MetaStoreCompactorThread.java
index 2e32b22..6a451d5 100644
---
a/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/MetaStoreCompactorThread.java
+++
b/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/MetaStoreCompactorThread.java
@@ -48,15 +48,9 @@ import static
org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.getDefaultCa
public class MetaStoreCompactorThread extends CompactorThread implements
MetaStoreThread {
protected TxnStore txnHandler;
- protected int threadId;
protected ScheduledExecutorService cycleUpdaterExecutorService;
@Override
- public void setThreadId(int threadId) {
- this.threadId = threadId;
- }
-
- @Override
public void init(AtomicBoolean stop) throws Exception {
super.init(stop);
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/TxnCommandsBaseForTests.java
b/ql/src/test/org/apache/hadoop/hive/ql/TxnCommandsBaseForTests.java
index c879b0a..88b5e00 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/TxnCommandsBaseForTests.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/TxnCommandsBaseForTests.java
@@ -259,7 +259,6 @@ public abstract class TxnCommandsBaseForTests {
default:
throw new IllegalArgumentException("Unknown type: " + type);
}
- t.setThreadId((int) t.getId());
t.setConf(hiveConf);
t.init(stop);
t.run();
diff --git
a/ql/src/test/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/TestHiveMetaStoreAuthorizer.java
b/ql/src/test/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/TestHiveMetaStoreAuthorizer.java
index 0da2291..e163002 100644
---
a/ql/src/test/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/TestHiveMetaStoreAuthorizer.java
+++
b/ql/src/test/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/TestHiveMetaStoreAuthorizer.java
@@ -82,7 +82,8 @@ public class TestHiveMetaStoreAuthorizer {
MetaStoreTestUtils.setConfForStandloneMode(conf);
- hmsHandler = new HMSHandler("test", conf, true);
+ hmsHandler = new HMSHandler("test", conf);
+ hmsHandler.init();
rawStore = new ObjectStore();
rawStore.setConf(hmsHandler.getConf());
// Create the 'hive' catalog with new warehouse directory
diff --git
a/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/CompactorTest.java
b/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/CompactorTest.java
index 54a1e21..f4ce773 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/CompactorTest.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/CompactorTest.java
@@ -362,7 +362,6 @@ public abstract class CompactorTest {
case CLEANER: t = new Cleaner(); break;
default: throw new RuntimeException("Huh? Unknown thread type.");
}
- t.setThreadId((int) t.getId());
t.setConf(conf);
stop.set(true);
t.init(stop);
diff --git
a/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator.java
b/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator.java
index a07427e..dd508a2 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator.java
@@ -982,7 +982,6 @@ public class TestInitiator extends CompactorTest {
// run and fail initiator
Initiator initiator = Mockito.spy(new Initiator());
- initiator.setThreadId((int) t.getId());
initiator.setConf(conf);
initiator.init(new AtomicBoolean(true));
doThrow(new RuntimeException("This was thrown on purpose by
testInitiatorFailure"))
@@ -1051,7 +1050,6 @@ public class TestInitiator extends CompactorTest {
// need to mock the runtime version, because the manifest file won't be
there in the mvn test setup
Initiator initiator = Mockito.spy(new Initiator());
- initiator.setThreadId((int) t.getId());
initiator.setConf(conf);
String runtimeVersion = "4.0.0-SNAPSHOT";
doReturn(runtimeVersion).when(initiator).getRuntimeVersion();
@@ -1104,7 +1102,6 @@ public class TestInitiator extends CompactorTest {
conf.setIntVar(HiveConf.ConfVars.HIVE_COMPACTOR_REQUEST_QUEUE, 3);
Initiator initiator = Mockito.spy(new Initiator());
- initiator.setThreadId((int) t.getId());
initiator.setConf(conf);
initiator.init(new AtomicBoolean(true));
initiator.run();
diff --git
a/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestWorker.java
b/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestWorker.java
index 734a618..b902c14 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestWorker.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestWorker.java
@@ -993,7 +993,6 @@ public class TestWorker extends CompactorTest {
txnHandler.compact(rqst);
Worker worker = Mockito.spy(new Worker());
- worker.setThreadId((int) t.getId());
worker.setConf(conf);
String workerVersion = "4.0.0-SNAPSHOT";
doReturn(workerVersion).when(worker).getRuntimeVersion();
@@ -1168,7 +1167,6 @@ public class TestWorker extends CompactorTest {
private TimeoutWorker getTimeoutWorker(HiveConf conf, ExecutorService
executor, boolean runForever,
boolean swallowInterrupt, CountDownLatch looped) throws Exception {
TimeoutWorker timeoutWorker = new TimeoutWorker(runForever,
swallowInterrupt, looped);
- timeoutWorker.setThreadId((int)timeoutWorker.getId());
timeoutWorker.setConf(conf);
timeoutWorker.init(new AtomicBoolean(false));
executor.submit(timeoutWorker);
diff --git
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
index 965ab77..83a838f 100644
---
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
+++
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
@@ -287,29 +287,7 @@ public class HMSHandler extends FacebookBase implements
IHMSHandler {
return expressionProxy;
}
- /**
- * Use {@link #getThreadId()} instead.
- * @return thread id
- */
- @Deprecated
- public static Integer get() {
- return HMSHandlerContext.getThreadId();
- }
-
- @Override
- public int getThreadId() {
- return HMSHandlerContext.getThreadId();
- }
-
- public HMSHandler(String name) throws MetaException {
- this(name, MetastoreConf.newMetastoreConf(), true);
- }
-
- public HMSHandler(String name, Configuration conf) throws MetaException {
- this(name, conf, true);
- }
-
- public HMSHandler(String name, Configuration conf, boolean init) throws
MetaException {
+ public HMSHandler(String name, Configuration conf) {
super(name);
this.conf = conf;
isInTest = MetastoreConf.getBoolVar(this.conf, ConfVars.HIVE_IN_TEST);
@@ -324,9 +302,6 @@ public class HMSHandler extends FacebookBase implements
IHMSHandler {
}
}
}
- if (init) {
- init();
- }
}
/**
@@ -651,7 +626,7 @@ public class HMSHandler extends FacebookBase implements
IHMSHandler {
Configuration newConf = new Configuration(conf);
String rawStoreClassName = MetastoreConf.getVar(newConf,
ConfVars.RAW_STORE_IMPL);
LOG.info("Opening raw store with implementation class: {}",
rawStoreClassName);
- return RawStoreProxy.getProxy(newConf, conf, rawStoreClassName,
HMSHandlerContext.getThreadId());
+ return RawStoreProxy.getProxy(newConf, conf, rawStoreClassName);
}
@VisibleForTesting
diff --git
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandlerContext.java
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandlerContext.java
index f46c917..c30b5b3 100644
---
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandlerContext.java
+++
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandlerContext.java
@@ -20,7 +20,6 @@ package org.apache.hadoop.hive.metastore;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
-import java.util.concurrent.atomic.AtomicInteger;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.metastore.txn.TxnStore;
@@ -34,8 +33,6 @@ public final class HMSHandlerContext {
private static final ThreadLocal<HMSHandlerContext> context =
ThreadLocal.withInitial(() -> new HMSHandlerContext());
- private static final AtomicInteger nextSerialNum = new AtomicInteger();
-
private RawStore rawStore;
private TxnStore txnStore;
@@ -50,7 +47,6 @@ public final class HMSHandlerContext {
// Thread local Map to keep track of modified meta conf keys
private Map<String, String> modifiedConfig = new HashMap<>();
- private Integer threadId = nextSerialNum.incrementAndGet();
// This will only be set if the metastore is being accessed from a metastore
Thrift server,
// not if it is from the CLI. Also, only if the TTransport being used to
connect is an
// instance of TSocket. This is also not set when kerberos is used.
@@ -88,10 +84,6 @@ public final class HMSHandlerContext {
return context.get().modifiedConfig;
}
- public static Integer getThreadId() {
- return context.get().threadId;
- }
-
public static Map<String, com.codahale.metrics.Timer.Context>
getTimerContexts() {
return context.get().timerContexts;
}
diff --git
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
index a5845bf..cd6691e 100644
---
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -129,7 +129,7 @@ public class HiveMetaStore extends ThriftHiveMetastore {
*/
static Iface newRetryingHMSHandler(Configuration conf)
throws MetaException {
- HMSHandler baseHandler = new HMSHandler("hive client", conf, false);
+ HMSHandler baseHandler = new HMSHandler("hive client", conf);
return RetryingHMSHandler.getProxy(conf, baseHandler, true);
}
@@ -367,7 +367,7 @@ public class HiveMetaStore extends ThriftHiveMetastore {
boolean tcpKeepAlive = MetastoreConf.getBoolVar(conf,
ConfVars.TCP_KEEP_ALIVE);
boolean useCompactProtocol = MetastoreConf.getBoolVar(conf,
ConfVars.USE_THRIFT_COMPACT_PROTOCOL);
boolean useSSL = MetastoreConf.getBoolVar(conf, ConfVars.USE_SSL);
- HMSHandler baseHandler = new HMSHandler("new db based metaserver", conf,
false);
+ HMSHandler baseHandler = new HMSHandler("new db based metaserver", conf);
AuthFactory authFactory = new AuthFactory(bridge, conf, baseHandler);
useSasl = authFactory.isSASLWithKerberizedHadoop();
@@ -733,13 +733,10 @@ public class HiveMetaStore extends ThriftHiveMetastore {
}
}
- private static int nextThreadId = 1000000;
-
private static void initializeAndStartThread(MetaStoreThread thread,
Configuration conf) throws
Exception {
LOG.info("Starting metastore thread of type " +
thread.getClass().getName());
thread.setConf(conf);
- thread.setThreadId(nextThreadId++);
thread.init(new AtomicBoolean());
thread.start();
}
diff --git
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/IHMSHandler.java
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/IHMSHandler.java
index f5f6046..9ff8436 100644
---
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/IHMSHandler.java
+++
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/IHMSHandler.java
@@ -41,12 +41,6 @@ public interface IHMSHandler extends
ThriftHiveMetastore.Iface, Configurable {
void init() throws MetaException;
/**
- * Get the id of the thread of this handler.
- * @return thread id
- */
- int getThreadId();
-
- /**
* Get a reference to the underlying RawStore.
* @return the RawStore instance.
* @throws MetaException if the creation of a new RawStore object is
necessary but fails.
diff --git
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreThread.java
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreThread.java
index 57bf36b..dabd61c 100644
---
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreThread.java
+++
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreThread.java
@@ -28,15 +28,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
public interface MetaStoreThread extends Configurable {
/**
- * Set the id for this thread.
- * @param threadId id of the thread
- */
- void setThreadId(int threadId);
-
- /**
* Initialize the thread. This must not be called until after
- * {@link #setConf(Configuration)} and {@link #setThreadId(int)}
- * have been called.
+ * {@link #setConf(Configuration)} has been called.
* @param stop a flag to watch for when to stop. If this value is set to
true,
* the thread will terminate the next time through its main loop.
*/
diff --git
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/RawStoreProxy.java
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/RawStoreProxy.java
index 775c163..a03b6b7 100644
---
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/RawStoreProxy.java
+++
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/RawStoreProxy.java
@@ -47,7 +47,7 @@ public class RawStoreProxy implements InvocationHandler {
private final long socketTimeout;
protected RawStoreProxy(Configuration hiveConf, Configuration conf,
- Class<? extends RawStore> rawStoreClass, int id) throws MetaException {
+ Class<? extends RawStore> rawStoreClass) throws MetaException {
this.conf = conf;
this.hiveConf = hiveConf;
this.socketTimeout = MetastoreConf.getTimeVar(hiveConf,
@@ -59,12 +59,12 @@ public class RawStoreProxy implements InvocationHandler {
this.base = ReflectionUtils.newInstance(rawStoreClass, conf);
}
- public static RawStore getProxy(Configuration hiveConf, Configuration conf,
String rawStoreClassName,
- int id) throws MetaException {
+ public static RawStore getProxy(Configuration hiveConf, Configuration conf,
String rawStoreClassName)
+ throws MetaException {
Class<? extends RawStore> baseClass =
JavaUtils.getClass(rawStoreClassName, RawStore.class);
- RawStoreProxy handler = new RawStoreProxy(hiveConf, conf, baseClass, id);
+ RawStoreProxy handler = new RawStoreProxy(hiveConf, conf, baseClass);
// Look for interfaces on both the class and all base classes.
return (RawStore)
Proxy.newProxyInstance(RawStoreProxy.class.getClassLoader(),
diff --git
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java
index 169ac02..d0cc5b3 100644
---
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java
+++
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java
@@ -100,7 +100,6 @@ public class RetryingHMSHandler implements
InvocationHandler {
@Override
public Object invoke(final Object proxy, final Method method, final Object[]
args) throws Throwable {
int retryCount = -1;
- int threadId = baseHandler.getThreadId();
boolean error = true;
PerfLogger perfLogger = PerfLogger.getPerfLogger(false);
perfLogger.perfLogBegin(CLASS_NAME, method.getName());
@@ -111,7 +110,7 @@ public class RetryingHMSHandler implements
InvocationHandler {
return result.result;
} finally {
StringBuilder additionalInfo = new StringBuilder();
- additionalInfo.append("threadId=").append(threadId).append("
retryCount=").append(retryCount)
+ additionalInfo.append("retryCount=").append(retryCount)
.append(" error=").append(error);
perfLogger.perfLogEnd(CLASS_NAME, method.getName(),
additionalInfo.toString());
}
diff --git
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestAdminUser.java
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestAdminUser.java
index d98d94b..4912775 100644
---
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestAdminUser.java
+++
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestAdminUser.java
@@ -38,7 +38,9 @@ public class TestAdminUser {
Configuration conf = MetastoreConf.newMetastoreConf();
MetastoreConf.setVar(conf, ConfVars.USERS_IN_ADMIN_ROLE, "adminuser");
MetaStoreTestUtils.setConfForStandloneMode(conf);
- RawStore rawStore = new HMSHandler("testcreateroot", conf).getMS();
+ HMSHandler hms = new HMSHandler("testcreateroot", conf);
+ hms.init();
+ RawStore rawStore = hms.getMS();
Role adminRole = rawStore.getRole(HMSHandler.ADMIN);
Assert.assertTrue(adminRole.getOwnerName().equals(HMSHandler.ADMIN));
Assert.assertEquals(rawStore.listPrincipalGlobalGrants(HMSHandler.ADMIN,
PrincipalType.ROLE)
diff --git
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java
index 19c575e..b453af1 100644
---
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java
+++
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java
@@ -3493,7 +3493,7 @@ public abstract class TestHiveMetaStore {
part.getSd().setLocation(tbl.getSd().getLocation() + "/partCol=1");
Warehouse wh = mock(Warehouse.class);
//Execute initializeAddedPartition() and it should not trigger
updatePartitionStatsFast() as DO_NOT_UPDATE_STATS is true
- HMSHandler hms = new HMSHandler("", conf, false);
+ HMSHandler hms = new HMSHandler("", conf);
Method m = hms.getClass().getDeclaredMethod("initializeAddedPartition",
Table.class, Partition.class,
boolean.class, EnvironmentContext.class);
m.setAccessible(true);
diff --git
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStoreMethods.java
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStoreMethods.java
index 58737db..0900073 100644
---
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStoreMethods.java
+++
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStoreMethods.java
@@ -46,6 +46,7 @@ public class TestHiveMetaStoreMethods {
MetaStoreTestUtils.setConfForStandloneMode(conf);
hmsHandler = new HMSHandler("hive-conf", conf);
+ hmsHandler.init();
}
protected void initConf() {
diff --git
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreConnectionUrlHook.java
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreConnectionUrlHook.java
index 710e205..3ec522b 100644
---
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreConnectionUrlHook.java
+++
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestMetaStoreConnectionUrlHook.java
@@ -44,5 +44,6 @@ public class TestMetaStoreConnectionUrlHook {
// Instantiating the HMSHandler with hive.metastore.checkForDefaultDb will
cause it to
// initialize an instance of the DummyRawStoreForJdoConnection
HMSHandler hms = new
HMSHandler("test_metastore_connection_url_hook_hms_handler", conf);
+ hms.init();
}
}
diff --git
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestRawStoreProxy.java
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestRawStoreProxy.java
index 2bf5d32..759594a6 100644
---
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestRawStoreProxy.java
+++
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestRawStoreProxy.java
@@ -53,7 +53,7 @@ public class TestRawStoreProxy {
Configuration conf = MetastoreConf.newMetastoreConf();
MetastoreConf.setTimeVar(conf,
MetastoreConf.ConfVars.CLIENT_SOCKET_TIMEOUT, 10,
TimeUnit.MILLISECONDS);
- RawStoreProxy rsp = new RawStoreProxy(conf, conf, TestStore.class, 1);
+ RawStoreProxy rsp = new RawStoreProxy(conf, conf, TestStore.class);
try {
rsp.invoke(null, TestStore.class.getMethod("exceptions"), new Object[]
{});
fail("an exception is expected");
diff --git a/streaming/src/test/org/apache/hive/streaming/TestStreaming.java
b/streaming/src/test/org/apache/hive/streaming/TestStreaming.java
index 71a1e6f..ce0b370 100644
--- a/streaming/src/test/org/apache/hive/streaming/TestStreaming.java
+++ b/streaming/src/test/org/apache/hive/streaming/TestStreaming.java
@@ -785,7 +785,6 @@ public class TestStreaming {
public static void runWorker(HiveConf hiveConf) throws Exception {
AtomicBoolean stop = new AtomicBoolean(true);
Worker t = new Worker();
- t.setThreadId((int) t.getId());
t.setConf(hiveConf);
t.init(stop);
t.run();