waitinfuture commented on code in PR #2346:
URL: 
https://github.com/apache/incubator-celeborn/pull/2346#discussion_r1512047948


##########
master/src/main/scala/org/apache/celeborn/service/deploy/master/Master.scala:
##########
@@ -850,6 +852,22 @@ private[celeborn] class Master(
       logInfo(s"Offered extra $offerSlotsExtraSize slots for $shuffleKey")
     }
 
+    if (authEnabled) {
+      // Pass application registration information to the workers
+      val pbApplicationMeta = PbApplicationMeta.newBuilder()
+        .setAppId(requestSlots.applicationId)
+        .setSecret(secretRegistry.getSecretKey(requestSlots.applicationId))
+        .build()
+      val transportMessage =
+        new TransportMessage(MessageType.APPLICATION_META, 
pbApplicationMeta.toByteArray)
+
+      slots.keySet().asScala.foreach { worker =>
+        logDebug(s"Sending app registration info to 
${worker.host}:${worker.internalPort}")
+        internalRpcEnvInUse.setupEndpointRef(
+          RpcAddress.apply(worker.host, worker.internalPort),
+          RpcNameConstants.WORKER_INTERNAL_EP).send(transportMessage)

Review Comment:
   `RequestSlots` is currently sent for each shuffleId, so it can happen 
multiple times for the same application, which will lead to exception in 
`SecretRegistryImpl#register`:
   ```
     public void register(String appId, String secret) {
       // TODO: Persist the secret in ratis. See 
https://issues.apache.org/jira/browse/CELEBORN-1234
       secrets.compute(
           appId,
           (id, oldVal) -> {
             if (oldVal != null) {
               throw new IllegalArgumentException("AppId " + appId + " is 
already registered.");
             }
             return secret;
           });
     }
   ```
   Further more, in the future the same shuffleId might also send multiple 
`RequestSlots`. Maybe we can just check whether secret is the same instead of 
throwing Exception, or avoid sending duplicate `APPLICATION_META` in Master.



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

Reply via email to