Skip to content

[bug] slab_ids returns multiple items #8

@berislavlopac

Description

@berislavlopac

Currently, the slab_ids methods can return a list of several (four in my case) identical slab ID numbers. The reason is that _stat_regex is defined as STAT items:(.*):number, so it includes the stats that only start with number (for LRU cache). The memcached instance I'm using (on Xubuntu 19.10) returns four such stats, as can be seen in this telnet response (and according to the protocol even more are possible):

$ telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
stats items
STAT items:1:number 1
STAT items:1:number_hot 0
STAT items:1:number_warm 0
STAT items:1:number_cold 1
STAT items:1:age_hot 0
STAT items:1:age_warm 0
STAT items:1:age 13
STAT items:1:evicted 0
STAT items:1:evicted_nonzero 0
STAT items:1:evicted_time 0
STAT items:1:outofmemory 0
STAT items:1:tailrepairs 0
STAT items:1:reclaimed 0
STAT items:1:expired_unfetched 0
STAT items:1:evicted_unfetched 0
STAT items:1:evicted_active 0
STAT items:1:crawler_reclaimed 0
STAT items:1:crawler_items_checked 0
STAT items:1:lrutail_reflocked 0
STAT items:1:moves_to_cold 1
STAT items:1:moves_to_warm 0
STAT items:1:moves_within_lru 0
STAT items:1:direct_reclaims 0
STAT items:1:hits_to_hot 0
STAT items:1:hits_to_warm 0
STAT items:1:hits_to_cold 0
STAT items:1:hits_to_temp 0
END

There are two ways around that:

  1. Fix the regex to include the space at the end.
  2. Make slab_ids return a set of IDs, instead of a list.

I'd in fact like to propose implementing both, as I think set is a better representation of what slab_ids should return.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions