[lxc-devel] [lxd/master] Band aid for https://github.com/canonical/dqlite/issues/163

freeekanayaka on Github lxc-bot at linuxcontainers.org
Mon Sep 16 15:10:21 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 560 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190916/293dcf1f/attachment.bin>
-------------- next part --------------
From 689cca71b6245c5a7457375dbbe196cfbaadfb2e Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Mon, 16 Sep 2019 17:08:31 +0200
Subject: [PATCH] Band aid for https://github.com/canonical/dqlite/issues/163

The above bug causes dqlite to crash when a read query issued during a big
transaction triggers a page cache spill. The value of 50M should be
enough for most users until we fix this in dqlite.

Signed-off-by: Free Ekanayaka <free.ekanayaka at canonical.com>
---
 lxd/db/db.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lxd/db/db.go b/lxd/db/db.go
index feec9af821..40fd7ad876 100644
--- a/lxd/db/db.go
+++ b/lxd/db/db.go
@@ -213,6 +213,12 @@ func OpenCluster(name string, store driver.NodeStore, address, dir string, timeo
 		}
 	}
 
+	// FIXME: https://github.com/canonical/dqlite/issues/163
+	_, err = db.Exec("PRAGMA cache_size=-50000")
+	if err != nil {
+		return nil, errors.Wrap(err, "Failed to set page cache size")
+	}
+
 	if dump != nil {
 		logger.Infof("Migrating data from local to global database")
 		err := query.Transaction(db, func(tx *sql.Tx) error {


More information about the lxc-devel mailing list