Todd Lipcon has uploaded this change for review. (

Change subject: KUDU-2343. java: properly reconnect to new leader master after 

KUDU-2343. java: properly reconnect to new leader master after failover

This fixes the "fake" location information returned in response to a
ConnectToMaster RPC to include a distinct "fake UUID" for each master.
Previously, we were using an empty string for the UUID of the masters.
This caused collisions in the ConnectionCache, which is keyed by server

The fake UUID added by this patch matches the fake UUID already in use
by AsyncKuduClient.newMasterRpcProxy. This should allow us to share the
RPC connection between the ConnectToMaster RPCs and the subsequent
GetTableLocation RPCs, which is also a benefit for latency after a
failover or on a fresh client.

Additionally, this will help with various log messages that previously
would print an empty UUID string.

A prior version of this patch solved the problem by changing the key for
the ConnectionCache to be based on IP address, which has other benefits
in terms of future support for servers changing their DNS resolution at
runtime. However, since this patch is intended for backport into prior
releases, this simpler approach is taken for now. A TODO is added for
the longer-term idea.

An existing test which tested killing a master now runs in a second mode
which restarts the master. This reproduced the bug prior to the fix.
This patch also cleans up that test somewhat - it was doing some buggy
logic to attempt to kill more than one tablet server, but in fact just
called "killTabletServer" three times on the same one. Killing three
tablet servers never made sense, either, since the table in the test
only had three replicas. Neither did it make sense to start six tablet
servers for the test.

Change-Id: I36f96c6712800e398ed46887d97d4b09fd993b04
Reviewed-by: Alexey Serbin <>
Tested-by: Todd Lipcon <>
(cherry picked from commit 4c2bb92f14e1346928ef16dacd63812602683ed2)
M java/kudu-client/src/main/java/org/apache/kudu/client/
M java/kudu-client/src/main/java/org/apache/kudu/client/
M java/kudu-client/src/test/java/org/apache/kudu/client/
M java/kudu-client/src/test/java/org/apache/kudu/client/
6 files changed, 65 insertions(+), 19 deletions(-)

  git pull ssh:// refs/changes/16/9616/1
To view, visit
To unsubscribe, visit

Gerrit-Project: kudu
Gerrit-Branch: branch-1.6.x
Gerrit-MessageType: newchange
Gerrit-Change-Id: I36f96c6712800e398ed46887d97d4b09fd993b04
Gerrit-Change-Number: 9616
Gerrit-PatchSet: 1
Gerrit-Owner: Todd Lipcon <>

Reply via email to