Search in sources :

Example 1 with HushableRandomAccessFileAppender

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);
}
Also used : Appender(org.apache.logging.log4j.core.Appender) LogDivertAppender(org.apache.hadoop.hive.ql.log.LogDivertAppender) RoutingAppender(org.apache.logging.log4j.core.appender.routing.RoutingAppender) HushableRandomAccessFileAppender(org.apache.hadoop.hive.ql.log.HushableRandomAccessFileAppender) RowSet(org.apache.hive.service.cli.RowSet) OperationHandle(org.apache.hive.service.cli.OperationHandle) LogDivertAppenderForTest(org.apache.hadoop.hive.ql.log.LogDivertAppenderForTest) Test(org.junit.Test)

Aggregations

HushableRandomAccessFileAppender (org.apache.hadoop.hive.ql.log.HushableRandomAccessFileAppender)1 LogDivertAppender (org.apache.hadoop.hive.ql.log.LogDivertAppender)1 LogDivertAppenderForTest (org.apache.hadoop.hive.ql.log.LogDivertAppenderForTest)1 OperationHandle (org.apache.hive.service.cli.OperationHandle)1 RowSet (org.apache.hive.service.cli.RowSet)1 Appender (org.apache.logging.log4j.core.Appender)1 RoutingAppender (org.apache.logging.log4j.core.appender.routing.RoutingAppender)1 Test (org.junit.Test)1