Skip to content

Commit 3f5a19f

Browse files
authored
fix: add default endpoint for partition table (#63)
1 parent 9f9da95 commit 3f5a19f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ceresdb-protocol/src/main/java/io/ceresdb/RouterClient.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@
4444

4545
/**
4646
* A route rpc client which implement RouteMode.Direct
47-
*
47+
* <p>
4848
* cached the routing table information locally
4949
* and will refresh when the server returns an error code of INVALID_ROUTE
50-
*
5150
*/
5251
public class RouterClient implements Lifecycle<RouterOptions>, Display, Iterable<Route> {
5352

@@ -410,7 +409,11 @@ private CompletableFuture<Storage.RouteResponse> invokeRpc(final Storage.RouteRe
410409

411410
private Route toRouteObj(final Storage.Route r) {
412411
final Storage.Endpoint ep = Requires.requireNonNull(r.getEndpoint(), "CeresDB.Endpoint");
413-
return Route.of(r.getTable(), Endpoint.of(ep.getIp(), ep.getPort()));
412+
if (r.getEndpoint().getIp().isEmpty()) {
413+
return Route.of(r.getTable(), this.endpoint);
414+
} else {
415+
return Route.of(r.getTable(), Endpoint.of(ep.getIp(), ep.getPort()));
416+
}
414417
}
415418
}
416419
}

0 commit comments

Comments
 (0)