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

fix ListBackups for gcp and az to work with root directory #6873

Merged
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
11 changes: 8 additions & 3 deletions go/vt/mysqlctl/azblobbackupstorage/azblob.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,15 +276,20 @@ func (bs *AZBlobBackupStorage) containerURL() (*azblob.ContainerURL, error) {

// ListBackups implements BackupStorage.
func (bs *AZBlobBackupStorage) ListBackups(ctx context.Context, dir string) ([]backupstorage.BackupHandle, error) {
log.Infof("ListBackups: [azblob] container: %s, directory: %v", *containerName, objName(dir, ""))
var searchPrefix string
if dir == "/" {
searchPrefix = "/"
} else {
searchPrefix = objName(dir, "")
}

log.Infof("ListBackups: [azblob] container: %s, directory: %v", *containerName, searchPrefix)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this log line required? will it spam the logs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this log was originally in there, I just moved it below the searchPrefix assignment. I'm fine either way to remove it or not

Copy link
Member

@deepthi deepthi Oct 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can leave it in for now and remove it later if it becomes noisy.


containerURL, err := bs.containerURL()
if err != nil {
return nil, err
}

searchPrefix := objName(dir, "")

result := make([]backupstorage.BackupHandle, 0)
var subdirs []string

Expand Down
9 changes: 8 additions & 1 deletion go/vt/mysqlctl/gcsbackupstorage/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,14 @@ func (bs *GCSBackupStorage) ListBackups(ctx context.Context, dir string) ([]back

// List prefixes that begin with dir (i.e. list subdirs).
var subdirs []string
searchPrefix := objName(dir, "" /* include trailing slash */)

var searchPrefix string
if dir == "/" {
searchPrefix = ""
} else {
searchPrefix = objName(dir, "" /* include trailing slash */)
}

query := &storage.Query{
Delimiter: "/",
Prefix: searchPrefix,
Expand Down