Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pkg/chunk/aws_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,15 +432,13 @@ func (a awsStorageClient) GetChunks(ctx context.Context, chunks []Chunk) ([]Chun
var err error
s3Chunks, err = a.getS3Chunks(ctx, s3Chunks)
if err != nil {
return nil, err
return s3Chunks, err
}

dynamoDBChunks, err = a.getDynamoDBChunks(ctx, dynamoDBChunks)
if err != nil {
return nil, err
}

return append(dynamoDBChunks, s3Chunks...), nil
// Return any chunks we did receive: a partial result may be useful
return append(dynamoDBChunks, s3Chunks...), err
}

func (a awsStorageClient) getS3Chunks(ctx context.Context, chunks []Chunk) ([]Chunk, error) {
Expand Down Expand Up @@ -468,7 +466,8 @@ func (a awsStorageClient) getS3Chunks(ctx context.Context, chunks []Chunk) ([]Ch
}
}
if len(errors) > 0 {
return nil, errors[0]
// Return any chunks we did receive: a partial result may be useful
return result, errors[0]
}
return result, nil
}
Expand Down Expand Up @@ -575,7 +574,8 @@ func (a awsStorageClient) getDynamoDBChunks(ctx context.Context, chunks []Chunk)
}

if valuesLeft := outstanding.Len() + unprocessed.Len(); valuesLeft > 0 {
return nil, fmt.Errorf("failed to query chunks after %d retries, %d values remaining", numRetries, valuesLeft)
// Return the chunks we did fetch, because partial results may be useful
return result, fmt.Errorf("failed to query chunks after %d retries, %d values remaining", numRetries, valuesLeft)
}
return result, nil
}
Expand Down
10 changes: 6 additions & 4 deletions pkg/chunk/chunk_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,14 @@ func (c *Store) getMetricNameChunks(ctx context.Context, from, through model.Tim
}

fromStorage, err := c.storage.GetChunks(ctx, missing)
if err != nil {
return nil, promql.ErrStorage(err)

// Always cache any chunks we did get
if cacheErr := c.writeBackCache(ctx, fromStorage); cacheErr != nil {
logger.Warnf("Could not store chunks in chunk cache: %v", cacheErr)
}

if err = c.writeBackCache(ctx, fromStorage); err != nil {
logger.Warnf("Could not store chunks in chunk cache: %v", err)
if err != nil {
return nil, promql.ErrStorage(err)
}

// TODO instead of doing this sort, propagate an index and assign chunks
Expand Down