SQLite Forum

Question on internals: Sync between WAL and B Tree
Login
> Then on system restart, we would end up make changes to B Tree again? How does SQLite prevents this

Why would sqlite need or want to prevent that? Step (2) is a logical part of step (3). We cannot *persistently* know that step (2) succeeded unless recording that (in step (3)) succeeds. Thus if step (3) does not complete then step (2) is not complete. Ergo, it will replay the log the next time it can. That's a feature, not a bug.