You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2018/01/11 00:18:30 UTC
[5/5] mesos git commit: Replaced `os::read` with `state::read`.
Replaced `os::read` with `state::read`.
The `state::checkpoint` utility was updated to checkpoint
the automatically downgraded resources. This was done to mitigate
the need to manually invoke `downgradeResources` prior to
checkpointing. `state::read` was introduced to provide a symmetric
functionality for `state::checkpoint`. Specifically, it will perform
upgrade resources upon reading the checkpointed resources state.
This patch updates the previous uses of `os::read` which was used to
read the state that was written by `state::checkpoint(path, string)`.
While there is no functional change, it completes the picture where
`state::read` is used to read state written by `state::checkpoint`.
Review: https://reviews.apache.org/r/65025
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/3685c011
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/3685c011
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/3685c011
Branch: refs/heads/master
Commit: 3685c011bb71da0ba2af75691101ea383eeb2ccd
Parents: 80f6606
Author: Michael Park <mp...@apache.org>
Authored: Sat Jan 6 00:48:58 2018 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Wed Jan 10 15:57:11 2018 -0800
----------------------------------------------------------------------
.../containerizer/mesos/isolators/docker/volume/isolator.cpp | 2 +-
src/slave/containerizer/mesos/paths.cpp | 6 +++---
src/slave/state.cpp | 8 ++++----
src/tests/slave_recovery_tests.cpp | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/3685c011/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp b/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp
index deacffe..ba9e20c 100644
--- a/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp
+++ b/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp
@@ -263,7 +263,7 @@ Try<Nothing> DockerVolumeIsolatorProcess::_recover(
return Nothing();
}
- Try<string> read = os::read(volumesPath);
+ Try<string> read = state::read<string>(volumesPath);
if (read.isError()) {
return Error(
"Failed to read docker volumes checkpoint file '" +
http://git-wip-us.apache.org/repos/asf/mesos/blob/3685c011/src/slave/containerizer/mesos/paths.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/paths.cpp b/src/slave/containerizer/mesos/paths.cpp
index 4784d91..612c967 100644
--- a/src/slave/containerizer/mesos/paths.cpp
+++ b/src/slave/containerizer/mesos/paths.cpp
@@ -94,7 +94,7 @@ Result<pid_t> getContainerPid(
return None();
}
- Try<string> read = os::read(path);
+ Try<string> read = state::read<string>(path);
if (read.isError()) {
return Error("Failed to recover pid of container: " + read.error());
}
@@ -180,7 +180,7 @@ Result<pid_t> getContainerIOSwitchboardPid(
return None();
}
- Try<string> read = os::read(path);
+ Try<string> read = state::read<string>(path);
if (read.isError()) {
return Error("Failed to recover pid of io switchboard: " + read.error());
}
@@ -221,7 +221,7 @@ Result<unix::Address> getContainerIOSwitchboardAddress(
return None();
}
- Try<string> read = os::read(path);
+ Try<string> read = state::read<string>(path);
if (read.isError()) {
return Error("Failed reading '" + path + "': " + read.error());
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/3685c011/src/slave/state.cpp
----------------------------------------------------------------------
diff --git a/src/slave/state.cpp b/src/slave/state.cpp
index 63ae264..ff984e4 100644
--- a/src/slave/state.cpp
+++ b/src/slave/state.cpp
@@ -86,7 +86,7 @@ Try<State> recover(const string& rootDir, bool strict)
const string& bootIdPath = paths::getBootIdPath(rootDir);
if (os::exists(bootIdPath)) {
- Try<string> read = os::read(bootIdPath);
+ Try<string> read = state::read<string>(bootIdPath);
if (read.isError()) {
LOG(WARNING) << "Failed to read '"
<< bootIdPath << "': " << read.error();
@@ -240,7 +240,7 @@ Try<FrameworkState> FrameworkState::recover(
return state;
}
- Try<string> pid = os::read(path);
+ Try<string> pid = state::read<string>(path);
if (pid.isError()) {
message =
@@ -455,7 +455,7 @@ Try<RunState> RunState::recover(
return state;
}
- Try<string> pid = os::read(path);
+ Try<string> pid = state::read<string>(path);
if (pid.isError()) {
message = "Failed to read executor forked pid from '" + path +
@@ -491,7 +491,7 @@ Try<RunState> RunState::recover(
rootDir, slaveId, frameworkId, executorId, containerId);
if (os::exists(path)) {
- pid = os::read(path);
+ pid = state::read<string>(path);
if (pid.isError()) {
message = "Failed to read executor libprocess pid from '" + path +
http://git-wip-us.apache.org/repos/asf/mesos/blob/3685c011/src/tests/slave_recovery_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_recovery_tests.cpp b/src/tests/slave_recovery_tests.cpp
index 4d32a84..607fe5d 100644
--- a/src/tests/slave_recovery_tests.cpp
+++ b/src/tests/slave_recovery_tests.cpp
@@ -115,7 +115,7 @@ TEST_F(SlaveStateTest, CheckpointString)
const string file = "test-file";
slave::state::checkpoint(file, expected);
- EXPECT_SOME_EQ(expected, os::read(file));
+ EXPECT_SOME_EQ(expected, slave::state::read<string>(file));
}