From: Tom Clegg Date: Fri, 16 Jun 2017 13:34:08 +0000 (-0400) Subject: 11283: Add explanatory comment to SQL query. X-Git-Tag: 1.1.0~190^2 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/7409b2f682d562cd7ef7bcf558597ae2181ea7c1 11283: Add explanatory comment to SQL query. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- diff --git a/services/api/app/models/node.rb b/services/api/app/models/node.rb index e1c1e64914..8eb40f9fbb 100644 --- a/services/api/app/models/node.rb +++ b/services/api/app/models/node.rb @@ -139,6 +139,9 @@ class Node < ArvadosModel protected def self.available_slot_number + # Join the sequence 1..max with the nodes table. Return the first + # (i.e., smallest) value that doesn't match the slot_number of any + # existing node. connection.exec_query('SELECT n FROM generate_series(1, $1) AS slot(n) LEFT JOIN nodes ON n=slot_number WHERE slot_number IS NULL