]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
remove (mostly) duplicate configs.
authorAlan T. DeKok <aland@freeradius.org>
Fri, 11 Jan 2019 18:59:02 +0000 (13:59 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 11 Jan 2019 18:59:02 +0000 (13:59 -0500)
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

raddb/mods-config/files/authorize
raddb/mods-config/sql/ippool/mysql/queries.conf
raddb/mods-config/sql/ippool/postgresql/queries.conf

index 94380eef665f861f6057e2d8847e69021988effd..e6b519d89a790baabea5cc5b7e86b04ebe248966 100644 (file)
@@ -1,3 +1,5 @@
+bob    Cleartext-Password := "bob"
+
 #
 #      Configuration file for the rlm_files module.
 #      Please see rlm_files(5) manpage for more information.
index 78103d3574e5ba3bf4bded3ad1b34f1bdefb499f..cc250daa8aa69b450e1606614186d34e1ff894db 100644 (file)
 #        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,
index e8fdf58e1d039169798da639e8f3fe7feb722a3b..433282394619d91ba9ecd02e5aa791fe84cb8c8f 100644 (file)
@@ -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