File tree Expand file tree Collapse file tree 2 files changed +9
-17
lines changed
main/scala/org/apache/spark/storage
test/scala/org/apache/spark/storage Expand file tree Collapse file tree 2 files changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -199,22 +199,18 @@ object BlockFetcherIterator {
199199 // Get the local blocks while remote blocks are being fetched. Note that it's okay to do
200200 // these all at once because they will just memory-map some files, so they won't consume
201201 // any memory that might exceed our maxBytesInFlight
202- var fetchIndex = 0
203- try {
204- for (id <- localBlocksToFetch) {
205-
202+ for (id <- localBlocksToFetch) {
203+ try {
206204 // getLocalFromDisk never return None but throws BlockException
207205 val iter = getLocalFromDisk(id, serializer).get
208206 // Pass 0 as size since it's not in flight
209207 results.put(new FetchResult (id, 0 , () => iter))
210- fetchIndex += 1
211208 logDebug(" Got local block " + id)
212- }
213- } catch {
214- case e : Exception => {
215- logError(s " Error occurred while fetching local blocks " , e)
216- for (id <- localBlocksToFetch.drop(fetchIndex)) {
209+ } catch {
210+ case e : Exception => {
211+ logError(s " Error occurred while fetching local blocks " , e)
217212 results.put(new FetchResult (id, - 1 , null ))
213+ return
218214 }
219215 }
220216 }
Original file line number Diff line number Diff line change @@ -81,14 +81,10 @@ class BlockFetcherIteratorSuite extends FunSuite with Matchers {
8181 assert(iterator.next._2.isDefined, " 2nd element should be defined but is not actually defined" )
8282 assert(iterator.hasNext, " iterator should have 5 elements but actually has 2 elements" )
8383 // 3rd fetch should be failed
84- assert(! iterator.next._2.isDefined, " 3nd element should not be defined but is actually defined" )
84+ assert(! iterator.next._2.isDefined, " 3rd element should not be defined but is actually defined" )
8585 assert(iterator.hasNext, " iterator should have 5 elements but actually has 3 elements" )
86- // And then, all of local fetches should be failed
87- assert(! iterator.next._2.isDefined, " Rest of elements after non-defined element should not be defined " +
88- " but 4th element is actually defined" )
89- assert(iterator.hasNext, " iterator should have 5 elements but actually has 4 elements" )
90- assert(! iterator.next._2.isDefined, " Rest of elements after non-defined element should not be defined " +
91- " but 5th element is actually defined" )
86+ // Don't call next() after fetching non-defined element even if thare are rest of elements in the iterator.
87+ // Otherwise, BasicBlockFetcherIterator hangs up.
9288 }
9389
9490
You can’t perform that action at this time.
0 commit comments