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

New vcl_backend_refresh method #3994

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

walid-git
Copy link
Member

This PR introduces the new vcl_backend_refresh method discussed during VDD23Q3.
See: #3102 (comment) for more context.

@dridi
Copy link
Member

dridi commented Oct 9, 2023

You need to update doc/graphviz/cache_*.dot and rebuild doc/graphviz/cache_*.svg as part of this change.

@dridi
Copy link
Member

dridi commented Oct 9, 2023

This is also missing the obj_stale variable in vcl_backend_refresh. See how obj is handled for vcl_hit in doc/sphinx/reference/vcl_var.rst.

Comment on lines 212 to 241
sub vcl_backend_refresh {
return (merge);
}
Copy link
Member

@dridi dridi Oct 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having second thoughts here, and I'm wondering whether we should generalize this subroutine to whenever there is a stale object involved.

sub vcl_backend_refresh {
        if (obj_stale.status == 200 && beresp.status == 304) {
                return (merge);
        }
        if (beresp.status == 304) {
                return (error); # until we refine error statuses
        }
        return (beresp);
}

Of course, with a pinch of splitting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dridi can you please motivate this suggestion? What else would you do with the stale object besides delivering it as-is (for grace mode) or use it for a refresh?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bugwash: This makes sense.

@walid-git walid-git force-pushed the vcl_backend_refresh branch 3 times, most recently from 5722162 to 68dda70 Compare October 16, 2023 11:59
@walid-git walid-git marked this pull request as ready for review October 23, 2023 12:06
This commit introduces a new sub vcl_backend_refresh method intended
to allow allow a more flexible approach on object revalidation.
Comment on lines +499 to +491
case VCL_RET_ERROR:
/* FALLTHROUGH */
case VCL_RET_ABANDON:
/* FALLTHROUGH */
case VCL_RET_FAIL:
/* FALLTHROUGH */
case VCL_RET_RETRY:
skip_vbr = 1;
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can simply do this:

case VCL_RET_ERROR:
case VCL_RET_ABANDON:
case VCL_RET_FAIL:
case VCL_RET_RETRY:
	skip_vbr = 1;
	break;

It shouldn't trigger a warning.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember doing that on another PR and getting CCI failing compilation because of -Wimplicit-fallthrough

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that only happens if you got statements in-between without a break.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, I can test it then

Comment on lines +260 to 264
case HDR_OBJ_STALE:
/* FALLTHROUGH */
case HDR_OBJ:
hp = NULL;
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

	case HDR_OBJ:
	case HDR_OBJ_STALE:
		hp = NULL;
		break;

Comment on lines 214 to 215
if (!obj_stale.http.Last-Modified &&
!obj_stale.http.ETag) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are using obj_stale before it exists.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure to understand, we only get into vcl_backend_refresh when we already have a stale_oc

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable is introduced in VCL in the last commit of the current series.

@nigoroll
Copy link
Member

nigoroll commented Dec 4, 2023

bugwash: #4026 should be addressed first

@dridi dridi marked this pull request as draft December 6, 2023 09:58
dridi added a commit to dridi/varnish-cache that referenced this pull request Mar 19, 2024
Named after vcl_backend_refresh from varnishcache#3994.
dridi added a commit to dridi/varnish-cache that referenced this pull request Mar 19, 2024
Named after vcl_backend_refresh from varnishcache#3994.
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.

None yet

4 participants