Skip to content
Snippets Groups Projects
Commit ccd451eb authored by Ilya's avatar Ilya Committed by Roman Tsisyk
Browse files

Always touch snapshpot in checkpoint_daemon

* Remove check on checkpoint signature and always touch snapshot
  even if there were no transations since the previous checkpoint
* Fix timeout check

Fixup #2780
parent f6ec32e8
No related branches found
No related tags found
No related merge requests found
......@@ -44,10 +44,6 @@ local function process(self)
local checkpoints = box.internal.gc.info().checkpoints
local last_checkpoint = checkpoints[#checkpoints]
if last_checkpoint.signature == box.info.signature then
log.debug('snapshot %d already exists', last_checkpoint.signature)
return false
end
local last_snap = fio.pathjoin(box.cfg.memtx_dir,
string.format('%020d.snap', last_checkpoint.signature))
......@@ -56,7 +52,7 @@ local function process(self)
log.error("can't stat %s: %s", last_snap, errno.strerror())
return false
end
if snstat.mtime <= fiber.time() + daemon.checkpoint_interval then
if snstat.mtime + daemon.checkpoint_interval <= fiber.time() then
return snapshot()
end
end
......
......@@ -241,3 +241,25 @@ daemon.control == nil
---
- true
...
-- gh-2780 check that scheduled snapshots are performed
PERIOD = 0.03
---
...
if jit.os ~= 'Linux' then PERIOD = 1.5 end
---
...
box.cfg{ checkpoint_interval = PERIOD}
---
...
fiber.sleep(3 * PERIOD)
---
...
-- check that it's not first snapshot
test_run:grep_log("default", "saving snapshot", 400)
---
- null
...
test_run:grep_log("default", "making snapshot", 400)
---
- making snapshot
...
......@@ -112,3 +112,12 @@ box.cfg{ checkpoint_count = 2, checkpoint_interval = 0}
daemon.next_snapshot_time
daemon.fiber == nil
daemon.control == nil
-- gh-2780 check that scheduled snapshots are performed
PERIOD = 0.03
if jit.os ~= 'Linux' then PERIOD = 1.5 end
box.cfg{ checkpoint_interval = PERIOD}
fiber.sleep(3 * PERIOD)
-- check that it's not first snapshot
test_run:grep_log("default", "saving snapshot", 400)
test_run:grep_log("default", "making snapshot", 400)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment