From 55e88ef22dca49c3ed39d1853bd52976c275cde9 Mon Sep 17 00:00:00 2001 From: Gary Elliott Date: Wed, 6 Sep 2017 15:05:53 -0400 Subject: [PATCH] bigtable: Fail ListInstances when any zones fail Change-Id: I258d2f2eedc84aa02c4a71feac8c50db0b3b0714 Reviewed-on: https://code-review.googlesource.com/16550 Reviewed-by: kokoro Reviewed-by: Jonathan Amsterdam --- bigtable/admin.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bigtable/admin.go b/bigtable/admin.go index 5a7304a6deef..cfc9106dc8eb 100644 --- a/bigtable/admin.go +++ b/bigtable/admin.go @@ -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" @@ -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 {