org.apache.hadoop.hive.metastore.api.CheckLockRequest Java Examples
The following examples show how to use
org.apache.hadoop.hive.metastore.api.CheckLockRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HiveTableOperations.java From iceberg with Apache License 2.0 | 6 votes |
private long acquireLock() throws UnknownHostException, TException { final LockComponent lockComponent = new LockComponent(LockType.EXCLUSIVE, LockLevel.TABLE, database); lockComponent.setTablename(tableName); final LockRequest lockRequest = new LockRequest(Lists.newArrayList(lockComponent), System.getProperty("user.name"), InetAddress.getLocalHost().getHostName()); LockResponse lockResponse = metaStoreClient.lock(lockRequest); LockState state = lockResponse.getState(); long lockId = lockResponse.getLockid(); //TODO add timeout while (state.equals(LockState.WAITING)) { lockResponse = metaStoreClient.check_lock(new CheckLockRequest(lockResponse.getLockid())); state = lockResponse.getState(); } if (!state.equals(LockState.ACQUIRED)) { throw new CommitFailedException(format("Could not acquire the lock on %s.%s, " + "lock request ended in state %s", database, tableName, state)); } return lockId; }
Example #2
Source File: FederatedHMSHandlerTest.java From waggle-dance with Apache License 2.0 | 5 votes |
@Test public void check_lock() throws TException { CheckLockRequest request = new CheckLockRequest(); LockResponse expected = new LockResponse(); when(primaryClient.check_lock(request)).thenReturn(expected); LockResponse result = handler.check_lock(request); assertThat(result, is(expected)); }
Example #3
Source File: ThriftHiveMetastoreClient.java From presto with Apache License 2.0 | 4 votes |
@Override public LockResponse checkLock(long lockId) throws TException { return client.check_lock(new CheckLockRequest(lockId)); }
Example #4
Source File: FederatedHMSHandler.java From waggle-dance with Apache License 2.0 | 4 votes |
@Override @Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME) public LockResponse check_lock(CheckLockRequest rqst) throws NoSuchTxnException, TxnAbortedException, NoSuchLockException, TException { return getPrimaryClient().check_lock(rqst); }
Example #5
Source File: CatalogThriftHiveMetastore.java From metacat with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public LockResponse check_lock(final CheckLockRequest rqst) throws TException { throw unimplemented("check_lock", new Object[]{rqst}); }