add a ms instead of ns to end time of the rebound chunk interval (#5351)

* add a ms instead of ns to end time of the rebound chunk interval

conversion between ms and ns loses ns precision which causes us to not include all the logs

* improve error when failing to rebound chunk
pull/5397/head
Sandeep Sukhani 3 years ago committed by GitHub
parent 0afd113c96
commit 7fafe94e1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      pkg/chunkenc/memchunk.go
  2. 2
      pkg/storage/stores/shipper/compactor/retention/retention.go

@ -911,8 +911,8 @@ func (c *MemChunk) Blocks(mintT, maxtT time.Time) []Block {
// Rebound builds a smaller chunk with logs having timestamp from start and end(both inclusive)
func (c *MemChunk) Rebound(start, end time.Time) (Chunk, error) {
// add a nanosecond to end time because the Chunk.Iterator considers end time to be non-inclusive.
itr, err := c.Iterator(context.Background(), start, end.Add(time.Nanosecond), logproto.FORWARD, log.NewNoopPipeline().ForStream(labels.Labels{}))
// add a millisecond to end time because the Chunk.Iterator considers end time to be non-inclusive.
itr, err := c.Iterator(context.Background(), start, end.Add(time.Millisecond), logproto.FORWARD, log.NewNoopPipeline().ForStream(labels.Labels{}))
if err != nil {
return nil, err
}

@ -152,7 +152,7 @@ func markforDelete(ctx context.Context, tableName string, marker MarkerStorageWr
if len(nonDeletedIntervals) > 0 {
wroteChunks, err := chunkRewriter.rewriteChunk(ctx, c, nonDeletedIntervals)
if err != nil {
return false, false, err
return false, false, fmt.Errorf("failed to rewrite chunk %s for interval %s with error %s", c.ChunkID, nonDeletedIntervals, err)
}
if wroteChunks {

Loading…
Cancel
Save