Github user brkyvz commented on a diff in the pull request:
https://github.com/apache/spark/pull/9143#discussion_r43330013
--- Diff:
streaming/src/main/scala/org/apache/spark/streaming/scheduler/ReceivedBlockTracker.scala
---
@@ -195,30 +236,44 @@ private[streaming] class ReceivedBlockTracker(
timeToAllocatedBlocks --= batchTimes
}
+ def resolveEvent(event: ReceivedBlockTrackerLogEvent): Unit = {
+ event match {
+ case CombinedReceivedBlockTrackerLogEvent(events) =>
+ events.foreach(resolveEvent)
+ case BlockAdditionEvent(receivedBlockInfo) =>
+ insertAddedBlock(receivedBlockInfo)
+ case BatchAllocationEvent(time, allocatedBlocks) =>
+ insertAllocatedBatch(time, allocatedBlocks)
+ case BatchCleanupEvent(batchTimes) =>
+ cleanupBatches(batchTimes)
+ }
+ }
+
writeAheadLogOption.foreach { writeAheadLog =>
logInfo(s"Recovering from write ahead logs in
${checkpointDirOption.get}")
writeAheadLog.readAll().asScala.foreach { byteBuffer =>
logTrace("Recovering record " + byteBuffer)
- Utils.deserialize[ReceivedBlockTrackerLogEvent](
- byteBuffer.array, Thread.currentThread().getContextClassLoader)
match {
- case BlockAdditionEvent(receivedBlockInfo) =>
- insertAddedBlock(receivedBlockInfo)
- case BatchAllocationEvent(time, allocatedBlocks) =>
- insertAllocatedBatch(time, allocatedBlocks)
- case BatchCleanupEvent(batchTimes) =>
- cleanupBatches(batchTimes)
- }
+ resolveEvent(Utils.deserialize[ReceivedBlockTrackerLogEvent](
+ byteBuffer.array, Thread.currentThread().getContextClassLoader))
}
}
}
/** Write an update to the tracker to the write ahead log */
- private def writeToLog(record: ReceivedBlockTrackerLogEvent) {
- if (isWriteAheadLogEnabled) {
- logDebug(s"Writing to log $record")
+ private[streaming] def writeToLog(record: ReceivedBlockTrackerLogEvent):
Boolean = {
+ if (!isWriteAheadLogEnabled) return true
+ if (WriteAheadLogUtils.isBatchingEnabled(conf)) {
+ val promise = Promise[Boolean]()
+ walWriteStatusMap.put(record, promise)
+ walWriteQueue.offer(record)
+ Await.result(promise.future.recover { case _ => false
}(batchWriterThreadPool),
--- End diff --
we need to add a try-catch block with `TimeoutException` here which returns
`false`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]