diff --git a/src/box/vinyl.c b/src/box/vinyl.c index 4f729a135feaa6d6327527b16661201433f7cd71..47ac2565bbb4c40727cfd2cc65ce5cf02b5c8bb8 100644 --- a/src/box/vinyl.c +++ b/src/box/vinyl.c @@ -2639,6 +2639,8 @@ vy_index_commit_stmt(struct vy_index *index, struct vy_mem *mem, if (vy_stmt_type(stmt) == IPROTO_UPSERT) vy_index_commit_upsert(index, mem, stmt); + vy_stmt_counter_acct_tuple(&index->stat.put, stmt); + /* Invalidate cache element. */ vy_cache_on_write(&index->cache, stmt, NULL); } @@ -4538,6 +4540,10 @@ vy_index_info(struct vy_index *index, struct info_handler *h) vy_stmt_counter_add_disk(&count, &stat->disk.count); vy_info_append_stmt_counter(h, NULL, &count); + info_append_int(h, "lookup", stat->lookup); + vy_info_append_stmt_counter(h, "get", &stat->get); + vy_info_append_stmt_counter(h, "put", &stat->put); + info_table_begin(h, "memory"); vy_info_append_stmt_counter(h, NULL, &stat->memory.count); info_table_begin(h, "iterator"); @@ -7821,6 +7827,8 @@ vy_read_iterator_start(struct vy_read_iterator *itr) itr->index->space_format, itr->index->upsert_format, itr->index->id == 0); vy_read_iterator_use_range(itr); + + itr->index->stat.lookup++; } /** @@ -8000,6 +8008,8 @@ vy_read_iterator_next(struct vy_read_iterator *itr, struct tuple **result) *result = itr->curr_stmt; assert(*result == NULL || vy_stmt_type(*result) == IPROTO_REPLACE); + if (*result != NULL) + vy_stmt_counter_acct_tuple(&index->stat.get, *result); /** * Add a statement to the cache diff --git a/src/box/vy_stat.h b/src/box/vy_stat.h index c357750906977036db7624885ab7be4f2c42e44e..b1fe1dde4c863044663ee2c0b3745afd7966303d 100644 --- a/src/box/vy_stat.h +++ b/src/box/vy_stat.h @@ -111,6 +111,12 @@ struct vy_compact_stat { /** Vinyl index statistics. */ struct vy_index_stat { + /** Number of lookups in the index. */ + int64_t lookup; + /** Number of statements read from this index. */ + struct vy_stmt_counter get; + /** Number of statements written to this index. */ + struct vy_stmt_counter put; /** Memory related statistics. */ struct { /** Number of statements stored in memory. */