public class ZooKeeperHiveLockManager extends Object implements HiveLockManager
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG |
Constructor and Description |
---|
ZooKeeperHiveLockManager() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
List<HiveLock> |
getLocks(boolean verifyTablePartition,
boolean fetchData) |
List<HiveLock> |
getLocks(HiveLockObject key,
boolean verifyTablePartitions,
boolean fetchData) |
ZooKeeperHiveLock |
lock(HiveLockObject key,
HiveLockMode mode,
boolean keepAlive) |
List<HiveLock> |
lock(List<HiveLockObj> lockObjects,
boolean keepAlive,
DriverState driverState) |
void |
prepareRetry() |
void |
refresh()
refresh to enable new configurations.
|
static void |
releaseAllLocks(HiveConf conf) |
void |
releaseLocks(List<HiveLock> hiveLocks) |
void |
setContext(HiveLockManagerCtx ctx) |
void |
unlock(HiveLock hiveLock) |
public void setContext(HiveLockManagerCtx ctx) throws LockException
setContext
in interface HiveLockManager
ctx
- The lock manager context (containing the Hive configuration file)
Start the ZooKeeper client based on the zookeeper cluster specified in the conf.LockException
public void refresh()
HiveLockManager
refresh
in interface HiveLockManager
public List<HiveLock> lock(List<HiveLockObj> lockObjects, boolean keepAlive, DriverState driverState) throws LockException
lock
in interface HiveLockManager
lockObjects
- List of objects and the modes of the locks requestedkeepAlive
- Whether the lock is to be persisted after the statement
Acquire all the locks. Release all the locks and return null if any lock
could not be acquired.LockException
public void releaseLocks(List<HiveLock> hiveLocks)
releaseLocks
in interface HiveLockManager
hiveLocks
- list of hive locks to be released Release all the locks specified. If some of the
locks have already been released, ignore thempublic ZooKeeperHiveLock lock(HiveLockObject key, HiveLockMode mode, boolean keepAlive) throws LockException
lock
in interface HiveLockManager
key
- The object to be lockedmode
- The mode of the lockkeepAlive
- Whether the lock is to be persisted after the statement Acquire the
lock. Return null if a conflicting lock is present.LockException
public void unlock(HiveLock hiveLock) throws LockException
unlock
in interface HiveLockManager
LockException
public static void releaseAllLocks(HiveConf conf) throws Exception
Exception
public List<HiveLock> getLocks(boolean verifyTablePartition, boolean fetchData) throws LockException
getLocks
in interface HiveLockManager
LockException
public List<HiveLock> getLocks(HiveLockObject key, boolean verifyTablePartitions, boolean fetchData) throws LockException
getLocks
in interface HiveLockManager
LockException
public void close() throws LockException
close
in interface HiveLockManager
LockException
public void prepareRetry() throws LockException
prepareRetry
in interface HiveLockManager
LockException
Copyright © 2022 The Apache Software Foundation. All rights reserved.