[ML] Default model_snapshots_retention_days to 1 (elastic/x-pack-elasticsearch#759)

relates elastic/x-pack-elasticsearch#722

Original commit: elastic/x-pack-elasticsearch@e68aaf229c
This commit is contained in:
Dimitris Athanasiou 2017-03-17 17:56:46 +00:00 committed by GitHub
parent 30ea37943c
commit ca931f4b39
3 changed files with 7 additions and 5 deletions

View File

@ -510,7 +510,7 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
private ModelDebugConfig modelDebugConfig;
private Long renormalizationWindowDays;
private TimeValue backgroundPersistInterval;
private Long modelSnapshotRetentionDays;
private Long modelSnapshotRetentionDays = 1L;
private Long resultsRetentionDays;
private Map<String, Object> customSettings;
private String modelSnapshotId;

View File

@ -119,9 +119,9 @@ public class DeleteExpiredDataIT extends SecurityIntegTestCase {
}
public void testDeleteExpiredData() throws Exception {
jobs.add(newJobBuilder("no-retention").build());
jobs.add(newJobBuilder("results-retention").setResultsRetentionDays(1L).build());
jobs.add(newJobBuilder("snapshots-retention").setModelSnapshotRetentionDays(2L).build());
jobs.add(newJobBuilder("no-retention").setResultsRetentionDays(null).setModelSnapshotRetentionDays(null).build());
jobs.add(newJobBuilder("results-retention").setResultsRetentionDays(1L).setModelSnapshotRetentionDays(null).build());
jobs.add(newJobBuilder("snapshots-retention").setResultsRetentionDays(null).setModelSnapshotRetentionDays(2L).build());
jobs.add(newJobBuilder("results-and-snapshots-retention").setResultsRetentionDays(1L).setModelSnapshotRetentionDays(2L).build());
long now = System.currentTimeMillis();

View File

@ -21,6 +21,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.hamcrest.Matchers.equalTo;
public class JobTests extends AbstractSerializingTestCase<Job> {
@Override
@ -53,7 +55,7 @@ public class JobTests extends AbstractSerializingTestCase<Job> {
assertNull(job.getModelDebugConfig());
assertNull(job.getRenormalizationWindowDays());
assertNull(job.getBackgroundPersistInterval());
assertNull(job.getModelSnapshotRetentionDays());
assertThat(job.getModelSnapshotRetentionDays(), equalTo(1L));
assertNull(job.getResultsRetentionDays());
assertNotNull(job.allFields());
assertFalse(job.allFields().isEmpty());