MINOR: cache: Dump secondary entries in "show cache"
The duplicated entries (in case of vary) were not taken into account by the "show cache" command. They are now dumped too. A new "vary" column is added to the output. It contains the complete seocndary key (in hex format).
This commit is contained in:
parent
1470b9d045
commit
e3e1e5f34b
@ -2021,15 +2021,16 @@ show cache
|
||||
3. pointer to the mmap area (shctx)
|
||||
4. number of blocks available for reuse in the shctx
|
||||
|
||||
0x7f6ac6c5b4cc hash:286881868 size:39114 (39 blocks), refcount:9, expire:237
|
||||
1 2 3 4 5 6
|
||||
0x7f6ac6c5b4cc hash:286881868 vary:0x0011223344556677 size:39114 (39 blocks), refcount:9, expire:237
|
||||
1 2 3 4 5 6 7
|
||||
|
||||
1. pointer to the cache entry
|
||||
2. first 32 bits of the hash
|
||||
3. size of the object in bytes
|
||||
4. number of blocks used for the object
|
||||
5. number of transactions using the entry
|
||||
6. expiration time, can be negative if already expired
|
||||
3. secondary hash of the entry in case of vary
|
||||
4. size of the object in bytes
|
||||
5. number of blocks used for the object
|
||||
6. number of transactions using the entry
|
||||
7. expiration time, can be negative if already expired
|
||||
|
||||
show env [<name>]
|
||||
Dump one or all environment variables known by the process. Without any
|
||||
|
@ -2135,6 +2135,7 @@ static int cli_io_handler_show_cache(struct appctx *appctx)
|
||||
struct eb32_node *node = NULL;
|
||||
unsigned int next_key;
|
||||
struct cache_entry *entry;
|
||||
unsigned int i;
|
||||
|
||||
next_key = appctx->ctx.cli.i0;
|
||||
if (!next_key) {
|
||||
@ -2150,7 +2151,8 @@ static int cli_io_handler_show_cache(struct appctx *appctx)
|
||||
while (1) {
|
||||
|
||||
shctx_lock(shctx_ptr(cache));
|
||||
node = eb32_lookup_ge(&cache->entries, next_key);
|
||||
if (!node || (node = eb32_next_dup(node)) == NULL)
|
||||
node = eb32_lookup_ge(&cache->entries, next_key);
|
||||
if (!node) {
|
||||
shctx_unlock(shctx_ptr(cache));
|
||||
appctx->ctx.cli.i0 = 0;
|
||||
@ -2158,7 +2160,10 @@ static int cli_io_handler_show_cache(struct appctx *appctx)
|
||||
}
|
||||
|
||||
entry = container_of(node, struct cache_entry, eb);
|
||||
chunk_printf(&trash, "%p hash:%u size:%u (%u blocks), refcount:%u, expire:%d\n", entry, read_u32(entry->hash), block_ptr(entry)->len, block_ptr(entry)->block_count, block_ptr(entry)->refcount, entry->expire - (int)now.tv_sec);
|
||||
chunk_printf(&trash, "%p hash:%u vary:0x", entry, read_u32(entry->hash));
|
||||
for (i = 0; i < HTTP_CACHE_SEC_KEY_LEN; ++i)
|
||||
chunk_appendf(&trash, "%02x", (unsigned char)entry->secondary_key[i]);
|
||||
chunk_appendf(&trash, " size:%u (%u blocks), refcount:%u, expire:%d\n", block_ptr(entry)->len, block_ptr(entry)->block_count, block_ptr(entry)->refcount, entry->expire - (int)now.tv_sec);
|
||||
|
||||
next_key = node->key + 1;
|
||||
appctx->ctx.cli.i0 = next_key;
|
||||
|
Loading…
x
Reference in New Issue
Block a user