use of org.apache.hadoop.hive.metastore.api.GetAllWriteEventInfoRequest in project hive by apache.
the class CommitTxnHandler method getAllWriteEventInfo.
private List<WriteEventInfo> getAllWriteEventInfo(Context withinContext) throws Exception {
String contextDbName = StringUtils.normalizeIdentifier(withinContext.replScope.getDbName());
GetAllWriteEventInfoRequest request = new GetAllWriteEventInfoRequest(eventMessage.getTxnId());
request.setDbName(contextDbName);
List<WriteEventInfo> writeEventInfoList = withinContext.db.getMSC().getAllWriteEventInfo(request);
return ((writeEventInfoList == null) ? null : new ArrayList<>(Collections2.filter(writeEventInfoList, writeEventInfo -> {
assert (writeEventInfo != null);
// it should be skipped.
return (ReplUtils.tableIncludedInReplScope(withinContext.replScope, writeEventInfo.getTable()) && ReplUtils.tableIncludedInReplScope(withinContext.oldReplScope, writeEventInfo.getTable()) && !withinContext.getTablesForBootstrap().contains(writeEventInfo.getTable().toLowerCase()));
})));
}
use of org.apache.hadoop.hive.metastore.api.GetAllWriteEventInfoRequest in project hive by apache.
the class TestGetAllWriteEventInfo method testGetByWrongTable.
@Test
public void testGetByWrongTable() throws Exception {
GetAllWriteEventInfoRequest req = new GetAllWriteEventInfoRequest();
req.setTxnId(TXN_ID);
req.setDbName(DB_NAME);
req.setTableName("wrong_table");
List<WriteEventInfo> writeEventInfoList = client.getAllWriteEventInfo(req);
Assert.assertTrue(writeEventInfoList.isEmpty());
}
use of org.apache.hadoop.hive.metastore.api.GetAllWriteEventInfoRequest in project hive by apache.
the class TestGetAllWriteEventInfo method testGetByTxnId.
@Test
public void testGetByTxnId() throws Exception {
GetAllWriteEventInfoRequest req = new GetAllWriteEventInfoRequest();
req.setTxnId(TXN_ID);
List<WriteEventInfo> writeEventInfoList = client.getAllWriteEventInfo(req);
Assert.assertEquals(1, writeEventInfoList.size());
WriteEventInfo writeEventInfo = writeEventInfoList.get(0);
Assert.assertEquals(TXN_ID, writeEventInfo.getWriteId());
Assert.assertEquals(DB_NAME, writeEventInfo.getDatabase());
Assert.assertEquals(TABLE_NAME, writeEventInfo.getTable());
}
use of org.apache.hadoop.hive.metastore.api.GetAllWriteEventInfoRequest in project hive by apache.
the class TestGetAllWriteEventInfo method testGetByWrongDB.
@Test
public void testGetByWrongDB() throws Exception {
GetAllWriteEventInfoRequest req = new GetAllWriteEventInfoRequest();
req.setTxnId(TXN_ID);
req.setDbName("wrong_db");
List<WriteEventInfo> writeEventInfoList = client.getAllWriteEventInfo(req);
Assert.assertTrue(writeEventInfoList.isEmpty());
}
use of org.apache.hadoop.hive.metastore.api.GetAllWriteEventInfoRequest in project hive by apache.
the class TestGetAllWriteEventInfo method testGetByTxnIdAndTableName.
@Test
public void testGetByTxnIdAndTableName() throws Exception {
GetAllWriteEventInfoRequest req = new GetAllWriteEventInfoRequest();
req.setTxnId(TXN_ID);
req.setDbName(DB_NAME);
req.setTableName(TABLE_NAME);
List<WriteEventInfo> writeEventInfoList = client.getAllWriteEventInfo(req);
Assert.assertEquals(1, writeEventInfoList.size());
WriteEventInfo writeEventInfo = writeEventInfoList.get(0);
Assert.assertEquals(TXN_ID, writeEventInfo.getWriteId());
Assert.assertEquals(DB_NAME, writeEventInfo.getDatabase());
Assert.assertEquals(TABLE_NAME, writeEventInfo.getTable());
}
Aggregations