mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-05-17 08:36:55 +03:00
The DataBlock.GetTimestamps() was returning a slice of strings, which belong to the DataBlock. These strings are changed whenever the DataBlock is re-used for the next block. So these strings couldn't be assigned to logRow.timestamp and to tailProcessor.lastTimestamps, which outlive the DataBlock. The commit aa8c18fc9f5d44091d7ca92be6935eeaf3b85d7f broke this assumption, which triggered the following bugs: 1. The bug, which could return incorrectly sorted results from /select/logsql/query when the 'limit' query arg is passed to it. The endpoint must return the last 'limit' log entries on the selected time range in this case, and these log entries must be sorted by _time. 2. The bug, which could return incorrect results from /select/logsql/tail (e.g. it could incorrectly skip some matching logs, it could return the same logs multiple times and it could return out-of-order logs without proper sorting by _time). The solution is to return parsed timestamps from the DataBlock.GetTimestamps() function, so they could be safely used by the caller without worries that they could be changed while in use.