Skip to content

fix(etcd): check availability before starting watcher - #13934

Open
shreemaan-abhishek wants to merge 1 commit into
apache:masterfrom
shreemaan-abhishek:fix/etcd-watch-ready-gate
Open

fix(etcd): check availability before starting watcher#13934
shreemaan-abhishek wants to merge 1 commit into
apache:masterfrom
shreemaan-abhishek:fix/etcd-watch-ready-gate

Conversation

@shreemaan-abhishek

Copy link
Copy Markdown
Contributor

Description

The shared etcd watcher publishes watch_ctx.started before calling watchdir. Config objects interpret that state as permission to wait only for events from the watcher. When a preload revision was available, watcher initialization skipped the range request that otherwise verified etcd was reachable, so config objects could wait on a watcher that had not connected.

This change extracts that range request into an explicit availability check and runs it during every initial watcher setup. The preload revision remains the watch cursor when present, preventing writes made after the snapshot from being skipped; the revision returned by the availability check is used only when no preload revision exists.

The startup-revision regression test now also verifies that the availability check occurs when the preload supplies the revision.

Which issue(s) this PR fixes:

N/A

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

Config objects treat the shared watcher as started before watchdir is called. When a preload revision is available, no etcd request was made before publishing that state, so the objects could wait for events while the watcher was unable to connect.

Probe etcd during every initial watcher setup. Keep using the preload revision as the cursor when one exists, and use the probe revision only as the existing fallback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant