From 4bc4da331aae13be8a39e768524a854597addd8a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 29 May 2012 22:59:12 -0400 Subject: Reserve some disk space for the garbage collector We can't open a SQLite database if the disk is full. Since this prevents the garbage collector from running when it's most needed, we reserve some dummy space that we can free just before doing a garbage collection. This actually revives some old code from the Berkeley DB days. Fixes #27. --- src/nix-worker/nix-worker.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/nix-worker/nix-worker.cc') diff --git a/src/nix-worker/nix-worker.cc b/src/nix-worker/nix-worker.cc index c69b9de506d6..b7bce20bd412 100644 --- a/src/nix-worker/nix-worker.cc +++ b/src/nix-worker/nix-worker.cc @@ -625,8 +625,12 @@ static void processConnection() throw Error("if you run `nix-worker' as root, then you MUST set `build-users-group'!"); #endif + bool reserveSpace = true; + if (GET_PROTOCOL_MINOR(clientVersion) >= 11) + reserveSpace = readInt(from) != 0; + /* Open the store. */ - store = boost::shared_ptr(new LocalStore()); + store = boost::shared_ptr(new LocalStore(reserveSpace)); stopWork(); to.flush(); -- cgit 1.4.1