use of org.apache.hadoop.hive.ql.log.HushableRandomAccessFileAppender in project hive by apache.
the class TestOperationLoggingLayout method testHushableRandomAccessFileAppender.
@Test
public /**
* Test to make sure that appending log event to HushableRandomAccessFileAppender even after
* closing the corresponding operation would not throw an exception.
*/
void testHushableRandomAccessFileAppender() throws Exception {
// verify whether the sql operation log is generated and fetch correctly.
OperationHandle operationHandle = client.executeStatement(sessionHandle, sqlCntStar, null);
RowSet rowSetLog = client.fetchResults(operationHandle, FetchOrientation.FETCH_FIRST, 1000, FetchType.LOG);
Appender queryAppender;
Appender testQueryAppender;
String queryId = getQueryId(rowSetLog);
Assert.assertNotNull("Could not find query id, perhaps a logging message changed", queryId);
checkAppenderState("before operation close ", LogDivertAppender.QUERY_ROUTING_APPENDER, queryId, false);
queryAppender = getAppender(LogDivertAppender.QUERY_ROUTING_APPENDER, queryId);
checkAppenderState("before operation close ", LogDivertAppenderForTest.TEST_QUERY_ROUTING_APPENDER, queryId, false);
testQueryAppender = getAppender(LogDivertAppenderForTest.TEST_QUERY_ROUTING_APPENDER, queryId);
client.closeOperation(operationHandle);
appendHushableRandomAccessFileAppender(queryAppender);
appendHushableRandomAccessFileAppender(testQueryAppender);
}
Aggregations