Skip to content

Commit

Permalink
Pass tracker correctly. Add guard code
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Elliott <number101010@gmail.com>
  • Loading branch information
joe-elliott committed Feb 4, 2021
1 parent 7584089 commit f853fb2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tempodb/backend/gcs/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ func (rw *readerWriter) Append(ctx context.Context, name string, blockID uuid.UU

// CloseAppend implements backend.Writer
func (rw *readerWriter) CloseAppend(_ context.Context, tracker backend.AppendTracker) error {
if tracker == nil {
return nil
}

w := tracker.(*storage.Writer)
return w.Close()
}
Expand Down
4 changes: 4 additions & 0 deletions tempodb/backend/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ func (rw *readerWriter) Append(ctx context.Context, name string, blockID uuid.UU

// CloseAppend implements backend.Writer
func (rw *readerWriter) CloseAppend(ctx context.Context, tracker backend.AppendTracker) error {
if tracker == nil {
return nil
}

var dst *os.File = tracker.(*os.File)
return dst.Close()
}
Expand Down
4 changes: 4 additions & 0 deletions tempodb/backend/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ func (rw *readerWriter) Append(ctx context.Context, name string, blockID uuid.UU

// CloseAppend implements backend.Writer
func (rw *readerWriter) CloseAppend(ctx context.Context, tracker backend.AppendTracker) error {
if tracker == nil {
return nil
}

a := tracker.(appendTracker)
completeParts := make([]minio.CompletePart, 0)
for _, p := range a.parts {
Expand Down
2 changes: 1 addition & 1 deletion tempodb/encoding/compactor_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (c *CompactorBlock) Complete(ctx context.Context, tracker backend.AppendTra
}

// one final flush
_, bytesFlushed, err := c.FlushBuffer(ctx, tracker, w)
tracker, bytesFlushed, err := c.FlushBuffer(ctx, tracker, w)
if err != nil {
return 0, err
}
Expand Down

0 comments on commit f853fb2

Please sign in to comment.