Skip to content

Commit

Permalink
add a ms instead of ns to end time of the rebound chunk interval (#5351)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
sandeepsukhani authored Feb 10, 2022
1 parent 0afd113 commit 7fafe94
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/chunkenc/memchunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7fafe94

Please sign in to comment.