• Martin Blix Grydeland's avatar
    Limit automatic active VCL selection to startup VCLs · 49d31c8d
    Martin Blix Grydeland authored
    Limit the selection of the active VCL from MGT's view point to be the last
    startup VCL given. That would be the VCL from the very last -f argument
    given to varnishd, or the autogenerated VCL from the -b argument (-f and
    -b are mutually exclusive). Because all startup VCLs are always set to
    state AUTO, and AUTO VCLs are made warm when the child is not
    running (which it is not at the time the startup VCLs are compiled), this
    ensures that it is a warm VCL that is selected as the active VCL.
    
    With this patch, VCLs loaded through the use of an initial CLI command
    script (-I option) will not cause a VCL to automatically be selected as
    the active VCL. Rather, it is expected that the initial CLI command script
    should have an explicit 'vcl.use' statement to select the active VCL. When
    an active VCL is not set, attempts to start the child will fail, which
    again will fail the varnishd daemon startup (unless -d is given) with an
    error code.
    
    The behaviour prior to this patch when using -I, -f '' (empty field), -F
    or -d was not well defined. The first VCL loaded (either by -I startup CLI
    script or a CLI 'vcl.load' command) would become the active VCL, even if
    that VCL is loaded cold. That is an illegal state and would lead to
    asserts. It is also not very useful functionality, given the typical use
    case for -I is to set up VCL labels. Those require the tips of the VCL
    tree dependency graph to be loaded first, and then the VCLs that selects
    the label. This means that the active VCL will typically be the last VCL
    loaded, which then will require the use of a 'vcl.use' statement in the -I
    script anyways. This makes it an acceptable change of default behaviour
    that should not affect users.
    49d31c8d
u00000.vtc 4.77 KB