From 45c2e6a6115d7c985ee9b6186aec7c96491e4fbe Mon Sep 17 00:00:00 2001
From: "Dmitry E. Oboukhov" <unera@debian.org>
Date: Thu, 4 Sep 2014 15:31:27 +0400
Subject: [PATCH] Snapshot daemon is disabled by default.

---
 src/box/lua/load_cfg.lua        |  2 +-
 src/box/lua/snapshot_daemon.lua | 21 ++++++++++++++-------
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua
index 7aa58e4969..6743b23da7 100644
--- a/src/box/lua/load_cfg.lua
+++ b/src/box/lua/load_cfg.lua
@@ -52,7 +52,7 @@ local default_cfg = {
     coredump            = false,
 
     -- snap_daemon
-    snapshot_period     = 3600 * 4,
+    snapshot_period     = 0,        -- 0 = disabled
     snapshot_count      = 6,
 }
 
diff --git a/src/box/lua/snapshot_daemon.lua b/src/box/lua/snapshot_daemon.lua
index b482cc53c4..6dc9cff6ee 100644
--- a/src/box/lua/snapshot_daemon.lua
+++ b/src/box/lua/snapshot_daemon.lua
@@ -183,15 +183,22 @@ do
         log.info("%s", self.status)
         while true do
             local interval = next_snap_interval()
-            fiber.sleep(interval)
-            if self.status ~= 'started' then
-                break
-            end
 
-            local s, e = pcall(process)
+            if interval ~= nil then
+                fiber.sleep(interval)
+                if self.status ~= 'started' then
+                    break
+                end
 
-            if not s then
-                log.error(e)
+                local s, e = pcall(process)
+
+                if not s then
+                    log.error(e)
+                end
+            else
+                -- daemon is disabled
+                -- do nothing, waiting for change event wakes us up
+                fiber.sleep(3600 * 24 * 365 * 100)
             end
         end
         log.info("%s", self.status)
-- 
GitLab