Fix GC'd alloc tracking

The Client.allocs map now contains all AllocRunners again, not just
un-GC'd AllocRunners. Client.allocs is only pruned when the server GCs
allocs.

Also stops logging "marked for GC" twice.
This commit is contained in:
Michael Schurter
2017-10-18 17:06:46 -07:00
committed by Preetha Appan
parent 0aeda0d39e
commit 9c1e595e2e
7 changed files with 200 additions and 168 deletions

View File

@@ -115,7 +115,8 @@ func (s *HTTPServer) ClientGCRequest(resp http.ResponseWriter, req *http.Request
return nil, structs.ErrPermissionDenied
}
return nil, s.agent.Client().CollectAllAllocs()
s.agent.Client().CollectAllAllocs()
return nil, nil
}
func (s *HTTPServer) allocGC(allocID string, resp http.ResponseWriter, req *http.Request) (interface{}, error) {
@@ -131,7 +132,9 @@ func (s *HTTPServer) allocGC(allocID string, resp http.ResponseWriter, req *http
} else if aclObj != nil && !aclObj.AllowNsOp(namespace, acl.NamespaceCapabilitySubmitJob) {
return nil, structs.ErrPermissionDenied
}
return nil, s.agent.Client().CollectAllocation(allocID)
s.agent.Client().CollectAllocation(allocID)
return nil, nil
}
func (s *HTTPServer) allocSnapshot(allocID string, resp http.ResponseWriter, req *http.Request) (interface{}, error) {