Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
00bcf8a
Avoid IO operations on empty files in BlockObjectWriter.
JoshRosen Apr 21, 2015
8fd89b4
Do not create empty files at all.
JoshRosen Apr 21, 2015
0db87c3
Reduce scope of FileOutputStream in ExternalSorter
JoshRosen Apr 21, 2015
7e2340d
Revert "Reduce scope of FileOutputStream in ExternalSorter"
JoshRosen Apr 22, 2015
8113eac
Hacky WIP towards speculatively running w/o reset(), then retrying wi…
JoshRosen Jun 5, 2015
417f50e
Hackily comment out most of dev/run-tests to speed up Jenkins iteration.
JoshRosen Jun 5, 2015
f90dc94
Don't pass configuration to ObjectWritable in SerializableWritable
JoshRosen Jun 5, 2015
480d20a
Broadcast configuration in hiveWriterContainers (WIP hack)
JoshRosen Jun 5, 2015
55041d2
Use local[*] instead of local[2]
JoshRosen Jun 5, 2015
57c2cb4
try in-memory Derby
JoshRosen Jun 5, 2015
9db0abc
Avoid writing empty files in BypassMergeSortShuffleWriter
JoshRosen Jun 5, 2015
9e116d1
Rework SPARK-7041 for BypassMergeSort split
JoshRosen Jun 5, 2015
3fe16e8
Revert "Broadcast configuration in hiveWriterContainers (WIP hack)"
JoshRosen Jun 5, 2015
54cd5ce
Merge remote-tracking branch 'origin/master' into file-handle-optimiz…
JoshRosen Jun 5, 2015
5c777cf
Rework SPARK-7041 for BypassMergeSort split
JoshRosen Jun 5, 2015
5ac11d1
Revert "Use local[*] instead of local[2]"
JoshRosen Jun 5, 2015
895de59
Revert "try in-memory Derby"
JoshRosen Jun 5, 2015
bf30fee
Revert "Don't pass configuration to ObjectWritable in SerializableWri…
JoshRosen Jun 5, 2015
b1e3f82
Revert "Hacky WIP towards speculatively running w/o reset(), then ret…
JoshRosen Jun 5, 2015
5113370
Revert "Rework SPARK-7041 for BypassMergeSort split"
JoshRosen Jun 5, 2015
fac08d5
SPARK-8135. In SerializableWritable, don't load defaults when instant…
sryza Jun 5, 2015
c7caa5c
Merge remote-tracking branch 'origin/master' into file-handle-optimiz…
JoshRosen Jun 6, 2015
8c1e1ff
Merge branch 'file-handle-optimizations' into hive-compat-suite-speedup
JoshRosen Jun 8, 2015
2b500b9
Only run unsafe tests (testing a jenkins job)
JoshRosen Jun 12, 2015
fbd3d03
Add log4j test properties to unsafe project.
JoshRosen Jun 12, 2015
46dd005
Try only testing bagel instead (since I don't think Maven logs to uni…
JoshRosen Jun 12, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ public void insertAll(Iterator<Product2<K, V>> records) throws IOException {
blockManager.diskBlockManager().createTempShuffleBlock();
final File file = tempShuffleBlockIdPlusFile._2();
final BlockId blockId = tempShuffleBlockIdPlusFile._1();
// Note that we purposely do not call open() on the disk writers here; DiskBlockObjectWriter
// will automatically open() itself if necessary. This is an optimization to avoid file
// creation and truncation for empty partitions; this optimization probably doesn't make sense
// for most realistic production workloads, but it can make a large difference when playing
// around with Spark SQL queries in spark-shell on toy datasets: if you performed a query over
// an extremely small number of records then Spark SQL's default parallelism of 200 would
// result in slower out-of-the-box performance due to these constant-factor overheads. This
// optimization speeds up local microbenchmarking and SQL unit tests.
partitionWriters[i] =
blockManager.getDiskWriter(blockId, file, serInstance, fileBufferSize, writeMetrics);
}
Expand Down Expand Up @@ -144,6 +152,10 @@ public long[] writePartitionedFile(
try {
for (int i = 0; i < numPartitions; i++) {
if (partitionWriters[i].fileSegment().length() == 0) {
// In insertAll(), we didn't create empty files for empty reduce partitions; this branch
// handles that case. Since we'll be skipping deletion of these files, verify that they
// don't exist:
assert(!partitionWriters[i].fileSegment().file().exists());
continue;
}
final FileInputStream in = new FileInputStream(partitionWriters[i].fileSegment().file());
Expand Down Expand Up @@ -175,7 +187,8 @@ public void stop() throws IOException {
for (BlockObjectWriter writer : partitionWriters) {
// This method explicitly does _not_ throw exceptions:
writer.revertPartialWritesAndClose();
if (!diskBlockManager.getFile(writer.blockId()).delete()) {
final File file = diskBlockManager.getFile(writer.blockId());
if (file.exists() && !file.delete()) {
logger.error("Error while deleting file for block {}", writer.blockId());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,12 @@ private[spark] class DiskBlockObjectWriter(
objOut.flush()
bs.flush()
close()
}

val truncateStream = new FileOutputStream(file, true)
try {
truncateStream.getChannel.truncate(initialPosition)
} finally {
truncateStream.close()
val truncateStream = new FileOutputStream(file, true)
try {
truncateStream.getChannel.truncate(initialPosition)
} finally {
truncateStream.close()
}
}
} catch {
case e: Exception =>
Expand Down