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

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

commit cba5ea9ac64d0a430b7d37dbd1b408c0879faa02
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 0ae8e36..67572a3 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -3965,6 +3965,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