Re: [squid-users] support for smp-related macros in squid.conf?

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Tue, 19 Feb 2013 09:24:36 -0700

On 02/18/2013 03:42 PM, Linda W wrote:

> it seems that the new smp-related macros that yield names like
> squid1, squid2 or cache1, or give the process numbers 1, 2, ...
> Don't work in squid.conf.

Macros have been available since 2010 (v3.2.0.1) so they are not exactly
"new". There are lots of reports from Squid admins using
${process_number} macro successfully so either you are doing something
wrong or it is a fresh bug unknown to developers.

> It did't get a chance to try it, as the syntax
> of specifying conditionals is completely unspecified,

Conditionals syntax is specified in squid.conf.documented subsection
called "Conditional configuration". That syntax is unrelated to SMP
macros, but you can find many examples using macros in squid.conf
conditionals by googling for something like
    squid.conf "process_number"

> but maybe they only work in
> the expression that is the CONDITIONAL for an 'if'?

No, macros can be used virtually anywhere.

> Is it intended that those macros be supported in any expression?

Yes, macros should work in any squid.conf statement. They are processed
before the main Squid configuration parser kicks in. There may be
exceptions like macros in included file names, but even those would not
be intentional and should be reported as bugs.

Macros are probably not processed in external files such as ACL lists
loaded into squid.conf using the "file" syntax, but even that can be
considered a bug.

> I tried it in "cache dir" and was less than successful
>
> i.e.
> cache_dir aufs /var/cache/squid${process_number} 655360 64 64
>
> on startup it complained about squid${process_number} not existing
> or being an illegal file name (forget which).
>
> I DID precreate them (duplicated existing contents in main cache).

Conditionals and SMP macros work fine in my v3.3 and trunk tests:

> cache_dir aufs /usr/local/squid/var/cache/ufs/kid${process_number} 10 10 10

> 2013/02/19 08:18:04.789| ERROR: /usr/local/squid/var/cache/ufs/kid0: (2) No such file or directory

What Squid version are you running? Care to post a copy of your
squid.conf and the cache.log that ends with the corresponding fatal error?

Thank you,

Alex.
Received on Tue Feb 19 2013 - 16:24:48 MST

This archive was generated by hypermail 2.2.0 : Wed Feb 20 2013 - 12:00:04 MST