steveloughran commented on code in PR #49779: URL: https://github.com/apache/spark/pull/49779#discussion_r1942702521
########## core/src/main/scala/org/apache/spark/util/Utils.scala: ########## @@ -3214,12 +3219,28 @@ private[spark] class CallerContext( /** * Set up the caller context [[context]] by invoking Hadoop CallerContext API of - * [[HadoopCallerContext]]. + * [[HadoopCallerContext]], which is included in IPC calls. + * and the hadoop audit context, which may be included in cloud storage + * requests for collection in cloud service logs. */ - def setCurrentContext(): Unit = if (CallerContext.callerContextEnabled) { - val hdfsContext = new HadoopCallerContextBuilder(context).build() - HadoopCallerContext.setCurrent(hdfsContext) + def setCurrentContext(): Unit = { + setCurrentContext(CallerContext.callerContextEnabled) } + + /** + * Inner method to set the context. + * @param enabled should the thread-level contexts be updated? + */ + @VisibleForTesting + private[util] def setCurrentContext(enabled: Boolean): Unit = { + if (enabled) { + val hdfsContext = new HadoopCallerContextBuilder(context).build() + HadoopCallerContext.setCurrent(hdfsContext) + // audit context as passed down to object stores, use prefix "spark" + currentAuditContext.put("spark", context) Review Comment: yes! Rest of it is test related -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org