Skip to content

Commit

Permalink
bigtable: Fail ListInstances when any zones fail
Browse files Browse the repository at this point in the history
Change-Id: I258d2f2eedc84aa02c4a71feac8c50db0b3b0714
Reviewed-on: https://code-review.googlesource.com/16550
Reviewed-by: kokoro <[email protected]>
Reviewed-by: Jonathan Amsterdam <[email protected]>
  • Loading branch information
garye committed Sep 7, 2017
1 parent adba27d commit 55e88ef
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bigtable/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import (
btapb "google.golang.org/genproto/googleapis/bigtable/admin/v2"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/grpc/codes"
)

const adminAddr = "bigtableadmin.googleapis.com:443"
Expand Down Expand Up @@ -379,6 +381,11 @@ func (iac *InstanceAdminClient) Instances(ctx context.Context) ([]*InstanceInfo,
if err != nil {
return nil, err
}
if len(res.FailedLocations) > 0 {
// We don't have a good way to return a partial result in the face of some zones being unavailable.
// Fail the entire request.
return nil, status.Errorf(codes.Unavailable, "Failed locations: %v", res.FailedLocations)
}

var is []*InstanceInfo
for _, i := range res.Instances {
Expand Down

0 comments on commit 55e88ef

Please sign in to comment.