[lxc-devel] [lxd/master] lxd/db/node: Tweaks LEFT JOIN to just JOIN in NodeIsEmpty()
tomponline on Github
lxc-bot at linuxcontainers.org
Wed Mar 18 10:03:50 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 460 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200318/e6eaa3bc/attachment.bin>
-------------- next part --------------
From f46db35b159043847020cb84dabc58017d5889a8 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Wed, 18 Mar 2020 10:02:07 +0000
Subject: [PATCH] lxd/db/node: Tweaks LEFT JOIN to just JOIN in NodeIsEmpty()
So that NULL handling isn't needed.
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/db/node.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lxd/db/node.go b/lxd/db/node.go
index ed80dd3313..bf743d0828 100644
--- a/lxd/db/node.go
+++ b/lxd/db/node.go
@@ -508,7 +508,7 @@ SELECT fingerprint, node_id FROM images JOIN images_nodes ON images.id=images_no
// Check if the node has any custom volumes.
volumes, err := query.SelectStrings(
- c.tx, "SELECT storage_volumes.name FROM storage_volumes LEFT JOIN storage_pools ON storage_volumes.storage_pool_id=storage_pools.id WHERE storage_volumes.node_id=? AND storage_volumes.type=? AND storage_pools.driver NOT IN ('ceph', 'cephfs')",
+ c.tx, "SELECT storage_volumes.name FROM storage_volumes JOIN storage_pools ON storage_volumes.storage_pool_id=storage_pools.id WHERE storage_volumes.node_id=? AND storage_volumes.type=? AND storage_pools.driver NOT IN ('ceph', 'cephfs')",
id, StoragePoolVolumeTypeCustom)
if err != nil {
return "", errors.Wrapf(err, "Failed to get custom volumes for node %d", id)
More information about the lxc-devel
mailing list