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

Function corruptRootPage

tx_check_test.go:192–202  ·  view source on GitHub ↗
(t testing.TB, db *bbolt.DB, bucketName []byte)

Source from the content-addressed store, hash-verified

190}
191
192func corruptRootPage(t testing.TB, db *bbolt.DB, bucketName []byte) {
193 bucketRootPageId := mustGetBucketRootPage(t, db, bucketName)
194 bucketRootPage, bucketRootPageBuf, err := guts_cli.ReadPage(db.Path(), uint64(bucketRootPageId))
195 require.NoError(t, err)
196 require.True(t, bucketRootPage.IsBranchPage())
197
198 bucketRootPage.SetFlags(0)
199
200 err = guts_cli.WritePage(db.Path(), bucketRootPageBuf)
201 require.NoError(t, err)
202}
203
204// mustGetBucketRootPage returns the root page for the provided bucket.
205func mustGetBucketRootPage(t testing.TB, db *bbolt.DB, bucketName []byte) common.Pgid {

Callers 1

TestTx_Check_PanicFunction · 0.85

Calls 6

ReadPageFunction · 0.92
WritePageFunction · 0.92
mustGetBucketRootPageFunction · 0.85
IsBranchPageMethod · 0.80
PathMethod · 0.45
SetFlagsMethod · 0.45

Tested by

no test coverage detected