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:
- Fix the regex to include the space at the end.
- 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.
Currently, the
slab_idsmethods can return a list of several (four in my case) identical slab ID numbers. The reason is that_stat_regexis defined asSTAT items:(.*):number, so it includes the stats that only start withnumber(for LRU cache). Thememcachedinstance 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):There are two ways around that:
slab_idsreturn 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_idsshould return.