Data in mutation layer lose when DGraph crash?

I see there is mutation layer on the top of RocksDB, and it will commit the changes every 5 seconds. If the DGraph crash, what will happen to the changes temporary in mutation layer? I guess we will lose them, right?

No, you won’t. Dgraph uses a Write Ahead Log, before any mutation is applied. In case Dgraph crashes, it would replay the WAL from the last snapshot, which would bring the system to the same state.

If you have received an OK reply for a write mutation, we guarantee that you won’t lose that write. Also, Dgraph is (going to be) atomically (instantaneously) consistent; so if a write mutation has been done, every read from then on would see that or a future write.

I know the RocksDB has a Write Ahead Log. Do you mean the WAL log is updated first before changes arrive the Mutation Layer?

I’m not talking about RocksDB WAL. We have our own WAL. We do a synchronous write to WAL before the mutation is applied to Posting List. This way, even if Dgraph crashes or machines goes down, we can get the best guarantee available by the kernel about data being flushed to disk.

Do you already have the WAL for mutation layer, or are you planning to add it? I don’t find any code related to WAL for mutation layer. could you help me ?

Wal is part of Raft code. Every mutation goes via raft. You can see it in node.Ready in draft.go. Sorry, typing from mobile, so can’t give you exact github link.

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