public class Cleaner extends Thread
Thread.State, Thread.UncaughtExceptionHandler| Modifier and Type | Field and Description |
|---|---|
protected HiveConf |
conf |
protected AtomicBoolean |
looped |
protected RawStore |
rs |
protected AtomicBoolean |
stop |
protected int |
threadId |
protected TxnStore |
txnHandler |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
Cleaner() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
findUserToRunAs(String location,
org.apache.hadoop.hive.metastore.api.Table t)
Determine which user to run an operation as, based on the owner of the directory to be
compacted.
|
org.apache.hadoop.conf.Configuration |
getConf() |
void |
init(AtomicBoolean stop,
AtomicBoolean looped)
Initialize the thread.
|
protected org.apache.hadoop.hive.metastore.api.Partition |
resolvePartition(CompactionInfo ci)
Get the partition being compacted.
|
protected org.apache.hadoop.hive.metastore.api.StorageDescriptor |
resolveStorageDescriptor(org.apache.hadoop.hive.metastore.api.Table t,
org.apache.hadoop.hive.metastore.api.Partition p)
Get the storage descriptor for a compaction.
|
protected org.apache.hadoop.hive.metastore.api.Table |
resolveTable(CompactionInfo ci)
Find the table being compacted
|
void |
run() |
protected boolean |
runJobAsSelf(String owner)
Determine whether to run this job as the current user or whether we need a doAs to switch
users.
|
void |
setConf(org.apache.hadoop.conf.Configuration configuration) |
void |
setThreadId(int threadId)
Set the id for this thread.
|
protected String |
tableName(org.apache.hadoop.hive.metastore.api.Table t) |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitstartprotected HiveConf conf
protected TxnStore txnHandler
protected RawStore rs
protected int threadId
protected AtomicBoolean stop
protected AtomicBoolean looped
public void init(AtomicBoolean stop, AtomicBoolean looped) throws org.apache.hadoop.hive.metastore.api.MetaException
MetaStoreThreadConfigurable.setConf(Configuration) and MetaStoreThread.setThreadId(int)
have been called.init in interface MetaStoreThreadstop - 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.looped - a flag that is set to true everytime a thread goes through it's main loop.
This is purely for testing so that tests can assure themselves that the thread
has run through it's loop once. The test can set this value to false. The
thread should then assure that the loop has been gone completely through at
least once.org.apache.hadoop.hive.metastore.api.MetaExceptionpublic void setConf(org.apache.hadoop.conf.Configuration configuration)
setConf in interface org.apache.hadoop.conf.Configurablepublic org.apache.hadoop.conf.Configuration getConf()
getConf in interface org.apache.hadoop.conf.Configurablepublic void setThreadId(int threadId)
MetaStoreThreadsetThreadId in interface MetaStoreThreadthreadId - id of the threadprotected org.apache.hadoop.hive.metastore.api.Table resolveTable(CompactionInfo ci) throws org.apache.hadoop.hive.metastore.api.MetaException
ci - compaction info returned from the compaction queueorg.apache.hadoop.hive.metastore.api.MetaException - if the table cannot be found.protected org.apache.hadoop.hive.metastore.api.Partition resolvePartition(CompactionInfo ci) throws Exception
ci - compaction info returned from the compaction queueException - if underlying calls throw, or if the partition name resolves to more than
one partition.protected org.apache.hadoop.hive.metastore.api.StorageDescriptor resolveStorageDescriptor(org.apache.hadoop.hive.metastore.api.Table t,
org.apache.hadoop.hive.metastore.api.Partition p)
t - table from resolveTable(org.apache.hadoop.hive.metastore.txn.CompactionInfo)p - table from resolvePartition(org.apache.hadoop.hive.metastore.txn.CompactionInfo)protected String findUserToRunAs(String location, org.apache.hadoop.hive.metastore.api.Table t) throws IOException, InterruptedException
location - directory that will be read or written to.t - metastore table objectIOException - if neither the hive metastore user nor the table owner can stat
the location.InterruptedExceptionprotected boolean runJobAsSelf(String owner)
owner - of the directory we will be working in, as determined by
findUserToRunAs(String, org.apache.hadoop.hive.metastore.api.Table)protected String tableName(org.apache.hadoop.hive.metastore.api.Table t)
Copyright © 2019 The Apache Software Foundation. All Rights Reserved.