From 97765967ead6267b40de6d5b4c85e585ff6a2969 Mon Sep 17 00:00:00 2001 From: Ke Jia Date: Wed, 8 Apr 2026 11:31:07 +0100 Subject: [PATCH] Remove the synchronized lock in VeloxBroadcastBuildSideCache --- .../execution/VeloxBroadcastBuildSideCache.scala | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxBroadcastBuildSideCache.scala b/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxBroadcastBuildSideCache.scala index eadcb0f3493a..535fd8900e19 100644 --- a/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxBroadcastBuildSideCache.scala +++ b/backends-velox/src/main/scala/org/apache/gluten/execution/VeloxBroadcastBuildSideCache.scala @@ -57,7 +57,7 @@ object VeloxBroadcastBuildSideCache def getOrBuildBroadcastHashTable( broadcast: Broadcast[BuildSideRelation], - broadcastContext: BroadcastHashJoinContext): BroadcastHashTable = synchronized { + broadcastContext: BroadcastHashJoinContext): BroadcastHashTable = { buildSideRelationCache .get( @@ -76,14 +76,13 @@ object VeloxBroadcastBuildSideCache } /** This is callback from c++ backend. */ - def get(broadcastHashtableId: String): Long = - synchronized { - Option(buildSideRelationCache.getIfPresent(broadcastHashtableId)) - .map(_.pointer) - .getOrElse(0) - } + def get(broadcastHashtableId: String): Long = { + Option(buildSideRelationCache.getIfPresent(broadcastHashtableId)) + .map(_.pointer) + .getOrElse(0) + } - def invalidateBroadcastHashtable(broadcastHashtableId: String): Unit = synchronized { + def invalidateBroadcastHashtable(broadcastHashtableId: String): Unit = { // Cleanup operations on the backend are idempotent. buildSideRelationCache.invalidate(broadcastHashtableId) }