mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-25 07:37:19 -04:00
Cleanup assert in DownsampleShardIndexer (#124751)
This commit is contained in:
parent
5f204938f8
commit
5bbc04bc66
1 changed files with 23 additions and 18 deletions
|
@ -457,24 +457,7 @@ class DownsampleShardIndexer {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
assert assertTsidAndTimestamp(tsidHash, timestamp);
|
||||||
* Sanity checks to ensure that we receive documents in the correct order
|
|
||||||
* - _tsid must be sorted in ascending order
|
|
||||||
* - @timestamp must be sorted in descending order within the same _tsid
|
|
||||||
*/
|
|
||||||
BytesRef lastTsid = downsampleBucketBuilder.tsid();
|
|
||||||
assert lastTsid == null || lastTsid.compareTo(tsidHash) <= 0
|
|
||||||
: "_tsid is not sorted in ascending order: ["
|
|
||||||
+ DocValueFormat.TIME_SERIES_ID.format(lastTsid)
|
|
||||||
+ "] -> ["
|
|
||||||
+ DocValueFormat.TIME_SERIES_ID.format(tsidHash)
|
|
||||||
+ "]";
|
|
||||||
assert tsidHash.equals(lastTsid) == false || lastTimestamp >= timestamp
|
|
||||||
: "@timestamp is not sorted in descending order: ["
|
|
||||||
+ timestampFormat.format(lastTimestamp)
|
|
||||||
+ "] -> ["
|
|
||||||
+ timestampFormat.format(timestamp)
|
|
||||||
+ "]";
|
|
||||||
lastTimestamp = timestamp;
|
lastTimestamp = timestamp;
|
||||||
|
|
||||||
if (tsidChanged || downsampleBucketBuilder.timestamp() != lastHistoTimestamp) {
|
if (tsidChanged || downsampleBucketBuilder.timestamp() != lastHistoTimestamp) {
|
||||||
|
@ -532,6 +515,28 @@ class DownsampleShardIndexer {
|
||||||
// buffer.clean() also overwrites all slots with zeros
|
// buffer.clean() also overwrites all slots with zeros
|
||||||
docIdBuffer.elementsCount = 0;
|
docIdBuffer.elementsCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanity checks to ensure that we receive documents in the correct order
|
||||||
|
* - _tsid must be sorted in ascending order
|
||||||
|
* - @timestamp must be sorted in descending order within the same _tsid
|
||||||
|
*/
|
||||||
|
boolean assertTsidAndTimestamp(BytesRef tsidHash, long timestamp) {
|
||||||
|
BytesRef lastTsid = downsampleBucketBuilder.tsid();
|
||||||
|
assert lastTsid == null || lastTsid.compareTo(tsidHash) <= 0
|
||||||
|
: "_tsid is not sorted in ascending order: ["
|
||||||
|
+ DocValueFormat.TIME_SERIES_ID.format(lastTsid)
|
||||||
|
+ "] -> ["
|
||||||
|
+ DocValueFormat.TIME_SERIES_ID.format(tsidHash)
|
||||||
|
+ "]";
|
||||||
|
assert tsidHash.equals(lastTsid) == false || lastTimestamp >= timestamp
|
||||||
|
: "@timestamp is not sorted in descending order: ["
|
||||||
|
+ timestampFormat.format(lastTimestamp)
|
||||||
|
+ "] -> ["
|
||||||
|
+ timestampFormat.format(timestamp)
|
||||||
|
+ "]";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void indexBucket(XContentBuilder doc) {
|
private void indexBucket(XContentBuilder doc) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue