Fixed a CHECK failure in master during agent removal.
Fixed a CHECK failure in master during agent removal.

Per MESOS-9609, it's possible for the master to encounter a CHECK
failure during agent removal in the following situation:

  1. Given a framework with checkpoint == false, with only
     executor(s) (no tasks) running on an agent:
  2. When this agent disconects from the master,
     Master::removeFramework(Slave*, Framework*) removes the
     tasks and executors. However, when there are no tasks, this
     function will accidentally insert an entry into
     Master::Slave::tasks! (Due to the [] operator usage)
  3. Now if the framework is removed, we have an entry in
     Slave::tasks, for which there is no corresponding framework.
  4. When the agent is removed, we have a CHECK failure given
     we can't find the framework.

This fixes the issue by avoiding the accidental insertion.

Review: https://reviews.apache.org/r/72831

dforsyth/mesos,reneploetz/mesos,Gilbert88/mesos,reneploetz/mesos,Gilbert88/mesos,Gilbert88/mesos,dforsyth/mesos,reneploetz/mesos,dforsyth/mesos,abudnik/mesos,Gilbert88/mesos,reneploetz/mesos,reneploetz/mesos,dforsyth/mesos,reneploetz/mesos,dforsyth/mesos,abudnik/mesos,dforsyth/mesos,abudnik/mesos,abudnik/mesos,dforsyth/mesos,Gilbert88/mesos,Gilbert88/mesos,abudnik/mesos,abudnik/mesos,Gilbert88/mesos,reneploetz/mesos,abudnik/mesos