-
Notifications
You must be signed in to change notification settings - Fork 28.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-19956][Core]Optimize a location order of blocks with topology information #17300
Closed
Closed
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -485,7 +485,7 @@ class BlockManagerSuite extends SparkFunSuite with Matchers with BeforeAndAfterE | |
assert(list2DiskGet.get.readMethod === DataReadMethod.Disk) | ||
} | ||
|
||
test("optimize a location order of blocks") { | ||
test("optimize a location order of blocks without topology information") { | ||
val localHost = Utils.localHostName() | ||
val otherHost = "otherHost" | ||
val bmMaster = mock(classOf[BlockManagerMaster]) | ||
|
@@ -497,7 +497,30 @@ class BlockManagerSuite extends SparkFunSuite with Matchers with BeforeAndAfterE | |
val blockManager = makeBlockManager(128, "exec", bmMaster) | ||
val getLocations = PrivateMethod[Seq[BlockManagerId]]('getLocations) | ||
val locations = blockManager invokePrivate getLocations(BroadcastBlockId(0)) | ||
assert(locations.map(_.host).toSet === Set(localHost, localHost, otherHost)) | ||
assert(locations.map(_.host) === Seq(localHost, localHost, otherHost)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should also be Seq. |
||
} | ||
|
||
test("optimize a location order of blocks with topology information") { | ||
val localHost = Utils.localHostName() | ||
val otherHost = "otherHost" | ||
val localRack = "localRack" | ||
val otherRack = "otherRack" | ||
|
||
val bmMaster = mock(classOf[BlockManagerMaster]) | ||
val bmId1 = BlockManagerId("id1", localHost, 1, Some(localRack)) | ||
val bmId2 = BlockManagerId("id2", localHost, 2, Some(localRack)) | ||
val bmId3 = BlockManagerId("id3", otherHost, 3, Some(otherRack)) | ||
val bmId4 = BlockManagerId("id4", otherHost, 4, Some(otherRack)) | ||
val bmId5 = BlockManagerId("id5", otherHost, 5, Some(localRack)) | ||
when(bmMaster.getLocations(mc.any[BlockId])) | ||
.thenReturn(Seq(bmId1, bmId2, bmId5, bmId3, bmId4)) | ||
|
||
val blockManager = makeBlockManager(128, "exec", bmMaster) | ||
val getLocations = PrivateMethod[Seq[BlockManagerId]]('getLocations) | ||
val locations = blockManager invokePrivate getLocations(BroadcastBlockId(0)) | ||
assert(locations.map(_.host) === Seq(localHost, localHost, otherHost, otherHost, otherHost)) | ||
assert(locations.flatMap(_.topologyInfo) | ||
=== Seq(localRack, localRack, localRack, otherRack, otherRack)) | ||
} | ||
|
||
test("SPARK-9591: getRemoteBytes from another location when Exception throw") { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
blockManagerId.topologyInfo
isNone
, we will prefer the locations with emptytopologyInfo
. It is slightly different with what the shuffling wants to do here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified, thanks a lot for the good advice.