neils-dev commented on code in PR #4116:
URL: https://github.com/apache/ozone/pull/4116#discussion_r1063930639


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneIdentityProvider.java:
##########
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.om;
+
+import org.apache.hadoop.ipc.IdentityProvider;
+import org.apache.hadoop.ipc.Schedulable;
+import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.S3Authentication;
+import 
org.apache.hadoop.ozone.protocolPB.OzoneManagerProtocolServerSideTranslatorPB;
+import org.apache.hadoop.security.UserGroupInformation;
+
+/**
+ * Ozone implementation of IdentityProvider used by
+ * Hadoop DecayRpcScheduler.
+ */
+public class OzoneIdentityProvider implements IdentityProvider {
+
+  public OzoneIdentityProvider() {
+  }
+
+  @Override
+  public String makeIdentity(Schedulable schedulable) {
+    S3Authentication s3Authentication =
+        OzoneManagerProtocolServerSideTranslatorPB.getS3Auth();

Review Comment:
   I have a concern about the thread context for setting the 
`DecayRpcScheduler` (Fair Call Queue instrumentation) user identity from the 
scope of the `OzoneManagerProtocolServerSideTranslatorPB` servicing the request 
(`processRequest`).  
   
https://github.com/apache/ozone/blob/f2f0afa9f683a940f33048b1f4c2f33dad2d2a26/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerProtocolServerSideTranslatorPB.java#L153
   
   After examining the thread context of setting the user identity in 
`OzoneManagerProtocolServiceSideTranslatorPB `and the thread contexts of the 
`DecayRpcScheduler` sampling the `identityProvider` there indeed is an 
inconsistency in thread context.
   
   The DecayRpcScheduler reads the identityProvider in two separate contexts 
for processing requests with two separate thread contexts,
   `i.) Server.Handler `- inline with the  
`OzoneManagerProtocolServiceSideTranslatorPB.processRequest` that extracts the 
user, here the user identity is used to update the `DecayRpcScheduler` metrics 
(which we see in JMX endpoint)   
   `ii.) Server.Reader` - the socket listener reader that sets the 
FairCallQueue 
   
   For the second thread context, ii `Server.Reader`, the context is 
_inconsistent_ with the `S3Auth `stored for the identityProvider.  We are 
unable to get the identity of the user from the `OzoneIdentityProvider` to set 
the priority level for the fair call queue with this. 
   
   @smengcl , following up on our discussions offline on this thread context 
inconsistency, do you have any thoughts on this?  I have an idea that I will 
try in the next few days and will follow up    



-- 
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]

Reply via email to