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

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

-------------------------------------------------------------------------------------------------------------------------------------------------
spa

// check every day线程

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

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

而后往下执行
rem

private void cleanOldExecutionLogs(long millis) {get

try {io

int count = executorLoader.removeExecutionLogsByTime(millis);date

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

} 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上传的!

相关文章
相关标签/搜索