Browse Source

client: return partial replicas

If we get `ErrReplicaNotAvailable` we should still return any partial
replicas/isr that we have.
Evan Huus 8 years ago
parent
commit
84d87a3a41
1 changed files with 2 additions and 2 deletions
  1. 2 2
      client.go

+ 2 - 2
client.go

@@ -297,7 +297,7 @@ func (client *client) Replicas(topic string, partitionID int32) ([]int32, error)
 	}
 
 	if metadata.Err == ErrReplicaNotAvailable {
-		return nil, metadata.Err
+		return dupInt32Slice(metadata.Replicas), metadata.Err
 	}
 	return dupInt32Slice(metadata.Replicas), nil
 }
@@ -322,7 +322,7 @@ func (client *client) InSyncReplicas(topic string, partitionID int32) ([]int32,
 	}
 
 	if metadata.Err == ErrReplicaNotAvailable {
-		return nil, metadata.Err
+		return dupInt32Slice(metadata.Isr), metadata.Err
 	}
 	return dupInt32Slice(metadata.Isr), nil
 }