| index 2c22c8bfe..6ec646144 100644 |
| --- a/internal/edge/retiredcopy.go |
| +++ b/internal/edge/retiredcopy.go |
| @@ -4,29 +4,32 @@ import ( |
| "fmt" |
| "log" |
| "net/http" |
| + "strings" |
| "sync" |
| "time" |
| |
| "github.com/carlosframework/platform/internal/tunnelclient" |
| ) |
| |
| -// hubSetReloadBound bounds one hub reload of a replica set: how long the |
| -// hub takes, after a box's copy retires, to rewrite the set's row in its |
| -// provision pass and load it through its registry poll (2 s). Drill 4 |
| -// (#511) saw the dev hub rewrite the set 2 s after box-2 dropped its row, |
| -// and its passes about 15 s apart (17:53:40.7Z, 17:53:55.6Z). A refusal |
| -// ejects the copy at the hub sooner than that (R26), and the box's replica |
| -// probe for a host it no longer serves fails, which keeps it out. |
| -const hubSetReloadBound = 30 * time.Second |
| - |
| -// retiredCopyGrace is #511 R28's grace window: two hub reload intervals. |
| -// For this long after this box drops a replica set's row because its copy |
| -// is retiring (the copies lowered, or the box removed as a member), a |
| -// request for the host that still arrives over the fleet tunnel is refused |
| -// unprocessed (RST_STREAM REFUSED_STREAM) instead of answered 404, and the |
| -// hub serves it from a surviving copy whatever its method (R26). After it, |
| -// the host gets the normal unknown-host answer. |
| -const retiredCopyGrace = 2 * hubSetReloadBound |
| +// retiredCopyGrace is #511 R28's grace window. For this long after this |
| +// box drops a replica set's row because its copy is retiring (the copies |
| +// lowered, or the box removed as a member), a request for the host that |
| +// still arrives over the fleet tunnel is refused unprocessed (RST_STREAM |
| +// REFUSED_STREAM) instead of answered 404, and the hub serves it from a |
| +// surviving copy whatever its method (R26). After it, the host gets the |
| +// normal unknown-host answer. |
| +// |
| +// What actually stops the hub sending here is its replica prober, not |
| +// this window: the first refusal ejects the copy (R26), and the box's |
| +// probe for a host it no longer serves fails (replicaprobe.go, |
| +// replica-probe-route), so the copy is out within replicaProbeInterval x |
| +// replicaProbeFail (2 s) and never readmitted. The hub's own reload of |
| +// the set is the backstop: its provision pass rewriting the row (a 2 s |
| +// tick, a 5 s full-pass clamp and the pass's own length, 25 to 50 s |
| +// measured on the flagship) and its 2 s registry poll. None of that is a |
| +// proven bound, so the grace is a conservative 120 s, past two flagship |
| +// passes; a longer grace costs nothing once the hub has dropped the copy. |
| +const retiredCopyGrace = 120 * time.Second |
| |
| // retiredCopies is the hosts whose replica copy this box retired within |
| // retiredCopyGrace, each with the time its grace ends. Only Reload writes |
| @@ -71,6 +74,12 @@ func (c *retiredCopies) note(prev, next map[string]upstream) []string { |
| if _, served := next[host]; served { |
| continue |
| } |
| + // A catch-all key ("*.example.com") is never recorded: retiring |
| + // is asked with a request's exact host, and replica rows are exact |
| + // hosts (a set's row, and the hub's forward row, name one host). |
| + if strings.HasPrefix(host, "*") { |
| + continue |
| + } |
| // The copy itself retired: its own host is gone too. A name |
| // dropped while the copy's row stays (an alias detached) is not a |
| // retiring copy. |