RevertMetaPage replaces the newer metadata page with the older. It usually means that one transaction is being lost. But frequently data corruption happens on the last transaction pages and the previous state is consistent.
(path string)
| 144 | // data corruption happens on the last transaction pages and the |
| 145 | // previous state is consistent. |
| 146 | func RevertMetaPage(path string) error { |
| 147 | _, activeMetaPage, err := guts_cli.GetRootPage(path) |
| 148 | if err != nil { |
| 149 | return err |
| 150 | } |
| 151 | if activeMetaPage == 0 { |
| 152 | return CopyPage(path, 1, 0) |
| 153 | } else { |
| 154 | return CopyPage(path, 0, 1) |
| 155 | } |
| 156 | } |