# Worker, raft and snapshot logic

**URL:** <https://discuss.dgraph.io/t/worker-raft-and-snapshot-logic/3473>\
**Category:** Users\
**Created:** [October 24, 2018, 1:49pm UTC](https://discuss.dgraph.io/t/worker-raft-and-snapshot-logic/3473 "2018-10-24T13:49:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brk0v](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/brk0v/32/1323_2.png) [@brk0v](https://discuss.dgraph.io/u/brk0v)\
**Post date:** [October 24, 2018, 1:49pm UTC](https://discuss.dgraph.io/t/worker-raft-and-snapshot-logic/3473/1 "2018-10-24T13:49:22Z")

</div>

Hello,

I have a question about internal raft snapshots logic on the worker node.

I can see that:

1. Save hard state and snapshot to WAL log ([dgraph/draft.go at 146fb535f3d794f3f9ad25ac21fe640b875263f6 · dgraph-io/dgraph · GitHub](https://github.com/dgraph-io/dgraph/blob/146fb535f3d794f3f9ad25ac21fe640b875263f6/worker/draft.go#L662))
2. Then you try to sync using `retrieveSnapshot` function ([dgraph/draft.go at 146fb535f3d794f3f9ad25ac21fe640b875263f6 · dgraph-io/dgraph · GitHub](https://github.com/dgraph-io/dgraph/blob/146fb535f3d794f3f9ad25ac21fe640b875263f6/worker/draft.go#L688))

My question is what if node crashes during 2 step. So metadata saved, but database is out of sync with raft metadata.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/2/2b38fdece2abe5814f2e51bee69d1e67fc304b0a.png) [@system](https://discuss.dgraph.io/u/system)\
**Post date:** [November 23, 2018, 1:59pm UTC](https://discuss.dgraph.io/t/worker-raft-and-snapshot-logic/3473/2 "2018-11-23T13:59:42Z")

</div>

Closed on November 23, 2018, 1:59pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
