Skip to content

Commit

Permalink
snapshot twice after each step
Browse files Browse the repository at this point in the history
  • Loading branch information
elazarg committed Aug 4, 2024
1 parent ad7a623 commit 1045b98
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions checkpoint/persist.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ def __init__(self, tag: str) -> None:

def commit(self) -> None:
self.i += 1
if self.i % self.step == 0:
if self.i % self.step in [0, 1]:
# send commend to save_snapshot server to take snapshot
self.socket.send(struct.pack("Q", self.value))
self.socket.send(struct.pack("Q", self.i, self.value))
# wait for snapshot to start, and continue after it's done
self.socket.recv(256)

Expand Down
2 changes: 1 addition & 1 deletion save_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ async def relay_qmp_dumps(qmp_port: int, server: Server) -> None:
for index in server:
async with vm.pause(server.sleep_duration_ms):
current_next_file = f"{folder}/{index}.b.dump"
next_prev_file = f"{folder}/{index + persist.read_step()}.a.dump"
next_prev_file = f"{folder}/{index + 1}.a.dump"
await vm.dump(current_next_file)
os.link(current_next_file, next_prev_file)
p: Future[int] = executor.submit(count_diff, folder, index)
Expand Down

0 comments on commit 1045b98

Please sign in to comment.