fixed snapshot expire

This commit is contained in:
七锋
2018-10-27 00:47:50 +08:00
parent f822761ab2
commit fd7b9d766a

View File

@@ -84,16 +84,19 @@ public class DatabaseTableMeta implements TableMetaTSDB {
@Override @Override
public void run() { public void run() {
boolean applyResult = false;
try { try {
MDC.put("destination", destination); MDC.put("destination", destination);
applySnapshotToDB(lastPosition, false); applyResult = applySnapshotToDB(lastPosition, false);
} catch (Throwable e) { } catch (Throwable e) {
logger.error("scheudle applySnapshotToDB faield", e); logger.error("scheudle applySnapshotToDB faield", e);
} }
try { try {
MDC.put("destination", destination); MDC.put("destination", destination);
snapshotExpire((int) TimeUnit.HOURS.toSeconds(snapshotExpire)); if (applyResult) {
snapshotExpire((int) TimeUnit.HOURS.toSeconds(snapshotExpire));
}
} catch (Throwable e) { } catch (Throwable e) {
logger.error("scheudle snapshotExpire faield", e); logger.error("scheudle snapshotExpire faield", e);
} }