use of org.apache.hadoop.hive.metastore.api.HeartbeatRequest in project hive by apache.
the class TestTxnHandler method testHeartbeatNoLock.
@Test
public void testHeartbeatNoLock() throws Exception {
HeartbeatRequest h = new HeartbeatRequest();
h.setLockid(29389839L);
try {
txnHandler.heartbeat(h);
fail("Told there was a lock, when there wasn't.");
} catch (NoSuchLockException e) {
}
}
use of org.apache.hadoop.hive.metastore.api.HeartbeatRequest in project hive by apache.
the class TestTxnHandler method testHeartbeatNoTxn.
@Test
public void testHeartbeatNoTxn() throws Exception {
// Test that when a transaction is aborted, the heartbeat fails
HeartbeatRequest h = new HeartbeatRequest();
h.setTxnid(939393L);
try {
txnHandler.heartbeat(h);
fail("Told there was a txn, when there wasn't.");
} catch (NoSuchTxnException e) {
}
}
use of org.apache.hadoop.hive.metastore.api.HeartbeatRequest in project hive by apache.
the class TestTxnHandler method testHeartbeatLock.
@Test
public void testHeartbeatLock() throws Exception {
conf.setTimeVar(HiveConf.ConfVars.HIVE_TXN_TIMEOUT, 1, TimeUnit.SECONDS);
HeartbeatRequest h = new HeartbeatRequest();
LockComponent comp = new LockComponent(LockType.EXCLUSIVE, LockLevel.DB, "mydb");
comp.setTablename("mytable");
comp.setPartitionname("mypartition=myvalue");
comp.setOperationType(DataOperationType.NO_TXN);
List<LockComponent> components = new ArrayList<LockComponent>(1);
components.add(comp);
LockRequest req = new LockRequest(components, "me", "localhost");
LockResponse res = txnHandler.lock(req);
assertTrue(res.getState() == LockState.ACQUIRED);
h.setLockid(res.getLockid());
for (int i = 0; i < 30; i++) {
try {
txnHandler.heartbeat(h);
} catch (NoSuchLockException e) {
fail("Told there was no lock, when the heartbeat should have kept it.");
}
}
}
use of org.apache.hadoop.hive.metastore.api.HeartbeatRequest in project hive by apache.
the class TestTxnHandler method testHeartbeatTxnAborted.
@Test
public void testHeartbeatTxnAborted() throws Exception {
// Test that when a transaction is aborted, the heartbeat fails
openTxn();
txnHandler.abortTxn(new AbortTxnRequest(1));
HeartbeatRequest h = new HeartbeatRequest();
h.setTxnid(1);
try {
txnHandler.heartbeat(h);
fail("Told there was a txn, when it should have been aborted.");
} catch (TxnAbortedException e) {
}
}
Aggregations