Merge pull request #48269 from FengyunPan/add-gc-metric

Automatic merge from submit-queue (batch tested with PRs 48518, 48525, 48269)

Update comment for garbagecollector

Update comment for garbagecollector, update not exist func.

**Release note**:
```release-note
NONE
```
pull/6/head
Kubernetes Submit Queue 2017-07-06 13:34:46 -07:00 committed by GitHub
commit 7df2bce1ec
3 changed files with 5 additions and 5 deletions

View File

@ -272,7 +272,7 @@ func TestProcessEvent(t *testing.T) {
var testScenarios = []struct {
name string
// a series of events that will be supplied to the
// GraphBuilder.eventQueue.
// GraphBuilder.graphChanges.
events []event
}{
{

View File

@ -34,8 +34,8 @@ func (s objectReference) String() string {
return fmt.Sprintf("[%s/%s, namespace: %s, name: %s, uid: %s]", s.APIVersion, s.Kind, s.Namespace, s.Name, s.UID)
}
// The single-threaded GraphBuilder.processEvent() is the sole writer of the
// nodes. The multi-threaded GarbageCollector.processItem() reads the nodes.
// The single-threaded GraphBuilder.processGraphChanges() is the sole writer of the
// nodes. The multi-threaded GarbageCollector.attemptToDeleteItem() reads the nodes.
// WARNING: node has different locks on different fields. setters and getters
// use the respective locks, so the return values of the getters can be
// inconsistent.
@ -46,7 +46,7 @@ type node struct {
// dependents are the nodes that have node.identity as a
// metadata.ownerReference.
dependents map[*node]struct{}
// this is set by processEvent() if the object has non-nil DeletionTimestamp
// this is set by processGraphChanges() if the object has non-nil DeletionTimestamp
// and has the FinalizerDeleteDependents.
deletingDependents bool
deletingDependentsLock sync.RWMutex

View File

@ -259,7 +259,7 @@ func (gb *GraphBuilder) enqueueChanges(e *event) {
// addDependentToOwners adds n to owners' dependents list. If the owner does not
// exist in the gb.uidToNode yet, a "virtual" node will be created to represent
// the owner. The "virtual" node will be enqueued to the attemptToDelete, so that
// processItem() will verify if the owner exists according to the API server.
// attemptToDeleteItem() will verify if the owner exists according to the API server.
func (gb *GraphBuilder) addDependentToOwners(n *node, owners []metav1.OwnerReference) {
for _, owner := range owners {
ownerNode, ok := gb.uidToNode.Read(owner.UID)