Skip to content

[SPARK-4991][CORE] Worker should reconnect to Master when Master actor restart #3825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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 @@ -89,6 +89,8 @@ private[deploy] object DeployMessages {
case class KillDriver(driverId: String) extends DeployMessage

case class ApplicationFinished(id: String)

case class MasterDisconnected(masterUrl: String) extends DeployMessage

// Worker internal

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,12 @@ private[spark] class Master(
" Asking it to re-register.")
sender ! ReconnectWorker(masterUrl)
} else {
// Get unknown worker's heart beat, tell the worker disconnected. And worker need to
// register to this master first.
logWarning(s"Got heartbeat from unregistered worker $workerId." +
" This worker was never registered, so ignoring the heartbeat.")
" This worker was never registered, tell the worker connection is disconnected." +
" Need to re-register if want to connect.")
sender ! MasterDisconnected(masterUrl)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,14 @@ private[spark] class Worker(
case ApplicationFinished(id) =>
finishedApps += id
maybeCleanupApplication(id)

case MasterDisconnected(masterUrl) =>
if (masterUrl != activeMasterUrl) {
logWarning(s"Get message from Invalid Master ($masterUrl)." +
s"Valid Master is : $activeMasterUrl, so ignore the message.")
} else {
masterDisconnected()
}
}

private def masterDisconnected() {
Expand Down