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 CompactionTxnHandler |
txnHandler |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
Cleaner() |
Modifier and Type | Method and Description |
---|---|
protected String |
findUserToRunAs(String location,
Table t)
Determine which user to run an operation as, based on the owner of the directory to be
compacted.
|
void |
init(AtomicBoolean stop,
AtomicBoolean looped)
Initialize the thread.
|
protected Partition |
resolvePartition(CompactionInfo ci)
Get the partition being compacted.
|
protected StorageDescriptor |
resolveStorageDescriptor(Table t,
Partition p)
Get the storage descriptor for a compaction.
|
protected 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 |
setHiveConf(HiveConf conf)
Set the Hive configuration for this thread.
|
void |
setThreadId(int threadId)
Set the id for this thread.
|
protected String |
tableName(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, yield
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
start
protected HiveConf conf
protected CompactionTxnHandler txnHandler
protected RawStore rs
protected int threadId
protected AtomicBoolean stop
protected AtomicBoolean looped
public void setHiveConf(HiveConf conf)
MetaStoreThread
setHiveConf
in interface MetaStoreThread
public void setThreadId(int threadId)
MetaStoreThread
setThreadId
in interface MetaStoreThread
public void init(AtomicBoolean stop, AtomicBoolean looped) throws MetaException
MetaStoreThread
MetaStoreThread.setHiveConf(org.apache.hadoop.hive.conf.HiveConf)
and MetaStoreThread.setThreadId(int)
have been called.init
in interface MetaStoreThread
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.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.MetaException
protected Table resolveTable(CompactionInfo ci) throws MetaException
ci
- compaction info returned from the compaction queueMetaException
- if the table cannot be found.protected 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 StorageDescriptor resolveStorageDescriptor(Table t, 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, 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.InterruptedException
protected 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)
Copyright © 2017 The Apache Software Foundation. All rights reserved.