The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7458
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === This can be enabled with "lxd --debug --trace database" Signed-off-by: Free Ekanayaka <free.ekanay...@canonical.com>
From c91e018f4f873993b02b69ed03a3bcb57ff65976 Mon Sep 17 00:00:00 2001 From: Free Ekanayaka <free.ekanay...@canonical.com> Date: Wed, 27 May 2020 13:20:11 +0100 Subject: [PATCH] lxd: New command line option to trace SQL statements This can be enabled with "lxd --debug --trace database" Signed-off-by: Free Ekanayaka <free.ekanay...@canonical.com> --- lxd/daemon.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lxd/daemon.go b/lxd/daemon.go index f001f164d6..0655b0bc98 100644 --- a/lxd/daemon.go +++ b/lxd/daemon.go @@ -17,6 +17,7 @@ import ( "time" "github.com/CanonicalLtd/candidclient" + dqliteclient "github.com/canonical/go-dqlite/client" "github.com/canonical/go-dqlite/driver" "github.com/gorilla/mux" "github.com/pkg/errors" @@ -790,14 +791,21 @@ func (d *Daemon) init() error { contextTimeout = time.Minute } - d.cluster, err = db.OpenCluster( - "db.bin", store, clusterAddress, dir, - d.config.DqliteSetupTimeout, dump, + options := []driver.Option{ driver.WithDialFunc(d.gateway.DialFunc()), driver.WithContext(d.gateway.Context()), - driver.WithConnectionTimeout(10*time.Second), + driver.WithConnectionTimeout(10 * time.Second), driver.WithContextTimeout(contextTimeout), driver.WithLogFunc(cluster.DqliteLog), + } + + if shared.StringInSlice("database", trace) { + options = append(options, driver.WithTracing(dqliteclient.LogDebug)) + } + + d.cluster, err = db.OpenCluster( + "db.bin", store, clusterAddress, dir, + d.config.DqliteSetupTimeout, dump, options..., ) if err == nil { break
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel