You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/12/21 20:06:53 UTC
[2/5] mesos git commit: Logged warning message if reading previous
boot ID fails.
Logged warning message if reading previous boot ID fails.
Not much we can do here, but as a general rule, we should never silently
ignore I/O errors.
Review: https://reviews.apache.org/r/53234/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c9807d60
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c9807d60
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c9807d60
Branch: refs/heads/master
Commit: c9807d60ad58a44513c812a6b6c08fbd352b441f
Parents: e5fe811
Author: Neil Conway <ne...@gmail.com>
Authored: Wed Dec 21 15:06:13 2016 -0500
Committer: Vinod Kone <vi...@gmail.com>
Committed: Wed Dec 21 15:06:13 2016 -0500
----------------------------------------------------------------------
src/slave/state.cpp | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/c9807d60/src/slave/state.cpp
----------------------------------------------------------------------
diff --git a/src/slave/state.cpp b/src/slave/state.cpp
index 8656694..7926117 100644
--- a/src/slave/state.cpp
+++ b/src/slave/state.cpp
@@ -75,11 +75,14 @@ Try<State> recover(const string& rootDir, bool strict)
// resources checkpoint file.
state.resources = resources.get();
- // Did the machine reboot? No need to recover slave state if the
- // machine has rebooted.
- if (os::exists(paths::getBootIdPath(rootDir))) {
- Try<string> read = os::read(paths::getBootIdPath(rootDir));
- if (read.isSome()) {
+ // If the machine has rebooted, skip recovering slave state.
+ const string& bootIdPath = paths::getBootIdPath(rootDir);
+ if (os::exists(bootIdPath)) {
+ Try<string> read = os::read(bootIdPath);
+ if (read.isError()) {
+ LOG(WARNING) << "Failed to read '"
+ << bootIdPath << "': " << read.error();
+ } else {
Try<string> id = os::bootId();
CHECK_SOME(id);