Uh oh!
There was an error while loading. Please reload this page.
[SPARK-4027][Streaming] WriteAheadLogBackedBlockRDD to read received either from BlockManager or WAL in HDFS - #2931
[SPARK-4027][Streaming] WriteAheadLogBackedBlockRDD to read received either from BlockManager or WAL in HDFS#2931tdas wants to merge 13 commits into
Conversation
tdas
commented
Oct 24, 2014
@JoshRosen Can you take a look? |
SparkQA
commented
Oct 24, 2014
Test build #22152 has started for PR 2931 at commit
|
SparkQA
commented
Oct 24, 2014
Test build #22152 timed out for PR 2931 at commit |
AmplabJenkins
commented
Oct 24, 2014
Test FAILed. |
tdas
commented
Oct 24, 2014
Jenkins, test this. |
SparkQA
commented
Oct 24, 2014
Test build #420 has started for PR 2931 at commit
|
SparkQA
commented
Oct 24, 2014
Test build #420 has finished for PR 2931 at commit
|
harishreedharan
commented
Oct 24, 2014
The HdfsBackedRDDSuite is passing - not sure why there are some other failures. Maybe we are missing some cleanup? |
There was a problem hiding this comment.
Can you explain how this code gets the block locations of the segment of the file that the partition needs? The offsets dont seem to be passed on to the HDFSUtils.getBlockLocations
There was a problem hiding this comment.
Fixed this one in the PR sent to your repo.
There was a problem hiding this comment.
Does it make sense to take the SerializableWritable as the argument in the constructor (as being done in #2935) or should we just take the hadoopConf and wrap it in the SerializableWritable once that is merged? We don't want to change the interface later.
There was a problem hiding this comment.
For now I am leaving this as is. Lets revisit this later if needed.
JoshRosen
commented
Oct 25, 2014
I left a pass of fairly shallow style comments; I'll loop back later to offer more substantive feedback and to actually check that I understand this logic. |
Make sure getBlockLocations uses offset and length to find the blocks on...
SparkQA
commented
Oct 25, 2014
Test build #22189 has started for PR 2931 at commit
|
SparkQA
commented
Oct 25, 2014
Test build #22189 has finished for PR 2931 at commit
|
AmplabJenkins
commented
Oct 25, 2014
Test FAILed. |
Shutdown spark context after tests. Formatting/minor fixes
SparkQA
commented
Oct 27, 2014
Test build #22300 has started for PR 2931 at commit
|
SparkQA
commented
Oct 27, 2014
Test build #22300 has finished for PR 2931 at commit
|
JoshRosen
commented
Oct 29, 2014
This looks good to me. |
There was a problem hiding this comment.
nitpick: the common style in spark is
valstorageLevel:StorageLevel)
extendsBlockRDD[T](sc, blockIds) {rxin
commented
Oct 29, 2014
@harishreedharan / @tdas I made a few more comments. Most are just nits that I've left earlier. |
harishreedharan
commented
Oct 29, 2014
Thanks @rxin. Updates coming soon. |
tdas
commented
Oct 30, 2014
@rxin I updated. Only part i am not in agreement is the preferred location logic. |
SparkQA
commented
Oct 30, 2014
Test build #22521 has started for PR 2931 at commit
|
harishreedharan
commented
Oct 30, 2014
Apart from the readability, does one have a performance benefit over the other? |
SparkQA
commented
Oct 30, 2014
Test build #22521 has finished for PR 2931 at commit
|
AmplabJenkins
commented
Oct 30, 2014
Test PASSed. |
tdas
commented
Oct 30, 2014
@harishreedharan I dont think so. The block location is called only once in both, and the hdfs location is called only once and only if required. I dont think there is any issue in performance between these two possible different implementations. |
There was a problem hiding this comment.
Yeah its not very ideal as I think the most easy to understand is something like
if ( ) {
blockLocations
} else if ( ) {
segmentLocations
} else {
Seq.empty
}
but this isnt too bad if the above isn't possible
There was a problem hiding this comment.
actually this discussion is moot because we should just let getFileSegmentLocations return Seq[String] rather than Option[Seq[String]], and then this should only consist of two branches, accomplishable with a single getOrElse.
There was a problem hiding this comment.
This is the final version that I am doing then.
val blockLocations = getBlockIdLocations().get(partition.blockId)
def segmentLocations = HdfsUtils.getFileSegmentLocations(...)
blockLocations.getOrElse(segmentLocations)
There was a problem hiding this comment.
Correct. Once we make that change, I think both the getOrElse and the if..else solutions are equivalent - one is a scala way of doing things, and the other is the "traditional" way. The ones using def/lazy val is really a more scala way of doing it.
I have no preference for any one method, but would generally consider the overhead and performance incurred by each and I am not that much of an expert in scala to know.
rxin
commented
Oct 30, 2014
@tdas you also missed one other comments ... |
tdas
commented
Oct 30, 2014
@rxin, crap, i missed that. Personally I find the parenthesis ending in the next line more logical as braces always end in next line. But will do it in the interest of consistency. |
SparkQA
commented
Oct 30, 2014
Test build #22537 has started for PR 2931 at commit
|
SparkQA
commented
Oct 30, 2014
Test build #22537 has finished for PR 2931 at commit
|
AmplabJenkins
commented
Oct 30, 2014
Test PASSed. |
SparkQA
commented
Oct 30, 2014
Test build #22562 has started for PR 2931 at commit
|
tdas
commented
Oct 30, 2014
Alright! I think we have converged to the best solution here. I am going to wait for the tests to pass and then converge. Thanks @rxin and @JoshRosen for all the feedback! |
SparkQA
commented
Oct 30, 2014
Test build #22562 has finished for PR 2931 at commit
|
AmplabJenkins
commented
Oct 30, 2014
Test PASSed. |
As part of the initiative of preventing data loss on streaming driver failure, this sub-task implements a BlockRDD that is backed by HDFS. This BlockRDD can either read data from the Spark's BlockManager, or read the data from file-segments in write ahead log in HDFS.
Most of this code has been written by @harishreedharan