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"
+
#
# If you prefer to allocate a random IP address every time, use this query instead.
#
# 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 IS NULL \
+# ORDER BY \
+# RAND() \
+# LIMIT 1 \
+# FOR UPDATE SKIP LOCKED"
#
# pool_check allows the module to differentiate between a full pool
# and no pool when an IP address could not be allocated so an appropriate
# error message can be returned.
+#
+
#
# Note: If you are not running redundant pool modules this query may be
# commented out as it provides no additional information in that case.
expiry_time \
FOR UPDATE"
+#
+# The above query again, but with SKIP LOCKED. This requires Oracle > 11g.
+# It may work in 9i and 10g, but is not documented, so YMMV.
+#
+#allocate_find = "\
+# SELECT framedipaddress \
+# FROM ${ippool_table} \
+# WHERE pool_name = '%{control:${pool_name}}' \
+# AND expiry_time < current_timestamp \
+# AND rownum <= 1 \
+# ORDER BY \
+# (username <> '%{SQL-User-Name}'), \
+# (callingstationid <> '%{Calling-Station-Id}'), \
+# expiry_time \
+# FOR UPDATE SKIP LOCKED"
+
#
# This function is available if you want to use multiple pools
#
# ORDER BY RANDOM() \
# FOR UPDATE"
+#
+# The above query again, but with SKIP LOCKED. This requires Oracle > 11g.
+# It may work in 9i and 10g, but is not documented, so YMMV.
+#
+#allocate_find = "\
+# SELECT framedipaddress \
+# FROM ${ippool_table} \
+# WHERE pool_name = '%{control:${pool_name}}' \
+# AND expiry_time < current_timestamp \
+# AND rownum <= 1 \
+# ORDER BY RANDOM() \
+# FOR UPDATE SKIP LOCKED"
+
#
# If an IP could not be allocated, check to see whether the pool exists or not
# This allows the module to differentiate between a full pool and no pool
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"
+
#
# If you prefer to allocate a random IP address every time, use this query instead
#
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"
+
#
# If an IP could not be allocated, check to see whether the pool exists or not
# This allows the module to differentiate between a full pool and no pool