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上傳的!

相關文章
相關標籤/搜索