This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch 1.9.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 6a30d38dc2f976faa891e5601abe2ca8e5e317e5
Author: Benjamin Mahler <[email protected]>
AuthorDate: Wed Feb 12 22:09:57 2020 -0500

    Disallow reactivating a DRAINING agent.
    
    When reactivating an agent that's in the draining state, the master
    erases it from its draining maps, and erases its estimated drain time.
    However, it doesn't send any message to the agent, so if the agent is
    still draining and waiting for tasks to terminate, it will stay in
    that state, ultimately making any tasks that then get launched get
    DROPPED due to the agent still being in a draining state.
    
    To avoid this confusing scenario, we disallow reactivating a DRAINING
    agent, since that seems to have been the original design intent.
    
    Review: https://reviews.apache.org/r/72125
---
 src/master/http.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/master/http.cpp b/src/master/http.cpp
index a93718a..9cfdc77 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -4127,6 +4127,11 @@ Future<Response> Master::Http::_reactivateAgent(
     return BadRequest("Agent is not deactivated");
   }
 
+  if (master->slaves.draining.contains(slaveId) &&
+      master->slaves.draining.at(slaveId).state() == DRAINING) {
+    return BadRequest("Agent is still in the DRAINING state");
+  }
+
   // Save the reactivation to the registry.
   return master->registrar->apply(Owned<RegistryOperation>(
       new ReactivateAgent(slaveId)))

Reply via email to