Sort shuffle read improvements

Hi @sryza , I've done some improvements in current SortSHuffleRead, would you mind help reviewing this and give me some comments, thanks a lot!

1. copy memory shuffle block from off-heap to on-heap if memory is allocated with direct memory to control the off-heap memory size.
2. Some code style modification and better failure processing logic.
From my test, there's two things I think we should be noted:

1. ShuffleMemoryManager will return negative acquired memory size, I think there's a bug inside the code.
2. The algorithm of calculating memory spilling size and spilling the related block is not always the optimal way: 

Here is the log:
```
14/11/17 13:34:47 INFO SortShuffleReader: Granted 391 memory is not enough to store shuffle block id shuffle_0_3441_836, block size 98673, spilling in-memory blocks to release the memory
14/11/17 13:34:47 INFO SortShuffleReader: Merged 1 in-memory blocks into file temp_shuffle_3609d291-25c9-4ed4-ab4f-24808591c413
14/11/17 13:34:47 INFO SortShuffleReader: Granted 391 memory is not enough to store shuffle block id shuffle_0_882_836, block size 99206, spilling in-memory blocks to release the memory
14/11/17 13:34:47 INFO SortShuffleReader: Merged 1 in-memory blocks into file temp_shuffle_d9ba992c-1d47-4464-959b-70da8d137076
14/11/17 13:34:47 INFO SortShuffleReader: Granted 391 memory is not enough to store shuffle block id shuffle_0_3040_836, block size 98881, spilling in-memory blocks to release the memory
14/11/17 13:34:47 INFO SortShuffleReader: Merged 1 in-memory blocks into file temp_shuffle_4868f7f4-b845-460a-8ce2-9f8f910e9df5
14/11/17 13:34:47 INFO SortShuffleReader: Granted 391 memory is not enough to store shuffle block id shuffle_0_3634_836, block size 101012, spilling in-memory blocks to release the memory
14/11/17 13:34:47 INFO SortShuffleReader: Merged 1 in-memory blocks into file temp_shuffle_21a8be76-5723-4089-bf07-0b835718fb3a
14/11/17 13:34:47 INFO SortShuffleReader: Granted 391 memory is not enough to store shuffle block id shuffle_0_2438_836, block size 100158, spilling in-memory blocks to release the memory
14/11/17 13:34:47 INFO SortShuffleReader: Merged 1 in-memory blocks into file temp_shuffle_f067b22d-8765-4a5b-a042-623e18b9cb85
14/11/17 13:34:47 INFO SortShuffleReader: Granted 391 memory is not enough to store shuffle block id shuffle_0_1636_836, block size 100055, spilling in-memory blocks to release the memory
14/11/17 13:34:47 INFO SortShuffleReader: Merged 1 in-memory blocks into file temp_shuffle_af05bc4a-996d-4730-bb4f-4073cb0c081d
14/11/17 13:34:47 INFO SortShuffleReader: Granted 391 memory is not enough to store shuffle block id shuffle_0_24_836, block size 100437, spilling in-memory blocks to release the memory
14/11/17 13:34:47 INFO SortShuffleReader: Merged 1 in-memory blocks into file temp_shuffle_c56e70ac-cb78-447a-a774-eb119c38e5a5
14/11/17 13:34:47 INFO SortShuffleReader: Granted 391 memory is not enough to store shuffle block id shuffle_0_2052_836, block size 99309, spilling in-memory blocks to release the memory
14/11/17 13:34:47 INFO SortShuffleReader: Merged 1 in-memory blocks into file temp_shuffle_ff5fe08c-277b-4fa4-9c8b-c61e5f9943b9
14/11/17 13:34:47 INFO SortShuffleReader: Granted 391 memory is not enough to store shuffle block id shuffle_0_624_836, block size 99535, spilling in-memory blocks to release the memory
14/11/17 13:34:47 INFO SortShuffleReader: Merged 1 in-memory blocks into file temp_shuffle_5e268de6-1cd4-434b-9986-a667b112d125
```

Seems ShuffleMemory of this thread is not increased after we spill 1 block, so as you can see we will always spill 1 block into disk, it's not efficient.