39
39
import org .elasticsearch .transport .*;
40
40
41
41
import java .io .IOException ;
42
+ import java .util .Arrays ;
42
43
import java .util .List ;
43
44
import java .util .Map ;
44
45
import java .util .Queue ;
@@ -158,7 +159,7 @@ public PingResponse[] pingAndWait(TimeValue timeout) {
158
159
}, timeout );
159
160
}
160
161
161
- private void sendPings (int id , TimeValue timeout , boolean wait ) {
162
+ private void sendPings (final int id , TimeValue timeout , boolean wait ) {
162
163
UnicastPingRequest pingRequest = new UnicastPingRequest ();
163
164
pingRequest .id = id ;
164
165
pingRequest .timeout = timeout ;
@@ -185,11 +186,13 @@ private void sendPings(int id, TimeValue timeout, boolean wait) {
185
186
try {
186
187
transportService .connectToNode (nodeToSend );
187
188
} catch (ConnectTransportException e ) {
189
+ logger .trace ("[{}] failed to connect to {}" , e , id , nodeToSend );
188
190
latch .countDown ();
189
191
// can't connect to the node
190
192
continue ;
191
193
}
192
194
195
+ logger .trace ("[{}] connecting to {}, disconnect[{}]" , id , nodeToSend , disconnectX );
193
196
final boolean disconnect = disconnectX ;
194
197
transportService .sendRequest (nodeToSend , UnicastPingRequestHandler .ACTION , pingRequest , TransportRequestOptions .options ().withTimeout ((long ) (timeout .millis () * 1.25 )), new BaseTransportResponseHandler <UnicastPingResponse >() {
195
198
@@ -198,6 +201,7 @@ private void sendPings(int id, TimeValue timeout, boolean wait) {
198
201
}
199
202
200
203
@ Override public void handleResponse (UnicastPingResponse response ) {
204
+ logger .trace ("[{}] received response from {}: {}" , id , nodeToSend , Arrays .toString (response .pingResponses ));
201
205
try {
202
206
DiscoveryNodes discoveryNodes = nodesProvider .nodes ();
203
207
for (PingResponse pingResponse : response .pingResponses ) {
@@ -210,6 +214,7 @@ private void sendPings(int id, TimeValue timeout, boolean wait) {
210
214
}
211
215
if (!pingResponse .clusterName ().equals (clusterName )) {
212
216
// not part of the cluster
217
+ logger .debug ("[{}] filtering out response from {}, not same cluster_name [{}]" , pingResponse .target (), pingResponse .clusterName ().value ());
213
218
return ;
214
219
}
215
220
ConcurrentMap <DiscoveryNode , PingResponse > responses = receivedResponses .get (response .id );
@@ -228,6 +233,7 @@ private void sendPings(int id, TimeValue timeout, boolean wait) {
228
233
latch .countDown ();
229
234
if (exp instanceof ConnectTransportException ) {
230
235
// ok, not connected...
236
+ logger .trace ("failed to connect to {}" , exp , nodeToSend );
231
237
} else {
232
238
if (disconnect ) {
233
239
transportService .disconnectFromNode (nodeToSend );
0 commit comments