ericm-db opened a new pull request, #50595:
URL: https://github.com/apache/spark/pull/50595

   ### What changes were proposed in this pull request?
   Moves the unload operation away from task thread into the maintenance 
thread. To ensure unloading still occurs ASAP (rather than potentially waiting 
for the maintenance interval) as was introduced by 
https://issues.apache.org/jira/browse/SPARK-33827, we immediately trigger a 
maintenance thread to do the unload.
   
   This gives us an extra benefit that unloading other providers doesn't block 
the task thread. To capitalize on this, unload() should not hold the 
loadedProviders lock the entire time (which will block other task threads), but 
instead release it once it has deleted the unloading providers from the map and 
close the providers without the lock held.
   
   ### Why are the changes needed?
   Currently, both the task thread and maintenance thread can call unload() on 
a provider. This leads to a race condition where the maintenance could be 
conducting maintenance while the task thread is closing the provider, leading 
to unexpected behavior.
   
   ### Does this PR introduce any user-facing change?
   No
   
   ### How was this patch tested?
   Added unit test
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No


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

Reply via email to