Skip to content

Commit

Permalink
meta/redis: fix converted bit and pattern (#5284)
Browse files Browse the repository at this point in the history
Signed-off-by: jiefenghuang <[email protected]>
  • Loading branch information
jiefenghuang authored Nov 12, 2024
1 parent c90a175 commit 5d0a9d6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/meta/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2088,7 +2088,7 @@ func (m *redisMeta) doCleanStaleSession(sid uint64) error {
key = m.sustained(sid)
if inodes, err := m.rdb.SMembers(ctx, key).Result(); err == nil {
for _, sinode := range inodes {
inode, _ := strconv.ParseInt(sinode, 10, 0)
inode, _ := strconv.ParseUint(sinode, 10, 64)
if err = m.doDeleteSustainedInode(sid, Ino(inode)); err != nil {
logger.Warnf("Delete sustained inode %d of sid %d: %s", inode, sid, err)
fail = true
Expand Down Expand Up @@ -2633,7 +2633,7 @@ func (m *redisMeta) cleanupLeakedChunks(delete bool) {
if len(ps) != 2 {
continue
}
ino, _ := strconv.ParseInt(ps[0][prefix+1:], 10, 0)
ino, _ := strconv.ParseUint(ps[0][prefix+1:], 10, 64)
ikeys = append(ikeys, k)
rs = append(rs, p.Exists(ctx, m.inodeKey(Ino(ino))))
}
Expand All @@ -2653,7 +2653,7 @@ func (m *redisMeta) cleanupLeakedChunks(delete bool) {
logger.Infof("found leaked chunk %s", key)
if delete {
ps := strings.Split(key, "_")
ino, _ := strconv.ParseInt(ps[0][prefix+1:], 10, 0)
ino, _ := strconv.ParseUint(ps[0][prefix+1:], 10, 64)
indx, _ := strconv.Atoi(ps[1])
_ = m.deleteChunk(Ino(ino), uint32(indx))
}
Expand Down Expand Up @@ -2792,10 +2792,10 @@ func (r *redisMeta) doCleanupDelayedSlices(edge int64) (int, error) {
logger.Warnf("Invalid key %s", key)
continue
}
if ts, e := strconv.ParseInt(ps[1], 10, 64); e != nil {
if ts, e := strconv.ParseUint(ps[1], 10, 64); e != nil {
logger.Warnf("Invalid key %s", key)
continue
} else if ts >= edge {
} else if ts >= uint64(edge) {
continue
}

Expand Down Expand Up @@ -2950,7 +2950,7 @@ func (m *redisMeta) cleanupLeakedInodes(delete bool) {
cutoff := time.Now().Add(time.Hour * -1)
prefix := len(m.prefix)

_ = m.scan(ctx, "d*", func(keys []string) error {
_ = m.scan(ctx, "d[0-9]+", func(keys []string) error {
for _, key := range keys {
ino, _ := strconv.Atoi(key[prefix+1:])
var entries []*Entry
Expand Down

0 comments on commit 5d0a9d6

Please sign in to comment.