GitHub user viirya opened a pull request: https://github.com/apache/spark/pull/16387
[SPARK-18986][Core] ExternalAppendOnlyMap shouldn't fail when forced to spill before calling its iterator ## What changes were proposed in this pull request? `ExternalAppendOnlyMap.forceSpill` now uses an assert to check if an iterator is not null in the map. However, the assertion is only true after the map is asked for iterator. Before it, if another memory consumer asks more memory than currently available, `ExternalAppendOnlyMap.forceSpill` is also be called too. In this case, we will see failure like this: [info] java.lang.AssertionError: assertion failed [info] at scala.Predef$.assert(Predef.scala:156) [info] at org.apache.spark.util.collection.ExternalAppendOnlyMap.forceSpill(ExternalAppendOnlyMap.scala:196) [info] at org.apache.spark.util.collection.Spillable.spill(Spillable.scala:111) [info] at org.apache.spark.util.collection.ExternalAppendOnlyMapSuite$$anonfun$13.apply$mcV$sp(ExternalAppendOnly MapSuite.scala:294) ## How was this patch tested? Jenkins tests. Please review http://spark.apache.org/contributing.html before opening a pull request. You can merge this pull request into a Git repository by running: $ git pull https://github.com/viirya/spark-1 fix-externalappendonlymap Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/16387.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #16387 ---- commit 2e4f34e54e92bfc47d817cb6392d89d660401b57 Author: Liang-Chi Hsieh <vii...@gmail.com> Date: 2016-12-23T04:59:01Z Return false when forceSpill is called before the map is asked for iterator. commit 03d4dc0afbba0217a322a20a999894640f43aecc Author: Liang-Chi Hsieh <vii...@gmail.com> Date: 2016-12-23T05:45:54Z Add test. ---- --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org