projects
/
arvados.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
82de737
)
11283: Add explanatory comment to SQL query.
author
Tom Clegg <tom@curoverse.com>
Fri, 16 Jun 2017 13:34:08 +0000
(09:34 -0400)
committer
Tom Clegg <tom@curoverse.com>
Fri, 16 Jun 2017 13:34:08 +0000
(09:34 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curoverse.com>
services/api/app/models/node.rb
patch
|
blob
|
history
diff --git
a/services/api/app/models/node.rb
b/services/api/app/models/node.rb
index e1c1e649143c3f142acb24c7e9525c5247d4800d..8eb40f9fbb7d9e96988a233b1436f491ef665cff 100644
(file)
--- 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