Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
SparkEnv modified to set SnappyUMM if in classpath.
  • Loading branch information
rmishra committed Nov 14, 2017
commit 78884fb2d8e4cb7908ec7b9f3e767af2fd706472
20 changes: 11 additions & 9 deletions core/src/main/scala/org/apache/spark/SparkEnv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,17 @@ object SparkEnv extends Logging {

val useLegacyMemoryManager = conf.getBoolean("spark.memory.useLegacyMode", false)
val memoryManager: MemoryManager =
conf.getOption("spark.memory.manager").filterNot(_.equalsIgnoreCase("default"))
.map(Utils.classForName(_)
.getConstructor(classOf[SparkConf], classOf[Int])
.newInstance(conf, Int.box(numUsableCores))
.asInstanceOf[MemoryManager]).getOrElse {
if (useLegacyMemoryManager) {
new StaticMemoryManager(conf, numUsableCores)
} else {
UnifiedMemoryManager(conf, numUsableCores)
SparkSnappyUtils.loadSnappyManager(conf, numUsableCores).getOrElse {
conf.getOption("spark.memory.manager").filterNot(_.equalsIgnoreCase("default"))
.map(Utils.classForName(_)
.getConstructor(classOf[SparkConf], classOf[Int])
.newInstance(conf, Int.box(numUsableCores))
.asInstanceOf[MemoryManager]).getOrElse {
if (useLegacyMemoryManager) {
new StaticMemoryManager(conf, numUsableCores)
} else {
UnifiedMemoryManager(conf, numUsableCores)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An explicit setting of "spark.memory.manager" should override SnappyUMM. So this should be changed in the getOrElse block of previous code:

      conf.getOption("spark.memory.manager").filterNot(_.equalsIgnoreCase("default"))
      ...
          .asInstanceOf[MemoryManager]).getOrElse {
            SparkSnappyUtils.loadSnappyManager(conf, numUsableCores).getOrElse {
              if (useLegacyMemoryManager)
              ...
            }
          }

}
}

Expand Down