From: Alan T. DeKok Date: Fri, 11 Jan 2019 18:59:02 +0000 (-0500) Subject: remove (mostly) duplicate configs. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f70ab48c80dc3d5ac449740979804e31daebc6c9;p=thirdparty%2Ffreeradius-server.git remove (mostly) duplicate configs. It's better to define `skip_locked = "SKIP LOCKED"` once, and then use it where necessary. Otherwise, we get near-infinite variations of the same queries --- diff --git a/raddb/mods-config/files/authorize b/raddb/mods-config/files/authorize index 94380eef665..e6b519d89a7 100644 --- a/raddb/mods-config/files/authorize +++ b/raddb/mods-config/files/authorize @@ -1,3 +1,5 @@ +bob Cleartext-Password := "bob" + # # Configuration file for the rlm_files module. # Please see rlm_files(5) manpage for more information. diff --git a/raddb/mods-config/sql/ippool/mysql/queries.conf b/raddb/mods-config/sql/ippool/mysql/queries.conf index 78103d3574e..cc250daa8aa 100644 --- a/raddb/mods-config/sql/ippool/mysql/queries.conf +++ b/raddb/mods-config/sql/ippool/mysql/queries.conf @@ -30,6 +30,12 @@ # users to keep old addresses after outages # +# Using SKIP LOCKED speed up the allocate_find query by 10 +# times. However, it requires MySQL >= 8.0.1, and InnoDB. +# +# Uncomment the next line to automatically use SKIP LOCKED +#skip_locked = "SKIP LOCKED" + # # allocate_clear clears stale IP addresses before processing a new request # @@ -89,22 +95,7 @@ allocate_find = "\ (callingstationid <> '%{Calling-Station-Id}'), \ expiry_time \ LIMIT 1 \ - FOR UPDATE" - -# -# The above query again, but with SKIP LOCKED. This requires MySQL >= 8.0.1, -# and InnoDB. -# -#allocate_find = "\ -# SELECT framedipaddress FROM ${ippool_table} \ -# WHERE pool_name = '%{control:${pool_name}}' \ -# AND (expiry_time < NOW() OR expiry_time IS NULL) \ -# ORDER BY \ -# (username <> '%{User-Name}'), \ -# (callingstationid <> '%{Calling-Station-Id}'), \ -# expiry_time \ -# LIMIT 1 \ -# FOR UPDATE SKIP LOCKED" + FOR UPDATE ${skip_locked}" # # If you prefer to allocate a random IP address every time, use this query instead. @@ -117,7 +108,7 @@ allocate_find = "\ # ORDER BY \ # RAND() \ # LIMIT 1 \ -# FOR UPDATE" +# FOR UPDATE ${skip_locked}" # # The above query again, but with SKIP LOCKED. This requires MySQL >= 8.0.1, diff --git a/raddb/mods-config/sql/ippool/postgresql/queries.conf b/raddb/mods-config/sql/ippool/postgresql/queries.conf index e8fdf58e1d0..43328239461 100644 --- a/raddb/mods-config/sql/ippool/postgresql/queries.conf +++ b/raddb/mods-config/sql/ippool/postgresql/queries.conf @@ -4,6 +4,12 @@ # # $Id$ +# Using SKIP LOCKED speed up the allocate_find query by 10 +# times. However, it requires PostgreSQL >= 9.5. +# +# Uncomment the next line to automatically use SKIP LOCKED +#skip_locked = "SKIP LOCKED" + # # This query allocates an IP address from the Pool # The ORDER BY clause of this query tries to allocate the same IP-address @@ -19,22 +25,7 @@ allocate_find = "\ (callingstationid <> '%{Calling-Station-Id}'), \ expiry_time \ LIMIT 1 \ - FOR UPDATE" - -# -# The above query again, but with SKIP LOCKED. This requires PostgreSQL >= 9.5. -# -#allocate_find = "\ -# SELECT framedipaddress \ -# FROM ${ippool_table} \ -# WHERE pool_name = '%{control:${pool_name}}' \ -# AND expiry_time < 'now'::timestamp(0) \ -# ORDER BY \ -# (username <> '%{SQL-User-Name}'), \ -# (callingstationid <> '%{Calling-Station-Id}'), \ -# expiry_time \ -# LIMIT 1 \ -# FOR UPDATE SKIP LOCKED" + FOR UPDATE ${skip_locked}" # # If you prefer to allocate a random IP address every time, use this query instead @@ -45,17 +36,7 @@ allocate_find = "\ # WHERE pool_name = '%{control:${pool_name}}' AND expiry_time < 'now'::timestamp(0) \ # ORDER BY RANDOM() \ # LIMIT 1 \ -# FOR UPDATE" - -# -# The above query again, but with SKIP LOCKED. This requires PostgreSQL >= 9.5. -# -#allocate_find = "\ -# SELECT framedipaddress FROM ${ippool_table} \ -# WHERE pool_name = '%{control:${pool_name}}' AND expiry_time < 'now'::timestamp(0) \ -# ORDER BY RANDOM() \ -# LIMIT 1 \ -# FOR UPDATE SKIP LOCKED" +# FOR UPDATE ${skip_locked}" # # If an IP could not be allocated, check to see whether the pool exists or not