fapifta commented on a change in pull request #3658:
URL: https://github.com/apache/hadoop/pull/3658#discussion_r749290889
##########
File path:
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java
##########
@@ -1679,11 +1679,13 @@ private Connection getConnection(ConnectionId remoteId,
private final boolean doPing; //do we need to send ping message
private final int pingInterval; // how often sends ping to the server in
msecs
private String saslQop; // here for testing
+ private final AtomicBoolean fallbackToSimpleAuth;
private final Configuration conf; // used to get the expected kerberos
principal name
ConnectionId(InetSocketAddress address, Class<?> protocol,
UserGroupInformation ticket, int rpcTimeout,
- RetryPolicy connectionRetryPolicy, Configuration conf) {
+ RetryPolicy connectionRetryPolicy, Configuration conf,
+ AtomicBoolean fallbackToSimpleAuth) {
Review comment:
I have tried to simply use a boolean here, but it did not work, and I
realized that we need to distinguish between connections based on the reference
of the AtomicBoolean what Object.equals will do here.
Here is why:
If we pass in the boolean value of AtomicBoolean, then the event sequence is
this:
- dfs client created with atomic boolean set to false
- we get the connection based on connection id, and the boolean value false
- we call setupIOStreams at first connect, which sets the AtomicBoolean to
true
- at next call when we get a connection, we get an other one, based on the
boolean value true
- the next client at initialization will create an other AtomicBoolean, and
then gets the connection associated with the boolean value false, and never
initializes its own AtomicBoolean via setupIOStreams again
The situation is similar also, if we use the value of the AtomicBooleans in
the hashcode and equals.
That is why I chose to compare based on Object.equals (which will use
AtomicBoolean's equals, which falls back to Object.equals), and also the
hashcode method of AtomicBoolean (which will also give back something based on
the Object.hashcode).
With that every distinct client with its own AtomicBoolean will get a
distinct connection, and will initialize the fallback properly via
setupIOStreams.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]