viirya commented on code in PR #59331:
URL: https://github.com/apache/spark/pull/59331#discussion_r4244154481
##########
core/src/main/java/org/apache/spark/memory/MemoryConsumer.java:
##########
@@ -28,6 +28,11 @@
* A memory consumer of {@link TaskMemoryManager} that supports spilling.
*
* Note: this only supports allocation / spilling of Tungsten memory.
+ *
+ * {@link TaskMemoryManager} tracks consumers by identity, so distinct
consumer instances are
+ * always tracked, spilled and reported separately, regardless of how they
implement
Review Comment:
Thanks, good catch. Scala `==`/`!=` here call `equals`, so being offered for
spilling is not enough on its own.
- `Spillable.spill`: changed to `trigger ne this`, with a new
`SpillableSuite` that spills when triggered by a distinct but equal consumer
and still skips a self-triggered spill. The existing subclasses
(`ExternalSorter`, `ExternalAppendOnlyMap`) use reference equality, so their
behavior is unchanged.
- `HybridQueue.spill`: #59282 already changes this check to `trigger eq
this` and adds "hybrid queue spills for another queue with the same fields" to
`RowQueueSuite`, so I left it to that PR rather than duplicate the change and
the test here. Once both are merged, the `MemoryConsumer` Javadoc holds for all
in-tree consumers.
I also updated the PR description: it now lists the four `TaskMemoryManager`
tests and `SpillableSuite`, shows `IdentityHashMap<>(4)`, and describes the
consumer-side check instead of saying nothing else is affected.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]