diff --git a/tx_check.go b/tx_check.go index 1a6d8e2..4e3c41a 100644 --- a/tx_check.go +++ b/tx_check.go @@ -74,7 +74,7 @@ func (tx *Tx) check(cfg checkConfig, ch chan error) { } } else { // Check the db file starting from a specified pageId. - if cfg.pageId < 2 || cfg.pageId >= uint(tx.meta.Pgid()) { + if cfg.pageId < 2 || cfg.pageId >= uint64(tx.meta.Pgid()) { ch <- fmt.Errorf("page ID (%d) out of range [%d, %d)", cfg.pageId, 2, tx.meta.Pgid()) return } @@ -250,7 +250,7 @@ func verifyKeyOrder(pgId common.Pgid, pageType string, index int, key []byte, pr type checkConfig struct { kvStringer KVStringer - pageId uint + pageId uint64 } type CheckOption func(options *checkConfig) @@ -262,7 +262,7 @@ func WithKVStringer(kvStringer KVStringer) CheckOption { } // WithPageId sets a page ID from which the check command starts to check -func WithPageId(pageId uint) CheckOption { +func WithPageId(pageId uint64) CheckOption { return func(c *checkConfig) { c.pageId = pageId } diff --git a/tx_check_test.go b/tx_check_test.go index af36108..a0ce69a 100644 --- a/tx_check_test.go +++ b/tx_check_test.go @@ -35,7 +35,7 @@ func TestTx_Check_CorruptPage(t *testing.T) { var cErrs []error t.Log("Check corrupted page.") - errChan := tx.Check(bbolt.WithPageId(uint(victimPageId))) + errChan := tx.Check(bbolt.WithPageId(uint64(victimPageId))) for cErr := range errChan { cErrs = append(cErrs, cErr) } @@ -44,7 +44,7 @@ func TestTx_Check_CorruptPage(t *testing.T) { t.Log("Check valid pages.") cErrs = cErrs[:0] for _, pgId := range validPageIds { - errChan = tx.Check(bbolt.WithPageId(uint(pgId))) + errChan = tx.Check(bbolt.WithPageId(uint64(pgId))) for cErr := range errChan { cErrs = append(cErrs, cErr) } @@ -104,7 +104,7 @@ func TestTx_Check_WithNestBucket(t *testing.T) { vErr := db.View(func(tx *bbolt.Tx) error { var cErrs []error - errChan := tx.Check(bbolt.WithPageId(uint(bucketRootPageId))) + errChan := tx.Check(bbolt.WithPageId(uint64(bucketRootPageId))) for cErr := range errChan { cErrs = append(cErrs, cErr) }