You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkg/gce-pd-csi-driver/controller.go
+70-12
Original file line number
Diff line number
Diff line change
@@ -39,8 +39,8 @@ import (
39
39
)
40
40
41
41
const (
42
-
nodeBackoffInitialDuration=200*time.Millisecond
43
-
nodeBackoffMaxDuration=5*time.Minute
42
+
errorBackoffInitialDuration=200*time.Millisecond
43
+
errorBackoffMaxDuration=5*time.Minute
44
44
)
45
45
46
46
typeGCEControllerServerstruct {
@@ -58,11 +58,46 @@ type GCEControllerServer struct {
58
58
// Aborted error
59
59
volumeLocks*common.VolumeLocks
60
60
61
-
// When the attacher sidecar issues controller publish/unpublish for multiple disks for a given node, the per-instance operation queue in GCE fills up causing attach/detach disk requests to immediately return with an error until the queue drains. nodeBackoff keeps track of any active backoff condition on a given node, and the time when retry of controller publish/unpublish is permissible. A node is marked with backoff when any error is encountered by the driver during controller publish/unpublish calls.
62
-
// If the controller eventually allows controller publish/publish requests for volumes (because the backoff time expired), and those requests fail, the next backoff retry time will be updated on every failure and capped at 'nodeBackoffMaxDuration'. Also, any successful controller publish/unpublish call will clear the backoff condition for the node.
63
-
nodeBackoff*flowcontrol.Backoff
61
+
// There are several kinds of errors that are immediately retried by either
62
+
// the CSI sidecars or the k8s control plane. The retries consume GCP api
63
+
// quota, eg by doing ListVolumes, and so backoff needs to be used to
64
+
// prevent quota exhaustion.
65
+
//
66
+
// Examples of these errors are the per-instance GCE operation queue getting
67
+
// full (typically only 32 operations in flight at a time are allowed), and
68
+
// disks being deleted out from under a PV causing unpublish errors.
69
+
//
70
+
// While we need to backoff, we also need some semblance of fairness. In
71
+
// particular, volume unpublish retries happen very quickly, and with
72
+
// a single backoff per node these retries can prevent any other operation
73
+
// from making progess, even if it would succeed. Hence we track errors on
74
+
// node and disk pairs, backing off only for calls matching such a
75
+
// pair.
76
+
//
77
+
// An implication is that in the full operation queue situation, requests
78
+
// for new disks will not backoff the first time. This is acceptible as a
79
+
// single spurious call will not cause problems for quota exhaustion or make
80
+
// the operation queue problem worse. This is well compensated by giving
81
+
// disks where no problems are ocurring a chance to be processed.
82
+
//
83
+
// errorBackoff keeps track of any active backoff condition on a given node,
84
+
// and the time when retry of controller publish/unpublish is permissible. A
85
+
// node and disk pair is marked with backoff when any error is encountered
86
+
// by the driver during controller publish/unpublish calls. If the
87
+
// controller eventually allows controller publish/publish requests for
88
+
// volumes (because the backoff time expired), and those requests fail, the
89
+
// next backoff retry time will be updated on every failure and capped at
90
+
// 'errorBackoffMaxDuration'. Also, any successful controller
91
+
// publish/unpublish call will clear the backoff condition for a node and
92
+
// disk.
93
+
errorBackoff*csiErrorBackoff
64
94
}
65
95
96
+
typecsiErrorBackoffstruct {
97
+
backoff*flowcontrol.Backoff
98
+
}
99
+
typecsiErrorBackoffIdstring
100
+
66
101
typeworkItemstruct {
67
102
ctx context.Context
68
103
publishReq*csi.ControllerPublishVolumeRequest
@@ -376,17 +411,18 @@ func (gceCS *GCEControllerServer) ControllerPublishVolume(ctx context.Context, r
0 commit comments