Azkaban的线程系列 36:AzkabanWebServer-Cleaner-Thread

此线程 azkaban.executor.ExecutorManager$CleanerThread.run

-------------------------------------------------------------------------------------------------------------------------------------------------

// check every day

private static final long CLEANER_THREAD_WAIT_INTERVAL_MS = 24 * 60 * 60 * 1000;

根据上面的设置,每隔1天检查1次。

然后往下执行

private void cleanOldExecutionLogs(long millis) {

try {

int count = executorLoader.removeExecutionLogsByTime(millis);

logger.info("Cleaned up " + count + " log entries.");

} catch (ExecutorManagerException e) {

e.printStackTrace();

}

}

那么,int count = executorLoader.removeExecutionLogsByTime(millis);做了什么事情呢?

@Override

public int removeExecutionLogsByTime(long millis) throws ExecutorManagerException {

final String DELETE_BY_TIME = "DELETE FROM execution_logs WHERE upload_time < ?";

 

QueryRunner runner = createQueryRunner();

int updateNum = 0;

try {

updateNum = runner.update(DELETE_BY_TIME, millis);

} catch (SQLException e) {

e.printStackTrace();

throw new ExecutorManagerException("Error deleting old execution_logs before " + millis, e);

}

 

return updateNum;

}

其实就是删除执行的日志,从DB中删除,看来就是删除过期数据,

那么到底保留多少天的数据呢?


long executionLogsRetentionMs = azkProps.getLong("execution.logs.retention.ms",

DEFAULT_EXECUTION_LOGS_RETENTION_MS);

 

cleanerThread = new CleanerThread(executionLogsRetentionMs);

cleanerThread.start();

// 12 weeks

private static final long DEFAULT_EXECUTION_LOGS_RETENTION_MS = 3 * 4 * 7 * 24 * 60 * 60 * 1000L;

也就是说,默认保留3个礼拜的执行日志!


日志其实是executor server上传的!

你可能感兴趣的:(azkaban)