MCPcopy
hub / github.com/etcd-io/bbolt / RevertMetaPage

Function RevertMetaPage

internal/surgeon/surgeon.go:146–156  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

144// data corruption happens on the last transaction pages and the
145// previous state is consistent.
146func 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}

Callers 2

TestRevertMetaPageFunction · 0.92

Calls 2

GetRootPageFunction · 0.92
CopyPageFunction · 0.85

Tested by 1

TestRevertMetaPageFunction · 0.74