Change the type of pageId uint -> uint64.

Signed-off-by: ishan16696 <ishan.tyagi@sap.com>
This commit is contained in:
Ishan Tyagi 2024-02-25 19:02:02 +05:30 committed by ishan16696
parent a6ec26b9cc
commit cdac32e57c
2 changed files with 6 additions and 6 deletions

View File

@ -74,7 +74,7 @@ func (tx *Tx) check(cfg checkConfig, ch chan error) {
} }
} else { } else {
// Check the db file starting from a specified pageId. // 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()) ch <- fmt.Errorf("page ID (%d) out of range [%d, %d)", cfg.pageId, 2, tx.meta.Pgid())
return return
} }
@ -250,7 +250,7 @@ func verifyKeyOrder(pgId common.Pgid, pageType string, index int, key []byte, pr
type checkConfig struct { type checkConfig struct {
kvStringer KVStringer kvStringer KVStringer
pageId uint pageId uint64
} }
type CheckOption func(options *checkConfig) 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 // 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) { return func(c *checkConfig) {
c.pageId = pageId c.pageId = pageId
} }

View File

@ -35,7 +35,7 @@ func TestTx_Check_CorruptPage(t *testing.T) {
var cErrs []error var cErrs []error
t.Log("Check corrupted page.") t.Log("Check corrupted page.")
errChan := tx.Check(bbolt.WithPageId(uint(victimPageId))) errChan := tx.Check(bbolt.WithPageId(uint64(victimPageId)))
for cErr := range errChan { for cErr := range errChan {
cErrs = append(cErrs, cErr) cErrs = append(cErrs, cErr)
} }
@ -44,7 +44,7 @@ func TestTx_Check_CorruptPage(t *testing.T) {
t.Log("Check valid pages.") t.Log("Check valid pages.")
cErrs = cErrs[:0] cErrs = cErrs[:0]
for _, pgId := range validPageIds { for _, pgId := range validPageIds {
errChan = tx.Check(bbolt.WithPageId(uint(pgId))) errChan = tx.Check(bbolt.WithPageId(uint64(pgId)))
for cErr := range errChan { for cErr := range errChan {
cErrs = append(cErrs, cErr) cErrs = append(cErrs, cErr)
} }
@ -104,7 +104,7 @@ func TestTx_Check_WithNestBucket(t *testing.T) {
vErr := db.View(func(tx *bbolt.Tx) error { vErr := db.View(func(tx *bbolt.Tx) error {
var cErrs []error var cErrs []error
errChan := tx.Check(bbolt.WithPageId(uint(bucketRootPageId))) errChan := tx.Check(bbolt.WithPageId(uint64(bucketRootPageId)))
for cErr := range errChan { for cErr := range errChan {
cErrs = append(cErrs, cErr) cErrs = append(cErrs, cErr)
} }