[ML] Add check to prevent NoSuchElementException (elastic/x-pack-elasticsearch#1147)
Original commit: elastic/x-pack-elasticsearch@dca4020734
This commit is contained in:
parent
f9b8c82137
commit
a11e52fea2
|
@ -81,8 +81,10 @@ public class DataStreamDiagnostics {
|
|||
*/
|
||||
public void flush() {
|
||||
// flush all we know
|
||||
if (movingBucketHistogram.isEmpty() == false) {
|
||||
flush(movingBucketHistogram.lastKey() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check bucketing of record. Report empty and sparse buckets.
|
||||
|
|
|
@ -259,6 +259,12 @@ public class DataStreamDiagnosticsTests extends ESTestCase {
|
|||
assertEquals(null, d.getLatestEmptyBucketTime());
|
||||
}
|
||||
|
||||
public void testFlushAfterZeroRecords() {
|
||||
DataStreamDiagnostics d = new DataStreamDiagnostics(job);
|
||||
d.flush();
|
||||
assertEquals(0, d.getBucketCount());
|
||||
}
|
||||
|
||||
private void sendManyDataPoints(DataStreamDiagnostics d, long recordTimestampInMsMin, long recordTimestampInMsMax, long howMuch) {
|
||||
|
||||
long range = recordTimestampInMsMax - recordTimestampInMsMin;
|
||||
|
|
Loading…
Reference in New Issue