Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/9127#discussion_r42805085
--- Diff:
core/src/main/scala/org/apache/spark/shuffle/ShuffleMemoryManager.scala ---
@@ -1,209 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.spark.shuffle
-
-import scala.collection.mutable
-import scala.collection.mutable.ArrayBuffer
-
-import com.google.common.annotations.VisibleForTesting
-
-import org.apache.spark._
-import org.apache.spark.memory.{StaticMemoryManager, MemoryManager}
-import org.apache.spark.storage.{BlockId, BlockStatus}
-import org.apache.spark.unsafe.array.ByteArrayMethods
-
-/**
- * Allocates a pool of memory to tasks for use in shuffle operations. Each
disk-spilling
- * collection (ExternalAppendOnlyMap or ExternalSorter) used by these
tasks can acquire memory
- * from this pool and release it as it spills data out. When a task ends,
all its memory will be
- * released by the Executor.
- *
- * This class tries to ensure that each task gets a reasonable share of
memory, instead of some
- * task ramping up to a large amount first and then causing others to
spill to disk repeatedly.
- * If there are N tasks, it ensures that each tasks can acquire at least 1
/ 2N of the memory
- * before it has to spill, and at most 1 / N. Because N varies
dynamically, we keep track of the
- * set of active tasks and redo the calculations of 1 / 2N and 1 / N in
waiting tasks whenever
- * this set changes. This is all done by synchronizing access to
`memoryManager` to mutate state
- * and using wait() and notifyAll() to signal changes.
- *
- * Use `ShuffleMemoryManager.create()` factory method to create a new
instance.
- *
- * @param memoryManager the interface through which this manager acquires
execution memory
- * @param pageSizeBytes number of bytes for each page, by default.
- */
-private[spark]
-class ShuffleMemoryManager protected (
- memoryManager: MemoryManager,
- val pageSizeBytes: Long)
- extends Logging {
-
- private val taskMemory = new mutable.HashMap[Long, Long]() //
taskAttemptId -> memory bytes
-
- private def currentTaskAttemptId(): Long = {
- // In case this is called on the driver, return an invalid task
attempt id.
- Option(TaskContext.get()).map(_.taskAttemptId()).getOrElse(-1L)
--- End diff --
It looks like I'll need to port this logic into Spillable so that those
collections can continue to be used on the driver.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]