The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7486
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) === The Driver.SetContextTimeout() has been a no-op for a while now and should be dropped. The functionality has been moved to the WithContextTimeout() option, which we use when creating the driver object and that sets a 30 seconds timeout for DB.Begin(). In all other cases we don't actually timeout anymore and rather rely on the network layer to report a broken connection. So the original #5234 issue can't happen anymore for non-clustered deployments. Signed-off-by: Free Ekanayaka <free.ekanay...@canonical.com>
From ad977fbb031768c858d49a8af0cd11a2e6fab2bd Mon Sep 17 00:00:00 2001 From: Free Ekanayaka <free.ekanay...@canonical.com> Date: Thu, 4 Jun 2020 10:28:07 +0100 Subject: [PATCH] Stop using Driver.SetContextTimeout() which is a no-op The Driver.SetContextTimeout() has been a no-op for a while now and should be dropped. The functionality has been moved to the WithContextTimeout() option, which we use when creating the driver object and that sets a 30 seconds timeout for DB.Begin(). In all other cases we don't actually timeout anymore and rather rely on the network layer to report a broken connection. So the original #5234 issue can't happen anymore for non-clustered deployments. Signed-off-by: Free Ekanayaka <free.ekanay...@canonical.com> --- lxd/api_cluster.go | 16 ---------------- lxd/db/db.go | 6 ------ 2 files changed, 22 deletions(-) diff --git a/lxd/api_cluster.go b/lxd/api_cluster.go index 31ddbb6abc..b4d93fe66e 100644 --- a/lxd/api_cluster.go +++ b/lxd/api_cluster.go @@ -218,19 +218,11 @@ func clusterPut(d *Daemon, r *http.Request) response.Response { func clusterPutBootstrap(d *Daemon, req api.ClusterPut) response.Response { run := func(op *operations.Operation) error { - // The default timeout when non-clustered is one minute, let's - // lower it down now that we'll likely have to make requests - // over the network. - // - // FIXME: this is a workaround for #5234. - d.cluster.SetDefaultTimeout(5 * time.Second) - // Start clustering tasks d.startClusterTasks() err := cluster.Bootstrap(d.State(), d.gateway, req.ServerName) if err != nil { - d.cluster.SetDefaultTimeout(time.Minute) d.stopClusterTasks() return err } @@ -468,19 +460,11 @@ func clusterPutJoin(d *Daemon, req api.ClusterPut) response.Response { nodes[i].Role = db.RaftRole(node.Role) } - // The default timeout when non-clustered is one minute, let's - // lower it down now that we'll likely have to make requests - // over the network. - // - // FIXME: this is a workaround for #5234. - d.cluster.SetDefaultTimeout(5 * time.Second) - // Start clustering tasks d.startClusterTasks() err = cluster.Join(d.State(), d.gateway, cert, req.ServerName, nodes) if err != nil { - d.cluster.SetDefaultTimeout(time.Minute) d.stopClusterTasks() return err } diff --git a/lxd/db/db.go b/lxd/db/db.go index eccf970311..e1ef3a1f68 100644 --- a/lxd/db/db.go +++ b/lxd/db/db.go @@ -324,12 +324,6 @@ func ForLocalInspectionWithPreparedStmts(db *sql.DB) (*Cluster, error) { return c, nil } -// SetDefaultTimeout sets the default go-dqlite driver timeout. -func (c *Cluster) SetDefaultTimeout(timeout time.Duration) { - driver := c.db.Driver().(*driver.Driver) - driver.SetContextTimeout(timeout) -} - // Kill should be called upon shutdown, it will prevent retrying failed // database queries. func (c *Cluster) Kill() {
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel