[SPARK-2532] WIP Consolidated shuffle fixes

Status of the PR
- [X] Cherry pick and merge changes from internal branch to spark master
- [X] Remove WIP comments and 2G branch references.
- [X] Tests for BlockObjectWriter
- [ ] Tests for ExternalAppendOnlyMap
- [ ] Tests for MapOutputTracker
- [ ] Tests for ShuffleBlockManager



Make sure to remove commented out debug code like this