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

Function clearFreelistInMetaPage

internal/surgeon/surgeon.go:125–140  ·  view source on GitHub ↗
(path string, pageId uint64)

Source from the content-addressed store, hash-verified

123}
124
125func clearFreelistInMetaPage(path string, pageId uint64) error {
126 _, buf, err := guts_cli.ReadPage(path, pageId)
127 if err != nil {
128 return fmt.Errorf("ReadPage %d failed: %w", pageId, err)
129 }
130
131 meta := common.LoadPageMeta(buf)
132 meta.SetFreelist(common.PgidNoFreelist)
133 meta.SetChecksum(meta.Sum64())
134
135 if err := guts_cli.WritePage(path, buf); err != nil {
136 return fmt.Errorf("WritePage %d failed: %w", pageId, err)
137 }
138
139 return nil
140}
141
142// RevertMetaPage replaces the newer metadata page with the older.
143// It usually means that one transaction is being lost. But frequently

Callers 1

ClearFreelistFunction · 0.85

Calls 7

ReadPageFunction · 0.92
LoadPageMetaFunction · 0.92
WritePageFunction · 0.92
SetFreelistMethod · 0.80
SetChecksumMethod · 0.80
Sum64Method · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected