Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VDI_EVENT_SICK and use it for admin health changes #4196

Merged
merged 3 commits into from
Sep 30, 2024

Conversation

nigoroll
Copy link
Member

@nigoroll nigoroll commented Sep 23, 2024

Alternative implementation to #4186 as suggested by dridi and phk:

This patch adds an event to the existing event facility, which so far was only used for VCL-related events. We now add VDI_EVENT_SICK as a director-specific event, which is cheap and also helps us maintain clean layering.
The new event is posted when the admin health changes and used by VBE to cancel all waiting connection requests.

@gquintard
Copy link
Member

one note here: because the events were only sent for VCL lifetime steps, I think we were guaranteed to be running without in-flight requests (for that VCL). This changes the contract a bit.

For context, in the rust layer, we allow the PRIV struct to be mutated because we know that nobody has access to it, but that change would force the function to keep the mutability without the guarantee that there's no in-flight request. That's quite a big regression

@nigoroll
Copy link
Member Author

one note here: because the events were only sent for VCL lifetime steps, I think we were guaranteed to be running without in-flight requests (for that VCL). This changes the contract a bit.

There is a relevant change that we extend the facility for director events, but the way I read your understanding of what was guaranteed, I think it might be incomplete: VDI temperature events were already generated outside VCL lifetime steps for dynamic backends here and here. At least the cold event happens outside the vcl_mtx.

For context, in the rust layer, we allow the PRIV struct to be mutated because we know that nobody has access to it, but that change would force the function to keep the mutability without the guarantee that there's no in-flight request. That's quite a big regression

I am not sure which PRIV struct you are referring to, but it sounds unrelated?

@dridi
Copy link
Member

dridi commented Sep 24, 2024

That would be the PRIV_VCL for VMODs subscribing to events. However this event is not directed (pun intended) towards the VMOD itself so it does not violate the mutability assumption you made in the VMOD event callback.

@gquintard
Copy link
Member

Ah, thank you both, I did confuse the two events

@nigoroll
Copy link
Member Author

That would be the PRIV_VCL for VMODs subscribing to events.

Yes, the director .event function is something different than the vmod event function.

include/vrt.h Outdated Show resolved Hide resolved
nigoroll added a commit to nigoroll/varnish-cache that referenced this pull request Sep 26, 2024
slightly edited version of Dridis suggestion
varnishcache#4196 (comment)
@nigoroll
Copy link
Member Author

bugwash: ok

Pondering solutions for varnishcache#4183 it became apparent that we need a way to notify
directors of changes to the admin_health without crossing the VDI/VBE layering.

Besides adding another director callback, one option is to add an event to the
existing event facility, which so far was only used for VCL-related events. We
now add VDI_EVENT_SICK as a director-specific event, which is cheap and also
helps us maintain clean layering.
Using the new event, we can now selectively notify interested backend types
(so far: VBE only) when the admin health changes.

This fixes the layer violation introduced with
e46f972, where a director private pointer was
used with a VBE specific function.

Fixes varnishcache#4183
@nigoroll nigoroll merged commit e3d1e29 into varnishcache:master Sep 30, 2024
1 of 11 checks passed
@nigoroll nigoroll deleted the vdi_event_sick branch September 30, 2024 14:05
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.

3 participants