Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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 @@ -145,10 +145,16 @@ class FileStreamSource(

if (batchFiles.nonEmpty) {
metadataLogCurrentOffset += 1
metadataLog.add(metadataLogCurrentOffset, batchFiles.map { case (p, timestamp) =>

val fileEntries = batchFiles.map { case (p, timestamp) =>
FileEntry(path = p, timestamp = timestamp, batchId = metadataLogCurrentOffset)
}.toArray)
logInfo(s"Log offset set to $metadataLogCurrentOffset with ${batchFiles.size} new files")
}.toArray
if (metadataLog.add(metadataLogCurrentOffset, fileEntries)) {
logInfo(s"Log offset set to $metadataLogCurrentOffset with ${batchFiles.size} new files")
} else {
throw new IllegalStateException("Concurrent update to the log. Multiple streaming jobs " +
s"detected for $metadataLogCurrentOffset")
}
}

FileStreamSourceOffset(metadataLogCurrentOffset)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,8 @@ class MicroBatchExecution(
withProgressLocked {
sinkCommitProgress = batchSinkProgress
watermarkTracker.updateWatermark(lastExecution.executedPlan)
commitLog.add(currentBatchId, CommitMetadata(watermarkTracker.currentWatermark))
assert(commitLog.add(currentBatchId, CommitMetadata(watermarkTracker.currentWatermark)),
s"Concurrent update to the log. Multiple streaming jobs detected for $currentBatchId")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update to the log -> update to the commit log?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Addressed.

committedOffsets ++= availableOffsets
}
logDebug(s"Completed batch ${currentBatchId}")
Expand Down