in phoenix5-hive/src/main/java/org/apache/phoenix/hive/PhoenixRecordUpdater.java [268:318]
public void close(boolean abort) throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug("abort : " + abort);
}
try {
conn.commit();
if (LOG.isInfoEnabled()) {
LOG.info("Written row : " + numRecords);
}
} catch (SQLException e) {
LOG.error("SQLException while performing the commit for the task.");
throw new IOException(e);
} finally {
try {
if (restoreWalMode && PhoenixUtil.isDisabledWal(metaDataClient, tableName)) {
try {
PhoenixUtil.alterTableForWalDisable(conn, tableName, false);
} catch (ConcurrentTableMutationException e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Concurrent modification of disableWAL");
}
}
if (LOG.isDebugEnabled()) {
LOG.debug(tableName + "s wal enabled.");
}
}
// flush when [table-name].auto.flush is true.
String autoFlushConfigName = tableName.toLowerCase() +
PhoenixStorageHandlerConstants.AUTO_FLUSH;
boolean autoFlush = config.getBoolean(autoFlushConfigName, false);
if (autoFlush) {
if (LOG.isDebugEnabled()) {
LOG.debug("autoFlush is " + autoFlush);
}
PhoenixUtil.flush(conn, tableName);
}
PhoenixUtil.closeResource(pstmt);
PhoenixUtil.closeResource(pstmtForDelete);
PhoenixUtil.closeResource(conn);
} catch (SQLException ex) {
LOG.error("SQLException while closing the connection for the task.");
throw new IOException(ex);
}
}
}