Skip to content

Commit

Permalink
Update gcs.go
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytm authored Feb 27, 2024
1 parent 0e76332 commit ae17566
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions br/pkg/storage/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,39 +290,7 @@ func newGCSStorage(ctx context.Context, gcs *backuppb.GCS, opts *ExternalStorage
}

bucket := client.Bucket(gcs.Bucket)
<<<<<<< HEAD
// check whether it's a bug before #647, to solve case #2
// If the storage is set as gcs://bucket/prefix/,
// the backupmeta is written correctly to gcs://bucket/prefix/backupmeta,
// but the SSTs are written wrongly to gcs://bucket/prefix//*.sst (note the extra slash).
// see details about case 2 at https://github.com/pingcap/br/issues/675#issuecomment-753780742
sstInPrefix := hasSSTFiles(ctx, bucket, gcs.Prefix)
sstInPrefixSlash := hasSSTFiles(ctx, bucket, gcs.Prefix+"//")
if sstInPrefixSlash && !sstInPrefix {
// This is a old bug, but we must make it compatible.
// so we need find sst in slash directory
gcs.Prefix += "//"
}
return &gcsStorage{gcs: gcs, bucket: bucket}, nil
=======
return &GCSStorage{gcs: gcs, bucket: bucket, cli: client}, nil
}

func shouldRetry(err error) bool {
if storage.ShouldRetry(err) {
return true
}

// workaround for https://github.com/googleapis/google-cloud-go/issues/9262
if e := (&googleapi.Error{}); goerrors.As(err, &e) {
if e.Code == 401 && strings.Contains(e.Message, "Authentication required.") {
log.Warn("retrying gcs request due to internal authentication error", zap.Error(err))
return true
}
}

return false
>>>>>>> c92094fcb48 (external: remove old compatibility check of BR (#50534))
}

// gcsObjectReader wrap storage.Reader and add the `Seek` method.
Expand Down

0 comments on commit ae17566

Please sign in to comment.