@@ -41,15 +41,21 @@ class BlockManagerDecommissionSuite extends SparkFunSuite with LocalSparkContext
41
41
runDecomTest(true , false , true )
42
42
}
43
43
44
- test(s " verify that shuffle blocks are migrated. " ) {
44
+ test(s " verify that shuffle blocks are migrated with force to disk " ) {
45
+ runDecomTest(false , true , false , remoteBlockSize = " 1" )
46
+ }
47
+
48
+ test(s " verify that shuffle blocks are migrated " ) {
45
49
runDecomTest(false , true , false )
46
50
}
47
51
48
52
test(s " verify that both migrations can work at the same time. " ) {
49
53
runDecomTest(true , true , false )
50
54
}
51
55
52
- private def runDecomTest (persist : Boolean , shuffle : Boolean , migrateDuring : Boolean ) = {
56
+ private def runDecomTest (persist : Boolean , shuffle : Boolean , migrateDuring : Boolean ,
57
+ remoteBlockSize : String = " 100000" ) = {
58
+
53
59
val master = s " local-cluster[ ${numExecs}, 1, 1024] "
54
60
val conf = new SparkConf ().setAppName(" test" ).setMaster(master)
55
61
.set(config.Worker .WORKER_DECOMMISSION_ENABLED , true )
@@ -75,16 +81,16 @@ class BlockManagerDecommissionSuite extends SparkFunSuite with LocalSparkContext
75
81
76
82
// Create a new RDD where we have sleep in each partition, we are also increasing
77
83
// the value of accumulator in each partition
78
- val sleepyRdd = input.mapPartitions { x =>
84
+ val baseRdd = input.mapPartitions { x =>
79
85
if (migrateDuring) {
80
86
Thread .sleep(500 )
81
87
}
82
88
accum.add(1 )
83
89
x.map(y => (y, y))
84
90
}
85
91
val testRdd = shuffle match {
86
- case true => sleepyRdd .reduceByKey(_ + _)
87
- case false => sleepyRdd
92
+ case true => baseRdd .reduceByKey(_ + _)
93
+ case false => baseRdd
88
94
}
89
95
90
96
// Listen for the job & block updates
@@ -182,7 +188,7 @@ class BlockManagerDecommissionSuite extends SparkFunSuite with LocalSparkContext
182
188
val blockLocs = rddUpdates.map{ update =>
183
189
(update.blockUpdatedInfo.blockId.name,
184
190
update.blockUpdatedInfo.blockManagerId)}
185
- val blocksToManagers = blockLocs.groupBy(_._1).mapValues(_.toSet. size)
191
+ val blocksToManagers = blockLocs.groupBy(_._1).mapValues(_.size)
186
192
assert(! blocksToManagers.filter(_._2 > 1 ).isEmpty,
187
193
s " We should have a block that has been on multiple BMs in rdds: \n ${rddUpdates} from: \n " +
188
194
s " ${blocksUpdated}\n but instead we got: \n ${blocksToManagers}" )
@@ -193,11 +199,11 @@ class BlockManagerDecommissionSuite extends SparkFunSuite with LocalSparkContext
193
199
val numDataLocs = blocksUpdated.filter{ update =>
194
200
val blockId = update.blockUpdatedInfo.blockId
195
201
blockId.isInstanceOf [ShuffleDataBlockId ]
196
- }.toSet. size
202
+ }.size
197
203
val numIndexLocs = blocksUpdated.filter{ update =>
198
204
val blockId = update.blockUpdatedInfo.blockId
199
205
blockId.isInstanceOf [ShuffleIndexBlockId ]
200
- }.toSet. size
206
+ }.size
201
207
assert(numDataLocs >= 1 , s " Expect shuffle data block updates in ${blocksUpdated}" )
202
208
assert(numIndexLocs >= 1 , s " Expect shuffle index block updates in ${blocksUpdated}" )
203
209
}
0 commit comments