cxzl25 opened a new pull request #29605:
URL: https://github.com/apache/spark/pull/29605


   ### What changes were proposed in this pull request?
   This PR increases the thread safety of the `BytesToBytesMap`:
   - It makes the `iterator()` and `destructiveIterator()` methods used their 
own `Location` object. This used to be shared, and this was causing issues when 
the map was being iterated over in two threads by two different iterators.
   - Removes the `safeIterator()` function. This is not needed anymore.
   - Improves the documentation of a couple of methods w.r.t. thread-safety.
   
   ### Why are the changes needed?
   It is unexpected an iterator shares the object it is returning with all 
other iterators. This is a violation of the iterator contract, and it causes 
issues with iterators over a map that are consumed in different threads.
   
   ### Does this PR introduce any user-facing change?
   No
   
   ### How was this patch tested?
   add ut


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

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