Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paper over GCS backend corruption issues #5804

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
3 changes: 3 additions & 0 deletions physical/gcs/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gcs

import (
"context"
"crypto/md5"
"errors"
"fmt"
"io/ioutil"
Expand Down Expand Up @@ -177,6 +178,8 @@ func (b *Backend) Put(ctx context.Context, entry *physical.Entry) (retErr error)
// Insert
w := b.client.Bucket(b.bucket).Object(entry.Key).NewWriter(ctx)
w.ChunkSize = b.chunkSize
md5Array := md5.Sum(entry.Value)
w.MD5 = md5Array[:]
defer func() {
closeErr := w.Close()
if closeErr != nil {
Expand Down
4 changes: 2 additions & 2 deletions vault/expiration.go
Original file line number Diff line number Diff line change
Expand Up @@ -1384,14 +1384,14 @@ func (m *ExpirationManager) loadEntryInternal(ctx context.Context, leaseID strin
view := m.leaseView(ns)
out, err := view.Get(ctx, leaseID)
if err != nil {
return nil, errwrap.Wrapf("failed to read lease entry: {{err}}", err)
return nil, errwrap.Wrapf(fmt.Sprintf("failed to read lease entry %s: {{err}}", leaseID), err)
}
if out == nil {
return nil, nil
}
le, err := decodeLeaseEntry(out.Value)
if err != nil {
return nil, errwrap.Wrapf("failed to decode lease entry: {{err}}", err)
return nil, errwrap.Wrapf(fmt.Sprintf("failed to decode lease entry %s: {{err}}", leaseID), err)
}
le.namespace = ns

Expand Down